This commit is contained in:
2023-07-06 15:11:17 +08:00
parent 43848ff6ea
commit a71bc60928
3 changed files with 62 additions and 11 deletions

View File

@@ -13,7 +13,7 @@ import java.util.List;
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CreateSettleAccountDTO {
public class SettleAccountDTO {
// 运营商id
private String merchantId;

View File

@@ -5,11 +5,8 @@ import com.alibaba.fastjson2.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.huifu.adapay.model.CorpMember;
import com.huifu.adapay.model.Drawcash;
import com.huifu.adapay.model.Member;
import com.huifu.adapay.model.SettleAccount;
import com.jsowell.adapay.dto.CreateSettleAccountDTO;
import com.huifu.adapay.model.*;
import com.jsowell.adapay.dto.SettleAccountDTO;
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
import com.jsowell.adapay.dto.WithdrawDTO;
import com.jsowell.adapay.response.QueryCorpMemberResponse;
@@ -51,7 +48,7 @@ public class AdapayMemberService {
@Autowired
private IAdapayMemberAccountService adapayMemberAccountService;
public void createSettleAccount(CreateSettleAccountDTO dto) throws Exception {
public void createSettleAccount(SettleAccountDTO dto) throws Exception {
String bankAcctType = dto.getBankAcctType();
if (StringUtils.equals(bankAcctType, Constants.ONE)) {
createCorpMember(dto);
@@ -67,7 +64,7 @@ public class AdapayMemberService {
* @throws Exception
*/
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
public void createMember(CreateSettleAccountDTO dto) throws Exception {
public void createMember(SettleAccountDTO dto) throws Exception {
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
if (adapayMemberAccount != null) {
log.error("通过merchantId:{}, 没有查询到结算账户配置", dto.getMerchantId());
@@ -364,7 +361,7 @@ public class AdapayMemberService {
/**
* 创建企业用户
*/
public void createCorpMember(CreateSettleAccountDTO dto) throws BaseAdaPayException, IOException {
public void createCorpMember(SettleAccountDTO dto) throws BaseAdaPayException, IOException {
Map<String, Object> memberParams = Maps.newHashMap();
String adapayMemberId = Constants.ADAPAY_CORP_MEMBER_PREFIX + IdUtils.getMemberId();
memberParams.put("member_id", adapayMemberId);
@@ -426,4 +423,36 @@ public class AdapayMemberService {
Map<String, Object> settleCount = Drawcash.create(settleCountParams);
log.info("取现接口返回参数" + JSON.toJSONString(settleCount));
}
public Map<String, Object> updateAdapayMember(SettleAccountDTO dto) throws BaseAdaPayException {
AdapayMemberAccount adapayMemberAccount = adapayMemberAccountService.selectByMerchantId(dto.getMerchantId());
if (adapayMemberAccount == null) {
log.error("通过merchantId:{}, 没有查询到结算账户配置", dto.getMerchantId());
return null;
}
Map<String, Object> memberParams = Maps.newHashMap();
memberParams.put("adapay_func_code", "corp_members.update");
memberParams.put("member_id", adapayMemberAccount.getAdapayMemberId());
memberParams.put("app_id", ADAPAY_APP_ID);
memberParams.put("order_no", "jsdk_order_" + System.currentTimeMillis());
memberParams.put("social_credit_code_expires", dto.getSocialCreditCodeExpires());
memberParams.put("business_scope", dto.getBusinessScope());
memberParams.put("name", dto.getNickname());
memberParams.put("prov_code", dto.getProvCode());
memberParams.put("area_code", dto.getAreaCode());
memberParams.put("legal_person", dto.getLegalPerson());
memberParams.put("legal_cert_id", dto.getLegalCertId());
memberParams.put("legal_cert_id_expires", dto.getLegalCertIdExpires());
memberParams.put("legal_mp", dto.getLegalMp());
memberParams.put("address", dto.getAddress());
memberParams.put("zip_code", dto.getZipCode());
memberParams.put("telphone", dto.getTelphone());
memberParams.put("email", dto.getEmail());
File file = ZipUtil.createZipFileFromImages(dto.getImgList());
log.info("更新企业账户param:{}", memberParams);
Map<String, Object> member = AdapayCommon.requestAdapayFile(memberParams, file);
log.info("更新企业账户result:{}", JSON.toJSONString(member));
return null;
}
}