| @@ -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()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -98,10 +98,10 @@ public class WxProfitSharingReceiverApply extends TenantEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="EnumSharingReceiverVerifyResult 修改收款帐号 申请状态",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,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); | |||||
| } | } | ||||
| @@ -29,4 +29,6 @@ public interface WxProfitSharingReceiverApplyService { | |||||
| ResultData handApplymentStates(WxProfitSharingReceiverApply apply); | ResultData handApplymentStates(WxProfitSharingReceiverApply apply); | ||||
| ResultData modifySettlement(WxProfitSharingReceiverApply receiverAdd,String subMchid); | ResultData modifySettlement(WxProfitSharingReceiverApply receiverAdd,String subMchid); | ||||
| ResultData handVerifyResult(WxProfitSharingReceiverApply apply); | |||||
| } | } | ||||
| @@ -4,10 +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.ModifySettlementRequest; | |||||
| 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; | ||||
| @@ -171,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); | ||||
| @@ -220,6 +219,35 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_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()); | |||||
| } | |||||
| } | |||||
| //------------------------------------------------------------------------------------------------------------------ | //------------------------------------------------------------------------------------------------------------------ | ||||
| @@ -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> | ||||