mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-19 18:45:03 +08:00
update
This commit is contained in:
@@ -3,7 +3,7 @@ package com.jsowell.web.controller.pile;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.huifu.adapay.core.exception.BaseAdaPayException;
|
||||
import com.jsowell.adapay.dto.AdapayMemberInfoDTO;
|
||||
import com.jsowell.adapay.dto.CreateSettleAccountDTO;
|
||||
import com.jsowell.adapay.dto.SettleAccountDTO;
|
||||
import com.jsowell.adapay.dto.UpdateAccountConfigDTO;
|
||||
import com.jsowell.adapay.dto.WithdrawDTO;
|
||||
import com.jsowell.adapay.service.AdapayMemberService;
|
||||
@@ -35,7 +35,7 @@ public class AdapayMemberController extends BaseController {
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/createSettleAccount")
|
||||
public AjaxResult createSettleAccount(@RequestBody CreateSettleAccountDTO dto) {
|
||||
public AjaxResult createSettleAccount(@RequestBody SettleAccountDTO dto) {
|
||||
logger.info("创建结算账户接口 param:{}", JSON.toJSONString(dto));
|
||||
AjaxResult result;
|
||||
try {
|
||||
@@ -76,6 +76,28 @@ public class AdapayMemberController extends BaseController {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新结算账户接口
|
||||
*/
|
||||
@PostMapping("/updateAdapayMember")
|
||||
public AjaxResult updateAdapayMember(@RequestBody SettleAccountDTO dto) {
|
||||
AjaxResult result;
|
||||
try {
|
||||
if (StringUtils.isBlank(dto.getMerchantId())) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
Map<String, Object> map = adapayMemberService.updateAdapayMember(dto);
|
||||
result = AjaxResult.success(map);
|
||||
} catch (BusinessException e) {
|
||||
logger.warn("查询汇付会员接口异常warn", e);
|
||||
result = AjaxResult.error(e.getMessage());
|
||||
} catch (Exception e) {
|
||||
logger.error("查询汇付会员接口异常error", e);
|
||||
result = AjaxResult.error("查询汇付会员接口异常");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询汇付账户余额
|
||||
* http://localhost:8080/adapay/member/queryAdapayAccountBalance
|
||||
|
||||
@@ -13,7 +13,7 @@ import java.util.List;
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class CreateSettleAccountDTO {
|
||||
public class SettleAccountDTO {
|
||||
|
||||
// 运营商id
|
||||
private String merchantId;
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user