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