| @@ -66,60 +66,51 @@ public class BankController extends BaseController{ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"参数不符合规范"); | 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)){ | if(EnumSharingReceiverAccountType.BANK_ACCOUNT_TYPE_CORPORATE.equals(enumAccountType)){ | ||||
| return wxBankUtilService.corporateBanking(getTenantInfo(),offset, limit); | |||||
| return wxBankUtilService.corporateBanking(getTenantInfo()); | |||||
| }else{ | }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("查省") | @ApiOperation("查省") | ||||
| @GetMapping("areasProvinces") | @GetMapping("areasProvinces") | ||||
| @@ -143,7 +134,7 @@ public class BankController extends BaseController{ | |||||
| @ApiImplicitParams({ | @ApiImplicitParams({ | ||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", 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"); | logger.debug("[" + getIpAddr() + "] BankController::bankBranches"); | ||||
| if(StringUtils.isBlank(bankAliasCode)){ | if(StringUtils.isBlank(bankAliasCode)){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择银行"); | return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择银行"); | ||||
| @@ -151,16 +142,8 @@ public class BankController extends BaseController{ | |||||
| if(cityCode == null){ | if(cityCode == null){ | ||||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未选择城市"); | 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); | |||||
| } | } | ||||
| } | } | ||||
| @@ -21,9 +21,7 @@ import org.springframework.web.multipart.MultipartFile; | |||||
| import javax.imageio.ImageIO; | import javax.imageio.ImageIO; | ||||
| import java.awt.image.BufferedImage; | import java.awt.image.BufferedImage; | ||||
| import java.util.ArrayList; | |||||
| import java.util.HashMap; | import java.util.HashMap; | ||||
| import java.util.List; | |||||
| import java.util.Map; | import java.util.Map; | ||||
| @RestController | @RestController | ||||
| @@ -5,23 +5,36 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxMerchant; | import com.iformall.domain.po.WxMerchant; | ||||
| import com.iformall.domain.po.WxProfitSharingReceiver; | import com.iformall.domain.po.WxProfitSharingReceiver; | ||||
| import com.iformall.domain.po.WxProfitSharingReceiverApply; | import com.iformall.domain.po.WxProfitSharingReceiverApply; | ||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import com.iformall.douyin.pay.enums.MerchantImportStatus; | import com.iformall.douyin.pay.enums.MerchantImportStatus; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.file.aliyun.AliyunOSS; | |||||
| import com.iformall.service.WxMerchantService; | import com.iformall.service.WxMerchantService; | ||||
| import com.iformall.service.WxProfitSharingReceiverApplyService; | import com.iformall.service.WxProfitSharingReceiverApplyService; | ||||
| import com.iformall.service.WxProfitSharingReceiverService; | import com.iformall.service.WxProfitSharingReceiverService; | ||||
| import com.iformall.utils.ImgYwsqhUtil; | |||||
| import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
| import java.io.ByteArrayInputStream; | |||||
| import java.util.HashMap; | |||||
| import java.util.Map; | |||||
| @RestController | @RestController | ||||
| @RequestMapping("/api/sharingReceiverApply") | @RequestMapping("/api/sharingReceiverApply") | ||||
| @Api(description = "进件相关接口") | @Api(description = "进件相关接口") | ||||
| @Slf4j | @Slf4j | ||||
| public class WxProfitSharingReceiverApplyController extends BaseController { | public class WxProfitSharingReceiverApplyController extends BaseController { | ||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; | private WxProfitSharingReceiverApplyService wxProfitSharingReceiverApplyService; | ||||
| @@ -31,6 +44,9 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxMerchantService wxMerchantService; | private WxMerchantService wxMerchantService; | ||||
| @Autowired | |||||
| private AliyunOSS aliyunOSS; | |||||
| @ApiOperation("申请") | @ApiOperation("申请") | ||||
| @PostMapping("/receiverAdd") | @PostMapping("/receiverAdd") | ||||
| public ResultData receiverApply(@RequestBody WxProfitSharingReceiverApply receiverAdd) { | public ResultData receiverApply(@RequestBody WxProfitSharingReceiverApply receiverAdd) { | ||||
| @@ -71,7 +87,7 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectByPlat(merchant,merchant.getId(),EnumAppPlat.WX); | WxProfitSharingReceiverApply receiverApply = wxProfitSharingReceiverApplyService.selectByPlat(merchant,merchant.getId(),EnumAppPlat.WX); | ||||
| if(receiverApply != null){ | if(receiverApply != null){ | ||||
| if(receiverApply.getApplymentState() != null && !EnumSharingReceiverApplymentState.getUpdList().contains(receiverApply.getApplymentState())){ | 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()); | receiverAdd.setId(receiverApply.getId()); | ||||
| } | } | ||||
| @@ -97,6 +113,26 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| return new ResultData(receiverApply); | 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("获取行业属性及特殊资质") | @ApiOperation("获取行业属性及特殊资质") | ||||
| @GetMapping("/getQualification") | @GetMapping("/getQualification") | ||||
| public ResultData getQualification(Integer organizationType) { | public ResultData getQualification(Integer organizationType) { | ||||
| @@ -131,4 +167,64 @@ public class WxProfitSharingReceiverApplyController extends BaseController { | |||||
| return wxProfitSharingReceiverApplyService.applyment(receiverAdd); | return wxProfitSharingReceiverApplyService.applyment(receiverAdd); | ||||
| } | } | ||||
| /** | |||||
| * 获取授权函 | |||||
| * { | |||||
| * "contact_name":"",//经办人姓名 | |||||
| * "contact_id_number":"",//经办人身份证 | |||||
| * "contact_department":"",//部门 | |||||
| * "contact_job":"",//职位 | |||||
| * "legal_person":"",//法人姓名 | |||||
| * "id_card_number":"",//法人身份证 | |||||
| * "card_period_begin":"",//法人身份证有效期开始 | |||||
| * "card_period_end":"",//法人身份证有效期结束 | |||||
| * "isSeal":"",//是否有公章(字符串"true","false") | |||||
| * "merchant_name":""//商户或企业名称 | |||||
| * } | |||||
| * | |||||
| * @param | |||||
| * @return | |||||
| */ | |||||
| @PostMapping(value = "/getYwsqh") | |||||
| @ApiOperation("获取图片") | |||||
| public ResultData getYwsqh(@RequestParam Map<String, String> param) { | |||||
| logger.info("[" + getIpAddr() + "] WxMerchantMediaUploadController::getYwsqh"); | |||||
| TenantEntity tenantEntity = getTenantInfo(); | |||||
| String contact_name = param.get("contact_name"); | |||||
| String contact_id_number = param.get("contact_id_number"); | |||||
| String contact_department = param.get("contact_department"); | |||||
| String contact_job = param.get("contact_job"); | |||||
| String legal_person = param.get("legal_person"); | |||||
| String id_card_number = param.get("id_card_number"); | |||||
| String card_period_begin = param.get("card_period_begin"); | |||||
| String card_period_end = param.get("card_period_end"); | |||||
| Boolean isSeal = "true".equals(param.get("isSeal"))?true:false; | |||||
| String merchant_name = param.get("merchant_name"); | |||||
| byte[] bytes = ImgYwsqhUtil.imgCeate(contact_name, contact_id_number, contact_department, contact_job, | |||||
| legal_person, id_card_number, card_period_begin, card_period_end, isSeal, merchant_name); | |||||
| if(bytes == null){ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"生成图片异常"); | |||||
| } | |||||
| try { | |||||
| String url = aliyunOSS.upload(tenantEntity.getTenantId(), ".png", new ByteArrayInputStream(bytes)); | |||||
| if(StringUtils.isBlank(url)){ | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"获取图片异常"); | |||||
| } | |||||
| Map<String,String> map = new HashMap<>(); | |||||
| map.put("url",url); | |||||
| return new ResultData(map); | |||||
| } catch(MallinkException e){ | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(e.getErrorCode(),e.getMessage()); | |||||
| }catch (Exception e) { | |||||
| logger.error(e.getMessage()); | |||||
| return new ResultData(ErrorCode.PICTURE_ANALYZING_ERROR); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -0,0 +1,139 @@ | |||||
| package com.iformall.utils; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.ResultData; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.core.io.ClassPathResource; | |||||
| import org.springframework.util.ResourceUtils; | |||||
| import javax.imageio.ImageIO; | |||||
| import java.awt.*; | |||||
| import java.awt.image.BufferedImage; | |||||
| import java.io.ByteArrayInputStream; | |||||
| import java.io.ByteArrayOutputStream; | |||||
| import java.io.File; | |||||
| import java.io.InputStream; | |||||
| import java.time.LocalDateTime; | |||||
| import java.time.format.DateTimeFormatter; | |||||
| import java.util.Locale; | |||||
| public class ImgYwsqhUtil { | |||||
| private static final Logger logger = LoggerFactory.getLogger(ImgYwsqhUtil.class); | |||||
| //模板图片 | |||||
| private static final String imgTempPath = "imgTemp/wxjjywsqh.jpg"; | |||||
| /** | |||||
| * 生成图片证书 | |||||
| * @return | |||||
| */ | |||||
| public static byte[] imgCeate(String contact_name,String contact_id_number,String contact_department,String contact_job, | |||||
| String legal_person,String id_card_number,String card_period_begin,String card_period_end, | |||||
| boolean isSeal,String merchant_name){ | |||||
| try { | |||||
| // InputStream backImgUrl = ImgYwsqhUtil.class.getClassLoader().getResourceAsStream(imgTempPath); | |||||
| ClassPathResource resource = new ClassPathResource(imgTempPath); | |||||
| InputStream backImgUrl = resource.getInputStream(); | |||||
| BufferedImage backImg = ImageIO.read(backImgUrl); | |||||
| backImgUrl.close(); | |||||
| Graphics g = backImg.getGraphics(); | |||||
| Font fTxtBottom = new Font("微软雅黑", Font.PLAIN, 70); | |||||
| Color myColorTxtBottom = Color.BLACK; | |||||
| g.setFont(fTxtBottom); | |||||
| g.setColor(myColorTxtBottom); | |||||
| FontMetrics metrics = g.getFontMetrics(fTxtBottom); | |||||
| //图片加中文名 | |||||
| if(StringUtils.isNotBlank(contact_name)){ | |||||
| if(contact_name.length() == 2){ | |||||
| contact_name = contact_name.replace("", " ").trim(); | |||||
| } | |||||
| int xName = 2955 - metrics.stringWidth(contact_name)/2 ; | |||||
| g.drawString(contact_name, xName , 1282);//g.drawString(文字, x 位置, y 位置); | |||||
| } | |||||
| //图片加身份证号 | |||||
| if(StringUtils.isNotBlank(contact_id_number)){ | |||||
| int xNumber = 1200 - metrics.stringWidth(contact_id_number) / 2; | |||||
| g.drawString(contact_id_number, xNumber, 1500); | |||||
| } | |||||
| //图片加部门 | |||||
| if(StringUtils.isNotBlank(contact_department)){ | |||||
| int xDepartment = 2340 - metrics.stringWidth(contact_department) / 2; | |||||
| g.drawString(contact_department, xDepartment, 1500); | |||||
| } | |||||
| //图片加职务 | |||||
| if(StringUtils.isNotBlank(contact_job)){ | |||||
| int xJob = 3100 - metrics.stringWidth(contact_job) / 2; | |||||
| g.drawString(contact_job, xJob, 1500); | |||||
| } | |||||
| //图片加法人姓名 | |||||
| if(StringUtils.isNotBlank(legal_person)){ | |||||
| if(legal_person.length() == 2){ | |||||
| legal_person = legal_person.replace("", " ").trim(); | |||||
| } | |||||
| g.drawString(legal_person, 1250, 2590); | |||||
| } | |||||
| //图片加法人身份证号 | |||||
| if(StringUtils.isNotBlank(id_card_number)){ | |||||
| g.drawString(id_card_number, 1100, 2800); | |||||
| } | |||||
| //图片加有效期 | |||||
| if(StringUtils.isNotBlank(card_period_begin) && StringUtils.isNotBlank(card_period_end)){ | |||||
| String card_begin_end = card_period_begin + " 至 " + card_period_end; | |||||
| g.drawString(card_begin_end, 1190, 3020); | |||||
| } | |||||
| //图片加商户/单位名称merchant_name | |||||
| if(StringUtils.isNotBlank(merchant_name)){ | |||||
| g.drawString(merchant_name, 2400, 4540); | |||||
| } | |||||
| //无公章 | |||||
| if(!isSeal){ | |||||
| Color sealColor = Color.LIGHT_GRAY; | |||||
| g.setColor(sealColor); | |||||
| int xSeal = 2400; | |||||
| g.drawString("无公章", xSeal, 4320); | |||||
| } | |||||
| //调这个方法就是开始这个整合 (可以多张图片,多个文字整合成一张图片,只有把他们放在这方法里面就行) | |||||
| g.dispose(); | |||||
| ByteArrayOutputStream out = new ByteArrayOutputStream(); | |||||
| ImageIO.write(backImg, "png", out); | |||||
| byte[] bytes = out.toByteArray(); | |||||
| out.close(); | |||||
| return bytes; | |||||
| } catch (Exception e) { | |||||
| e.printStackTrace(); | |||||
| logger.error("生成证书异常", e.getMessage()); | |||||
| } | |||||
| return null; | |||||
| } | |||||
| // public static void main(String[] args) { | |||||
| // String serverUploadImgUrl = "C:/Users/xiaohu/Desktop/img"; // 图片保存路径 | |||||
| // try { | |||||
| // byte[] bytes = imgCeate("周淼淼","421302199908081234","商务发展部","商务经理", | |||||
| // "周淼淼","421302199908081234","2020-08-08","长期", | |||||
| // false,"武汉富茂链客科技有限公司"); | |||||
| // ByteArrayInputStream bais = new ByteArrayInputStream(bytes); | |||||
| // BufferedImage bi1 =ImageIO.read(bais); | |||||
| // | |||||
| // ImageIO.write(bi1, "png", new File(serverUploadImgUrl+"/0.png")); | |||||
| // | |||||
| // } catch (Exception e) { | |||||
| // e.printStackTrace(); | |||||
| // } | |||||
| // System.out.println("结束"); | |||||
| // } | |||||
| } | |||||
| @@ -4,6 +4,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.WxProfitSharingReceiverApply; | import com.iformall.domain.po.WxProfitSharingReceiverApply; | ||||
| import com.iformall.enums.EnumSharingReceiverApplyStatus; | import com.iformall.enums.EnumSharingReceiverApplyStatus; | ||||
| import com.iformall.enums.EnumSharingReceiverApplymentState; | import com.iformall.enums.EnumSharingReceiverApplymentState; | ||||
| import com.iformall.enums.EnumSharingReceiverVerifyResult; | |||||
| import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; | import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; | ||||
| import com.iformall.service.WxProfitSharingReceiverApplyService; | import com.iformall.service.WxProfitSharingReceiverApplyService; | ||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| @@ -28,7 +29,7 @@ public class SharingReceiverApplySchedule { | |||||
| @Async | @Async | ||||
| @Scheduled(cron = "0 22 */1 * * ?")// 每小时的22分钟 | @Scheduled(cron = "0 22 */1 * * ?")// 每小时的22分钟 | ||||
| public void sharingOrderRedoSchedule() { | |||||
| public void handApplymentStatesSchedule() { | |||||
| WxProfitSharingReceiverApply receiverApply = new WxProfitSharingReceiverApply(); | WxProfitSharingReceiverApply receiverApply = new WxProfitSharingReceiverApply(); | ||||
| receiverApply.setStatus(EnumSharingReceiverApplyStatus.PROFIT_RECEIVER_APPLY_STATUS_VALID.getCode()); | receiverApply.setStatus(EnumSharingReceiverApplyStatus.PROFIT_RECEIVER_APPLY_STATUS_VALID.getCode()); | ||||
| receiverApply.setApplymentStates(EnumSharingReceiverApplymentState.getNeedSyncList()); | receiverApply.setApplymentStates(EnumSharingReceiverApplymentState.getNeedSyncList()); | ||||
| @@ -47,4 +48,25 @@ public class SharingReceiverApplySchedule { | |||||
| } | } | ||||
| } | } | ||||
| @Async | |||||
| @Scheduled(cron = "0 22 11,17 * * ?")// 每天上午11点下午17点的22分钟 | |||||
| public void handVerifyResultSchedule() { | |||||
| WxProfitSharingReceiverApply receiverApply = new WxProfitSharingReceiverApply(); | |||||
| receiverApply.setStatus(EnumSharingReceiverApplyStatus.PROFIT_RECEIVER_APPLY_STATUS_VALID.getCode()); | |||||
| receiverApply.setVerifyResult(EnumSharingReceiverVerifyResult.VERIFYING.getCode()); | |||||
| List<WxProfitSharingReceiverApply> needSyncList = wxProfitSharingReceiverApplyMapper.findListByVerifyResult(receiverApply); | |||||
| if(!needSyncList.isEmpty()){ | |||||
| for (WxProfitSharingReceiverApply apply:needSyncList){ | |||||
| try{ | |||||
| ResultData resultData = wxProfitSharingReceiverApplyService.handVerifyResult(apply); | |||||
| if(resultData.code != 200){ | |||||
| logger.error("同步进件状态异常{}"+apply.getId()); | |||||
| } | |||||
| }catch(Exception e){ | |||||
| logger.error("同步进件状态异常{}"+apply.getId()+"---"+e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -96,12 +96,12 @@ public class WxProfitSharingReceiverApply extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="法人验证链接二维码",name="legalValidationQrcode") | @io.swagger.annotations.ApiModelProperty(value="法人验证链接二维码",name="legalValidationQrcode") | ||||
| private String legalValidationQrcode; | private String legalValidationQrcode; | ||||
| @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态",name="verifyResult") | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumSharingReceiverVerifyResult 修改收款帐号 申请状态",name="verifyResult") | |||||
| private Integer verifyResult; | private Integer verifyResult; | ||||
| @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态描述",name="verifyFailReason") | |||||
| @io.swagger.annotations.ApiModelProperty(value="汇款验证失败原因",name="verifyFailReason") | |||||
| private String verifyFailReason; | private String verifyFailReason; | ||||
| @io.swagger.annotations.ApiModelProperty(value="修改收款帐号 申请状态描述",name="status") | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumSharingReceiverApplyStatus",name="status") | |||||
| private Integer status; | private Integer status; | ||||
| @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | @io.swagger.annotations.ApiModelProperty(value="",name="createTime") | ||||
| @@ -1,5 +1,6 @@ | |||||
| package com.iformall.enums; | package com.iformall.enums; | ||||
| import com.github.binarywang.wxpay.bean.applyment.enums.AccountTypeEnum; | |||||
| import com.github.binarywang.wxpay.bean.applyment.enums.BankAccountTypeEnum; | 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 { | 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) { | public static EnumSharingReceiverAccountType getEnum(Integer code) { | ||||
| @@ -33,12 +34,23 @@ public enum EnumSharingReceiverAccountType { | |||||
| return null; | 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 Integer code; | ||||
| private AccountTypeEnum accountTypeEnum; | |||||
| private BankAccountTypeEnum bankAccountTypeEnum; | private BankAccountTypeEnum bankAccountTypeEnum; | ||||
| private String message; | private String message; | ||||
| EnumSharingReceiverAccountType(Integer code, BankAccountTypeEnum bankAccountTypeEnum, String message) { | |||||
| EnumSharingReceiverAccountType(Integer code, AccountTypeEnum accountTypeEnum, BankAccountTypeEnum bankAccountTypeEnum, String message) { | |||||
| this.code = code; | this.code = code; | ||||
| this.accountTypeEnum = accountTypeEnum; | |||||
| this.bankAccountTypeEnum = bankAccountTypeEnum; | this.bankAccountTypeEnum = bankAccountTypeEnum; | ||||
| this.message = message; | this.message = message; | ||||
| } | } | ||||
| @@ -47,6 +59,10 @@ public enum EnumSharingReceiverAccountType { | |||||
| return code; | return code; | ||||
| } | } | ||||
| public AccountTypeEnum getAccountTypeEnum() { | |||||
| return accountTypeEnum; | |||||
| } | |||||
| public BankAccountTypeEnum getBankAccountTypeEnum() { | public BankAccountTypeEnum getBankAccountTypeEnum() { | ||||
| return bankAccountTypeEnum; | return bankAccountTypeEnum; | ||||
| } | } | ||||
| @@ -1,5 +1,7 @@ | |||||
| package com.iformall.enums; | package com.iformall.enums; | ||||
| import com.github.binarywang.wxpay.bean.applyment.enums.SettlementVerifyResultEnum; | |||||
| /** | /** | ||||
| * 签约状态 | * 签约状态 | ||||
| * VERIFYING:系统汇款验证中,商户可发起提现尝试。 | * VERIFYING:系统汇款验证中,商户可发起提现尝试。 | ||||
| @@ -8,9 +10,9 @@ package com.iformall.enums; | |||||
| */ | */ | ||||
| public enum EnumSharingReceiverVerifyResult { | public enum EnumSharingReceiverVerifyResult { | ||||
| VERIFYING(1, "VERIFYING", "系统汇款验证中,商户可发起提现尝试。"), | |||||
| VERIFY_SUCCESS(2, "VERIFY_SUCCESS", "系统成功汇款,该账户可正常发起提现。"), | |||||
| VERIFY_FAIL(3, "VERIFY_FAIL", "系统汇款失败,该账户无法发起提现,请检查修改。"), | |||||
| VERIFYING(1, SettlementVerifyResultEnum.VERIFYING, "系统汇款验证中,商户可发起提现尝试。"), | |||||
| VERIFY_SUCCESS(2, SettlementVerifyResultEnum.VERIFY_SUCCESS, "系统成功汇款,该账户可正常发起提现。"), | |||||
| VERIFY_FAIL(3, SettlementVerifyResultEnum.VERIFY_FAIL, "系统汇款失败,该账户无法发起提现,请检查修改。"), | |||||
| ; | ; | ||||
| public static EnumSharingReceiverVerifyResult getEnum(Integer code) { | public static EnumSharingReceiverVerifyResult getEnum(Integer code) { | ||||
| @@ -22,9 +24,9 @@ public enum EnumSharingReceiverVerifyResult { | |||||
| return null; | return null; | ||||
| } | } | ||||
| public static EnumSharingReceiverVerifyResult getEnum(String codeStr) { | |||||
| public static EnumSharingReceiverVerifyResult getEnum(SettlementVerifyResultEnum settlementVerifyResultEnum) { | |||||
| for (EnumSharingReceiverVerifyResult value : values()) { | for (EnumSharingReceiverVerifyResult value : values()) { | ||||
| if (value.getCodeStr().equals(codeStr)) { | |||||
| if (value.getSettlementVerifyResultEnum().equals(settlementVerifyResultEnum)) { | |||||
| return value; | return value; | ||||
| } | } | ||||
| } | } | ||||
| @@ -32,12 +34,12 @@ public enum EnumSharingReceiverVerifyResult { | |||||
| } | } | ||||
| private Integer code; | private Integer code; | ||||
| private String codeStr; | |||||
| private SettlementVerifyResultEnum settlementVerifyResultEnum; | |||||
| private String message; | private String message; | ||||
| EnumSharingReceiverVerifyResult(Integer code, String codeStr, String message) { | |||||
| EnumSharingReceiverVerifyResult(Integer code, SettlementVerifyResultEnum settlementVerifyResultEnum, String message) { | |||||
| this.code = code; | this.code = code; | ||||
| this.codeStr = codeStr; | |||||
| this.settlementVerifyResultEnum = settlementVerifyResultEnum; | |||||
| this.message = message; | this.message = message; | ||||
| } | } | ||||
| @@ -45,8 +47,8 @@ public enum EnumSharingReceiverVerifyResult { | |||||
| return code; | return code; | ||||
| } | } | ||||
| public String getCodeStr() { | |||||
| return codeStr; | |||||
| public SettlementVerifyResultEnum getSettlementVerifyResultEnum() { | |||||
| return settlementVerifyResultEnum; | |||||
| } | } | ||||
| public String getMessage() { | public String getMessage() { | ||||
| @@ -12,4 +12,5 @@ public interface WxProfitSharingReceiverApplyMapper extends CommonMapper<WxProfi | |||||
| List<WxProfitSharingReceiverApply> findListByApplymentState(WxProfitSharingReceiverApply apply); | List<WxProfitSharingReceiverApply> findListByApplymentState(WxProfitSharingReceiverApply apply); | ||||
| List<WxProfitSharingReceiverApply> findListByVerifyResult(WxProfitSharingReceiverApply apply); | |||||
| } | } | ||||
| @@ -28,4 +28,7 @@ public interface WxProfitSharingReceiverApplyService { | |||||
| ResultData handApplymentStates(WxProfitSharingReceiverApply apply); | ResultData handApplymentStates(WxProfitSharingReceiverApply apply); | ||||
| ResultData modifySettlement(WxProfitSharingReceiverApply receiverAdd,String subMchid); | |||||
| ResultData handVerifyResult(WxProfitSharingReceiverApply apply); | |||||
| } | } | ||||
| @@ -10,11 +10,18 @@ public interface WxBankUtilService { | |||||
| ResultData personalBanking(TenantEntity tenantInfo, int offset, int limit); | ResultData personalBanking(TenantEntity tenantInfo, int offset, int limit); | ||||
| ResultData personalBanking(TenantEntity tenantInfo); | |||||
| ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit); | ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit); | ||||
| ResultData corporateBanking(TenantEntity tenantInfo); | |||||
| ResultData areasProvinces(TenantEntity tenantInfo); | ResultData areasProvinces(TenantEntity tenantInfo); | ||||
| ResultData areasCities(TenantEntity tenantInfo, Integer provinceCode); | 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, 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.domain.po.base.TenantEntity; | ||||
| import com.iformall.service.WxPayAccountService; | import com.iformall.service.WxPayAccountService; | ||||
| import com.iformall.service.bank.WxBankUtilService; | import com.iformall.service.bank.WxBankUtilService; | ||||
| import com.iformall.utils.RedisCacheUtils; | |||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | import org.slf4j.LoggerFactory; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | 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 org.springframework.stereotype.Service; | ||||
| import java.util.ArrayList; | |||||
| import java.util.List; | |||||
| @Service | @Service | ||||
| public class WxBankUtilServiceImpl implements WxBankUtilService { | public class WxBankUtilServiceImpl implements WxBankUtilService { | ||||
| @@ -22,6 +28,10 @@ public class WxBankUtilServiceImpl implements WxBankUtilService { | |||||
| @Autowired | @Autowired | ||||
| WxPayAccountService wxPayAccountService; | WxPayAccountService wxPayAccountService; | ||||
| @Autowired | |||||
| @Qualifier("objectCommonRedisTemplate") | |||||
| RedisTemplate<String, Object> bankRedisTemplate; | |||||
| @Override | @Override | ||||
| public ResultData searchBanksByBankAccount(TenantEntity tenantInfo,String accountNumber) { | public ResultData searchBanksByBankAccount(TenantEntity tenantInfo,String accountNumber) { | ||||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | 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 | @Override | ||||
| public ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit) { | public ResultData corporateBanking(TenantEntity tenantInfo, int offset, int limit) { | ||||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | 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 | @Override | ||||
| public ResultData areasProvinces(TenantEntity tenantInfo) { | public ResultData areasProvinces(TenantEntity tenantInfo) { | ||||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(tenantInfo.getTenantId()); | 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()); | 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); | |||||
| } | |||||
| } | } | ||||
| @@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON; | |||||
| import com.alibaba.fastjson.JSONArray; | import com.alibaba.fastjson.JSONArray; | ||||
| import com.alibaba.fastjson.JSONObject; | import com.alibaba.fastjson.JSONObject; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.github.binarywang.wxpay.bean.applyment.ApplymentStateQueryResult; | |||||
| import com.github.binarywang.wxpay.bean.applyment.WxPayApplyment4SubCreateRequest; | |||||
| import com.github.binarywang.wxpay.bean.applyment.WxPayApplymentCreateResult; | |||||
| import com.github.binarywang.wxpay.bean.applyment.*; | |||||
| import com.github.binarywang.wxpay.bean.applyment.enums.SalesScenesTypeEnum; | import com.github.binarywang.wxpay.bean.applyment.enums.SalesScenesTypeEnum; | ||||
| import com.github.binarywang.wxpay.exception.WxPayException; | import com.github.binarywang.wxpay.exception.WxPayException; | ||||
| import com.github.binarywang.wxpay.service.WxPayService; | import com.github.binarywang.wxpay.service.WxPayService; | ||||
| @@ -18,6 +16,7 @@ import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.*; | import com.iformall.domain.po.*; | ||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.enums.*; | import com.iformall.enums.*; | ||||
| import com.iformall.exception.MallinkException; | |||||
| import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; | import com.iformall.mapper.WxProfitSharingReceiverApplyMapper; | ||||
| import com.iformall.service.*; | import com.iformall.service.*; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| @@ -98,7 +97,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| receiverAdd.setUpdateTime(now); | receiverAdd.setUpdateTime(now); | ||||
| wxProfitSharingReceiverApplyMapper.updateById(receiverAdd); | wxProfitSharingReceiverApplyMapper.updateById(receiverAdd); | ||||
| } | } | ||||
| return new ResultData(receiverAdd); | |||||
| return new ResultData(); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -169,6 +168,8 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| receiverApplyUpd.setApplymentStateDesc(applymentStateQueryResult.getApplymentStateMsg()); | receiverApplyUpd.setApplymentStateDesc(applymentStateQueryResult.getApplymentStateMsg()); | ||||
| if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_REJECTED)){ | if(enumApplymentState.equals(EnumSharingReceiverApplymentState.APPLYMENT_STATE_REJECTED)){ | ||||
| receiverApplyUpd.setAuditDetail(JSON.toJSONString(applymentStateQueryResult.getAuditDetail())); | receiverApplyUpd.setAuditDetail(JSON.toJSONString(applymentStateQueryResult.getAuditDetail())); | ||||
| }else{ | |||||
| receiverApplyUpd.setAuditDetail("[]"); | |||||
| } | } | ||||
| receiverApplyUpd.setUpdateTime(new Date()); | receiverApplyUpd.setUpdateTime(new Date()); | ||||
| wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | ||||
| @@ -197,6 +198,56 @@ 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(), "结算帐号填写未完成"); | |||||
| } | |||||
| @Override | |||||
| public ResultData handVerifyResult(WxProfitSharingReceiverApply receiverApply) { | |||||
| if(receiverApply == null || !EnumSharingReceiverVerifyResult.VERIFYING.getCode().equals(receiverApply.getVerifyResult())){ | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(), "该状态无需同步"); | |||||
| } | |||||
| WxPayService wxPayService = wxPayAccountService.getWxPayService(receiverApply.getTenantId()); | |||||
| try { | |||||
| SettlementInfoResult settlementInfoResult = wxPayService.getApplyment4SubService().querySettlementBySubMchid(receiverApply.getSubMchid()); | |||||
| EnumSharingReceiverVerifyResult enumVerifyResult = EnumSharingReceiverVerifyResult.getEnum(settlementInfoResult.getVerifyResult()); | |||||
| if(enumVerifyResult != null && !enumVerifyResult.getCode().equals(receiverApply.getVerifyResult())){ | |||||
| WxProfitSharingReceiverApply receiverApplyUpd = new WxProfitSharingReceiverApply(); | |||||
| receiverApplyUpd.updateTenantInfo(receiverApply); | |||||
| receiverApplyUpd.setId(receiverApply.getId()); | |||||
| receiverApplyUpd.setVerifyResult(enumVerifyResult.getCode()); | |||||
| if(enumVerifyResult.equals(EnumSharingReceiverVerifyResult.VERIFY_FAIL)){ | |||||
| receiverApplyUpd.setVerifyFailReason(settlementInfoResult.getVerifyFailReason()); | |||||
| }else{ | |||||
| receiverApplyUpd.setVerifyFailReason(""); | |||||
| } | |||||
| receiverApplyUpd.setUpdateTime(new Date()); | |||||
| wxProfitSharingReceiverApplyMapper.updateById(receiverApplyUpd); | |||||
| } | |||||
| return new ResultData(); | |||||
| } catch (WxPayException e) { | |||||
| e.printStackTrace(); | |||||
| return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); | |||||
| } | |||||
| } | |||||
| //------------------------------------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------------------------------------ | ||||
| @@ -726,7 +777,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| * "id":********, | * "id":********, | ||||
| * "organizationType":,//4个体,2企业 | * "organizationType":,//4个体,2企业 | ||||
| * "settlementInfo":"",//json格式在下面 转成字符串 | * "settlementInfo":"",//json格式在下面 转成字符串 | ||||
| * "qualifications":[//特殊资质图片 根据所选行业 是否必传 最多5张 | |||||
| * "qualifications":[//特殊资质图片 根据所选行业 是否必传 最多5张 转成字符串 | |||||
| * { | * { | ||||
| * "url":"", | * "url":"", | ||||
| * "media_id":"" | * "media_id":"" | ||||
| @@ -869,6 +920,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| logger.info("未填写开户银行"); | logger.info("未填写开户银行"); | ||||
| return false; | return false; | ||||
| } | } | ||||
| boolean need_bank_branch = accountInfoObject.getBooleanValue("need_bank_branch"); | |||||
| if(need_bank_branch){ | |||||
| String bank_branch_id = accountInfoObject.getString("bank_branch_id"); | |||||
| String bank_name = accountInfoObject.getString("bank_name"); | |||||
| if(StringUtils.isBlank(bank_branch_id) && StringUtils.isBlank(bank_name)){ | |||||
| logger.info("未填写开户银行支行"); | |||||
| return false; | |||||
| } | |||||
| } | |||||
| String bank_address_code = accountInfoObject.getString("bank_address_code"); | String bank_address_code = accountInfoObject.getString("bank_address_code"); | ||||
| if(StringUtils.isBlank(bank_address_code)){ | if(StringUtils.isBlank(bank_address_code)){ | ||||
| @@ -1241,9 +1301,12 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| bankAccountInfo.setBankAccountType(enumAccountType.getBankAccountTypeEnum()); | bankAccountInfo.setBankAccountType(enumAccountType.getBankAccountTypeEnum()); | ||||
| bankAccountInfo.setAccountName(accountInfoObject.getString("account_name")); | bankAccountInfo.setAccountName(accountInfoObject.getString("account_name")); | ||||
| bankAccountInfo.setAccountBank(accountInfoObject.getString("account_bank")); | bankAccountInfo.setAccountBank(accountInfoObject.getString("account_bank")); | ||||
| boolean need_bank_branch = accountInfoObject.getBooleanValue("need_bank_branch"); | |||||
| if(need_bank_branch){ | |||||
| bankAccountInfo.setBankBranchId(accountInfoObject.getString("bank_branch_id")); | |||||
| bankAccountInfo.setBankName(accountInfoObject.getString("bank_name")); | |||||
| } | |||||
| bankAccountInfo.setBankAddressCode(accountInfoObject.getString("bank_address_code")); | bankAccountInfo.setBankAddressCode(accountInfoObject.getString("bank_address_code")); | ||||
| bankAccountInfo.setBankBranchId(accountInfoObject.getString("bank_branch_id")); | |||||
| bankAccountInfo.setBankName(accountInfoObject.getString("bank_name")); | |||||
| bankAccountInfo.setAccountNumber(accountInfoObject.getString("account_number")); | bankAccountInfo.setAccountNumber(accountInfoObject.getString("account_number")); | ||||
| //todo 1. 当主体类型是“政府机关/事业单位”时或所属行业为“党费”时,支持在有合法资金管理关系的情况下结算账户设置为非同名。 | //todo 1. 当主体类型是“政府机关/事业单位”时或所属行业为“党费”时,支持在有合法资金管理关系的情况下结算账户设置为非同名。 | ||||
| //todo 2. 若结算账户设置为非同名,则需填写非同名证明材料,若结算账户为同名,则无需填写。 | //todo 2. 若结算账户设置为非同名,则需填写非同名证明材料,若结算账户为同名,则无需填写。 | ||||
| @@ -1301,5 +1364,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; | |||||
| } | |||||
| } | } | ||||
| @@ -144,5 +144,12 @@ | |||||
| from wx_profit_sharing_receiver_apply | from wx_profit_sharing_receiver_apply | ||||
| <include refid="dynamicWhereConditions"/> | <include refid="dynamicWhereConditions"/> | ||||
| </select> | </select> | ||||
| <select id="findListByVerifyResult" parameterType="com.iformall.domain.po.WxProfitSharingReceiverApply" resultMap="BaseResultMap"> | |||||
| select | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`merchant_id`,`plat`,`out_request_no`,`applyment_id`,`sub_mchid`,`verify_result` | |||||
| from wx_profit_sharing_receiver_apply | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | </mapper> | ||||