Browse Source

退税记录拉取联调

liangbo.huang 3 weeks ago
parent
commit
bfc2835596

+ 15 - 3
trade-admin/src/main/java/com/trade/admin/config/MyMetaObjectHandler.java

@@ -14,16 +14,28 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
 
     @Override
     public void insertFill(MetaObject metaObject) {
+        String userNickName = null;
+        try {
+            userNickName = SecurityUtils.getUserNickName();
+        } catch (Exception e) {
+            userNickName = "system";
+        }
         if (metaObject.hasGetter("createBy") && metaObject.hasGetter("updateBy")) {
-            setFieldValByName("createBy", SecurityUtils.getUserNickName(), metaObject);
-            setFieldValByName("updateBy", SecurityUtils.getUserNickName(), metaObject);
+            setFieldValByName("createBy", userNickName, metaObject);
+            setFieldValByName("updateBy", userNickName, metaObject);
         }
     }
 
     @Override
     public void updateFill(MetaObject metaObject) {
+        String userNickName = null;
+        try {
+            userNickName = SecurityUtils.getUserNickName();
+        } catch (Exception e) {
+            userNickName = "system";
+        }
         if (metaObject.hasGetter("updateBy")) {
-            setFieldValByName("updateBy", SecurityUtils.getUserNickName(), metaObject);
+            setFieldValByName("updateBy", userNickName, metaObject);
         }
     }
 }

+ 4 - 1
trade-admin/src/main/java/com/trade/admin/job/ExportTaxRebateSchedule.java

@@ -59,15 +59,18 @@ public class ExportTaxRebateSchedule {
             GridPage<CustomsDeclarationGoodsBelongsVO> gridPage = customsDeclarationGoodsService
                     .getAllNeedPullTaxRebateRecords(pageNum, pageSize);
             List<CustomsDeclarationGoodsBelongsVO> rows = gridPage.getRows();
+            handleTaxRebateRecords(rows);
             if (CollUtil.isEmpty(rows) || rows.size() < pageSize) {
                 break;
             }
-            handleTaxRebateRecords(rows);
             pageNum++;
         }
     }
 
     private void handleTaxRebateRecords(List<CustomsDeclarationGoodsBelongsVO> rows) {
+        if (CollUtil.isEmpty(rows)) {
+            return;
+        }
         // 查询21位报关单商品信息
         Map<String, CustomsDeclarationGoodsBelongsVO> map = rows.stream()
                 .collect(Collectors.toMap(CustomsDeclarationGoodsBelongsVO::getCkbgdh, (v) -> v, (v1, v2) -> v2));

+ 8 - 0
trade-admin/src/main/java/com/trade/admin/system/controller/TestController.java

@@ -1,6 +1,7 @@
 package com.trade.admin.system.controller;
 
 import com.trade.admin.job.CustomsDeclarationSchedule;
+import com.trade.admin.job.ExportTaxRebateSchedule;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -12,6 +13,8 @@ public class TestController {
 
     @Resource
     private CustomsDeclarationSchedule customsDeclarationSchedule;
+    @Resource
+    private ExportTaxRebateSchedule exportTaxRebateSchedule;
 
     @RequestMapping("/customsDeclarationTask1")
     public void customsDeclarationTask1() {
@@ -22,4 +25,9 @@ public class TestController {
     public void customsDeclarationTask2() {
         customsDeclarationSchedule.batchProcessCustomsDeclarationUnFinish();
     }
+
+    @RequestMapping("/exportTaxRebateTask")
+    public void exportTaxRebateTask() {
+        exportTaxRebateSchedule.pullTaxRebateRecordsJob();
+    }
 }

+ 1 - 1
trade-service/src/main/resources/mapper/trade/salesorder/CustomsDeclarationGoodsMapper.xml

@@ -96,7 +96,7 @@ yfhghbzm_dm, bfje, bfhghbzm_dm, zfje1, zfhghbzm_dm, js1, mz2, jz, hgckhwbgdsbrq,
                  LEFT JOIN trading_platform p ON p.cert_no = c.agency_cert_no
                  LEFT JOIN customer_user u ON  u.id= c.customer_user_id
                  LEFT JOIN enterprise e ON c.customer_user_id = e.customer_id
-        WHERE a.deleted = 0 AND a.tsjltbbs = 0 AND a.bgsbzt_dm = '2';
+        WHERE a.deleted = 0 AND a.tsjltbbs = 0 AND a.bgsbzt_dm = '10'
     </select>
 
 </mapper>