From 11e778f72b830a4050c293d78694417d32055727 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 20 十月 2023 20:39:55 +0800
Subject: [PATCH] 对接第三方分账接口

---
 ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
index d1ba142..47ab01f 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopServiceImpl.java
@@ -1140,24 +1140,28 @@
 
     /**
      * 商户进件异步通知
-     * @param jsonObject
      * @return
      */
     @Override
-    public R<String> merchantBasicdataNotify(JSONObject jsonObject) {
-        R<MerchantBasicdataVo> merchantBasicdataVoR = HuiFuTianXiaUtil.merchantBasicDataNotify(jsonObject);
+    public R<String> merchantBasicdataNotify(MerchantBasicDataNotifyDto dto) {
+        R<MerchantBasicdataVo> merchantBasicdataVoR = HuiFuTianXiaUtil.merchantBasicDataNotify(dto);
         if(merchantBasicdataVoR.getCode() != 200){
             return R.fail(merchantBasicdataVoR.getMsg());
         }
         MerchantBasicdataVo data = merchantBasicdataVoR.getData();
         ShopAuthenticationHftx shopAuthenticationHftx = shopAuthenticationHftxService.getOne(new QueryWrapper<ShopAuthenticationHftx>().eq("req_seq_id", data.getReqSeqId()));
-        if(!org.springframework.util.StringUtils.hasLength(shopAuthenticationHftx.getAuditStatus())){
+        if("U".equals(shopAuthenticationHftx.getAuditStatus())){
             shopAuthenticationHftx.setAuditStatus(data.getAuditStatus());
             shopAuthenticationHftx.setAuditDesc(data.getAuditDesc());
             shopAuthenticationHftx.setHuifuId(data.getHuifuId());
             shopAuthenticationHftx.setTokenNo(data.getTokenNo());
             shopAuthenticationHftx.setApplyNo(data.getApplyNo());
             shopAuthenticationHftxService.updateById(shopAuthenticationHftx);
+            if("Y".equals(data.getAuditStatus())){
+                Shop shop = this.getByShopId(shopAuthenticationHftx.getShopId());
+                shop.setShopStatus(1);
+                this.updateById(shop);
+            }
         }
         return R.ok(data.getReqSeqId());
     }
@@ -1575,6 +1579,23 @@
         List<ShopAuthentication> list = shopAuthenticationService.getShopAuthNeedUpdateStatus();
         log.info("定时检查微信二级商户"+list.toString());
         list.forEach(item -> queryApplyStatusByApplymentId(item.getApplymentId(), item.getShopId()));
+
+        List<ShopAuthenticationHftx> list1 = shopAuthenticationHftxService.list(new QueryWrapper<ShopAuthenticationHftx>().eq("audit_status", "U").eq("is_delete", 0));
+        for (ShopAuthenticationHftx shopAuthenticationHftx : list1) {
+            R<MerchantBasicdataVo> r = HuiFuTianXiaUtil.queryMerchantBasicdata(IdUtils.simpleUUID(), shopAuthenticationHftx.getHuifuId());
+            if(r.getCode() == 200){
+                MerchantBasicdataVo data = r.getData();
+                if(org.springframework.util.StringUtils.hasLength(data.getTokenNo())){
+                    shopAuthenticationHftx.setTokenNo(data.getTokenNo());
+                    shopAuthenticationHftx.setAuditStatus("Y");
+                    shopAuthenticationHftx.setAuditDesc("成功");
+                    Shop shop = this.getByShopId(shopAuthenticationHftx.getShopId());
+                    shop.setShopStatus(1);
+                    this.updateById(shop);
+                    shopAuthenticationHftxService.updateById(shopAuthenticationHftx);
+                }
+            }
+        }
     }
 
     /**

--
Gitblit v1.7.1