正式合同定时任务;
This commit is contained in:
+70
-19
@@ -1302,6 +1302,23 @@ public class ContractManageApplicationService {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 根据结算对象id获取结算对象参数列表
|
||||
* */
|
||||
public List<SettlementCustomersParametersPO> getSettlementCustomersParameters(Long settlementCustomersId) {
|
||||
try {
|
||||
AjaxResult ajaxResult = bmsServiceFeign.getListBySettlementCustomersId(settlementCustomersId);
|
||||
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code"))) || ajaxResult.get("data") == null) {
|
||||
log.warn("按 settlementCustomersId 查询结算对象参数未成功:settlementCustomersId={}, code={}", settlementCustomersId, ajaxResult != null ? ajaxResult.get("code") : null);
|
||||
return null;
|
||||
}
|
||||
return JSON.parseArray(JSON.toJSONString(ajaxResult.get("data")), SettlementCustomersParametersPO.class);
|
||||
} catch (Exception e) {
|
||||
log.warn("按 settlementCustomersId 查询结算对象参数异常,settlementCustomersId={}", settlementCustomersId, e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void pushContractManageToBms(String shipperId) {
|
||||
SettlementCustomersPO settlementCustomers = getSettlementCustomers(Long.valueOf(shipperId));
|
||||
if (settlementCustomers == null) {
|
||||
@@ -1309,31 +1326,65 @@ public class ContractManageApplicationService {
|
||||
return;
|
||||
}
|
||||
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
||||
List<ContractManage> contractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
|
||||
.eq(ContractManage::getContractRentType, "NORMAL")
|
||||
.eq(ContractManage::getContractState, 2)
|
||||
.eq(ContractManage::getDelFlag, 1)
|
||||
.eq(ContractManage::getSettlementCustomersId, settlementCustomers.getSettlementCustomersId()));
|
||||
if (contractManages == null || contractManages.isEmpty()) {
|
||||
log.warn("未找到正式合同");
|
||||
List<SettlementCustomersParametersPO> parametersList = getSettlementCustomersParameters(settlementCustomersId);
|
||||
if (parametersList == null || parametersList.isEmpty()) {
|
||||
log.warn("pushContractManageToBms 未找到结算对象参数,settlementCustomersId={}", settlementCustomersId);
|
||||
return;
|
||||
}
|
||||
for (ContractManage contractManage : contractManages) {
|
||||
Long contractManageId = contractManage.getContractManageId();
|
||||
ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper<ContractManageParameters>()
|
||||
.eq(ContractManageParameters::getContractManageId, contractManageId),false);
|
||||
if (contractManageParameters == null) {
|
||||
|
||||
for (SettlementCustomersParametersPO param : parametersList) {
|
||||
String parametersName = param.getParametersName();
|
||||
String content = param.getContent();
|
||||
if (StringUtils.isEmpty(content)) {
|
||||
log.warn("结算对象参数 content 为空,parametersName={}, settlementCustomersId={}", parametersName, settlementCustomersId);
|
||||
continue;
|
||||
}
|
||||
String parametersJson = contractManageParameters.getParametersJson();
|
||||
Map<String, Object> parametersMap = JSON.parseObject(parametersJson, new TypeReference<Map<String, Object>>() {});
|
||||
//合约价
|
||||
BigDecimal hyj = (BigDecimal) parametersMap.get("hyj");
|
||||
buildBusinessDocument(hyj,settlementCustomers,contractManage,"","","");
|
||||
Map<String, Object> contentMap = JSON.parseObject(content, new TypeReference<Map<String, Object>>() {});
|
||||
Integer sfzdcz = Integer.valueOf(contentMap.get("sfzdcz").toString());
|
||||
if (sfzdcz != 1) {
|
||||
log.info("结算对象参数 sfzdcz 不为1,跳过推送,parametersName={}, sfzdcz={}", parametersName, sfzdcz);
|
||||
continue;
|
||||
}
|
||||
|
||||
String warehouseTempLayerType;
|
||||
String serviceItemsName;
|
||||
if ("冻仓计费配置".equals(parametersName)) {
|
||||
warehouseTempLayerType = "DC";
|
||||
serviceItemsName = "冻仓仓租费用";
|
||||
} else if ("干仓计费配置".equals(parametersName)) {
|
||||
warehouseTempLayerType = "GC";
|
||||
serviceItemsName = "干仓仓租费用";
|
||||
} else {
|
||||
log.warn("未知的结算对象参数类型,parametersName={}", parametersName);
|
||||
continue;
|
||||
}
|
||||
|
||||
List<ContractManage> contractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
|
||||
.eq(ContractManage::getContractRentType, "NORMAL")
|
||||
.eq(ContractManage::getContractState, 2)
|
||||
.eq(ContractManage::getDelFlag, 1)
|
||||
.eq(ContractManage::getSettlementCustomersId, settlementCustomersId)
|
||||
.eq(ContractManage::getWarehouseTempLayerType, warehouseTempLayerType));
|
||||
if (contractManages == null || contractManages.isEmpty()) {
|
||||
log.warn("未找到正式合同,warehouseTempLayerType={}, settlementCustomersId={}", warehouseTempLayerType, settlementCustomersId);
|
||||
continue;
|
||||
}
|
||||
for (ContractManage contractManage : contractManages) {
|
||||
Long contractManageId = contractManage.getContractManageId();
|
||||
ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper<ContractManageParameters>()
|
||||
.eq(ContractManageParameters::getContractManageId, contractManageId), false);
|
||||
if (contractManageParameters == null) {
|
||||
continue;
|
||||
}
|
||||
String parametersJson = contractManageParameters.getParametersJson();
|
||||
Map<String, Object> parametersMap = JSON.parseObject(parametersJson, new TypeReference<Map<String, Object>>() {});
|
||||
BigDecimal hyj = (BigDecimal) parametersMap.get("hyj");
|
||||
buildBusinessDocument(hyj, settlementCustomers, contractManage, "0D081", "干仓仓租费用", warehouseTempLayerType, serviceItemsName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void buildBusinessDocument(BigDecimal fee, SettlementCustomersPO settlementCustomers,ContractManage contractManage, String code, String name, String warehouseType) {
|
||||
private void buildBusinessDocument(BigDecimal fee, SettlementCustomersPO settlementCustomers, ContractManage contractManage, String code, String name, String warehouseType, String serviceItemsName) {
|
||||
|
||||
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
||||
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
|
||||
@@ -1357,7 +1408,7 @@ public class ContractManageApplicationService {
|
||||
businessDocumentFeign.setFirstSubjectName(name);
|
||||
businessDocumentFeign.setBillingTime(new Date());
|
||||
businessDocumentFeign.setServiceItemsCode("GC_CZ");
|
||||
businessDocumentFeign.setServiceItemsName("干仓仓租费用");
|
||||
businessDocumentFeign.setServiceItemsName(serviceItemsName);
|
||||
businessDocumentFeign.setSettlementWay(1);
|
||||
businessDocumentFeign.setOriginalBusinessNum(contractManage.getContractNumber());
|
||||
businessDocumentFeign.setWarehouseType(warehouseType);
|
||||
|
||||
-2
@@ -242,7 +242,5 @@ public class ContractManageDomainService {
|
||||
return contractManagePO;
|
||||
}
|
||||
|
||||
public Map<String,Object> getSettlementCustomers(String shipperId) {
|
||||
|
||||
}
|
||||
}
|
||||
+1
@@ -263,6 +263,7 @@ public class ContractManageApi extends BaseController{
|
||||
String shipperId = XxlJobHelper.getJobParam();
|
||||
logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId);
|
||||
try {
|
||||
contractManageApplicationService.pushContractManageToBms(shipperId);
|
||||
// 设置任务执行结果
|
||||
XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功");
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user