Merge remote-tracking branch 'origin/master'

# Conflicts:
#	ghy-common/src/main/java/com/ghy/common/utils/AdapayUtils.java
This commit is contained in:
HH 2022-05-26 11:23:37 +08:00
commit 6fd119b2aa
5 changed files with 109 additions and 13 deletions

View File

@ -15,7 +15,9 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.Map;
@ -38,7 +40,8 @@ public class CustomerBankController {
* 个人账户绑定银行卡接口
*/
@PostMapping("bind")
private AjaxResult bindBankCard(BindBankCardRequest request) throws BaseAdaPayException {
@ResponseBody
private AjaxResult bindBankCard(@RequestBody BindBankCardRequest request) throws BaseAdaPayException {
Set<Merchant> merchants = AdapayConfig.getMerchants();
for (Merchant merchant : merchants) {
String memberId = AdapayUtils.getMemberId(request.getCustomerId(), merchant.getDeptId(), MemberType.CUSTOMER);
@ -62,6 +65,8 @@ public class CustomerBankController {
customerBank.setCustomerId(request.getCustomerId());
customerBank.setName(request.getName());
customerBank.setCertId(request.getCertId());
customerBank.setBankNum(request.getBankNum());
// TODO 入库
}
return AjaxResult.success();

View File

@ -1,6 +1,5 @@
package com.ghy.common.utils;
import com.ghy.common.adapay.MemberType;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.Assert;
@ -10,19 +9,19 @@ import org.springframework.util.Assert;
@Slf4j
public class AdapayUtils {
public static String getMemberId(Long memberId, Long deptId) {
Assert.isTrue(Math.min(memberId, deptId) > 0, "Invalid [memberId] or [deptId]");
return String.format("C%dD%d", memberId, deptId);
}
/**
* 生成 Adapay member_id
*
* @param userId 用户ID
* 当type=WORKER时用worker_id
* 当type=CUSTOMER时用customer_id
* @param deptId 所属公司
* @param type 用户类型
* @return member_id
* @param workerId 师傅id
* @param deptId 分平台id
* @return 生成的唯一id
*/
public static String getMemberId(Long userId, Long deptId, MemberType type) {
Assert.isTrue(Math.min(userId, deptId) > 0, "Invalid [userId] or [deptId]");
return String.format("%sU%dD%d", type.code, userId, deptId);
public static String getWorkerMemberId(Long workerId, Long deptId) {
Assert.isTrue(Math.min(workerId, deptId) > 0, "Invalid [workerId] or [deptId]");
return String.format("W%dD%d", workerId, deptId);
}
}

View File

@ -0,0 +1,30 @@
package com.ghy.worker.domain;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import lombok.Data;
/**
* @author clunt
* 师傅服务区域
*/
@Data
public class WorkerArea extends BaseEntity {
@Excel(name = "师傅服务区域关联id")
private Long workerAreaId;
@Excel(name = "师傅id", cellType = Excel.ColumnType.NUMERIC)
private Long workerId;
@Excel(name = "省份区域id", cellType = Excel.ColumnType.NUMERIC)
private Long provinceId;
@Excel(name = "市区域id", cellType = Excel.ColumnType.NUMERIC)
private Long cityId;
@Excel(name = "区县区域id", cellType = Excel.ColumnType.NUMERIC)
private Long countryId;
}

View File

@ -0,0 +1,39 @@
package com.ghy.worker.domain;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
public class WorkerBank extends BaseEntity {
@Excel(name = "师傅银行卡id", cellType = Excel.ColumnType.NUMERIC)
private Long workerBankId;
@Excel(name = "师傅id", cellType = Excel.ColumnType.NUMERIC)
private Long workerId;
@Excel(name = "用户真实姓名", cellType = Excel.ColumnType.STRING)
private String name;
@Excel(name = "身份证号", cellType = Excel.ColumnType.STRING)
private String certId;
@Excel(name = "银行名称", cellType = Excel.ColumnType.STRING)
private String bankName;
@Excel(name = "银行卡号", cellType = Excel.ColumnType.STRING)
private String bankNum;
@Excel(name = "银行卡绑定手机号", cellType = Excel.ColumnType.STRING)
private String phone;
@Excel(name = "分公司id", cellType = Excel.ColumnType.NUMERIC)
private Long deptId;
@Excel(name = "adapay会员账号", cellType = Excel.ColumnType.STRING)
private String adapayMemberId;
@Excel(name = "是否为结算账户", cellType = Excel.ColumnType.STRING)
private Integer settleAccount;
}

View File

@ -0,0 +1,23 @@
package com.ghy.worker.domain;
import com.ghy.common.annotation.Excel;
import com.ghy.common.core.domain.BaseEntity;
import lombok.Data;
/**
* 师傅擅长技术
*/
@Data
public class WorkerSkill extends BaseEntity {
@Excel(name = "师傅服务技能关联id", cellType = Excel.ColumnType.NUMERIC)
private Long workerSkillId;
@Excel(name = "师傅id", cellType = Excel.ColumnType.NUMERIC)
private Long workerId;
@Excel(name = "第三级服务类目id", cellType = Excel.ColumnType.NUMERIC)
private Long deptGoodsCategoryId;
}