bms改造;

This commit is contained in:
王奎兴
2026-09-01 16:58:39 +08:00
parent 3349552e10
commit 2c60dc8f84
42 changed files with 1561 additions and 16 deletions
@@ -3,6 +3,7 @@ package com.mhd.system.api;
import com.mhd.common.core.constant.ServiceNameConstants;
import com.mhd.common.core.domain.dto.BusinessDataPushDTO;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.domain.BusinessDocumentFeign;
import com.mhd.system.api.factory.RemoteBmsFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
@@ -68,4 +69,7 @@ public interface BmsServiceFeign {
*/
@PostMapping("/businessDocumentApi/wholeRentSynchronizationZXF")
public AjaxResult wholeRentSynchronizationZXF(@RequestBody BusinessDataPushDTO businessDataPushDTO);
@PostMapping("/businessDocumentApi/save")
public AjaxResult feignSaveBusinessDocument(@RequestBody BusinessDocumentFeign businessDocumentFeign);
}
@@ -13,6 +13,7 @@ import com.mhd.common.core.domain.po.SysMultistageDictPo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.domain.ContainerFeignPO;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import com.mhd.system.api.domain.SysDictData;
import com.mhd.system.api.factory.RemoteSystemFeignFallbackFactory;
import com.mhd.system.api.feign.FeignAutoConfiguration;
@@ -396,4 +397,8 @@ public interface SystemServiceFeign {
@PostMapping("/contractManageApi/feignSave")
public AjaxResult feignSave(@RequestBody ContractManageFeignDTO contractManageFeignDTO);
@ApiOperation("Feign保存合约信息规则维护")
@PostMapping("/contractManageParametersApi/feignSave")
public AjaxResult feignSaveContractParameters(@RequestBody ContractManageParametersFeign contractManageParametersFeign);
}
@@ -0,0 +1,197 @@
package com.mhd.system.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* 业务单据对象 business_document
*
* @author gen
* @date 2024-06-21
*/
@Data
public class BusinessDocumentFeign extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("业务单据记录id")
@TableId(type = IdType.AUTO)
private Long businessDocumentId;
@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 businessFlow;
@ApiModelProperty("状态(1-未生效,2-已生效,3-已计费,4-已驳回,5-已作废")
@Excel(name = "状态", readConverterExp = "状态(1-未生效,2-已生效,3-已计费,4-已驳回,5-已作废")
private Integer businessState;
@ApiModelProperty("来源模块")
@Excel(name = "来源模块")
private String belongModule;
@ApiModelProperty("来源模块code")
@Excel(name = "来源模块code")
private String belongModuleCode;
@ApiModelProperty("数据来源(1-系统生成,2-手工录入)")
@Excel(name = "数据来源", readConverterExp = "1=-系统生成,2-手工录入")
private Integer dataSources;
@ApiModelProperty("单据类型id")
@Excel(name = "单据类型id")
private Long documentTypeId;
@ApiModelProperty("单据类型code")
@Excel(name = "单据类型code")
private String documentTypeCode;
@ApiModelProperty("单据类型")
@Excel(name = "单据类型")
private String documentType;
@ApiModelProperty("原始业务单号")
@Excel(name = "原始业务单号")
private String originalBusinessNum;
@ApiModelProperty("项目编码")
@Excel(name = "项目编码")
private String projectCode;
@ApiModelProperty("项目名称")
@Excel(name = "项目名称")
private String projectName;
@ApiModelProperty("合同编号")
@Excel(name = "合同编号")
private String contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("账单金额")
@Excel(name = "账单金额")
private BigDecimal billAmount;
@ApiModelProperty("预计费金额")
@Excel(name = "预计费金额")
private BigDecimal estimatedCost;
@ApiModelProperty("一级费用科目code")
@Excel(name = "一级费用科目code")
private String firstSubjectCode;
@ApiModelProperty("一级费用科目(结算项)")
@Excel(name = "一级费用科目")
private String firstSubjectName;
@ApiModelProperty("二级费用科目code")
@Excel(name = "二级费用科目code")
private String secondSubjectCode;
@ApiModelProperty("二级费用科目(结算项)")
@Excel(name = "二级费用科目")
private String secondSubjectName;
@ApiModelProperty("结算对象id")
@Excel(name = "结算对象id")
private Long settlementCustomersId;
@ApiModelProperty("结算对象code")
@Excel(name = "结算对象code")
private String settlementCustomersCode;
@ApiModelProperty("结算对象")
@Excel(name = "结算对象")
private String settlementEntity;
@ApiModelProperty("计费时间")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "计费时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date billingTime;
@ApiModelProperty("单据表单json数据")
@Excel(name = "单据表单json数据")
private String documentFormJson;
@ApiModelProperty("合同管理id")
@Excel(name = "合同管理id", readConverterExp = "合同管理id")
private Long contractManageId;
@ApiModelProperty("项目管理id")
@Excel(name = "项目管理id", readConverterExp = "项目管理id")
private Long projectManageId;
@ApiModelProperty("原始流水号")
@Excel(name = "原始流水号")
private String originalSerialNumber;
@ApiModelProperty("费用类型code(服务项)")
@Excel(name = "费用类型code(服务项)")
private String serviceItemsCode;
@ApiModelProperty("费用类型")
@Excel(name = "费用类型")
private String serviceItemsName;
@ApiModelProperty("费用类型id(服务项)")
@Excel(name = "费用类型id(服务项)")
private Long serviceItemsManageId;
@ApiModelProperty("单据备注")
@Excel(name = "单据备注")
private String remark;
@ApiModelProperty("审核备注")
@Excel(name = "审核备注")
private String reviewRemarks;
@ApiModelProperty("结算方式(1-现金,2-油卡)")
private Integer settlementWay;
@ApiModelProperty("结算币种")
private String settlementCurrency;
@ApiModelProperty("业务员ID")
private String salesmanId;
@ApiModelProperty("业务员名称")
private String salesmanName;
@ApiModelProperty("税率")
private Double taxRate;
@ApiModelProperty("收款帐户")
private String paymentAccountId;
@ApiModelProperty("收款帐户名称")
private String paymentAccountName;
@ApiModelProperty("计费单位")
private String billingUnit;
@ApiModelProperty("计费单位2")
private String billingUnit2;
@ApiModelProperty("计费数量")
private BigDecimal billingNum;
@ApiModelProperty("计费单价")
private BigDecimal billingUnitPrice;
@ApiModelProperty("nc科目编码")
private String ncSubjectCode;
}
@@ -0,0 +1,52 @@
package com.mhd.system.api.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import com.mhd.common.core.web.domain.BaseVOEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 合约信息规则维护表
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParametersFeign extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@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 contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -6,6 +6,7 @@ import com.mhd.common.core.domain.po.OrganizationPo;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.system.api.BmsServiceFeign;
import com.mhd.system.api.ProductServiceFeign;
import com.mhd.system.api.domain.BusinessDocumentFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@@ -66,6 +67,11 @@ public class RemoteBmsFeignFallbackFactory implements FallbackFactory<BmsService
public AjaxResult wholeRentSynchronizationZXF(BusinessDataPushDTO businessDataPushDTO) {
return null;
}
@Override
public AjaxResult feignSaveBusinessDocument(BusinessDocumentFeign businessDocumentFeign) {
return AjaxResult.error("保存业务单据失败");
}
};
}
}
}
@@ -14,6 +14,7 @@ import com.mhd.system.api.AssociationWarehouseFeign;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.ContainerFeignPO;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import com.mhd.system.api.domain.SysDictData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -324,6 +325,11 @@ public class RemoteSystemFeignFallbackFactory implements FallbackFactory<SystemS
public AjaxResult feignSave(ContractManageFeignDTO contractManageFeignDTO) {
return AjaxResult.error("新增合同失败");
}
@Override
public AjaxResult feignSaveContractParameters(ContractManageParametersFeign contractManageParametersFeign) {
return AjaxResult.error("保存合同参数失败");
}
};
}
}
@@ -17,10 +17,16 @@ import com.mhd.basic.domain.contractManageDetail.repository.mapper.ContractManag
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
import com.mhd.basic.domain.contractManageDetail.repository.todo.ContractManageDetailDO;
import com.mhd.basic.domain.contractManageDetail.service.ContractManageDetailDomainService;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.domain.contractManageParameters.service.ContractManageParametersDomainService;
import com.mhd.basic.domain.expenseAccount.repository.po.ExpenseAccountPO;
import com.mhd.basic.domain.expenseAccount.service.ExpenseAccountDomainService;
import com.mhd.basic.interfaces.dto.contractManage.*;
import com.mhd.basic.interfaces.assember.contractManageParameters.ContractManageParametersAssembler;
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO;
import com.mhd.common.core.domain.po.*;
import com.mhd.common.core.enums.DictCode;
import com.mhd.common.core.exception.ServiceException;
@@ -75,6 +81,12 @@ public class ContractManageApplicationService {
@Autowired
private SystemServiceFeign systemServiceFeign;
@Autowired
private ContractManageParametersDomainService contractManageParametersDomainService;
@Autowired
private ContractManageParametersAssembler contractManageParametersAssembler;
/**
* 分页查询合同管理列表
@@ -126,7 +138,21 @@ public class ContractManageApplicationService {
contractManageDO.setTopOrganizationId(2827L);
}
}
return contractManageDomainService.queryList(contractManageDO);
List<ContractManagePO> list = contractManageDomainService.queryList(contractManageDO);
if (!list.isEmpty()) {
List<Long> contractManageIds = list.stream()
.map(ContractManagePO::getContractManageId)
.collect(Collectors.toList());
List<ContractManageParametersPO> allParams = contractManageParametersDomainService.queryListByManageIds(contractManageIds);
Map<Long, List<ContractManageParametersPO>> paramsMap = allParams.stream()
.collect(Collectors.groupingBy(ContractManageParametersPO::getContractManageId));
for (ContractManagePO po : list) {
po.setContractManageParametersList(paramsMap.getOrDefault(po.getContractManageId(), new ArrayList<>()));
}
}
return list;
}
// public BigDecimal getAmount(List<SubjectAndPriceReturn> subjectAndPriceReturnList) {
@@ -610,6 +636,7 @@ public class ContractManageApplicationService {
*/
//20260702取消同一时间段不能有相同合同校验
//checkContract(contractManageDO);
checkUniqueActiveContract(contractManageDO);
handleData(contractManageDO);
handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
@@ -618,6 +645,7 @@ public class ContractManageApplicationService {
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
boolean flag = contractManageDomainService.insert(contractManageDO);
handleDetils(contractManageDO, true);
handleParameters(contractManageDO);
return flag;
}
@@ -638,6 +666,7 @@ public class ContractManageApplicationService {
*/
//20260702取消同一时间段不能有相同合同校验
//checkContract(contractManageDO);
checkUniqueActiveContract(contractManageDO);
handleData(contractManageDO);
handleDict(contractManageDO);
contractManageDO.setContractNumber(OrderSequence.getOrderCode("HT"));
@@ -645,7 +674,7 @@ public class ContractManageApplicationService {
contractManageDO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
contractManageDO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
boolean flag = contractManageDomainService.insert(contractManageDO);
if (flag) {
if (!flag) {
throw new ServiceException("新增合同管理失败,请检查数据");
}
handleDetils(contractManageDO, true);
@@ -779,6 +808,26 @@ public class ContractManageApplicationService {
}
}
private void checkUniqueActiveContract(ContractManageDO contractManageDO) {
if (contractManageDO.getContractState() != null && contractManageDO.getContractState() != 2) {
return;
}
if (contractManageDO.getSettlementCustomersId() == null
|| StringUtils.isEmpty(contractManageDO.getWarehouseTempLayerType())
|| StringUtils.isEmpty(contractManageDO.getContractRentType())) {
return;
}
long count = contractManageDomainService.countByUniqueKey(
contractManageDO.getSettlementCustomersId(),
contractManageDO.getWarehouseTempLayerType(),
contractManageDO.getContractRentType(),
contractManageDO.getContractManageId()
);
if (count > 0) {
throw new ServiceException("同一结算客户、同一温层、同一租赁类型只能存在一个使用中的合同");
}
}
/**
* 处理合同详情
*/
@@ -877,6 +926,26 @@ public class ContractManageApplicationService {
}
}
private void handleParameters(ContractManageDO contractManageDO) {
List<ContractManageParametersPO> existingList = contractManageParametersDomainService.queryListByManageId(contractManageDO.getContractManageId());
if (!existingList.isEmpty()) {
Long[] ids = existingList.stream().map(ContractManageParametersPO::getId).toArray(Long[]::new);
contractManageParametersDomainService.delete(ids);
}
if (StringUtils.isNotEmpty(contractManageDO.getParametersJson())) {
ContractManageParametersDTO dto = new ContractManageParametersDTO();
dto.setContractManageId(contractManageDO.getContractManageId());
dto.setContractNumber(contractManageDO.getContractNumber());
dto.setContractName(contractManageDO.getContractName());
dto.setParametersJson(contractManageDO.getParametersJson());
dto.setOrganizationId(contractManageDO.getOrganizationId());
dto.setOrganizationName(contractManageDO.getOrganizationName());
dto.setTopOrganizationId(contractManageDO.getTopOrganizationId());
ContractManageParametersDO parametersDO = contractManageParametersAssembler.toDO(dto);
contractManageParametersDomainService.insert(parametersDO);
}
}
/**
* 修改合同管理
*/
@@ -884,8 +953,10 @@ public class ContractManageApplicationService {
public Boolean update(ContractManageDO contractManageDO) {
validateContractType(contractManageDO.getContractType());
//checkContract(contractManageDO);
checkUniqueActiveContract(contractManageDO);
handleData(contractManageDO);
handleDetils(contractManageDO, false);
handleParameters(contractManageDO);
handleDict(contractManageDO);
return contractManageDomainService.update(contractManageDO);
}
@@ -911,6 +982,8 @@ public class ContractManageApplicationService {
ContractManagePO result = contractManageDomainService.getInfo(contractManageId);
List<ContractManageDetailPO> contractManageDetailPOList = contractManageDetailDomainService.queryListByManageId(result.getContractManageId());
result.setContractManageDetailPOList(contractManageDetailPOList);
List<ContractManageParametersPO> paramsList = contractManageParametersDomainService.queryListByManageId(result.getContractManageId());
result.setContractManageParametersList(paramsList);
return result;
}
@@ -0,0 +1,72 @@
package com.mhd.basic.application.service.contractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.domain.contractManageParameters.service.ContractManageParametersDomainService;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 合约信息规则维护表ApplicationService
*
* @author gen
* @date 2024-06-07
*/
@Service
@Slf4j
public class ContractManageParametersApplicationService {
@Autowired
private ContractManageParametersDomainService contractManageParametersDomainService;
/**
* 分页查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null){
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
if (topOrganizationId != null && topOrganizationId != 1){
contractManageParametersDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
}
}
return contractManageParametersDomainService.queryList(contractManageParametersDO);
}
/**
* 新增合约信息规则维护表
*/
public Boolean insert(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersDomainService.insert(contractManageParametersDO);
}
/**
* 修改合约信息规则维护表
*/
public Boolean update(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersDomainService.update(contractManageParametersDO);
}
/**
* 批量删除合约信息规则维护表
*/
public boolean delete(Long[] ids) {
return contractManageParametersDomainService.delete(ids);
}
/**
* 获取合约信息规则维护表详细信息
*/
public ContractManageParametersPO getInfo(Long id)
{
return contractManageParametersDomainService.getInfo(id);
}
}
@@ -192,16 +192,30 @@ public class ContractManage extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("客户类型")
@ApiModelProperty("合同租赁类型")
private String contractRentType;
@ApiModelProperty("客户类型编码")
@ApiModelProperty("合同租赁类型")
private String contractRentTypeName;
@ApiModelProperty("客户类型")
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerType;
@ApiModelProperty("客户类型编码")
@ApiModelProperty("仓库温层类型")
private String warehouseTempLayerTypeName;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date initialStartDate;
}
@@ -1,6 +1,7 @@
package com.mhd.basic.domain.contractManage.repository.po;
import com.mhd.basic.domain.contractManageDetail.repository.po.ContractManageDetailPO;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.interfaces.dto.contractManageDetail.ContractManageDetailDTO;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
@@ -209,4 +210,21 @@ public class ContractManagePO extends BaseVOEntity{
private String warehouseTempLayerTypeName;
private String isMany;
@ApiModelProperty("合约信息规则维护列表")
private List<ContractManageParametersPO> contractManageParametersList;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date initialStartDate;
}
@@ -240,4 +240,20 @@ public class ContractManageDO extends BaseVOEntity{
@ApiModelProperty("一级费用科目code")
private String firstSubjectCode;
@ApiModelProperty("合约信息规则维护JSON")
private String parametersJson;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date initialStartDate;
}
@@ -193,6 +193,22 @@ public class ContractManageDomainService {
}
/**
* 同结算客户+同温层+同租赁类型+使用中 的合同数量(用于唯一性校验)
*/
public long countByUniqueKey(Long settlementCustomersId, String warehouseTempLayerType, String contractRentType, Long excludeId) {
LambdaQueryWrapper<ContractManage> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ContractManage::getSettlementCustomersId, settlementCustomersId);
wrapper.eq(ContractManage::getWarehouseTempLayerType, warehouseTempLayerType);
wrapper.eq(ContractManage::getContractRentType, contractRentType);
wrapper.eq(ContractManage::getContractState, 2);
wrapper.eq(ContractManage::getDelFlag, 1);
if (excludeId != null) {
wrapper.ne(ContractManage::getContractManageId, excludeId);
}
return contractManageService.count(wrapper);
}
public ContractManagePO getGeneralContract() {
ContractManagePO contractManagePO = new ContractManagePO();
LambdaQueryWrapper<ContractManage> queryWrapper = new LambdaQueryWrapper<>();
@@ -0,0 +1,52 @@
package com.mhd.basic.domain.contractManageParameters.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mhd.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
import lombok.Data;
/**
* 合约信息规则维护表
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParameters extends BaseVOEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
@TableId(type = IdType.AUTO)
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@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 contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,47 @@
package com.mhd.basic.domain.contractManageParameters.repository.facade;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import java.util.List;
/**
* 合约信息规则维护表Service接口
*
* @author gen
* @date 2024-06-07
*/
public interface IContractManageParametersService extends IService<ContractManageParameters>
{
/**
* 分页查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO);
/**
* 新增合约信息规则维护表
*/
public Boolean insert(ContractManageParametersDO contractManageParametersDO);
/**
* 修改合约信息规则维护表
*/
public Boolean update(ContractManageParametersDO contractManageParametersDO);
/**
* 批量删除合约信息规则维护表
*/
public Boolean delete(Long[] ids);
/**
* 查询合约信息规则维护表
*/
public ContractManageParametersPO getInfo(Long id);
/**
* 根据合同管理id查询合约信息规则维护列表
*/
List<ContractManageParametersPO> getListByContractManageId(Long contractManageId);
}
@@ -0,0 +1,26 @@
package com.mhd.basic.domain.contractManageParameters.repository.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import org.apache.ibatis.annotations.Param;
/**
* 合约信息规则维护表Mapper接口
*
* @author gen
* @date 2024-06-07
*/
public interface ContractManageParametersMapper extends BaseMapper<ContractManageParameters>
{
/**
* 查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(@Param("contractManageParametersDO") ContractManageParametersDO contractManageParametersDO);
/**
* 根据合同管理id查询合约信息规则维护列表
*/
List<ContractManageParametersPO> getListByContractManageId(@Param("contractManageId") Long contractManageId);
}
@@ -0,0 +1,86 @@
package com.mhd.basic.domain.contractManageParameters.repository.persistence;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService;
import com.mhd.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 合约信息规则维护表Service业务层处理
*
* @author gen
* @date 2024-06-07
*/
@Service
public class ContractManageParametersImpl extends ServiceImpl<ContractManageParametersMapper, ContractManageParameters> implements IContractManageParametersService{
@Autowired
private ContractManageParametersMapper contractManageParametersMapper;
/**
* 查询合约信息规则维护表列表
*/
@Override
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO)
{
return contractManageParametersMapper.queryList(contractManageParametersDO);
}
/**
* 新增合约信息规则维护表
*/
@Override
public Boolean insert(ContractManageParametersDO contractManageParametersDO) {
ContractManageParameters contractManageParameters = new ContractManageParameters();
BeanUtils.copyProperties(contractManageParametersDO,contractManageParameters);
return this.save(contractManageParameters);
}
/**
* 修改合约信息规则维护表
*/
@Override
public Boolean update(ContractManageParametersDO contractManageParametersDO) {
ContractManageParameters contractManageParameters = new ContractManageParameters();
BeanUtils.copyProperties(contractManageParametersDO,contractManageParameters);
return this.updateById(contractManageParameters);
}
/**
* 批量删除合约信息规则维护表
*/
@Override
public Boolean delete(Long[] ids ) {
List<ContractManageParameters> list = new ArrayList<>();
for (Long id : ids) {
ContractManageParameters contractManageParameters = new ContractManageParameters();
contractManageParameters.setId(id);
contractManageParameters.setDelFlag(2);
list.add(contractManageParameters);
}
return this.updateBatchById(list);
}
/**
* 查询合约信息规则维护表
*/
@Override
public ContractManageParametersPO getInfo(Long id) {
ContractManageParameters contractManageParameters = this.getById(id);
ContractManageParametersPO contractManageParametersPO = new ContractManageParametersPO();
BeanUtils.copyProperties(contractManageParameters,contractManageParametersPO);
return contractManageParametersPO;
}
@Override
public List<ContractManageParametersPO> getListByContractManageId(Long contractManageId) {
return contractManageParametersMapper.getListByContractManageId(contractManageId);
}
}
@@ -0,0 +1,51 @@
package com.mhd.basic.domain.contractManageParameters.repository.po;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 合约信息规则维护表对象 contract_manage_parameters
*
* @author gen
* @date 2024-06-07
*/
@Data
@ApiModel(value = "合约信息规则维护表对象", description = "合约信息规则维护表响应对象")
public class ContractManageParametersPO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@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 contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,49 @@
package com.mhd.basic.domain.contractManageParameters.repository.todo;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 合约信息规则维护表对象 contract_manage_parameters
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParametersDO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@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 contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,105 @@
package com.mhd.basic.domain.contractManageParameters.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.basic.domain.contractManageParameters.entity.ContractManageParameters;
import com.mhd.basic.domain.contractManageParameters.repository.facade.IContractManageParametersService;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
/**
* 合约信息规则维护表
*
* @author gen
* @date 2024-06-07
*/
@Service
@Slf4j
public class ContractManageParametersDomainService {
@Autowired
private IContractManageParametersService contractManageParametersService;
/**
* 分页查询合约信息规则维护表列表
*/
public List<ContractManageParametersPO> queryList(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersService.queryList(contractManageParametersDO);
}
/**
* 新增合约信息规则维护表
*/
public Boolean insert(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersService.insert(contractManageParametersDO);
}
/**
* 修改合约信息规则维护表
*/
public Boolean update(ContractManageParametersDO contractManageParametersDO) {
return contractManageParametersService.update(contractManageParametersDO);
}
/**
* 批量删除合约信息规则维护表
*/
public Boolean delete(Long[] ids) {
return contractManageParametersService.delete(ids);
}
/**
* 获取合约信息规则维护表详细信息
*/
public ContractManageParametersPO getInfo(Long id)
{
return contractManageParametersService.getInfo(id);
}
/**
* 根据合同管理id查询合约信息规则维护列表
* @param contractManageId
* @return
*/
public List<ContractManageParametersPO> queryListByManageId(Long contractManageId) {
List<ContractManageParametersPO> resultList = new ArrayList<>();
LambdaQueryWrapper<ContractManageParameters> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(ContractManageParameters::getContractManageId,contractManageId);
queryWrapper.eq(ContractManageParameters::getDelFlag,1);
List<ContractManageParameters> contractManageParametersList = contractManageParametersService.list(queryWrapper);
if(contractManageParametersList.size()>0){
for (ContractManageParameters contractManageParameters : contractManageParametersList) {
ContractManageParametersPO contractManageParametersPO = new ContractManageParametersPO();
BeanUtils.copyProperties(contractManageParameters,contractManageParametersPO);
resultList.add(contractManageParametersPO);
}
}
return resultList;
}
public List<ContractManageParametersPO> queryListByManageIds(Collection<Long> contractManageIds) {
List<ContractManageParametersPO> resultList = new ArrayList<>();
if (contractManageIds == null || contractManageIds.isEmpty()) {
return resultList;
}
LambdaQueryWrapper<ContractManageParameters> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.in(ContractManageParameters::getContractManageId, contractManageIds);
queryWrapper.eq(ContractManageParameters::getDelFlag, 1);
List<ContractManageParameters> entityList = contractManageParametersService.list(queryWrapper);
for (ContractManageParameters entity : entityList) {
ContractManageParametersPO po = new ContractManageParametersPO();
BeanUtils.copyProperties(entity, po);
resultList.add(po);
}
return resultList;
}
}
@@ -0,0 +1,65 @@
package com.mhd.basic.interfaces.assember.contractManageParameters;
import cn.hutool.core.util.ObjectUtil;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO;
import com.mhd.common.core.exception.digitalLogisticsException.DigitalLogisticsException;
import com.mhd.common.core.exception.digitalLogisticsException.UserError;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.IgnoreNullUtil;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.model.LoginUser;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* 合约信息规则维护表Assembler
*
* @author gen
* @date 2024-06-07
*/
@Component
public class ContractManageParametersAssembler {
/**
* 转换实体
*/
public ContractManageParametersDO toDO(ContractManageParametersDTO contractManageParametersDTO) {
ContractManageParametersDO contractManageParametersDO = new ContractManageParametersDO();
// 拷贝
BeanUtils.copyProperties(contractManageParametersDTO, contractManageParametersDO, IgnoreNullUtil.getNullPropertyNames(contractManageParametersDTO));
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
String userName = loginUser.getUsername();
// 获取登录人id
Long userId = loginUser.getUserid();
if(contractManageParametersDTO.getId() != null){
if(userId != null){
contractManageParametersDO.setUpdateBy(userId);
}else {
contractManageParametersDO.setUpdateBy(new Long("0"));
}
contractManageParametersDO.setUpdateByName(userName);
contractManageParametersDO.setUpdateTime(new Date());
}else {
if(userId != null){
contractManageParametersDO.setCreateBy(userId);
contractManageParametersDO.setUpdateBy(userId);
}else {
contractManageParametersDO.setCreateBy(new Long("0"));
contractManageParametersDO.setUpdateBy(new Long("0"));
}
contractManageParametersDO.setCreateByName(userName);
contractManageParametersDO.setUpdateByName(userName);
contractManageParametersDO.setCreateTime(new Date());
contractManageParametersDO.setUpdateTime(new Date());
contractManageParametersDO.setDelFlag(1);
}
return contractManageParametersDO;
}
}
@@ -217,15 +217,32 @@ public class ContractManageDTO extends BaseVOEntity{
@ApiModelProperty(name = "是否包含运输费用(1-包含,2-包含)")
private Integer transportationCosts;
@ApiModelProperty("客户类型")
@ApiModelProperty("合同租赁类型code")
private String contractRentType;
@ApiModelProperty("客户类型编码")
@ApiModelProperty("合同租赁类型名称")
private String contractRentTypeName;
@ApiModelProperty("仓库温层类型")
@ApiModelProperty("仓库温层类型code")
private String warehouseTempLayerType;
@ApiModelProperty("仓库温层类型编码")
@ApiModelProperty("仓库温层类型编码名称")
private String warehouseTempLayerTypeName;
@ApiModelProperty("合约信息规则维护JSON")
private String parametersJson;
@ApiModelProperty("续期提前天数")
private Integer renewalAdvanceDays;
@ApiModelProperty("标的物")
private String subjectMatter;
@ApiModelProperty("性质")
private String nature;
@ApiModelProperty("合同最初起始日")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@Excel(name = "合同最初起始日", width = 30, dateFormat = "yyyy-MM-dd")
private Date initialStartDate;
}
@@ -0,0 +1,48 @@
package com.mhd.basic.interfaces.dto.contractManageParameters;
import com.mhd.common.core.annotation.Excel;
import lombok.Data;
import io.swagger.annotations.ApiModelProperty;
import com.mhd.common.core.web.domain.BaseVOEntity;
/**
* 合约信息规则维护表对象 contract_manage_parameters
*
* @author gen
* @date 2024-06-07
*/
@Data
public class ContractManageParametersDTO extends BaseVOEntity{
private static final long serialVersionUID = 1L;
@ApiModelProperty("合同管理id")
private Long id;
@ApiModelProperty("合同管理id")
private Long contractManageId;
@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 contractNumber;
@ApiModelProperty("合同名称")
@Excel(name = "合同名称")
private String contractName;
@ApiModelProperty("合约信息规则维护")
@Excel(name = "合约信息规则维护表")
private String parametersJson;
}
@@ -0,0 +1,105 @@
package com.mhd.basic.interfaces.facade.contractManageParameters;
import java.util.List;
import com.mhd.basic.interfaces.assember.contractManageParameters.ContractManageParametersAssembler;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.mhd.basic.interfaces.dto.contractManageParameters.ContractManageParametersDTO;
import com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO;
import com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO;
import com.mhd.basic.application.service.contractManageParameters.ContractManageParametersApplicationService;
import javax.annotation.Resource;
import com.mhd.common.core.web.controller.BaseController;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.core.web.page.TableDataInfo;
/**
* 合约信息规则维护表Api
*
* @author gen
* @date 2024-06-07
*/
@RestController
@RequestMapping("/contractManageParametersApi")
public class ContractManageParametersApi extends BaseController{
@Autowired
private ContractManageParametersApplicationService contractManageParametersApplicationService;
@Resource
private ContractManageParametersAssembler contractManageParametersAssembler;
/**
* 分页查询合约信息规则维护表列表
*/
@ApiOperation("查询合约信息规则维护表列表")
@GetMapping("/list")
public TableDataInfo list(ContractManageParametersDTO contractManageParametersDTO)
{
//转换实体
ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO);
startPage();
List<ContractManageParametersPO> list = contractManageParametersApplicationService.queryList(contractManageParametersDO);
return getDataTable(list);
}
/**
* 编辑合约信息规则维护表
*/
@ApiOperation("编辑合约信息规则维护表")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody ContractManageParametersDTO contractManageParametersDTO)
{
//转换实体
ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO);
if(contractManageParametersDTO.getId() != null){
return toAjax(contractManageParametersApplicationService.update(contractManageParametersDO));
}else {
return toAjax(contractManageParametersApplicationService.insert(contractManageParametersDO));
}
}
/**
* 批量删除合约信息规则维护表
*/
@ApiOperation("批量删除合约信息规则维护表")
@DeleteMapping("/deleteByIds/{ids}")
public AjaxResult delete(@PathVariable Long[] ids)
{
return toAjax(contractManageParametersApplicationService.delete(ids));
}
/**
* 获取合约信息规则维护表详细信息
*/
@ApiOperation("获取合约信息规则维护表")
@GetMapping(value = "/getInfo/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return AjaxResult.success(contractManageParametersApplicationService.getInfo(id));
}
@ApiOperation("Feign保存合约信息规则维护")
@PostMapping("/feignSave")
public AjaxResult feignSave(@RequestBody ContractManageParametersFeign contractManageParametersFeign)
{
try {
ContractManageParametersDTO contractManageParametersDTO = new ContractManageParametersDTO();
BeanUtils.copyProperties(contractManageParametersFeign, contractManageParametersDTO);
ContractManageParametersDO contractManageParametersDO = contractManageParametersAssembler.toDO(contractManageParametersDTO);
return toAjax(contractManageParametersApplicationService.insert(contractManageParametersDO));
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
}
@@ -210,6 +210,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="contractManageDO.firstSubjectCode != null and contractManageDO.firstSubjectCode != ''">
and b.FIRST_SUBJECT_CODE = #{contractManageDO.firstSubjectCode}
</if>
<if test="contractManageDO.renewalAdvanceDays != null">
and a.renewal_advance_days = #{contractManageDO.renewalAdvanceDays}
</if>
<if test="contractManageDO.subjectMatter != null and contractManageDO.subjectMatter != ''">
and a.subject_matter like concat('%', #{contractManageDO.subjectMatter}, '%')
</if>
<if test="contractManageDO.nature != null and contractManageDO.nature != ''">
and a.nature = #{contractManageDO.nature}
</if>
<if test="contractManageDO.initialStartDate != null">
and a.initial_start_date = #{contractManageDO.initialStartDate}
</if>
</sql>
</mapper>
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mhd.basic.domain.contractManageParameters.repository.mapper.ContractManageParametersMapper">
<sql id="selectContractManageParametersPo">
select
*
from contract_manage_parameters
</sql>
<sql id="selectContractManageParametersPo1">
<where>
<if test="contractManageId != null ">
and contract_manage_id = #{contractManageId}
</if>
<if test="topOrganizationId != null ">
and top_organization_id = #{topOrganizationId}
</if>
<if test="organizationId != null ">
and organization_id = #{organizationId}
</if>
<if test="organizationName != null and organizationName != ''">
and organization_name like concat('%', #{organizationName}, '%')
</if>
<if test="contractNumber != null and contractNumber != ''">
and contract_number like concat('%', #{contractNumber}, '%')
</if>
<if test="contractName != null and contractName != ''">
and contract_name like concat('%', #{contractName}, '%')
</if>
</where>
</sql>
<select id="queryList" parameterType="com.mhd.basic.domain.contractManageParameters.repository.todo.ContractManageParametersDO"
resultType="com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO">
<include refid="selectContractManageParametersPo"/>
<include refid="selectContractManageParametersPo1"/>
</select>
<select id="getListByContractManageId"
resultType="com.mhd.basic.domain.contractManageParameters.repository.po.ContractManageParametersPO" parameterType="java.lang.Long">
SELECT
*
FROM
contract_manage_parameters
WHERE
contract_manage_id = #{contractManageId}
</select>
</mapper>
@@ -31,6 +31,7 @@ import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.UserServiceFeign;
import com.mhd.system.api.domain.BatchDetailFeignPO;
import com.mhd.system.api.domain.ContractManageFeignDTO;
import com.mhd.system.api.domain.ContractManageParametersFeign;
import com.mhd.system.api.domain.WarehouseFeignPO;
import com.mhd.system.api.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
@@ -39,6 +40,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
@@ -243,6 +245,7 @@ public class SettlementCustomersApplicationService {
/**
* 修改结算对象
*/
@Transactional
public Boolean update(SettlementCustomersDO settlementCustomersDO) {
LoginUser loginUser = SecurityUtils.getLoginUser();
if (ObjectUtil.isNull(loginUser)) {
@@ -305,6 +308,7 @@ public class SettlementCustomersApplicationService {
contractManageDTO.setContractState(2);
contractManageDTO.setPaymentDate(new Date());
contractManageDTO.setBillDays(10);
contractManageDTO.setContractType(1);
AjaxResult ajaxResult = systemServiceFeign.feignSave(contractManageDTO);
if (ajaxResult != null && "200".equals(String.valueOf(ajaxResult.get("code")))) {
ContractManageFeignDTO contractManageFeignDTO = com.alibaba.fastjson.JSON.parseObject(com.alibaba.fastjson2.JSONObject.toJSONString(ajaxResult.get("data")), ContractManageFeignDTO.class);
@@ -312,6 +316,18 @@ public class SettlementCustomersApplicationService {
String originalContractNumber = contractManageFeignDTO.getOriginalContractNumber();
settlementCustomersParameters.setContractManageId(contractManageId);
settlementCustomersParameters.setContractNumber(originalContractNumber);
ContractManageParametersFeign contractManageParametersFeign = new ContractManageParametersFeign();
contractManageParametersFeign.setContractManageId(contractManageId);
contractManageParametersFeign.setContractName(contractManageFeignDTO.getContractName());
contractManageParametersFeign.setContractNumber(contractManageFeignDTO.getContractNumber());
contractManageParametersFeign.setParametersJson(settlementCustomersParametersDTO.getContent());
contractManageParametersFeign.setOrganizationId(settlementCustomersDO.getOrganizationId());
contractManageParametersFeign.setOrganizationName(settlementCustomersDO.getOrganizationName());
contractManageParametersFeign.setTopOrganizationId(settlementCustomersDO.getTopOrganizationId());
AjaxResult paramResult = systemServiceFeign.feignSaveContractParameters(contractManageParametersFeign);
if (paramResult == null || !"200".equals(String.valueOf(paramResult.get("code")))) {
throw new ServiceException("保存合同参数失败");
}
} else {
throw new ServiceException("创建临时合同失败");
}
@@ -5,6 +5,10 @@ import com.mhd.bms.domain.settlementCustomers.entity.SettlementCustomers;
import com.mhd.bms.domain.settlementCustomers.repository.facade.ISettlementCustomersService;
import com.mhd.bms.domain.settlementCustomers.repository.po.SettlementCustomersPO;
import com.mhd.bms.domain.settlementCustomers.repository.todo.SettlementCustomersDO;
import com.mhd.bms.domain.settlementCustomersNcConfig.entity.SettlementCustomersNcConfig;
import com.mhd.bms.domain.settlementCustomersNcConfig.repository.facade.ISettlementCustomersNcConfigService;
import com.mhd.bms.domain.settlementCustomersParameters.entity.SettlementCustomersParameters;
import com.mhd.bms.domain.settlementCustomersParameters.repository.facade.ISettlementCustomersParametersService;
import com.mhd.common.security.utils.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +28,11 @@ public class SettlementCustomersDomainService {
@Autowired
private ISettlementCustomersService settlementCustomersService;
@Autowired
private ISettlementCustomersNcConfigService settlementCustomersNcConfigService;
@Autowired
private ISettlementCustomersParametersService settlementCustomersParametersService;
/**
* 分页查询结算对象列表
@@ -64,7 +73,17 @@ public class SettlementCustomersDomainService {
*/
public SettlementCustomersPO getInfo(Long settlementCustomersId)
{
return settlementCustomersService.getInfo(settlementCustomersId);
SettlementCustomersPO info = settlementCustomersService.getInfo(settlementCustomersId);
LambdaQueryWrapper<SettlementCustomersNcConfig> ncConfigWrapper = new LambdaQueryWrapper<>();
ncConfigWrapper.eq(SettlementCustomersNcConfig::getSettlementCustomersId, settlementCustomersId);
info.setSettlementCustomersNcConfigs(settlementCustomersNcConfigService.list(ncConfigWrapper));
LambdaQueryWrapper<SettlementCustomersParameters> parametersWrapper = new LambdaQueryWrapper<>();
parametersWrapper.eq(SettlementCustomersParameters::getSettlementCustomersId, settlementCustomersId);
info.setSettlementCustomersParameters(settlementCustomersParametersService.list(parametersWrapper));
return info;
}
+5 -1
View File
@@ -127,7 +127,11 @@
<groupId>com.mhd</groupId>
<artifactId>mhd-common-log</artifactId>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>2.4.0</version>
</dependency>
</dependencies>
<build>
@@ -66,4 +66,6 @@ public interface IReservationStockInOrderService extends IService<ReservationSto
* @throws Exception 解析异常
*/
StockInDataDTO parseStockInExcel(MultipartFile file, String sheetName) throws Exception;
public List<ReservationStockInOrderPO> queryPushBmsList();
}
@@ -77,4 +77,6 @@ public interface ReservationStockInOrderMapper extends BaseMapper<ReservationSto
List<String> generateReserveOrderNumber1(@Param("prefix") String prefix);
int existsByOrderNumber(@Param("inOrderNumber") String inOrderNumber);
public List<ReservationStockInOrderPO> queryPushBmsList();
}
@@ -770,5 +770,9 @@ public class ReservationStockInOrderImpl extends ServiceImpl<ReservationStockInO
}
}
public List<ReservationStockInOrderPO> queryPushBmsList() {
return stockInOrderMapper.queryPushBmsList();
}
}
@@ -18,6 +18,8 @@ import com.mhd.oms.domain.gwLog.repository.mapper.GwLogMapper;
import com.mhd.oms.domain.reservationInMaterialDetail.entity.ReservationInMaterialDetail;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.mapper.ReservationInMaterialDetailMapper;
import com.mhd.oms.domain.reservationInMaterialDetail.repository.po.ReservationInMaterialDetailPO;
import com.mhd.oms.domain.reservationMaterialInventory.repository.facade.IReservationMaterialInventoryService;
import com.mhd.oms.domain.reservationMaterialInventory.repository.mapper.ReservationMaterialInventoryMapper;
import com.mhd.oms.domain.reservationStockInOrder.entity.ReservationStockInOrder;
import com.mhd.oms.domain.reservationStockInOrder.repository.mapper.ReservationStockInOrderMapper;
import com.mhd.oms.domain.reservationStockInOrder.repository.po.MaterialBaseInfoPO;
@@ -76,6 +78,8 @@ public class ReservationStockInOrderApplicationService {
private ReservationStockInOrderMapper reservationStockInOrderMapper;
@Autowired
private ReservationInMaterialDetailMapper reservationInMaterialDetailMapper;
@Autowired
private IReservationMaterialInventoryService reservationMaterialInventoryService;
// @Autowired
// private IMaterialBaseInfoService materialBaseInfoService;
private static final String PUSH_API_URL = "http://10.102.192.15/nagu-erp-api/transfer/pushData";
@@ -2285,4 +2289,23 @@ public class ReservationStockInOrderApplicationService {
public String generateReserveOrderNumber1() {
return stockInOrderDomainService.generateReserveOrderNumber1();
}
public List<ReservationStockInOrderPO> queryPushBmsList() {
return stockInOrderDomainService.queryPushBmsList();
}
public void pushBillingRecord() {
//reservationMaterialInventoryService
// 当天应该推送的数据
List<ReservationStockInOrderPO> reservationStockInOrderPOS = stockInOrderDomainService.queryPushBmsList();
if (reservationStockInOrderPOS!=null&&reservationStockInOrderPOS.size()>0){
for (ReservationStockInOrderPO reservationStockInOrderPO : reservationStockInOrderPOS) {
String inOrderNumber = reservationStockInOrderPO.getInOrderNumber();
ReservationInMaterialDetail reservationInMaterialDetail = reservationInMaterialDetailMapper.selectOne(new LambdaQueryWrapper<ReservationInMaterialDetail>()
.eq(ReservationInMaterialDetail::getInOrderNumber, inOrderNumber)
.eq(ReservationInMaterialDetail::getDelFlag, 0));
}
}
}
}
@@ -1474,4 +1474,8 @@ public class ReservationStockInOrderDomainService {
// generateReserveOrderNumber 收敛为同一套跨表取号逻辑,避免两份实现日后分叉
return generateReserveOrderNumber();
}
public List<ReservationStockInOrderPO> queryPushBmsList() {
return stockInOrderService.queryPushBmsList();
}
}
@@ -16,6 +16,8 @@ import com.mhd.system.api.domain.InMaterialDetail;
import com.mhd.system.api.domain.InMaterialDetailTZPD;
import com.mhd.system.api.domain.StockInOrder;
import com.mhd.system.api.domain.StockInOrderTZPD;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -299,4 +301,24 @@ public class ReservationStockInOrderApi extends BaseController {
return AjaxResult.success(stockInOrderApplicationService.generateReserveOrderNumber1());
}
/**
* 1. 简单任务示例Bean模式
* 这里的 demoJobHandler 必须和调度中心配置一致
*/
// @XxlJob("pushBillingRecord")
public void pushBillingRecord() {
// 获取任务参数
String param = XxlJobHelper.getJobParam();
logger.info("XXL-JOB 开始入库业务单推送bms计费流水,参数:{}", param);
try {
stockInOrderApplicationService.pushBillingRecord();
// 设置任务执行结果
XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功");
} catch (Exception e) {
logger.error("XXL-JOB 执行失败", e);
XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage());
}
}
}
@@ -688,4 +688,12 @@
<select id="existsByOrderNumber" resultType="java.lang.Integer" parameterType="java.lang.String">
SELECT COUNT(1) FROM reservation_stock_in_order WHERE in_order_number = #{inOrderNumber}
</select>
<select id="queryPushBmsList" resultMap="StockInOrderResult">
SELECT *
FROM RESERVATION_STOCK_IN_ORDER
WHERE EXTRACT(DAY FROM CREATE_TIME) = EXTRACT(DAY FROM SYSDATE - 1)
AND EXTRACT(MONTH FROM CREATE_TIME) >= EXTRACT(MONTH FROM SYSDATE - 1)
AND DEL_FLAG = 1
</select>
</mapper>
@@ -3,16 +3,21 @@ package com.mhd.wms.application.service.materialInventory;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mhd.common.core.exception.ServiceException;
import com.mhd.common.core.utils.bean.BeanUtils;
import com.mhd.common.core.utils.StringUtils;
import com.mhd.common.core.web.domain.AjaxResult;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.BmsServiceFeign;
import com.mhd.system.api.SystemServiceFeign;
import com.mhd.system.api.domain.BatchDetailFeignPO;
import com.mhd.system.api.domain.BusinessDocumentFeign;
import com.mhd.system.api.domain.cache.AssociationWarehouseCacheDO;
import com.mhd.system.api.domain.cache.SystemServiceCacheUtil;
import com.mhd.system.api.model.LoginUser;
import com.mhd.wms.domain.materialBaseInfo.entity.MaterialBaseInfo;
import com.mhd.wms.domain.materialBaseInfo.repository.mapper.MaterialBaseInfoMapper;
import com.mhd.wms.domain.materialInventory.repository.mapper.MaterialInventoryMapper;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryPO;
import com.mhd.wms.domain.materialInventory.repository.po.MaterialInventoryQueryListPO;
@@ -32,9 +37,12 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.*;
import java.util.stream.Collectors;
@@ -49,8 +57,10 @@ import java.util.stream.Collectors;
public class MaterialInventoryApplicationService {
@Autowired
private MaterialInventoryDomainService materialInventoryDomainService;
@Autowired
@Resource
private SystemServiceFeign systemServiceFeign;
@Resource
private BmsServiceFeign bmsServiceFeign;
@Autowired
private MaterialInventoryMapper materialInventoryMapper;
@Autowired
@@ -59,6 +69,8 @@ public class MaterialInventoryApplicationService {
private IStockOutOrderService stockOutOrderService;
@Autowired
private OutMaterialDetailMapper outMaterialDetailMapper;
@Autowired
private MaterialBaseInfoMapper materialBaseInfoMapper;
/**
@@ -873,4 +885,101 @@ public class MaterialInventoryApplicationService {
}
}
}
}
public void pushBillingRecord(String shipperId) {
//非首次推送
List<MaterialInventoryPO> materialInventoryPOS = materialInventoryDomainService.queryPushBms(shipperId);
if (materialInventoryPOS==null || materialInventoryPOS.size()==0) return;
for (MaterialInventoryPO materialInventoryPO : materialInventoryPOS) {
Date createTime = materialInventoryPO.getCreateTime();
Long materialBaseInfoId = materialInventoryPO.getMaterialBaseInfoId();
String lotNumber = materialInventoryPO.getLotNumber();
String inOrderNumber = materialInventoryPO.getInOrderNumber();
List<Map<String, Object>> monthFee = materialInventoryDomainService.getMonthFee(inOrderNumber, materialBaseInfoId,lotNumber);
if (monthFee == null || monthFee.size()==0) return;
Map<String, Object> feeMap = monthFee.get(0);
//半月仓租
BigDecimal halfMonthWhFee = (BigDecimal) feeMap.get("halfMonthWhFee");
//整月仓租
BigDecimal monthlyWarehouseFee = (BigDecimal) feeMap.get("monthlyWarehouseFee");
// 判断是否为昨天
boolean isYesterday = false;
if (createTime != null) {
LocalDate yesterday = LocalDate.now().minusDays(1);
LocalDate createDate = createTime.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
isYesterday = yesterday.isEqual(createDate);
}
if (isYesterday) {
//首次计费 需要夫力费
//库存数量
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
//仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
//夫力费
BigDecimal manpowerFee = totalWarehouseRent.multiply(new BigDecimal("0.2"));
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
//火险保费
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
} else {
//期间付费 不需要夫力费
//库存数量
BigDecimal inventoryQuantity = materialInventoryPO.getInventoryQuantity();
//仓租
BigDecimal totalWarehouseRent = inventoryQuantity.multiply(monthlyWarehouseFee);
MaterialBaseInfo materialBaseInfo = materialBaseInfoMapper.selectById(materialBaseInfoId);
BigDecimal unitPrice = materialBaseInfo.getUnitPrice();
//火险保费
BigDecimal fireInsureFee = unitPrice.multiply(inventoryQuantity).multiply(new BigDecimal("0.0003"));
}
}
}
private void buildBusinessDocument(BigDecimal fee, MaterialInventoryPO materialInventoryPO) {
Long shipperId = materialInventoryPO.getShipperId();
Map<String, Object> shipper = materialInventoryMapper.querySetlleByShipperId(shipperId);
if (shipper == null) {
return;
}
Long settlementCustomersId = (Long) shipper.get("settlementCustomersId");
Long settlementEntityId = (Long) shipper.get("settlementEntityId");
String settlementEntity = (String) shipper.get("settlementEntity");
String settlementCustomersCode = (String) shipper.get("settlementCustomersCode");
BusinessDocumentFeign businessDocumentFeign = new BusinessDocumentFeign();
businessDocumentFeign.setBillAmount(fee);
businessDocumentFeign.setOrganizationId(materialInventoryPO.getOrganizationId());
businessDocumentFeign.setOrganizationName(materialInventoryPO.getOrganizationName());
businessDocumentFeign.setTopOrganizationId(materialInventoryPO.getTopOrganizationId());
businessDocumentFeign.setBelongModuleCode("wms");
businessDocumentFeign.setBelongModule("WMS");
businessDocumentFeign.setDataSources(1);
businessDocumentFeign.setSettlementEntity(settlementEntity);
businessDocumentFeign.setSettlementCustomersId(settlementCustomersId);
businessDocumentFeign.setSettlementCustomersCode(settlementCustomersCode);
businessDocumentFeign.setDocumentTypeId(5l);
businessDocumentFeign.setDocumentTypeCode("CM_SZ");
businessDocumentFeign.setDocumentType("仓码散租");
businessDocumentFeign.setFirstSubjectCode("0D81");
businessDocumentFeign.setFirstSubjectName("仓租费");
businessDocumentFeign.setBillingTime(new Date());
businessDocumentFeign.setServiceItemsCode("CMCZ");
businessDocumentFeign.setServiceItemsName("干仓仓租");
businessDocumentFeign.setSettlementWay(1);
Map<String, Object> contract = materialInventoryDomainService.queryContract(materialInventoryPO.getShipperId());
if (contract == null) {return;}
String contractName = (String) contract.get("contractName");
String contractNumber = (String) contract.get("contractNumber");
Long contractManageId = (Long) contract.get("contractManageId");
businessDocumentFeign.setContractName(contractName);
businessDocumentFeign.setContractNumber(contractNumber);
businessDocumentFeign.setContractManageId(contractManageId);
AjaxResult ajaxResult = bmsServiceFeign.feignSaveBusinessDocument(businessDocumentFeign);
if (ajaxResult == null || !"200".equals(String.valueOf(ajaxResult.get("code")))) {
log.error("保存业务单据失败: {}", ajaxResult != null ? ajaxResult.get("msg") : "feign调用异常");
}
}
}
@@ -14,6 +14,7 @@ import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 物料库存Service接口
@@ -120,4 +121,14 @@ public interface IMaterialInventoryService extends IService<MaterialInventory>
public void xgkc(MaterialInventoryParamDO materialInventoryParamDO);
public void kctzjl(MaterialInventoryParamDO materialInventoryParamDO,String adjustAction,LoginUser loginUser);
public List<MaterialInventoryPO> queryPushBmsFirst(String shipperId);
public List<MaterialInventoryPO> queryPushBms(String shipperId);
public List<Map<String,Object>> getMonthFee(String shipperId, Long materialBaseInfoId,String lotNumber);
public Map<String,Object> querySetlleByShipperId(Long ShipperId);
public Map<String,Object> queryContract(Long shipperId);
}
@@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Select;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 物料库存Mapper接口
@@ -124,4 +125,15 @@ public interface MaterialInventoryMapper extends BaseMapper<MaterialInventory>
MaterialInventoryPO selectByIdWithBatchAttributes(@Param("materialInventoryId") Long materialInventoryId);
public void insertReservationInventoryAdjustmentRecord(com.mhd.wms.domain.inventoryAdjustmentRecord.entity.InventoryAdjustmentRecord inventoryAdjustmentRecord);
public List<MaterialInventoryPO> queryPushBmsFirst(@Param("shipperId") String shipperId);
public List<MaterialInventoryPO> queryPushBms(@Param("shipperId") String shipperId);
public List<Map<String,Object>> getMonthFee(@Param("inOrderNumber") String inOrderNumber,@Param("materialBaseInfoId") Long materialBaseInfoId,@Param("lotNumber") String lotNumber);
public Map<String,Object> querySetlleByShipperId(@Param("shipperId") Long shipperId);
public Map<String,Object> queryContract(@Param("shipperId") Long shipperId);
}
@@ -37,6 +37,7 @@ import com.mhd.wms.domain.materialBaseInfo.repository.todo.MaterialBaseInfoDO;
import com.mhd.wms.domain.shelfMaterialDetail.entity.ShelfMaterialDetail;
import com.mhd.wms.domain.statementStatistics.po.ImmediateInventoryPO;
import com.mhd.wms.domain.statementStatistics.todo.ImmediateInventoryDO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -1235,4 +1236,24 @@ public class MaterialInventoryImpl extends ServiceImpl<MaterialInventoryMapper,
materialInventoryMapper.updateById(materialInventory);
}
}
public List<MaterialInventoryPO> queryPushBmsFirst(String shipperId) {
return materialInventoryMapper.queryPushBmsFirst(shipperId);
}
public List<MaterialInventoryPO> queryPushBms(String shipperId) {
return materialInventoryMapper.queryPushBms(shipperId);
}
public List<Map<String,Object>> getMonthFee(String shipperId ,Long materialBaseInfoId,String lotNumber) {
return materialInventoryMapper.getMonthFee(shipperId, materialBaseInfoId,lotNumber);
}
public Map<String,Object> querySetlleByShipperId(Long shipperId) {
return materialInventoryMapper.querySetlleByShipperId(shipperId);
}
public Map<String,Object> queryContract(Long shipperId) {
return materialInventoryMapper.queryContract(shipperId);
}
}
@@ -15,6 +15,7 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
/**
* 物料库存
@@ -120,4 +121,24 @@ public class MaterialInventoryDomainService {
public MaterialInventoryPO selectOneByWhere(MaterialInventoryDO materialInventoryDO) {
return materialInventoryService.selectOneByWhere(materialInventoryDO);
}
}
public List<MaterialInventoryPO> queryPushBmsFirst(String shipperId) {
return materialInventoryService.queryPushBmsFirst(shipperId);
}
public List<MaterialInventoryPO> queryPushBms(String shipperId) {
return materialInventoryService.queryPushBms(shipperId);
}
public List<Map<String,Object>> getMonthFee(String shipperId,Long materialBaseInfoId,String lotNumber) {
return materialInventoryService.getMonthFee(shipperId,materialBaseInfoId,lotNumber);
}
public Map<String,Object> querySetlleByShipperId(Long shipperId) {
return materialInventoryService.querySetlleByShipperId(shipperId);
}
public Map<String,Object> queryContract(Long shipperId) {
return materialInventoryService.queryContract(shipperId);
}
}
@@ -19,6 +19,8 @@ import com.mhd.wms.interfaces.assember.materialInventory.MaterialInventoryAssemb
import com.mhd.wms.interfaces.dto.materialInventory.MaterialInventoryDTO;
import com.mhd.wms.interfaces.dto.materialInventory.MaterialInventoryQueryListDTO;
import com.mhd.wms.util.TongyuOrgUtil;
import com.xxl.job.core.context.XxlJobHelper;
import com.xxl.job.core.handler.annotation.XxlJob;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -262,4 +264,23 @@ public class MaterialInventoryApi extends BaseController {
return AjaxResult.success(materialInventoryApplicationService.sumInventoryQuantity(materialInventoryDO));
}
/**
* 1. 简单任务示例Bean模式
* 这里的 demoJobHandler 必须和调度中心配置一致
*/
@XxlJob("pushBillingRecord")
public void pushBillingRecord() {
// 获取任务参数(货主id)
String shipperId = XxlJobHelper.getJobParam();
logger.info("XXL-JOB 开始入库业务单推送bms计费流水,货主id参数:{}", shipperId);
try {
materialInventoryApplicationService.pushBillingRecord(shipperId);
// 设置任务执行结果
XxlJobHelper.handleSuccess("入库业务单推送bms计费流水执行成功");
} catch (Exception e) {
logger.error("XXL-JOB 执行失败", e);
XxlJobHelper.handleFail("入库业务单推送bms计费流水执行失败:" + e.getMessage());
}
}
}
@@ -1691,4 +1691,55 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="batchNumber != null">#{batchNumber},</if>
</trim>
</insert>
<select id="queryPushBmsFirst" resultMap="MaterialInventoryResult">
SELECT *
FROM MATERIAL_INVENTORY
WHERE TRUNC(CREATE_TIME) = TRUNC(SYSDATE - 1)
AND DEL_FLAG = 1
AND SHIIPER_ID = #{shipperId}
</select>
<select id="queryPushBms" resultMap="MaterialInventoryResult">
SELECT *
FROM MATERIAL_INVENTORY
WHERE EXTRACT(DAY FROM CREATE_TIME) = EXTRACT(DAY FROM SYSDATE - 1) AND INVENTORY_QUANTITY > 0
AND DEL_FLAG = 1 AND SHIIPER_ID = #{shipperId}
</select>
<select id="getMonthFee" resultType="java.util.Map">
SELECT
IN_ORDER_NUMBER as "inOrderNumber",
MATERIAL_BASE_INFO_ID as "materialBaseInfoId",
MONTHLY_WAREHOUSE_FEE as "monthlyWarehouseFee",
HALF_MONTH_WH_FEE as "halfMonthWhFee"
FROM
"NGWL_TEST_OMS".RESERVATION_IN_MATERIAL_DETAIL
WHERE
IN_ORDER_NUMBER IN (SELECT BUSINESS_IN_ORDER_NUMBER FROM "NGWL_TEST_OMS".EXECUTION_STOCK_IN_ORDER WHERE IN_ORDER_NUMBER = #{inOrderNumber} AND DEL_FLAG = 1)
AND DEL_FLAG = 1 AND MATERIAL_BASE_INFO_ID = #{materialBaseInfoId} and LOT_NO = #{lotNumber}
</select>
<select id="querySetlleByShipperId" parameterType="java.lang.Long" resultType="java.util.Map">
SELECT
SETTLEMENT_ENTITY as settlementEntity,
SETTLEMENT_ENTITY_ID as settlementEntityId,
SETTLEMENT_CUSTOMERS_CODE as settlementCustomersCode,
SETTLEMENT_CUSTOMERS_ID as settlementCustomersId
FROM NGWL_TEST_OMS.SETTLEMENT_CUSTOMERS where 1=1 and
SETTLEMENT_ENTITY_ID = #{settlementEntityId}
</select>
<select id="queryContract" parameterType="java.lang.Long" resultType="java.util.Map">
SELECT
CONTRACT_MANAGE_ID as contractManageId,
ORIGINAL_CONTRACT_NUMBER as originalContractNumber,
CONTRACT_NUMBER as contractNumber,
CONTRACT_NAME as contractName
FROM NGWL_TEST_SYSTEM.CONTRACT_MANAGE where 1=1 and
SETTLEMENT_CUSTOMERS_ID = #{shipperId}
</select>
</mapper>