浏览代码

feat(对接交行):重置授权码

Wangyafan 3 周之前
父节点
当前提交
091681e507

+ 1 - 1
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/IBocomVipAccountBasicInfoService.java

@@ -52,7 +52,7 @@ public interface IBocomVipAccountBasicInfoService extends IService<BocomVipAccou
      * 重置授权二维码
      * @param id
      */
-    void resetUrl(Long id);
+    BocomVipAccountBasicInfo resetUrl(Long id);
 
     /**
      * 维护绑定银行卡信息

+ 13 - 8
src/main/java/com/inkasso/factoring/bocom/vipaccount/service/impl/BocomVipAccountBasicInfoServiceImpl.java

@@ -300,8 +300,11 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
                     throw new BusinessException(CodeUtil.FAIL, e.getMessage());
                 }
                 //静默户入库
-                newSilentAccountInfo.setBocomVipAccountBasicInfoId(oldBasicInfo.getId());
-                bocomVipSilentAccoutInfoService.save(newSilentAccountInfo);
+                BocomVipAccountBasicInfo accountBasicInfo = JSONObject.parseObject(JSONObject.toJSONString(responseJson.getData()), BocomVipAccountBasicInfo.class);
+                List<BocomVipSilentAccountInfo> silentAccountInfoList = accountBasicInfo.getSilentAccountInfoList();
+                BocomVipSilentAccountInfo silentAccountInfo = silentAccountInfoList.get(0);
+                silentAccountInfo.setBocomVipAccountBasicInfoId(oldBasicInfo.getId());
+                bocomVipSilentAccoutInfoService.save(silentAccountInfo);
             }
 
         }
@@ -362,25 +365,27 @@ public class BocomVipAccountBasicInfoServiceImpl extends ServiceImpl<BocomVipAcc
     }
 
     @Override
-    public void resetUrl(Long id) {
+    public BocomVipAccountBasicInfo resetUrl(Long id) {
         BocomVipAccountBasicInfo basicInfo = getById(id);
+        BocomVipAccountBasicInfo newVipAccount = null;
         if (basicInfo != null) {
             ResponseJson responseJson;
             try {
-                responseJson = restTemplate.postForObject(bocomVipResetQrCodeUrl, basicInfo, ResponseJson.class);
+                responseJson = restTemplate.getForObject(bocomVipResetQrCodeUrl + "?id=" + id, ResponseJson.class);
                 if (!responseJson.getCode().equals(200)) {
                     throw new BusinessException(CodeUtil.FAIL, responseJson.getMsg().toString());
                 }
             } catch (Exception e) {
                 throw new BusinessException(CodeUtil.FAIL, e.getMessage());
             }
-            BocomVipAccountBasicInfo vipAccountBasicInfo = JSONObject.parseObject(JSONObject.toJSONString(responseJson.getData()), BocomVipAccountBasicInfo.class);
-            lambdaUpdate().eq(BocomVipAccountBasicInfo::getId, vipAccountBasicInfo.getId())
-                    .set(BocomVipAccountBasicInfo::getQrCode, vipAccountBasicInfo.getQrCode())
-                    .set(BocomVipAccountBasicInfo::getQrCodeEffectTime, vipAccountBasicInfo.getQrCodeEffectTime())
+            newVipAccount = JSONObject.parseObject(JSONObject.toJSONString(responseJson.getData()), BocomVipAccountBasicInfo.class);
+            lambdaUpdate().eq(BocomVipAccountBasicInfo::getId, newVipAccount.getId())
+                    .set(BocomVipAccountBasicInfo::getQrCode, newVipAccount.getQrCode())
+                    .set(BocomVipAccountBasicInfo::getQrCodeEffectTime, newVipAccount.getQrCodeEffectTime())
                     .update();
 
         }
+        return newVipAccount;
     }
 
     @Override

+ 1 - 0
src/main/java/com/inkasso/factoring/bocom/vipaccount/web/BocomVipAccountController.java

@@ -53,6 +53,7 @@ public class BocomVipAccountController {
     @PostMapping("bocomVipAccount/doUpdate")
     public ResponseJson doUpdate(@RequestBody BocomVipAccountBasicInfo basicInfo) {
         bocomVipAccountBasicInfoService.doUpdate(basicInfo);
+        bocomVipAccountBasicInfoService.refreshBocomVipBasic(basicInfo.getId());
         return new ResponseJson("操作成功!");
     }