LAPTOP-FO2T5SIU\35838 před 7 měsíci
rodič
revize
d4b7a97731

+ 3 - 3
pro-base/src/main/java/com/idea/customerManagement/service/RoomSelectionInfoService.java

@@ -150,9 +150,9 @@ public class RoomSelectionInfoService implements BaseService<RoomSelectionInfo,
     public int submit(String houseIds, String customerManagementId, String userId) {
 
         ParkRoom originRoom = parkRoomMapper.selectByPrimaryKey(houseIds);
-//        if(originRoom.getIsChoose() == 1){
-//            throw new RuntimeException("该房间已被选择!!!");
-//        }
+        if(originRoom.getIsChoose() == 1){
+            throw new RuntimeException("该房间已被选择!!!");
+        }
         
         String groupId = "";
         String discId = "";

+ 33 - 1
pro-base/src/main/java/com/idea/invoice/task/InvoiceTask.java

@@ -3,6 +3,7 @@ package com.idea.invoice.task;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.idea.buildManage.dto.MnpBuildingDto;
+import com.idea.buildManage.mapper.ParkInfoMapper;
 import com.idea.buildManage.model.MnpBuilding;
 import com.idea.buildManage.model.ParkFloorDisc;
 import com.idea.buildManage.model.ParkInfo;
@@ -14,6 +15,8 @@ import com.idea.buildManage.service.ParkInfoService;
 import com.idea.buildManage.service.ParkRoomService;
 import com.idea.customerManagement.dto.CustomerManagementDto;
 import com.idea.customerManagement.model.Buyer;
+import com.idea.customerManagement.model.CustomerManagement;
+import com.idea.customerManagement.model.CustomerManagementExample;
 import com.idea.customerManagement.service.CustomerManagementService;
 import com.idea.invoice.mapper.InvoiceManageExtendMapper;
 import com.idea.invoice.model.InvoiceManage;
@@ -24,6 +27,7 @@ import com.idea.invoice.util.InvoiceUtil;
 import com.idea.util.DateUtils;
 import com.rockstar.util.StringUtils;
 import lombok.extern.slf4j.Slf4j;
+import nccloud.open.api.auto.token.cur.utils.APICurUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
@@ -50,6 +54,8 @@ public class InvoiceTask {
     private CustomerManagementService customerManagementService;
     @Autowired
     private InvoiceManageExtendMapper invoiceManageExtendMapper;
+    @Autowired
+    private ParkInfoMapper parkInfoMapper;
 
 
 
@@ -166,7 +172,7 @@ public class InvoiceTask {
      * 每天凌晨执行 推送客户数据
      */
 //    @Scheduled(cron = "0 0 0 1/1 * ?")
-    public void sendCustomer(){
+    public void sendCustomer() throws Exception {
 
         List<CustomerManagementDto> customerManagementDtos = customerManagementService.selectNeedSendList();
         for(CustomerManagementDto record: customerManagementDtos){
@@ -178,6 +184,7 @@ public class InvoiceTask {
                 json.put("pk_custclass", "02"); //客户基本分类 ,,(默认是02),必选,01内部客户,02外部客户
                 json.put("custprop", "0");//财务组织客户类型,必选,默认0
                 json.put("taxpayerid", record.getIdentityCard()); //统一社会信用代码,必选
+                log.info("推送客户详情:{}", json.toJSONString());
                 String result = InvoiceUtil.customerAdd(json);
                 JSONObject jsonObject = JSONObject.parseObject(result);
                 String success = jsonObject.getString("success");
@@ -189,12 +196,37 @@ public class InvoiceTask {
                     record.setNcCode(code);
                     customerManagementService.updateByPrimaryKeySelective(record);
                 }
+                Thread.sleep(500);//等待毫秒
             }catch (Exception e){
                 log.error("推送客户失败",e);
             }
         }
     }
 
+    /**
+     * 分配客户
+     */
+    public void customerAssign() throws Exception {
+
+
+        List<CustomerManagement> customerManagements = customerManagementService.selectByExample(new CustomerManagementExample());
+        for(CustomerManagement customerManagement : customerManagements){
+            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());
+                InvoiceUtil.customerAssign(json);
+                Thread.sleep(500);//等待毫秒
+            } catch (Exception e) {
+                log.error("客户分配失败", e);
+            }
+        }
+
+    }
+
 
     /**
      * 查询发票状态

+ 33 - 2
pro-base/src/main/java/com/idea/invoice/util/InvoiceUtil.java

@@ -156,10 +156,26 @@ public class InvoiceUtil {
         String token = InvoiceUtil.getToken(util);
         util.setApiUrl("nccloud/api/wxyy/uapbd/customer/add");
         String result = util.getAPIRetrun(token, json.toJSONString());
-        log.info("客户新增:{}", result);
+        log.info("客户新增结果:{}", result);
         return result;
     }
 
+    /**
+     * 客户新增
+     * @param json
+     * @param token
+     * @return
+     * @throws Exception
+     */
+    public static String customerAdd(JSONObject json,String token) throws Exception {
+        APICurUtils util = new APICurUtils();
+        util.setApiUrl("nccloud/api/wxyy/uapbd/customer/add");
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        log.info("客户新增结果:{}", result);
+        return result;
+    }
+
+
     /**
      * 客户分配
      *
@@ -170,9 +186,24 @@ public class InvoiceUtil {
         String token = InvoiceUtil.getToken(util);
         util.setApiUrl("nccloud/api/wxyy/uapbd/customer/assign");
         String result = util.getAPIRetrun(token, json.toJSONString());
-        log.info("客户分配:{}", result);
+        log.info("客户分配结果:{}", result);
     }
 
+    /**
+     * 客户分配
+     * @param json
+     * @param token
+     * @throws Exception
+     */
+    public static void customerAssign(JSONObject json,String token) throws Exception {
+        APICurUtils util = new APICurUtils();
+        util.setApiUrl("nccloud/api/wxyy/uapbd/customer/assign");
+        String result = util.getAPIRetrun(token, json.toJSONString());
+        log.info("客户分配结果:{}", result);
+    }
+
+
+
     /**
      * 客户修改
      *

+ 4 - 3
pro-base/src/main/resources/mybatis/customerManagement/CustomerManagementExtendMapper.xml

@@ -57,9 +57,10 @@
   </select>
 
     <select id="selectNeedSendList" resultType="com.idea.customerManagement.dto.CustomerManagementDto">
-      select c.*,b.name buyerName,b.identity_card from customer_management c
-      left join buyer b on c.id = b.customer_management_id and b.order_num = 1
-      where c.ncid is null or c.ncid = ''
+      select * from customer_management
+      where id in (
+          select customer_management_id from buyer
+        ) and ifnull(ncid,'') = ''
     </select>
 
     <select id="getByNum" resultType="com.idea.customerManagement.model.CustomerManagement">

+ 3 - 2
pro-wx/src/main/java/com/idea/pro/wx/controller/buildManage/WxParkRoomController.java

@@ -193,7 +193,7 @@ public class WxParkRoomController extends BaseController {
 
     @PostMapping(value = "test")
     @ResponseBody
-    public AjaxResult test(MultipartFile file) throws IOException {
+    public AjaxResult test(MultipartFile file) throws Exception {
 //        payLogService.sendVoucher(id);
 //        intentionalDepositService.sendToDepositVoucher(id);
 //        List<Map<String, String>> dictList = sysDictService.selectDictList("CONTENT_TYPE");
@@ -201,7 +201,8 @@ public class WxParkRoomController extends BaseController {
 //        invoiceTask.sendHouse();
 //        customerManagementService.tempCusUpdate(file);
 //        customerManagementService.tempCusUpdate2(file);
-        customerManagementService.tempContractUpdate(file);
+//        customerManagementService.tempContractUpdate(file);
+//        invoiceTask.sendCustomer();
         return success();
     }