Merge branch 'dev' into dev_WMS20260401

# Conflicts:
#	mhd-user-center/src/main/resources/bootstrap.yml
#	mhd_oms/src/main/java/com/mhd/oms/interfaces/dto/executeOrder/ExecuteOrderDTO.java
#	mhd_oms/src/main/resources/bootstrap.yml
#	mhd_wms/src/main/resources/mapper/deliveTask/DeliveTaskMapper.xml
This commit is contained in:
王奎兴
2026-06-16 11:11:48 +08:00
46 changed files with 660 additions and 225 deletions
@@ -590,6 +590,7 @@ public class ContractManageApplicationService {
if (ObjectUtil.isNull(loginUser)) {
throw new DigitalLogisticsException(UserError.TIMEOUT);
}
validateContractType(contractManageDO.getContractType());
/*
通用合同:同一时间段、同一合同类型,只能存在一个
特殊合同:同一结算主体、同一时间段、同一合同类型,只能存在一个
@@ -666,6 +667,29 @@ public class ContractManageApplicationService {
}
/**
* 校验合同类型
*/
private void validateContractType(Integer contractType) {
if (contractType == null) {
throw new ServiceException("合同类型不能为空");
}
if (contractType != 1 && contractType != 2 && contractType != 3) {
throw new ServiceException("合同类型不正确,请选择1-仓储、2-运输或3-其他");
}
}
/**
* 查询通用合同
*/
private ContractManagePO findGeneralContract(List<ContractManagePO> contractManagePOList, Integer contractType) {
return contractManagePOList.stream()
.filter(item -> Objects.equals(item.getContractType(), contractType)
&& item.getCommonContractFlag() == 1
&& item.getContractState() == 2)
.findFirst().orElse(null);
}
/**
* 校验合同是否合法
* @param contractManageDO
@@ -806,6 +830,7 @@ public class ContractManageApplicationService {
*/
@Transactional
public Boolean update(ContractManageDO contractManageDO) {
validateContractType(contractManageDO.getContractType());
checkContract(contractManageDO);
handleData(contractManageDO);
handleDetils(contractManageDO);
@@ -845,7 +870,7 @@ public class ContractManageApplicationService {
*/
public ContractManagePO getInfoByCustomer(String settlementCustomersCode,Integer contractType, Long topOrganizationId) {
/*
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
首先根据合同类型(仓储、运输、其他),以及结算客户,查询合同信息
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
*/
//获取当前登录人信息
@@ -872,31 +897,12 @@ public class ContractManageApplicationService {
ContractManagePO contractManagePO = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
if(null == contractManagePO){
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream()
.filter(item ->
item.getContractType()==1 &&
item.getCommonContractFlag() == 1 && item.getContractState() ==2)
.findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2
&& item.getCommonContractFlag() == 1 && item.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}else {
resultContract = contractManagePO;
}
}else {
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}
if(null == resultContract){
throw new ServiceException("找不到匹配的合同,请重试");
@@ -936,7 +942,7 @@ public class ContractManageApplicationService {
*/
public ContractManagePO getInfoByCustomerAndOrganizationId(String settlementCustomersCode,Integer contractType, Long topOrganizationId, Long organizationId) {
/*
首先根据合同类型(仓储、运输),以及结算客户,查询合同信息
首先根据合同类型(仓储、运输、其他),以及结算客户,查询合同信息
如果传了结算主体,则根据结算主体以及当前时间查询有效的特殊合同,如果特殊合同没有,则查询通用合同
*/
//获取当前登录人信息
@@ -966,31 +972,12 @@ public class ContractManageApplicationService {
ContractManagePO contractManagePO = contractManagePOList.stream()
.filter(item -> item.getSettlementCustomersCode().equals(settlementCustomersCode) && Objects.equals(item.getContractType(), contractType)).findFirst().orElse(null);
if(null == contractManagePO){
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream()
.filter(item ->
item.getContractType()==1 &&
item.getCommonContractFlag() == 1 && item.getContractState() ==2)
.findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(item -> item.getContractType()==2
&& item.getCommonContractFlag() == 1 && item.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}else {
resultContract = contractManagePO;
}
}else {
if(contractType==1){
//仓储合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==1
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}else{
//运输合同
resultContract = contractManagePOList.stream().filter(contractManagePO -> contractManagePO.getContractType()==2
&& contractManagePO.getCommonContractFlag() == 1 && contractManagePO.getContractState() ==2).findFirst().orElse(null);
}
resultContract = findGeneralContract(contractManagePOList, contractType);
}
if(null == resultContract){
throw new ServiceException("找不到匹配的合同,请重试");
@@ -56,8 +56,8 @@ public class ContractManage extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -57,8 +57,8 @@ public class ContractManagePO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -54,8 +54,8 @@ public class ContractManageDO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -74,5 +74,12 @@ public class MaterialClassify extends BaseVOEntity{
@Excel(name = "是否作废: 1-否 2-是")
private Integer nullify;
@ApiModelProperty("收费标准")
@Excel(name = "收费标准")
private String chargeStandard;
}
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
}
@@ -81,6 +81,12 @@ public class MaterialClassifyPO extends BaseVOEntity{
@ApiModelProperty("上级分类字典编码集合")
@Excel(name = "上级分类字典编码集合")
private List<String> materialClassifyCodeList;
@ApiModelProperty("收费标准")
@Excel(name = "收费标准")
private String chargeStandard;
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
}
}
@@ -82,4 +82,11 @@ public class MaterialClassifyDO extends BaseVOEntity{
@ApiModelProperty("上级分类字典编码集合")
@Excel(name = "上级分类字典编码集合")
private List<String> materialClassifyCodeList;
}
@ApiModelProperty("收费标准")
@Excel(name = "收费标准")
private String chargeStandard;
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
}
@@ -54,8 +54,8 @@ public class ContractManageDTO extends BaseVOEntity{
@Excel(name = "是否通用合同", readConverterExp = "1=-是,2-否")
private Integer commonContractFlag;
@ApiModelProperty("合同类型(1-仓储,2-运输)")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输")
@ApiModelProperty("合同类型(1-仓储,2-运输3-其他")
@Excel(name = "合同类型", readConverterExp = "1=-仓储,2-运输3=-其他")
private Integer contractType;
@ApiModelProperty("合同状态(1-未生效,2-使用中,3-已过期,4-已作废)")
@@ -82,4 +82,11 @@ public class MaterialClassifyDTO extends BaseVOEntity{
@ApiModelProperty("上级分类字典编码集合")
@Excel(name = "上级分类字典编码集合")
private List<String> materialClassifyCodeList;
}
@ApiModelProperty("收费标准")
@Excel(name = "收费标准")
private String chargeStandard;
@ApiModelProperty("单位")
@Excel(name = "单位")
private String unit;
}
@@ -21,6 +21,8 @@ import com.mhd.common.log.annotation.Log;
import com.mhd.common.log.enums.BusinessType;
import com.mhd.common.security.utils.SecurityUtils;
import com.mhd.system.api.domain.SysDictData;
import com.mhd.system.api.domain.SysDictType;
import com.mhd.system.api.model.LoginUser;
/**
* 数据字典信息
@@ -41,10 +43,87 @@ public class SysDictDataController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData)
{
if (!applyDictDataOrganizationFilterByDictType(dictData))
{
return getDataTable(new ArrayList<>());
}
startPage();
List<SysDictData> list = dictDataService.selectDictList(dictData);
return getDataTable(list);
}
/**
* 列表组织过滤按字典类型sys_dict_type上的组织维度过滤字典数据
* 前端可传 organizationId通常来自所选字典类型行南光组织2827可选组织或查全部其他组织仅本组织
*
* @return false 表示当前组织下无匹配字典类型应返回空列表
*/
private boolean applyDictDataOrganizationFilterByDictType(SysDictData dictData)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null)
{
return true;
}
Long loginUserOrganizationId = loginUser.getUserPo().getOrganizationId();
Long loginUserTopOrganizationId = loginUser.getUserPo().getTopOrganizationId();
Long frontendOrganizationId = dictData.getOrganizationId();
Long queryOrganizationId = null;
Long queryTopOrganizationId = null;
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L))
{
if (frontendOrganizationId != null)
{
queryOrganizationId = frontendOrganizationId;
}
}
else
{
if (frontendOrganizationId != null && !frontendOrganizationId.equals(loginUserOrganizationId))
{
queryOrganizationId = loginUserOrganizationId;
}
else if (frontendOrganizationId != null)
{
queryOrganizationId = frontendOrganizationId;
}
else
{
queryOrganizationId = loginUserOrganizationId;
}
queryTopOrganizationId = loginUserTopOrganizationId;
}
if (StringUtils.isEmpty(dictData.getDictType()))
{
dictData.setOrganizationId(queryOrganizationId);
dictData.setTopOrganizationId(queryTopOrganizationId);
return true;
}
if (queryOrganizationId == null)
{
dictData.setOrganizationId(null);
dictData.setTopOrganizationId(null);
return true;
}
SysDictType typeQuery = new SysDictType();
typeQuery.setDictType(dictData.getDictType());
typeQuery.setOrganizationId(queryOrganizationId);
List<SysDictType> dictTypes = dictTypeService.selectDictTypeList(typeQuery);
if (dictTypes.isEmpty())
{
return false;
}
SysDictType dictTypeRow = dictTypes.get(0);
dictData.setOrganizationId(dictTypeRow.getOrganizationId());
dictData.setTopOrganizationId(dictTypeRow.getTopOrganizationId());
return true;
}
@PostMapping("/getDictDataList")
public R<List<SysDictData>> getDictDataList(@RequestBody SysDictData sysDictData)
{
@@ -43,6 +43,7 @@ public class SysDictTypeController extends BaseController
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType)
{
applyDictTypeOrganizationFilter(dictType);
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
@@ -53,6 +54,7 @@ public class SysDictTypeController extends BaseController
@PostMapping("/export")
public void export(HttpServletResponse response, SysDictType dictType)
{
applyDictTypeOrganizationFilter(dictType);
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
util.exportExcel(response, list, "字典类型");
@@ -85,6 +87,61 @@ public class SysDictTypeController extends BaseController
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 列表/导出组织过滤优先使用前端传递的 organizationId
* 南光组织2827可按组织筛选或查全部其他组织只能查本组织数据
*/
private void applyDictTypeOrganizationFilter(SysDictType dictType)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser == null || loginUser.getUserPo() == null)
{
return;
}
Long loginUserOrganizationId = loginUser.getUserPo().getOrganizationId();
Long loginUserTopOrganizationId = loginUser.getUserPo().getTopOrganizationId();
Long frontendOrganizationId = dictType.getOrganizationId();
if (loginUserOrganizationId != null && loginUserOrganizationId.equals(2827L))
{
if (frontendOrganizationId != null)
{
dictType.setOrganizationId(frontendOrganizationId);
dictType.setTopOrganizationId(null);
}
else
{
dictType.setOrganizationId(null);
dictType.setTopOrganizationId(null);
}
}
else
{
if (frontendOrganizationId != null)
{
if (!frontendOrganizationId.equals(loginUserOrganizationId))
{
dictType.setOrganizationId(loginUserOrganizationId);
}
if (loginUserTopOrganizationId != null)
{
dictType.setTopOrganizationId(loginUserTopOrganizationId);
}
}
else
{
if (loginUserOrganizationId != null)
{
dictType.setOrganizationId(loginUserOrganizationId);
}
if (loginUserTopOrganizationId != null)
{
dictType.setTopOrganizationId(loginUserTopOrganizationId);
}
}
}
}
/**
* 写入组织维度优先使用请求体中选择的组织未传时使用当前登录用户所属组织无登录上下文时按平台0处理
*/
@@ -34,12 +34,12 @@ public interface SysDictTypeMapper
public SysDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
* 根据字典类型及组织查询信息同一 dict_type 在不同组织下可重复
*
* @param dictType 字典类型
* @param dictType 字典类型 dictTypeorganizationId
* @return 字典类型
*/
public SysDictType selectDictTypeByType(String dictType);
public SysDictType selectDictTypeByType(SysDictType dictType);
/**
* 通过字典ID删除字典信息
@@ -43,12 +43,12 @@ public interface ISysDictTypeService
public SysDictType selectDictTypeById(Long dictId);
/**
* 根据字典类型查询信息
* 根据字典类型及组织查询信息同一 dict_type 在不同组织下可重复
*
* @param dictType 字典类型
* @param dictType 字典类型 dictTypeorganizationId
* @return 字典类型
*/
public SysDictType selectDictTypeByType(String dictType);
public SysDictType selectDictTypeByType(SysDictType dictType);
/**
* 批量删除字典信息
@@ -441,7 +441,19 @@ public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDi
{
return;
}
SysDictType dictTypeRow = dictTypeService.selectDictTypeByType(dictType);
Long organizationId = data.getOrganizationId();
if (organizationId == null)
{
LoginUser loginUser = SecurityUtils.getLoginUser();
if (loginUser != null && loginUser.getUserPo() != null)
{
organizationId = loginUser.getUserPo().getOrganizationId();
}
}
SysDictType typeQuery = new SysDictType();
typeQuery.setDictType(dictType);
typeQuery.setOrganizationId(organizationId);
SysDictType dictTypeRow = dictTypeService.selectDictTypeByType(typeQuery);
if (dictTypeRow == null)
{
return;
@@ -113,13 +113,13 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService
}
/**
* 根据字典类型查询信息
* 根据字典类型及组织查询信息
*
* @param dictType 字典类型
* @param dictType 字典类型 dictTypeorganizationId
* @return 字典类型
*/
@Override
public SysDictType selectDictTypeByType(String dictType)
public SysDictType selectDictTypeByType(SysDictType dictType)
{
return dictTypeMapper.selectDictTypeByType(dictType);
}
@@ -25,11 +25,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateBy" column="update_by" />
<result property="updateByName" column="update_by_name" />
<result property="delFlag" column="del_flag" />
<result property="chargeStandard" column="charge_standard" />
<result property="unit" column="unit" />
</resultMap>
<sql id="selectMaterialClassifyPo">
select material_classify_id, organization_id, organization_name, top_organization_id, code, name, level, parent_code, parent_name, code_path, name_path, remark, nullify, create_time, create_by, create_by_name, update_time, update_by, update_by_name, del_flag from material_classify
select material_classify_id, organization_id, organization_name, top_organization_id, code, name, level, parent_code,
parent_name, code_path, name_path, remark, nullify, create_time, create_by, create_by_name, update_time, update_by,
update_by_name, del_flag,CHARGE_STANDARD,unit
from material_classify
</sql>
<sql id="selectMaterialClassifyPo1">
@@ -61,9 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where dict_id = #{dictId}
</select>
<select id="selectDictTypeByType" parameterType="String" resultMap="SysDictTypeResult">
<select id="selectDictTypeByType" parameterType="SysDictType" resultMap="SysDictTypeResult">
<include refid="selectDictTypeVo"/>
where dict_type = #{dictType}
and IFNULL(organization_id, 0) = IFNULL(#{organizationId}, 0)
limit 1
</select>
<select id="checkDictTypeUnique" parameterType="SysDictType" resultMap="SysDictTypeResult">