mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
updateupdate 创建企业用户
This commit is contained in:
@@ -3,7 +3,7 @@ package com.jsowell.web.controller.pile;
|
|||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||||
import com.jsowell.adapay.dto.AdapayMemberInfoDTO;
|
import com.jsowell.adapay.dto.AdapayMemberInfoDTO;
|
||||||
import com.jsowell.adapay.dto.CreateCorpMemberDTO;
|
import com.jsowell.adapay.dto.CreateSettleAccountDTO;
|
||||||
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
||||||
import com.jsowell.adapay.service.AdapayMemberService;
|
import com.jsowell.adapay.service.AdapayMemberService;
|
||||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||||
@@ -11,13 +11,11 @@ import com.jsowell.common.core.controller.BaseController;
|
|||||||
import com.jsowell.common.core.domain.AjaxResult;
|
import com.jsowell.common.core.domain.AjaxResult;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@@ -28,26 +26,27 @@ public class AdapayMemberController extends BaseController {
|
|||||||
private AdapayMemberService adapayMemberService;
|
private AdapayMemberService adapayMemberService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建汇付会员接口
|
* 创建结算账户
|
||||||
* http://localhost:8080/adapay/member/createAdapayMember
|
* http://localhost:8080/adapay/member/createSettleAccount
|
||||||
|
* @param dto
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/createAdapayMember")
|
@PostMapping("/createSettleAccount")
|
||||||
public AjaxResult createAdapayMember(@RequestBody AdapayMemberInfoDTO dto) {
|
public AjaxResult createSettleAccount(CreateSettleAccountDTO dto) {
|
||||||
logger.info("创建汇付会员接口 param:{}", JSON.toJSONString(dto));
|
logger.info("创建结算账户接口 param:{}", JSON.toJSONString(dto));
|
||||||
AjaxResult result;
|
AjaxResult result;
|
||||||
try {
|
try {
|
||||||
adapayMemberService.createMember(dto);
|
adapayMemberService.createSettleAccount(dto);
|
||||||
result = AjaxResult.success();
|
result = AjaxResult.success();
|
||||||
} catch (BusinessException e) {
|
} catch (BusinessException e) {
|
||||||
logger.warn("创建汇付会员接口warn", e);
|
logger.warn("创建结算账户接口warn", e);
|
||||||
result = AjaxResult.error(e.getMessage());
|
result = AjaxResult.error(e.getMessage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.warn("创建汇付会员接口error", e);
|
logger.warn("创建结算账户接口error", e);
|
||||||
result = AjaxResult.error("创建汇付会员接口异常");
|
result = AjaxResult.error("创建结算账户接口异常:" + e.getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询汇付会员接口
|
* 查询汇付会员接口
|
||||||
* http://localhost:8080/adapay/member/selectAdapayMember
|
* http://localhost:8080/adapay/member/selectAdapayMember
|
||||||
@@ -118,21 +117,5 @@ public class AdapayMemberController extends BaseController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建企业用户
|
|
||||||
* http://localhost:8080/adapay/member/createCorpMember
|
|
||||||
*/
|
|
||||||
@PostMapping("/createCorpMember")
|
|
||||||
public AjaxResult createCorpMember(@Validated @RequestBody CreateCorpMemberDTO dto) {
|
|
||||||
logger.info("创建企业用户 param:{}", JSON.toJSONString(dto));
|
|
||||||
AjaxResult result;
|
|
||||||
try {
|
|
||||||
adapayMemberService.createCorpMember(dto);
|
|
||||||
result = AjaxResult.success();
|
|
||||||
} catch (BaseAdaPayException | IOException e) {
|
|
||||||
logger.error("查询汇付账户余额error", e);
|
|
||||||
result = AjaxResult.error();
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,87 +0,0 @@
|
|||||||
package com.jsowell.adapay.dto;
|
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import javax.validation.constraints.Email;
|
|
||||||
import javax.validation.constraints.Max;
|
|
||||||
import javax.validation.constraints.NotBlank;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Builder
|
|
||||||
public class CreateCorpMemberDTO {
|
|
||||||
// 运营商id
|
|
||||||
private String merchantId;
|
|
||||||
|
|
||||||
// 企业名称
|
|
||||||
@Max(value = 50)
|
|
||||||
private String businessName;
|
|
||||||
|
|
||||||
// 省份编码
|
|
||||||
@Max(value = 4)
|
|
||||||
private String provCode;
|
|
||||||
|
|
||||||
// 地区编码
|
|
||||||
@Max(value = 4)
|
|
||||||
private String areaCode;
|
|
||||||
|
|
||||||
// 统一社会信用码
|
|
||||||
@Max(value = 18)
|
|
||||||
private String socialCreditCode;
|
|
||||||
|
|
||||||
// 统一社会信用证有效期 (格式:YYYYMMDD,例如:20190909)
|
|
||||||
private String socialCreditCodeExpires;
|
|
||||||
|
|
||||||
// 经营范围
|
|
||||||
private String businessScope;
|
|
||||||
|
|
||||||
// 法人姓名
|
|
||||||
@NotBlank(message = "法人姓名为必填项")
|
|
||||||
private String legalPerson;
|
|
||||||
|
|
||||||
// 法人身份证号码
|
|
||||||
@NotBlank(message = "法人身份证号码为必填项")
|
|
||||||
private String legalCertId;
|
|
||||||
|
|
||||||
// 法人身份证有效期 (格式:YYYYMMDD,例如:20190909)
|
|
||||||
@NotBlank(message = "法人身份证有效期为必填项")
|
|
||||||
private String legalCertIdExpires;
|
|
||||||
|
|
||||||
// 法人手机号
|
|
||||||
@NotBlank(message = "法人手机号为必填项")
|
|
||||||
private String legalMp;
|
|
||||||
|
|
||||||
// 企业地址
|
|
||||||
@NotBlank(message = "企业地址为必填项")
|
|
||||||
private String address;
|
|
||||||
|
|
||||||
// 邮编
|
|
||||||
private String zipCode;
|
|
||||||
|
|
||||||
// 企业电话
|
|
||||||
private String telphone;
|
|
||||||
|
|
||||||
// 企业邮箱
|
|
||||||
@Email(message = "请填写正确的邮箱地址")
|
|
||||||
private String email;
|
|
||||||
|
|
||||||
// 上传附件,传入的中文文件名称为 UTF-8 字符集 URLEncode 编码后的字符串。
|
|
||||||
// 内容须包含三证合一证件照、法人身份证正面照、法人身份证反面照、开户银行许可证照。 压缩 zip包后上传,最大限制为 9 M。
|
|
||||||
private MultipartFile attachFile;
|
|
||||||
|
|
||||||
// 银行代码,如果需要自动开结算账户,本字段必填
|
|
||||||
private String bankCode;
|
|
||||||
|
|
||||||
// 银行账户类型:1-对公;2-对私,如果需要自动开结算账户,本字段必填
|
|
||||||
private String bankAcctType;
|
|
||||||
|
|
||||||
// 银行卡号,如果需要自动开结算账户,本字段必填
|
|
||||||
private String cardNo;
|
|
||||||
|
|
||||||
// 银行卡对应的户名,如果需要自动开结算账户,本字段必填;若银行账户类型是对公,必须与企业名称一致
|
|
||||||
private String cardName;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,11 @@
|
|||||||
package com.jsowell.adapay.dto;
|
package com.jsowell.adapay.dto;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.validation.constraints.Email;
|
||||||
|
import javax.validation.constraints.Max;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
@@ -32,9 +37,77 @@ public class CreateSettleAccountDTO {
|
|||||||
// 银行账户类型:1-对公;2-对私
|
// 银行账户类型:1-对公;2-对私
|
||||||
private String bankAcctType;
|
private String bankAcctType;
|
||||||
|
|
||||||
// 银行账户开户银行所在省份编码 (省市编码),银行账户类型为对公时,必填
|
|
||||||
|
// 运营商id
|
||||||
|
private String merchantId;
|
||||||
|
|
||||||
|
// 企业名称
|
||||||
|
@Max(value = 50)
|
||||||
|
private String businessName;
|
||||||
|
|
||||||
|
// 省份编码
|
||||||
|
@Max(value = 4)
|
||||||
private String provCode;
|
private String provCode;
|
||||||
|
|
||||||
// 银行账户开户银行所在地区编码(省市编码),银行账户类型为对公时,必填
|
// 地区编码
|
||||||
|
@Max(value = 4)
|
||||||
private String areaCode;
|
private String areaCode;
|
||||||
|
|
||||||
|
// 统一社会信用码
|
||||||
|
@Max(value = 18)
|
||||||
|
private String socialCreditCode;
|
||||||
|
|
||||||
|
// 统一社会信用证有效期 (格式:YYYYMMDD,例如:20190909)
|
||||||
|
private String socialCreditCodeExpires;
|
||||||
|
|
||||||
|
// 经营范围
|
||||||
|
private String businessScope;
|
||||||
|
|
||||||
|
// 法人姓名
|
||||||
|
@NotBlank(message = "法人姓名为必填项")
|
||||||
|
private String legalPerson;
|
||||||
|
|
||||||
|
// 法人身份证号码
|
||||||
|
@NotBlank(message = "法人身份证号码为必填项")
|
||||||
|
private String legalCertId;
|
||||||
|
|
||||||
|
// 法人身份证有效期 (格式:YYYYMMDD,例如:20190909)
|
||||||
|
@NotBlank(message = "法人身份证有效期为必填项")
|
||||||
|
private String legalCertIdExpires;
|
||||||
|
|
||||||
|
// 法人手机号
|
||||||
|
@NotBlank(message = "法人手机号为必填项")
|
||||||
|
private String legalMp;
|
||||||
|
|
||||||
|
// 企业地址
|
||||||
|
@NotBlank(message = "企业地址为必填项")
|
||||||
|
private String address;
|
||||||
|
|
||||||
|
// 邮编
|
||||||
|
private String zipCode;
|
||||||
|
|
||||||
|
// 企业电话
|
||||||
|
private String telphone;
|
||||||
|
|
||||||
|
// 企业邮箱
|
||||||
|
@Email(message = "请填写正确的邮箱地址")
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
// 上传附件,传入的中文文件名称为 UTF-8 字符集 URLEncode 编码后的字符串。
|
||||||
|
// 内容须包含三证合一证件照、法人身份证正面照、法人身份证反面照、开户银行许可证照。 压缩 zip包后上传,最大限制为 9 M。
|
||||||
|
private MultipartFile attachFile;
|
||||||
|
|
||||||
|
// 银行卡号,如果需要自动开结算账户,本字段必填
|
||||||
|
private String cardNo;
|
||||||
|
|
||||||
|
// 地址
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
// 性别
|
||||||
|
private String gender;
|
||||||
|
// 昵称
|
||||||
|
private String nickname;
|
||||||
|
|
||||||
|
private String adapayMemberId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ import com.huifu.adapay.core.exception.BaseAdaPayException;
|
|||||||
import com.huifu.adapay.model.CorpMember;
|
import com.huifu.adapay.model.CorpMember;
|
||||||
import com.huifu.adapay.model.Member;
|
import com.huifu.adapay.model.Member;
|
||||||
import com.huifu.adapay.model.SettleAccount;
|
import com.huifu.adapay.model.SettleAccount;
|
||||||
import com.jsowell.adapay.dto.AdapayMemberInfoDTO;
|
import com.jsowell.adapay.dto.CreateSettleAccountDTO;
|
||||||
import com.jsowell.adapay.dto.CreateCorpMemberDTO;
|
|
||||||
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
||||||
import com.jsowell.adapay.response.QueryMemberResponse;
|
import com.jsowell.adapay.response.QueryMemberResponse;
|
||||||
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
import com.jsowell.adapay.vo.AdapayAccountBalanceVO;
|
||||||
import com.jsowell.adapay.vo.AdapayMemberInfoVO;
|
import com.jsowell.adapay.vo.AdapayMemberInfoVO;
|
||||||
import com.jsowell.adapay.vo.AdapaySettleAccountVO;
|
import com.jsowell.adapay.vo.AdapaySettleAccountVO;
|
||||||
|
import com.jsowell.common.constant.Constants;
|
||||||
import com.jsowell.common.exception.BusinessException;
|
import com.jsowell.common.exception.BusinessException;
|
||||||
import com.jsowell.common.util.StringUtils;
|
import com.jsowell.common.util.StringUtils;
|
||||||
import com.jsowell.common.util.id.IdUtils;
|
import com.jsowell.common.util.id.IdUtils;
|
||||||
@@ -41,6 +41,15 @@ public class AdapayMemberService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IAdapayMemberAccountService adapayMemberAccountService;
|
private IAdapayMemberAccountService adapayMemberAccountService;
|
||||||
|
|
||||||
|
public void createSettleAccount(CreateSettleAccountDTO dto) throws Exception {
|
||||||
|
String bankAcctType = dto.getBankAcctType();
|
||||||
|
if (StringUtils.equals(bankAcctType, Constants.ONE)) {
|
||||||
|
createMember(dto);
|
||||||
|
} else if (StringUtils.equals(bankAcctType, Constants.TWO)) {
|
||||||
|
createCorpMember(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建汇付会员
|
* 创建汇付会员
|
||||||
*
|
*
|
||||||
@@ -48,7 +57,7 @@ public class AdapayMemberService {
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
|
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
|
||||||
public void createMember(AdapayMemberInfoDTO dto) throws Exception {
|
public void createMember(CreateSettleAccountDTO dto) throws Exception {
|
||||||
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
|
||||||
if (adapayMemberAccount != null) {
|
if (adapayMemberAccount != null) {
|
||||||
return;
|
return;
|
||||||
@@ -283,7 +292,7 @@ public class AdapayMemberService {
|
|||||||
/**
|
/**
|
||||||
* 创建企业用户
|
* 创建企业用户
|
||||||
*/
|
*/
|
||||||
public void createCorpMember(CreateCorpMemberDTO dto) throws BaseAdaPayException, IOException {
|
public void createCorpMember(CreateSettleAccountDTO dto) throws BaseAdaPayException, IOException {
|
||||||
Map<String, Object> memberParams = Maps.newHashMap();
|
Map<String, Object> memberParams = Maps.newHashMap();
|
||||||
String adapayMemberId = "ACM" + IdUtils.getMemberId();
|
String adapayMemberId = "ACM" + IdUtils.getMemberId();
|
||||||
memberParams.put("member_id", adapayMemberId);
|
memberParams.put("member_id", adapayMemberId);
|
||||||
@@ -318,4 +327,6 @@ public class AdapayMemberService {
|
|||||||
// adapayMemberAccount.setSettleAccountId(settleAccountId);
|
// adapayMemberAccount.setSettleAccountId(settleAccountId);
|
||||||
adapayMemberAccountService.insertAdapayMemberAccount(adapayMemberAccount);
|
adapayMemberAccountService.insertAdapayMemberAccount(adapayMemberAccount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user