|
@@ -38,21 +38,21 @@ public class MerchantApplyRecordServiceImpl extends
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void updateSxyMerchantIdByNotify(SxyNotifyParam param) {
|
|
|
+ public String updateSxyMerchantIdByNotify(SxyNotifyParam param) {
|
|
|
JSONObject responseData = TradeHandle.decrypt(param);
|
|
|
log.info("申请商户号回调参数:{}", responseData);
|
|
|
String status = responseData.getString("subMerchantReviewStatus");
|
|
|
if (Constants.ERROR.equals(status)) {
|
|
|
//解密后报文,如果status=ERROR时,不需要验签
|
|
|
- return;
|
|
|
+ return status;
|
|
|
}
|
|
|
String requestId = responseData.getString("requestId");
|
|
|
LambdaQueryWrapper<MerchantApplyRecord> wrapper = Wrappers.lambdaQuery();
|
|
|
wrapper.eq(MerchantApplyRecord::getRequestId, requestId);
|
|
|
MerchantApplyRecord record = baseMapper.selectOne(wrapper);
|
|
|
Integer recordStatus = record.getStatus();
|
|
|
- if(recordStatus != 0){
|
|
|
- return;
|
|
|
+ if(MerchantApplyStatus.SUCCESS.getStatus().equals(recordStatus)){
|
|
|
+ return MerchantApplyStatus.SUCCESS.getType();
|
|
|
}
|
|
|
String subMerchantId = responseData.getString("subMerchantId");
|
|
|
Integer type = record.getType();
|
|
@@ -86,5 +86,57 @@ public class MerchantApplyRecordServiceImpl extends
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
+ //判断状态是否是通过 通过调用电子签重签
|
|
|
+ if("PASS".equals(status)){
|
|
|
+ merchantRelationService.reSign(requestId, subMerchantId, 5);
|
|
|
+ }
|
|
|
+ return status;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String updateStatusByReSignNotify(Integer frequency, SxyNotifyParam param) {
|
|
|
+ if(frequency == null || frequency > 5 || frequency < 1){
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ JSONObject responseData = TradeHandle.decrypt(param);
|
|
|
+ log.info("电子签重签回调参数:{}", responseData);
|
|
|
+ String status = responseData.getString("status");
|
|
|
+ String subMerchantId = responseData.getString("subMerchantId");
|
|
|
+ String requestId = responseData.getString("requestId");
|
|
|
+ if (!Constants.SUCCESS.equals(status)) {
|
|
|
+ merchantRelationService.reSign(requestId, subMerchantId, --frequency);
|
|
|
+ return status;
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<MerchantApplyRecord> wrapper = Wrappers.lambdaQuery();
|
|
|
+ wrapper.eq(MerchantApplyRecord::getRequestId, requestId);
|
|
|
+ MerchantApplyRecord record = baseMapper.selectOne(wrapper);
|
|
|
+ if(record == null){
|
|
|
+ return "FAIL";
|
|
|
+ }
|
|
|
+ Integer type = record.getType();
|
|
|
+ Integer resultStatus = MerchantApplyStatus.getStatus(status);
|
|
|
+ record.setStatus(resultStatus);
|
|
|
+ record.setExamineStatus(status);
|
|
|
+ String errorMessage = responseData.getString("errorMessage");
|
|
|
+ DatabaseContextHolder.transactional((Executor) () -> {
|
|
|
+ baseMapper.updateById(record);
|
|
|
+ if(type == 1){
|
|
|
+ //更改个人认证状态
|
|
|
+ userAuthService.updateStatus(record.getUserId(), resultStatus, errorMessage);
|
|
|
+ }
|
|
|
+ if(type == 2){
|
|
|
+ //更改商家认证状态
|
|
|
+ merchantAuthService.updateStatus(record.getUserId(), resultStatus, errorMessage);
|
|
|
+ }
|
|
|
+ if("SUCCESS".equals(status)){
|
|
|
+ int i = merchantRelationService.insert(record.getUserId(), record.getType(), subMerchantId);
|
|
|
+ if(i == 1 && record.getType() == 1){
|
|
|
+ //用户申请商户号成功,平台转账给用户
|
|
|
+ BigDecimal total = assetService.queryTotal(record.getUserId(), 1);
|
|
|
+ assetService.transfer(0L, record.getUserId(), 1, total, "0");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return status;
|
|
|
}
|
|
|
}
|