| @@ -66,60 +66,51 @@ public class BankController extends BaseController{ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数不符合规范"); | |||
| } | |||
| if(pageNum == null){ | |||
| pageNum = 1; | |||
| } | |||
| if(pageSize == null){ | |||
| pageSize = 200; | |||
| } | |||
| int offset = (pageNum-1)*pageSize; | |||
| int limit = pageSize; | |||
| if(EnumSharingReceiverAccountType.BANK_ACCOUNT_TYPE_CORPORATE.equals(enumAccountType)){ | |||
| return wxBankUtilService.corporateBanking(getTenantInfo(),offset, limit); | |||
| return wxBankUtilService.corporateBanking(getTenantInfo()); | |||
| }else{ | |||
| return wxBankUtilService.personalBanking(getTenantInfo(),offset, limit); | |||
| } | |||
| } | |||
| @ApiOperation("查询支持个人业务的银行列表") | |||
| @GetMapping("personalBanking") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData personalBanking(Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] BankController::personalBanking"); | |||
| if(pageNum == null){ | |||
| pageNum = 1; | |||
| return wxBankUtilService.personalBanking(getTenantInfo()); | |||
| } | |||
| if(pageSize == null){ | |||
| pageSize = 200; | |||
| } | |||
| int offset = (pageNum-1)*pageSize; | |||
| int limit = pageSize; | |||
| return wxBankUtilService.personalBanking(getTenantInfo(),offset, limit); | |||
| } | |||
| @ApiOperation("查询支持对公业务的银行列表") | |||
| @GetMapping("corporateBanking") | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData corporateBanking(Integer pageNum, Integer pageSize) { | |||
| logger.debug("[" + getIpAddr() + "] BankController::corporateBanking"); | |||
| if(pageNum == null){ | |||
| pageNum = 1; | |||
| } | |||
| if(pageSize == null){ | |||
| pageSize = 200; | |||
| } | |||
| int offset = (pageNum-1)*pageSize; | |||
| int limit = pageSize; | |||
| return wxBankUtilService.corporateBanking(getTenantInfo(),offset, limit); | |||
| } | |||
| // @ApiOperation("查询支持个人业务的银行列表") | |||
| // @GetMapping("personalBanking") | |||
| // @ApiImplicitParams({ | |||
| // @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| // @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| // public ResultData personalBanking(Integer pageNum, Integer pageSize) { | |||
| // logger.debug("[" + getIpAddr() + "] BankController::personalBanking"); | |||
| // if(pageNum == null){ | |||
| // pageNum = 1; | |||
| // } | |||
| // if(pageSize == null){ | |||
| // pageSize = 200; | |||
| // } | |||
| // int offset = (pageNum-1)*pageSize; | |||
| // int limit = pageSize; | |||
| // | |||
| // return wxBankUtilService.personalBanking(getTenantInfo(),offset, limit); | |||
| // } | |||
| // | |||
| // @ApiOperation("查询支持对公业务的银行列表") | |||
| // @GetMapping("corporateBanking") | |||
| // @ApiImplicitParams({ | |||
| // @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| // @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| // public ResultData corporateBanking(Integer pageNum, Integer pageSize) { | |||
| // logger.debug("[" + getIpAddr() + "] BankController::corporateBanking"); | |||
| // if(pageNum == null){ | |||
| // pageNum = 1; | |||
| // } | |||
| // if(pageSize == null){ | |||
| // pageSize = 200; | |||
| // } | |||
| // int offset = (pageNum-1)*pageSize; | |||
| // int limit = pageSize; | |||
| // | |||
| // return wxBankUtilService.corporateBanking(getTenantInfo(),offset, limit); | |||
| // } | |||
| @ApiOperation("查省") | |||
| @GetMapping("areasProvinces") | |||
| @@ -143,7 +134,7 @@ public class BankController extends BaseController{ | |||
| @ApiImplicitParams({ | |||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||
| public ResultData bankBranches(String bankAliasCode, Integer cityCode, Integer pageNum, Integer pageSize) { | |||
| public ResultData bankBranches(String bankAliasCode, Integer cityCode) { | |||
| logger.debug("[" + getIpAddr() + "] BankController::bankBranches"); | |||
| if(StringUtils.isBlank(bankAliasCode)){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择银行"); | |||
| @@ -151,16 +142,8 @@ public class BankController extends BaseController{ | |||
| if(cityCode == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择城市"); | |||
| } | |||
| if(pageNum == null){ | |||
| pageNum = 1; | |||
| } | |||
| if(pageSize == null){ | |||
| pageSize = 200; | |||
| } | |||
| int offset = (pageNum-1)*pageSize; | |||
| int limit = pageSize; | |||
| return wxBankUtilService.bankBranches(getTenantInfo(),bankAliasCode,cityCode,offset, limit); | |||
| return wxBankUtilService.bankBranches(getTenantInfo(),bankAliasCode,cityCode); | |||
| } | |||
| } | |||
| @@ -71,7 +71,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||
| WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectByPlat(merchant,merchant.getId(),EnumAppPlat.WX); | |||
| if(receiverApply != null){ | |||
| if(receiverApply.getApplymentState() != null && !EnumSharingReceiverApplymentState.getUpdList().contains(receiverApply.getApplymentState())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户进件流程中,无法修改"); | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该商户进件流程中或已完成,无法修改"); | |||
| } | |||
| receiverAdd.setId(receiverApply.getId()); | |||
| } | |||
| @@ -97,6 +97,26 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||
| return new ResultData(receiverApply); | |||
| } | |||
| @ApiOperation("修改结算帐号") | |||
| @PostMapping("/modifySettlement") | |||
| public ResultData modifySettlement(@RequestBody WxProfitSharingReceiverApply receiverAdd) { | |||
| log.debug("[" + getIpAddr() + "] merchantProfitSharingReceiver::modifySettlement"); | |||
| if(receiverAdd.getId() == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectById(receiverAdd.getId()); | |||
| if(receiverApply == null){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "未找到进件数据"); | |||
| } | |||
| if(!EnumSharingReceiverApplymentState.APPLYMENT_STATE_FINISHED.getCode().equals(receiverApply.getApplymentState())){ | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "进件还未完成"); | |||
| } | |||
| receiverAdd.updateTenantInfo(receiverApply); | |||
| receiverAdd.setPlat(receiverApply.getPlat()); | |||
| receiverAdd.setOrganizationType(receiverApply.getOrganizationType()); | |||
| return wxProfitSharingReceiverApplyService.modifySettlement(receiverAdd,receiverApply.getSubMchid()); | |||
| } | |||
| @ApiOperation("获取行业属性及特殊资质") | |||
| @GetMapping("/getQualification") | |||
| public ResultData getQualification(Integer organizationType) { | |||
| @@ -96,7 +96,7 @@ public class WxProfitSharingReceiverApply extends TenantEntity { | |||
| @io.swagger.annotations.ApiModelProperty(value="法人验证链接二维码",name="legalValidationQrcode") | |||
| private String legalValidationQrcode; | |||
| @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态",name="verifyResult") | |||
| @io.swagger.annotations.ApiModelProperty(value="EnumSharingReceiverVerifyResult 修改收款帐号 申请状态",name="verifyResult") | |||
| private Integer verifyResult; | |||
| @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态描述",name="verifyFailReason") | |||
| private String verifyFailReason; | |||
| @@ -1,5 +1,6 @@ | |||
| package com.iformall.enums; | |||
| import com.github.binarywang.wxpay.bean.applyment.enums.AccountTypeEnum; | |||
| import com.github.binarywang.wxpay.bean.applyment.enums.BankAccountTypeEnum; | |||
| /** | |||
| @@ -11,8 +12,8 @@ import com.github.binarywang.wxpay.bean.applyment.enums.BankAccountTypeEnum; | |||
| */ | |||
| public enum EnumSharingReceiverAccountType { | |||
| BANK_ACCOUNT_TYPE_CORPORATE(74, BankAccountTypeEnum.BANK_ACCOUNT_TYPE_CORPORATE,"对公账户"), | |||
| BANK_ACCOUNT_TYPE_PERSONAL(75, BankAccountTypeEnum.BANK_ACCOUNT_TYPE_PERSONAL,"对私账户"), | |||
| BANK_ACCOUNT_TYPE_CORPORATE(74, AccountTypeEnum.ACCOUNT_TYPE_BUSINESS, BankAccountTypeEnum.BANK_ACCOUNT_TYPE_CORPORATE,"对公账户"), | |||
| BANK_ACCOUNT_TYPE_PERSONAL(75, AccountTypeEnum.ACCOUNT_TYPE_PRIVATE, BankAccountTypeEnum.BANK_ACCOUNT_TYPE_PERSONAL,"对私账户"), | |||
| ; | |||
| public static EnumSharingReceiverAccountType getEnum(Integer code) { | |||
| @@ -33,12 +34,23 @@ public enum EnumSharingReceiverAccountType { | |||
| return null; | |||
| } | |||
| public static EnumSharingReceiverAccountType getEnum(AccountTypeEnum accountTypeEnum) { | |||
| for (EnumSharingReceiverAccountType value : values()) { | |||
| if (value.getAccountTypeEnum().equals(accountTypeEnum)) { | |||
| return value; | |||
| } | |||
| } | |||
| return null; | |||
| } | |||
| private Integer code; | |||
| private AccountTypeEnum accountTypeEnum; | |||
| private BankAccountTypeEnum bankAccountTypeEnum; | |||
| private String message; | |||
| EnumSharingReceiverAccountType(Integer code, BankAccountTypeEnum bankAccountTypeEnum, String message) { | |||
| EnumSharingReceiverAccountType(Integer code, AccountTypeEnum accountTypeEnum, BankAccountTypeEnum bankAccountTypeEnum, String message) { | |||
| this.code = code; | |||
| this.accountTypeEnum = accountTypeEnum; | |||
| this.bankAccountTypeEnum = bankAccountTypeEnum; | |||
| this.message = message; | |||
| } | |||
| @@ -47,6 +59,10 @@ public enum EnumSharingReceiverAccountType { | |||
| return code; | |||
| } | |||
| public AccountTypeEnum getAccountTypeEnum() { | |||
| return accountTypeEnum; | |||
| } | |||
| public BankAccountTypeEnum getBankAccountTypeEnum() { | |||
| return bankAccountTypeEnum; | |||
| } | |||
| @@ -28,4 +28,5 @@ public interface WxProfitSharingReceiverApplyService { | |||
| ResultData handApplymentStates(WxProfitSharingReceiverApply apply); | |||
| ResultData modifySettlement(WxProfitSharingReceiverApply receiverAdd,String subMchid); | |||
| } | |||
| @@ -10,11 +10,18 @@ public interface WxBankUtilService { | |||
| ResultData personalBanking(TenantEntity tenantInfo, int offset, int limit); | |||
| ResultData personalBanking(TenantEntity tenantInfo); | |||
| ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit); | |||
| ResultData corporateBanking(TenantEntity tenantInfo); | |||
| ResultData areasProvinces(TenantEntity tenantInfo); | |||
| ResultData areasCities(TenantEntity tenantInfo, Integer provinceCode); | |||
| ResultData bankBranches(TenantEntity tenantInfo, String bankAliasCode, Integer cityCode, int offset, int limit); | |||
| ResultData bankBranches(TenantEntity tenantInfo, String bankAliasCode, Integer cityCode); | |||
| } | |||
| @@ -8,11 +8,17 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.service.WxPayAccountService; | |||
| import com.iformall.service.bank.WxBankUtilService; | |||
| import com.iformall.utils.RedisCacheUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| import org.springframework.beans.factory.annotation.Qualifier; | |||
| import org.springframework.data.redis.core.RedisTemplate; | |||
| import org.springframework.stereotype.Service; | |||
| import java.util.ArrayList; | |||
| import java.util.List; | |||
| @Service | |||
| public class WxBankUtilServiceImpl implements WxBankUtilService { | |||
| @@ -22,6 +28,10 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { | |||
| @Autowired | |||
| WxPayAccountService wxPayAccountService; | |||
| @Autowired | |||
| @Qualifier("objectCommonRedisTemplate") | |||
| RedisTemplate<String, Object> bankRedisTemplate; | |||
| @Override | |||
| public ResultData searchBanksByBankAccount(TenantEntity tenantInfo,String accountNumber) { | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | |||
| @@ -46,6 +56,51 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData personalBanking(TenantEntity tenantInfo) { | |||
| String prev = "personal_banking:"; | |||
| List<BankInfo> bankInfoList = new ArrayList<>(); | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | |||
| int offset = 0, limit = 200; | |||
| try { | |||
| BankingResult bankingResult = wxPayService.getBankService().personalBanking(offset,limit); | |||
| bankInfoList.addAll(bankingResult.getData()); | |||
| String key = prev+offset+"_"+limit; | |||
| BankingResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankingResult.class); | |||
| boolean isNeedSearch = false; | |||
| if(cacheObject == null || !bankingResult.getTotalCount().equals(cacheObject.getTotalCount())){ | |||
| RedisCacheUtils.cache(bankRedisTemplate,key,bankingResult,0); | |||
| isNeedSearch = true; | |||
| } | |||
| offset += limit; | |||
| while (offset + limit < bankingResult.getTotalCount()){ | |||
| String nextkey = prev+offset+"_"+limit; | |||
| BankingResult nextBankingResult = null; | |||
| if(!isNeedSearch){ | |||
| nextBankingResult = RedisCacheUtils.getCacheObject(bankRedisTemplate, nextkey, BankingResult.class); | |||
| } | |||
| if(nextBankingResult == null){ | |||
| try{ | |||
| nextBankingResult = wxPayService.getBankService().personalBanking(offset,limit); | |||
| if(nextBankingResult != null){ | |||
| RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankingResult,0); | |||
| } | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| if(nextBankingResult != null){ | |||
| bankInfoList.addAll(nextBankingResult.getData()); | |||
| } | |||
| offset += limit; | |||
| } | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| return new ResultData(bankInfoList); | |||
| } | |||
| @Override | |||
| public ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit) { | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | |||
| @@ -58,6 +113,51 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData corporateBanking(TenantEntity tenantInfo) { | |||
| String prev = "corporate_banking:"; | |||
| List<BankInfo> bankInfoList = new ArrayList<>(); | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | |||
| int offset = 0, limit = 200; | |||
| try { | |||
| BankingResult bankingResult = wxPayService.getBankService().corporateBanking(offset,limit); | |||
| bankInfoList.addAll(bankingResult.getData()); | |||
| String key = prev+offset+"_"+limit; | |||
| BankingResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankingResult.class); | |||
| boolean isNeedSearch = false; | |||
| if(cacheObject == null || !bankingResult.getTotalCount().equals(cacheObject.getTotalCount())){ | |||
| RedisCacheUtils.cache(bankRedisTemplate,key,bankingResult,0); | |||
| isNeedSearch = true; | |||
| } | |||
| offset += limit; | |||
| while (offset + limit < bankingResult.getTotalCount()){ | |||
| String nextkey = prev+offset+"_"+limit; | |||
| BankingResult nextBankingResult = null; | |||
| if(!isNeedSearch){ | |||
| nextBankingResult = RedisCacheUtils.getCacheObject(bankRedisTemplate, nextkey, BankingResult.class); | |||
| } | |||
| if(nextBankingResult == null){ | |||
| try{ | |||
| nextBankingResult = wxPayService.getBankService().corporateBanking(offset,limit); | |||
| if(nextBankingResult != null){ | |||
| RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankingResult,0); | |||
| } | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| if(nextBankingResult != null){ | |||
| bankInfoList.addAll(nextBankingResult.getData()); | |||
| } | |||
| offset += limit; | |||
| } | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| return new ResultData(bankInfoList); | |||
| } | |||
| @Override | |||
| public ResultData areasProvinces(TenantEntity tenantInfo) { | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | |||
| @@ -93,4 +193,49 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| } | |||
| @Override | |||
| public ResultData bankBranches(TenantEntity tenantInfo, String bankAliasCode, Integer cityCode) { | |||
| String prev = "bank_branches:"; | |||
| List<BankBranchesResult.BankBranch> bankInfoList = new ArrayList<>(); | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | |||
| int offset = 0, limit = 200; | |||
| try { | |||
| BankBranchesResult bankBranchesResult = wxPayService.getBankService().bankBranches(bankAliasCode,cityCode,offset,limit); | |||
| bankInfoList.addAll(bankBranchesResult.getData()); | |||
| String key = prev+offset+"_"+limit; | |||
| BankBranchesResult cacheObject = RedisCacheUtils.getCacheObject(bankRedisTemplate, key, BankBranchesResult.class); | |||
| boolean isNeedSearch = false; | |||
| if(cacheObject == null || !bankBranchesResult.getTotalCount().equals(cacheObject.getTotalCount())){ | |||
| RedisCacheUtils.cache(bankRedisTemplate,key,bankBranchesResult,0); | |||
| isNeedSearch = true; | |||
| } | |||
| offset += limit; | |||
| while (offset + limit < bankBranchesResult.getTotalCount()){ | |||
| String nextkey = prev+offset+"_"+limit; | |||
| BankBranchesResult nextBankBranchesResult = null; | |||
| if(!isNeedSearch){ | |||
| nextBankBranchesResult = RedisCacheUtils.getCacheObject(bankRedisTemplate, nextkey, BankBranchesResult.class); | |||
| } | |||
| if(nextBankBranchesResult == null){ | |||
| try{ | |||
| nextBankBranchesResult = wxPayService.getBankService().bankBranches(bankAliasCode,cityCode,offset,limit); | |||
| if(nextBankBranchesResult != null){ | |||
| RedisCacheUtils.cache(bankRedisTemplate,nextkey,nextBankBranchesResult,0); | |||
| } | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| } | |||
| } | |||
| if(nextBankBranchesResult != null){ | |||
| bankInfoList.addAll(nextBankBranchesResult.getData()); | |||
| } | |||
| offset += limit; | |||
| } | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||
| } | |||
| return new ResultData(bankInfoList); | |||
| } | |||
| } | |||
| @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; | |||
| import com.alibaba.fastjson.JSONObject; | |||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | |||
| import com.github.binarywang.wxpay.bean.applyment.ApplymentStateQueryResult; | |||
| import com.github.binarywang.wxpay.bean.applyment.ModifySettlementRequest; | |||
| import com.github.binarywang.wxpay.bean.applyment.WxPayApplyment4SubCreateRequest; | |||
| import com.github.binarywang.wxpay.bean.applyment.WxPayApplymentCreateResult; | |||
| import com.github.binarywang.wxpay.bean.applyment.enums.SalesScenesTypeEnum; | |||
| @@ -18,6 +19,7 @@ import com.iformall.common.ResultData; | |||
| import com.iformall.domain.po.*; | |||
| import com.iformall.domain.po.base.TenantEntity; | |||
| import com.iformall.enums.*; | |||
| import com.iformall.exception.MallinkException; | |||
| import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; | |||
| import com.iformall.service.*; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| @@ -197,6 +199,27 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| } | |||
| } | |||
| @Override | |||
| @Transactional(rollbackFor = {Exception.class}) | |||
| public ResultData modifySettlement(WxProfitSharingReceiverApply receiverAdd,String subMchid) { | |||
| if(this.isFinishBankAccount(receiverAdd)){ | |||
| WxProfitSharingReceiverApply receiverApplyUpd = new WxProfitSharingReceiverApply(); | |||
| receiverApplyUpd.updateTenantInfo(receiverAdd); | |||
| receiverApplyUpd.setId(receiverAdd.getId()); | |||
| receiverApplyUpd.setAccountInfo(receiverAdd.getAccountInfo()); | |||
| receiverApplyUpd.setVerifyResult(EnumSharingReceiverVerifyResult.VERIFYING.getCode()); | |||
| this.saveOrUpdate(receiverApplyUpd); | |||
| boolean isModify = this.modifySettlement(receiverApplyUpd, subMchid, receiverApplyUpd.getAccountInfo()); | |||
| if(isModify){ | |||
| return new ResultData(); | |||
| }else{ | |||
| throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"结算帐号修改异常"); | |||
| } | |||
| } | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "结算帐号填写未完成"); | |||
| } | |||
| //------------------------------------------------------------------------------------------------------------------ | |||
| @@ -726,7 +749,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| * "id":********, | |||
| * "organizationType":,//4个体,2企业 | |||
| * "settlementInfo":"",//json格式在下面 转成字符串 | |||
| * "qualifications":[//特殊资质图片 根据所选行业 是否必传 最多5张 | |||
| * "qualifications":[//特殊资质图片 根据所选行业 是否必传 最多5张 转成字符串 | |||
| * { | |||
| * "url":"", | |||
| * "media_id":"" | |||
| @@ -1301,5 +1324,26 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||
| } | |||
| } | |||
| private boolean modifySettlement(TenantEntity tenantEntity,String subMchid,String accountInfo){ | |||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantEntity.getTenantId()); | |||
| try { | |||
| ModifySettlementRequest request = new ModifySettlementRequest(); | |||
| JSONObject accountInfoObject = JSONObject.parseObject(accountInfo); | |||
| EnumSharingReceiverAccountType enumAccountType = EnumSharingReceiverAccountType.getEnum(accountInfoObject.getInteger("bank_account_type")); | |||
| request.setAccountType(enumAccountType.getAccountTypeEnum()); | |||
| request.setAccountName(accountInfoObject.getString("account_name")); | |||
| request.setAccountBank(accountInfoObject.getString("account_bank")); | |||
| request.setBankAddressCode(accountInfoObject.getString("bank_address_code")); | |||
| request.setBankBranchId(accountInfoObject.getString("bank_branch_id")); | |||
| request.setBankName(accountInfoObject.getString("bank_name")); | |||
| request.setAccountNumber(accountInfoObject.getString("account_number")); | |||
| String result = wxPayService.getApplyment4SubService().modifySettlement(subMchid, request); | |||
| return true; | |||
| } catch (WxPayException e) { | |||
| e.printStackTrace(); | |||
| logger.error("修改结算帐号异常"+subMchid); | |||
| } | |||
| return false; | |||
| } | |||
| } | |||