Merge pull request 'demand: 查询漏组批次查询组批次完成时各网点只能查询自己网点的运单 供应商线路规划新增/修改/批量新增/批量修改去除死循环相关的校验' (#102) from develop into master
Reviewed-on: http://git.xdadan.loc/tanex/emis-service/pulls/102
This commit is contained in:
commit
15db89cf76
@ -12,6 +12,7 @@ package com.xdadan.erp.emis.service.impl;
|
|||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.xdadan.erp.common.utils.DictUtils;
|
import com.xdadan.erp.common.utils.DictUtils;
|
||||||
@ -19,6 +20,8 @@ import com.xdadan.erp.emis.domain.*;
|
|||||||
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
import com.xdadan.erp.emis.mapper.*;
|
import com.xdadan.erp.emis.mapper.*;
|
||||||
|
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||||
|
import jodd.util.StringUtil;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -34,7 +37,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||||||
* @date 2024-01-12 08:40:05
|
* @date 2024-01-12 08:40:05
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class EmisQuotePriceServiceImpl implements IEmisQuotePriceService
|
public class EmisQuotePriceServiceImpl extends EmisBaseService implements IEmisQuotePriceService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmisQuotePriceMapper emisQuotePriceMapper;
|
private EmisQuotePriceMapper emisQuotePriceMapper;
|
||||||
@ -414,7 +417,17 @@ public class EmisQuotePriceServiceImpl implements IEmisQuotePriceService
|
|||||||
emisQuotePrice.setDispAreaSiteCode(dispArea.getAreaSiteCode());
|
emisQuotePrice.setDispAreaSiteCode(dispArea.getAreaSiteCode());
|
||||||
emisQuotePrice.setDispAreaSite(dispArea.getAreaSite());
|
emisQuotePrice.setDispAreaSite(dispArea.getAreaSite());
|
||||||
}
|
}
|
||||||
// emisQuotePrice.setQuoteType("1");
|
|
||||||
|
if ("3".equals(emisQuotePrice.getQuoteType())) {
|
||||||
|
EmisCustomerUser monthCustomerByName = getMonthCustomerByName(emisQuotePrice.getCustName());
|
||||||
|
if (Objects.isNull(monthCustomerByName)) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "未找到对应的客户名称: " + emisQuotePrice.getCustName());
|
||||||
|
}
|
||||||
|
if (StringUtil.isBlank(monthCustomerByName.getCustNo())) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "未找到对应的客户名称: " + emisQuotePrice.getCustName());
|
||||||
|
}
|
||||||
|
emisQuotePrice.setCustNo(monthCustomerByName.getCustNo());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void checkDate(EmisQuotePrice emisQuotePrice) throws EmisBizError {
|
private static void checkDate(EmisQuotePrice emisQuotePrice) throws EmisBizError {
|
||||||
@ -468,5 +481,10 @@ public class EmisQuotePriceServiceImpl implements IEmisQuotePriceService
|
|||||||
if (emisQuotePrice.getDispAreaName() == null || emisQuotePrice.getDispAreaName().trim().isEmpty()) {
|
if (emisQuotePrice.getDispAreaName() == null || emisQuotePrice.getDispAreaName().trim().isEmpty()) {
|
||||||
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "派件区域不能为空");
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "派件区域不能为空");
|
||||||
}
|
}
|
||||||
|
if("3".equals(emisQuotePrice.getQuoteType())){
|
||||||
|
if (emisQuotePrice.getCustName() == null || emisQuotePrice.getCustName().trim().isEmpty()) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "客户名称不能为空");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,12 +82,12 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
|||||||
checkDate(emisTransPlanRule);
|
checkDate(emisTransPlanRule);
|
||||||
// 检查重复
|
// 检查重复
|
||||||
checkDuplicate(emisTransPlanRule);
|
checkDuplicate(emisTransPlanRule);
|
||||||
// 校验循环引用
|
// // 校验循环引用
|
||||||
EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
// EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
||||||
checkRule.setProductType(emisTransPlanRule.getProductType());
|
// checkRule.setProductType(emisTransPlanRule.getProductType());
|
||||||
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleListWithoutName(checkRule);
|
// List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleListWithoutName(checkRule);
|
||||||
allRules.add(emisTransPlanRule);
|
// allRules.add(emisTransPlanRule);
|
||||||
buildTree(allRules, emisTransPlanRule);
|
// buildTree(allRules, emisTransPlanRule);
|
||||||
return emisTransPlanRuleMapper.insertEmisTransPlanRule(emisTransPlanRule);
|
return emisTransPlanRuleMapper.insertEmisTransPlanRule(emisTransPlanRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,14 +106,14 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
|||||||
// 检查重复(排除自身)
|
// 检查重复(排除自身)
|
||||||
checkDuplicateForUpdate(emisTransPlanRule);
|
checkDuplicateForUpdate(emisTransPlanRule);
|
||||||
|
|
||||||
// 校验循环引用
|
// // 校验循环引用
|
||||||
EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
// EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
||||||
checkRule.setProductType(emisTransPlanRule.getProductType());
|
// checkRule.setProductType(emisTransPlanRule.getProductType());
|
||||||
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleListWithoutName(checkRule);
|
// List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleListWithoutName(checkRule);
|
||||||
// 移除当前要修改的规则,避免自己与自己比较
|
// // 移除当前要修改的规则,避免自己与自己比较
|
||||||
allRules.removeIf(rule -> rule.getId().equals(emisTransPlanRule.getId()));
|
// allRules.removeIf(rule -> rule.getId().equals(emisTransPlanRule.getId()));
|
||||||
allRules.add(emisTransPlanRule);
|
// allRules.add(emisTransPlanRule);
|
||||||
buildTree(allRules, emisTransPlanRule);
|
// buildTree(allRules, emisTransPlanRule);
|
||||||
|
|
||||||
return emisTransPlanRuleMapper.updateEmisTransPlanRule(emisTransPlanRule);
|
return emisTransPlanRuleMapper.updateEmisTransPlanRule(emisTransPlanRule);
|
||||||
}
|
}
|
||||||
@ -179,12 +179,12 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
|||||||
|
|
||||||
// 检查重复
|
// 检查重复
|
||||||
checkDuplicate(emisTransPlanRule);
|
checkDuplicate(emisTransPlanRule);
|
||||||
// 校验循环引用
|
// // 校验循环引用
|
||||||
EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
// EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
||||||
checkRule.setProductType(emisTransPlanRule.getProductType());
|
// checkRule.setProductType(emisTransPlanRule.getProductType());
|
||||||
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleListWithoutName(checkRule);
|
// List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper.selectEmisTransPlanRuleListWithoutName(checkRule);
|
||||||
allRules.add(emisTransPlanRule);
|
// allRules.add(emisTransPlanRule);
|
||||||
buildTree(allRules, emisTransPlanRule);
|
// buildTree(allRules, emisTransPlanRule);
|
||||||
return emisTransPlanRuleMapper.insertEmisTransPlanRule(emisTransPlanRule);
|
return emisTransPlanRuleMapper.insertEmisTransPlanRule(emisTransPlanRule);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -253,12 +253,12 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
|||||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "已存在相同的规则配置");
|
throw new EmisBizError(EmisBizErrorType.EXISTS, "已存在相同的规则配置");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查反向规则(下一网点到起始网点)
|
// // 检查反向规则(下一网点到起始网点)
|
||||||
List<EmisTransPlanRule> existingRules1 = checkDuplicateDirection(emisTransPlanRule,
|
// List<EmisTransPlanRule> existingRules1 = checkDuplicateDirection(emisTransPlanRule,
|
||||||
emisTransPlanRule.getNextSiteCode(), emisTransPlanRule.getStartSiteCode());
|
// emisTransPlanRule.getNextSiteCode(), emisTransPlanRule.getStartSiteCode());
|
||||||
if (existingRules1 != null && !existingRules1.isEmpty()) {
|
// if (existingRules1 != null && !existingRules1.isEmpty()) {
|
||||||
throw new EmisBizError(EmisBizErrorType.EXISTS, "已存在相同的规则配置");
|
// throw new EmisBizError(EmisBizErrorType.EXISTS, "已存在相同的规则配置");
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<EmisTransPlanRule> checkDuplicateDirection(EmisTransPlanRule emisTransPlanRule,
|
private List<EmisTransPlanRule> checkDuplicateDirection(EmisTransPlanRule emisTransPlanRule,
|
||||||
@ -431,13 +431,13 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
|||||||
checkCode(mergedRule);
|
checkCode(mergedRule);
|
||||||
checkDate(mergedRule);
|
checkDate(mergedRule);
|
||||||
checkDuplicateForUpdate(mergedRule);
|
checkDuplicateForUpdate(mergedRule);
|
||||||
EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
// EmisTransPlanRule checkRule = new EmisTransPlanRule();
|
||||||
checkRule.setProductType(mergedRule.getProductType());
|
// checkRule.setProductType(mergedRule.getProductType());
|
||||||
List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper
|
// List<EmisTransPlanRule> allRules = emisTransPlanRuleMapper
|
||||||
.selectEmisTransPlanRuleListWithoutName(checkRule);
|
// .selectEmisTransPlanRuleListWithoutName(checkRule);
|
||||||
allRules.removeIf(rule -> rule.getId().equals(mergedRule.getId()));
|
// allRules.removeIf(rule -> rule.getId().equals(mergedRule.getId()));
|
||||||
allRules.add(mergedRule);
|
// allRules.add(mergedRule);
|
||||||
buildTree(allRules, mergedRule);
|
// buildTree(allRules, mergedRule);
|
||||||
// 4. 只更新前端传递的字段
|
// 4. 只更新前端传递的字段
|
||||||
int result = emisTransPlanRuleMapper.updateEmisTransPlanRule(inputRule);
|
int result = emisTransPlanRuleMapper.updateEmisTransPlanRule(inputRule);
|
||||||
if (result > 0) {
|
if (result > 0) {
|
||||||
@ -467,16 +467,16 @@ public class EmisTransPlanRuleServiceImpl extends EmisBaseService implements IEm
|
|||||||
throw new EmisBizError(EmisBizErrorType.EXISTS, msg);
|
throw new EmisBizError(EmisBizErrorType.EXISTS, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查反向规则(下一网点到起始网点)
|
// // 检查反向规则(下一网点到起始网点)
|
||||||
List<EmisTransPlanRule> existingRules1 = checkDuplicateDirectionForUpdate(emisTransPlanRule,
|
// List<EmisTransPlanRule> existingRules1 = checkDuplicateDirectionForUpdate(emisTransPlanRule,
|
||||||
emisTransPlanRule.getNextSiteCode(), emisTransPlanRule.getStartSiteCode());
|
// emisTransPlanRule.getNextSiteCode(), emisTransPlanRule.getStartSiteCode());
|
||||||
if (existingRules1 != null && !existingRules1.isEmpty()) {
|
// if (existingRules1 != null && !existingRules1.isEmpty()) {
|
||||||
EmisTransPlanRule rule = existingRules1.get(0);
|
// EmisTransPlanRule rule = existingRules1.get(0);
|
||||||
String msg = String.format("已存在相同的规则配置,重复规则信息:线路名称[%s],产品类型[%s],起始网点[%s],下一网点[%s],供应商[%s]",
|
// String msg = String.format("已存在相同的规则配置,重复规则信息:线路名称[%s],产品类型[%s],起始网点[%s],下一网点[%s],供应商[%s]",
|
||||||
rule.getLineName(), rule.getProductTypeName(), rule.getStartSiteName(), rule.getNextSiteName(),
|
// rule.getLineName(), rule.getProductTypeName(), rule.getStartSiteName(), rule.getNextSiteName(),
|
||||||
rule.getSupplierName());
|
// rule.getSupplierName());
|
||||||
throw new EmisBizError(EmisBizErrorType.EXISTS, msg);
|
// throw new EmisBizError(EmisBizErrorType.EXISTS, msg);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -201,6 +201,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="params.endSendDate != null and params.endSendDate != ''">
|
<if test="params.endSendDate != null and params.endSendDate != ''">
|
||||||
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
and w.send_date <![CDATA[ <= ]]> #{params.endSendDate}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
|
||||||
|
and w.send_site_code=#{params.privSiteCode}
|
||||||
|
</if>
|
||||||
</where>
|
</where>
|
||||||
order by w.bill_code desc
|
order by w.bill_code desc
|
||||||
</when>
|
</when>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user