Просмотр исходного кода

新增 编辑客户是 推送ncc客户分配

LAPTOP-FO2T5SIU\35838 дней назад: 3
Родитель
Сommit
bdd4a269ae

+ 9 - 0
pro-base/src/main/java/com/idea/customerManagement/service/CustomerManagementService.java

@@ -35,6 +35,7 @@ import com.idea.customerManagement.mapper.RoomSelectionInfoMapper;
 import com.idea.customerManagement.model.*;
 import com.idea.invoice.model.ReceiptManage;
 import com.idea.invoice.service.ReceiptManageService;
+import com.idea.invoice.task.InvoiceTask;
 import com.idea.invoice.util.InvoiceUtil;
 import com.idea.paymentManagement.mapper.PayLogMapper;
 import com.idea.paymentManagement.model.PayLog;
@@ -103,6 +104,8 @@ public class CustomerManagementService implements BaseService<CustomerManagement
     private ContractManageService contractManageService;
     @Autowired
     private PayLogMapper payLogMapper;
+    @Autowired
+    private InvoiceTask invoiceTask;
 
 
     @Override
@@ -263,12 +266,15 @@ public class CustomerManagementService implements BaseService<CustomerManagement
                 record.setId(id);
                 record.setNcid(ncid);
                 record.setNcCode(code);
+                record.setSendFlag("1");
                 updateByPrimaryKeySelective(record);
             }
         }catch (Exception e){
             log.error("推送客户失败",e);
         }
 
+        // TODO: 2025/12/31 分配客户
+        invoiceTask.customerAssignSingle(id);
 
         return result;
 
@@ -354,6 +360,9 @@ public class CustomerManagementService implements BaseService<CustomerManagement
             log.error("修改客户失败",e);
         }
 
+        // TODO: 2025/12/31 分配客户
+        invoiceTask.customerAssignSingle(id);
+
         return result;
 
     }

+ 30 - 0
pro-base/src/main/java/com/idea/invoice/task/InvoiceTask.java

@@ -176,6 +176,12 @@ public class InvoiceTask {
 
         List<CustomerManagementDto> customerManagementDtos = customerManagementService.selectNeedSendList();
         for(CustomerManagementDto record: customerManagementDtos){
+
+            // 已推送的不处理
+            if(StringUtils.isNotEmpty(record.getSendFlag())){
+                continue;
+            }
+
             try {
                 // 给nc推送客户数据
                 JSONObject json = new JSONObject();
@@ -194,6 +200,7 @@ public class InvoiceTask {
                     String ncid = data.getString("ncid");
                     record.setNcid(ncid);
                     record.setNcCode(code);
+                    record.setSendFlag("1");
                     customerManagementService.updateByPrimaryKeySelective(record);
                 }
                 Thread.sleep(500);//等待毫秒
@@ -228,6 +235,29 @@ public class InvoiceTask {
 
     }
 
+    /**
+     * 单个客户分配
+     * @param id
+     */
+    public void customerAssignSingle(String id) {
+
+        try {
+            CustomerManagement customerManagement = customerManagementService.selectByPrimaryKey(id);
+            ParkInfo parkInfo = parkInfoMapper.selectByPrimaryKey(customerManagement.getGroupId());
+            // 客户分配
+            JSONObject json = new JSONObject();
+            json.put("pk_org", parkInfo.getOrganizationalCode());
+            json.put("ncid", customerManagement.getBuyerIdentityCard());
+            log.info("客户分配详情:{}", json.toJSONString());
+            InvoiceUtil.customerAssign(json);
+            Thread.sleep(500);//等待毫秒
+        } catch (Exception e) {
+            log.error("客户分配失败", e);
+        }
+
+    }
+
+
 
     /**
      * 查询发票状态

+ 19 - 1
pro-base/src/main/java/com/idea/invoice/util/InvoiceUtil.java

@@ -186,12 +186,13 @@ public class InvoiceUtil {
      *
      * @throws Exception
      */
-    public static void customerAssign(JSONObject json) throws Exception {
+    public static String customerAssign(JSONObject json) throws Exception {
         APICurUtils util = new APICurUtils();
         String token = InvoiceUtil.getToken(util);
         util.setApiUrl("nccloud/api/wxyy/uapbd/customer/assign");
         String result = util.getAPIRetrun(token, json.toJSONString());
         log.info("客户分配结果:{}", result);
+        return result;
     }
 
     /**
@@ -224,6 +225,23 @@ public class InvoiceUtil {
 //        return "";
     }
 
+
+    /**
+     * 客户修改
+     *
+     * @throws Exception
+     */
+    public static String customerInfoQuery(JSONObject json) throws Exception {
+        APICurUtils util = new APICurUtils();
+        String token = InvoiceUtil.getToken(util);
+        util.setApiUrl("nccloud/api/wxyy/uapbd/customer/infoquery");
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        log.info("客户查询:{}", result);
+        return result;
+//        return "";
+    }
+
+
     /**
      * 付款单接口_退款单
      *

+ 26 - 0
pro-base/src/main/java/com/idea/transactionRecordManage/controller/TransactionRecordController.java

@@ -1,8 +1,10 @@
 package com.idea.transactionRecordManage.controller;
 
+import com.alibaba.fastjson.JSONObject;
 import com.github.pagehelper.PageInfo;
 import com.idea.buildManage.model.HouseType;
 import com.idea.buildManage.response.ParkRoomResponse;
+import com.idea.invoice.util.InvoiceUtil;
 import com.idea.transactionRecordManage.service.TransactionRecordService;
 import com.idea.transactionRecordManage.vo.NccRecordVo;
 import com.rockstar.common.base.BaseController;
@@ -130,4 +132,28 @@ public class TransactionRecordController extends BaseController  {
         modelService.convertRecordSubmit(ids,collectionDateFrom, collectionDateTo);
         return AjaxResult.success();
     }
+
+
+    @PostMapping(value = "test", produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public AjaxResult test(String taxpayerid) throws Exception {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("taxpayerid", taxpayerid);
+        String result = InvoiceUtil.customerInfoQuery(jsonObject);
+        return AjaxResult.success(result);
+    }
+
+
+    @PostMapping(value = "test2", produces = {"application/json;charset=UTF-8"})
+    @ResponseBody
+    public AjaxResult test2(String id) throws Exception {
+
+        String result = modelService.customerAssignTemp(id);
+        return AjaxResult.success(result);
+    }
+
+
+
+
+
 }

+ 24 - 0
pro-base/src/main/java/com/idea/transactionRecordManage/service/TransactionRecordService.java

@@ -857,4 +857,28 @@ public class TransactionRecordService {
     }
 
 
+    public String customerAssignTemp(String id){
+
+        CustomerManagementExample example = new CustomerManagementExample();
+        example.createCriteria().andSendFlagEqualTo("1").andGroupIdEqualTo("1339601854048239616");
+        List<CustomerManagement> list = customerManagementMapper.selectByExample(example);
+        String result = "";
+        for (CustomerManagement customerManagement : list) {
+            try {
+                ParkInfo parkInfo = parkInfoMapper.selectByPrimaryKey(customerManagement.getGroupId());
+                // 客户分配
+                JSONObject json = new JSONObject();
+                json.put("pk_org", parkInfo.getOrganizationalCode());
+                json.put("ncid", customerManagement.getBuyerIdentityCard());
+                log.info("客户分配详情:{}", json.toJSONString());
+                result = InvoiceUtil.customerAssign(json);
+                Thread.sleep(500);//等待毫秒
+            } catch (Exception e) {
+                log.error("客户分配失败", e);
+            }
+        }
+
+        return result;
+    }
+
 }