正式合同定时任务;
This commit is contained in:
@@ -72,4 +72,10 @@ public interface BmsServiceFeign {
|
|||||||
|
|
||||||
@PostMapping("/businessDocumentApi/feignSave")
|
@PostMapping("/businessDocumentApi/feignSave")
|
||||||
public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign);
|
public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据结算对象id查询结算对象参数列表
|
||||||
|
*/
|
||||||
|
@GetMapping("/settlementCustomersParametersApi/getListBySettlementCustomersId")
|
||||||
|
AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId);
|
||||||
}
|
}
|
||||||
+5
@@ -72,6 +72,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory<BmsService
|
|||||||
public AjaxResult feignSaveBusinessDocument(BusinessDocumentFeign businessDocumentFeign) {
|
public AjaxResult feignSaveBusinessDocument(BusinessDocumentFeign businessDocumentFeign) {
|
||||||
return AjaxResult.error("保存业务单据失败");
|
return AjaxResult.error("保存业务单据失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult getListBySettlementCustomersId(Long settlementCustomersId) {
|
||||||
|
return AjaxResult.error(throwable.getMessage());
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+58
@@ -0,0 +1,58 @@
|
|||||||
|
package com.mhd.common.core.domain.po;
|
||||||
|
|
||||||
|
import com.mhd.common.core.annotation.Excel;
|
||||||
|
import com.mhd.common.core.web.domain.BaseVOEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel(value = "结算对象参数对象", description = "结算对象参数响应对象")
|
||||||
|
public class SettlementCustomersParametersPO extends BaseVOEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ApiModelProperty("结算对象id")
|
||||||
|
private Long settlementCustomersId;
|
||||||
|
|
||||||
|
@ApiModelProperty("一级组织表ID")
|
||||||
|
@Excel(name = "一级组织表ID")
|
||||||
|
private Long topOrganizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织表ID")
|
||||||
|
@Excel(name = "组织表ID")
|
||||||
|
private Long organizationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("组织名称")
|
||||||
|
@Excel(name = "组织名称")
|
||||||
|
private String organizationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("结算对象编码")
|
||||||
|
@Excel(name = "结算对象编码")
|
||||||
|
private String settlementCustomersCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("结算主体id")
|
||||||
|
@Excel(name = "结算主体id")
|
||||||
|
private Long settlementEntityId;
|
||||||
|
|
||||||
|
@ApiModelProperty("结算主体")
|
||||||
|
@Excel(name = "结算主体")
|
||||||
|
private String settlementEntity;
|
||||||
|
|
||||||
|
@ApiModelProperty("合同编号")
|
||||||
|
@Excel(name = "合同编号")
|
||||||
|
private String contractNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty("合同管理id")
|
||||||
|
private Long contractManageId;
|
||||||
|
|
||||||
|
@ApiModelProperty("参数内容")
|
||||||
|
@Excel(name = "参数内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty("参数名称")
|
||||||
|
@Excel(name = "参数名称")
|
||||||
|
private String parametersName;
|
||||||
|
}
|
||||||
+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) {
|
public void pushContractManageToBms(String shipperId) {
|
||||||
SettlementCustomersPO settlementCustomers = getSettlementCustomers(Long.valueOf(shipperId));
|
SettlementCustomersPO settlementCustomers = getSettlementCustomers(Long.valueOf(shipperId));
|
||||||
if (settlementCustomers == null) {
|
if (settlementCustomers == null) {
|
||||||
@@ -1309,31 +1326,65 @@ public class ContractManageApplicationService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
Long settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
||||||
List<ContractManage> contractManages = contractManageMapper.selectList(new LambdaQueryWrapper<ContractManage>()
|
List<SettlementCustomersParametersPO> parametersList = getSettlementCustomersParameters(settlementCustomersId);
|
||||||
.eq(ContractManage::getContractRentType, "NORMAL")
|
if (parametersList == null || parametersList.isEmpty()) {
|
||||||
.eq(ContractManage::getContractState, 2)
|
log.warn("pushContractManageToBms 未找到结算对象参数,settlementCustomersId={}", settlementCustomersId);
|
||||||
.eq(ContractManage::getDelFlag, 1)
|
|
||||||
.eq(ContractManage::getSettlementCustomersId, settlementCustomers.getSettlementCustomersId()));
|
|
||||||
if (contractManages == null || contractManages.isEmpty()) {
|
|
||||||
log.warn("未找到正式合同");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (ContractManage contractManage : contractManages) {
|
|
||||||
Long contractManageId = contractManage.getContractManageId();
|
for (SettlementCustomersParametersPO param : parametersList) {
|
||||||
ContractManageParameters contractManageParameters = contractManageParametersService.getOne(new LambdaQueryWrapper<ContractManageParameters>()
|
String parametersName = param.getParametersName();
|
||||||
.eq(ContractManageParameters::getContractManageId, contractManageId),false);
|
String content = param.getContent();
|
||||||
if (contractManageParameters == null) {
|
if (StringUtils.isEmpty(content)) {
|
||||||
|
log.warn("结算对象参数 content 为空,parametersName={}, settlementCustomersId={}", parametersName, settlementCustomersId);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
String parametersJson = contractManageParameters.getParametersJson();
|
Map<String, Object> contentMap = JSON.parseObject(content, new TypeReference<Map<String, Object>>() {});
|
||||||
Map<String, Object> parametersMap = JSON.parseObject(parametersJson, new TypeReference<Map<String, Object>>() {});
|
Integer sfzdcz = Integer.valueOf(contentMap.get("sfzdcz").toString());
|
||||||
//合约价
|
if (sfzdcz != 1) {
|
||||||
BigDecimal hyj = (BigDecimal) parametersMap.get("hyj");
|
log.info("结算对象参数 sfzdcz 不为1,跳过推送,parametersName={}, sfzdcz={}", parametersName, sfzdcz);
|
||||||
buildBusinessDocument(hyj,settlementCustomers,contractManage,"","","");
|
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 settlementCustomersId = settlementCustomers.getSettlementCustomersId();
|
||||||
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
|
Long settlementEntityId = settlementCustomers.getSettlementEntityId();
|
||||||
@@ -1357,7 +1408,7 @@ public class ContractManageApplicationService {
|
|||||||
businessDocumentFeign.setFirstSubjectName(name);
|
businessDocumentFeign.setFirstSubjectName(name);
|
||||||
businessDocumentFeign.setBillingTime(new Date());
|
businessDocumentFeign.setBillingTime(new Date());
|
||||||
businessDocumentFeign.setServiceItemsCode("GC_CZ");
|
businessDocumentFeign.setServiceItemsCode("GC_CZ");
|
||||||
businessDocumentFeign.setServiceItemsName("干仓仓租费用");
|
businessDocumentFeign.setServiceItemsName(serviceItemsName);
|
||||||
businessDocumentFeign.setSettlementWay(1);
|
businessDocumentFeign.setSettlementWay(1);
|
||||||
businessDocumentFeign.setOriginalBusinessNum(contractManage.getContractNumber());
|
businessDocumentFeign.setOriginalBusinessNum(contractManage.getContractNumber());
|
||||||
businessDocumentFeign.setWarehouseType(warehouseType);
|
businessDocumentFeign.setWarehouseType(warehouseType);
|
||||||
|
|||||||
-2
@@ -242,7 +242,5 @@ public class ContractManageDomainService {
|
|||||||
return contractManagePO;
|
return contractManagePO;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String,Object> getSettlementCustomers(String shipperId) {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+1
@@ -263,6 +263,7 @@ public class ContractManageApi extends BaseController{
|
|||||||
String shipperId = XxlJobHelper.getJobParam();
|
String shipperId = XxlJobHelper.getJobParam();
|
||||||
logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId);
|
logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId);
|
||||||
try {
|
try {
|
||||||
|
contractManageApplicationService.pushContractManageToBms(shipperId);
|
||||||
// 设置任务执行结果
|
// 设置任务执行结果
|
||||||
XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功");
|
XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
+8
-1
@@ -84,4 +84,11 @@ public class SettlementCustomersParametersApplicationService {
|
|||||||
Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
Long[] ids = idSet.stream().map(Long::valueOf).toArray(Long[]::new);
|
||||||
return settlementCustomersParametersDomainService.delete(ids);
|
return settlementCustomersParametersDomainService.delete(ids);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 根据结算对象id查询结算对象参数列表
|
||||||
|
*/
|
||||||
|
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId) {
|
||||||
|
return settlementCustomersParametersDomainService.getListBySettlementCustomersId(settlementCustomersId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-1
@@ -39,4 +39,9 @@ public interface ISettlementCustomersParametersService extends IService<Settleme
|
|||||||
* 查询结算对象参数
|
* 查询结算对象参数
|
||||||
*/
|
*/
|
||||||
public SettlementCustomersParametersPO getInfo(Long id);
|
public SettlementCustomersParametersPO getInfo(Long id);
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 根据结算对象id查询结算对象参数列表
|
||||||
|
*/
|
||||||
|
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId);
|
||||||
|
}
|
||||||
+15
-1
@@ -1,5 +1,6 @@
|
|||||||
package com.mhd.bms.domain.settlementCustomersParameters.repository.persistence;
|
package com.mhd.bms.domain.settlementCustomersParameters.repository.persistence;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
|
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
|
||||||
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
|
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
|
||||||
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 结算对象参数Service业务层处理
|
* 结算对象参数Service业务层处理
|
||||||
@@ -78,4 +80,16 @@ public class SettlementCustomersParametersImpl extends ServiceImpl<SettlementCus
|
|||||||
BeanUtils.copyProperties(settlementCustomersParameters, settlementCustomersParametersPO);
|
BeanUtils.copyProperties(settlementCustomersParameters, settlementCustomersParametersPO);
|
||||||
return settlementCustomersParametersPO;
|
return settlementCustomersParametersPO;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@Override
|
||||||
|
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId) {
|
||||||
|
List<SettlementCustomersParameters> list = this.list(new LambdaQueryWrapper<SettlementCustomersParameters>()
|
||||||
|
.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId)
|
||||||
|
.eq(SettlementCustomersParameters::getDelFlag, 1));
|
||||||
|
return list.stream().map(item -> {
|
||||||
|
SettlementCustomersParametersPO po = new SettlementCustomersParametersPO();
|
||||||
|
BeanUtils.copyProperties(item, po);
|
||||||
|
return po;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-1
@@ -56,4 +56,11 @@ public class SettlementCustomersParametersDomainService {
|
|||||||
public SettlementCustomersParametersPO getInfo(Long id) {
|
public SettlementCustomersParametersPO getInfo(Long id) {
|
||||||
return settlementCustomersParametersService.getInfo(id);
|
return settlementCustomersParametersService.getInfo(id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 根据结算对象id查询结算对象参数列表
|
||||||
|
*/
|
||||||
|
public List<SettlementCustomersParametersPO> getListBySettlementCustomersId(Long settlementCustomersId) {
|
||||||
|
return settlementCustomersParametersService.getListBySettlementCustomersId(settlementCustomersId);
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
-1
@@ -89,4 +89,13 @@ public class SettlementCustomersParametersApi extends BaseController {
|
|||||||
public AjaxResult getInfoById(SettlementCustomersParametersDTO settlementCustomersParametersDTO) {
|
public AjaxResult getInfoById(SettlementCustomersParametersDTO settlementCustomersParametersDTO) {
|
||||||
return AjaxResult.success(settlementCustomersParametersApplicationService.getInfo(settlementCustomersParametersDTO.getId()));
|
return AjaxResult.success(settlementCustomersParametersApplicationService.getInfo(settlementCustomersParametersDTO.getId()));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* 根据结算对象id查询结算对象参数列表
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据结算对象id查询结算对象参数列表")
|
||||||
|
@GetMapping(value = "/getListBySettlementCustomersId")
|
||||||
|
public AjaxResult getListBySettlementCustomersId(@RequestParam("settlementCustomersId") Long settlementCustomersId) {
|
||||||
|
return AjaxResult.success(settlementCustomersParametersApplicationService.getListBySettlementCustomersId(settlementCustomersId));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user