demand: TMS系统 - 报价管理 - 寄件区域/派件区域 - 细节调整
committer: heyu
This commit is contained in:
parent
36bd1744b9
commit
fc8d32d0ea
@ -13,6 +13,8 @@ package com.xdadan.erp.web.emis;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@ -89,8 +91,9 @@ public class EmisQuoteDispAreaController extends EmisBaseController
|
|||||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteDispArea:add')")
|
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteDispArea:add')")
|
||||||
@Log(title = "派件区域", businessType = BusinessType.INSERT)
|
@Log(title = "派件区域", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody EmisQuoteDispArea emisQuoteDispArea)
|
public AjaxResult add(@RequestBody EmisQuoteDispArea emisQuoteDispArea) throws EmisBizError {
|
||||||
{
|
// 校验数据
|
||||||
|
emisQuoteDispAreaService.validateEmisQuoteDispArea(emisQuoteDispArea, false);
|
||||||
return toAjax(emisQuoteDispAreaService.insertEmisQuoteDispArea(emisQuoteDispArea));
|
return toAjax(emisQuoteDispAreaService.insertEmisQuoteDispArea(emisQuoteDispArea));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,8 +103,9 @@ public class EmisQuoteDispAreaController extends EmisBaseController
|
|||||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteDispArea:edit')")
|
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteDispArea:edit')")
|
||||||
@Log(title = "派件区域", businessType = BusinessType.UPDATE)
|
@Log(title = "派件区域", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody EmisQuoteDispArea emisQuoteDispArea)
|
public AjaxResult edit(@RequestBody EmisQuoteDispArea emisQuoteDispArea) throws EmisBizError {
|
||||||
{
|
// 校验数据
|
||||||
|
emisQuoteDispAreaService.validateEmisQuoteDispArea(emisQuoteDispArea, true);
|
||||||
return toAjax(emisQuoteDispAreaService.updateEmisQuoteDispArea(emisQuoteDispArea));
|
return toAjax(emisQuoteDispAreaService.updateEmisQuoteDispArea(emisQuoteDispArea));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,6 @@ package com.xdadan.erp.web.emis;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
@ -25,15 +24,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import com.xdadan.erp.common.annotation.Log;
|
import com.xdadan.erp.common.annotation.Log;
|
||||||
import com.xdadan.erp.common.core.controller.BaseController;
|
|
||||||
import com.xdadan.erp.common.core.domain.AjaxResult;
|
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||||
import com.xdadan.erp.common.core.page.TableDataInfo;
|
import com.xdadan.erp.common.core.page.TableDataInfo;
|
||||||
import com.xdadan.erp.common.enums.BusinessType;
|
import com.xdadan.erp.common.enums.BusinessType;
|
||||||
import com.xdadan.erp.common.utils.StringUtils;
|
|
||||||
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
import com.xdadan.erp.common.utils.poi.ExcelUtil;
|
||||||
|
|
||||||
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
||||||
import com.xdadan.erp.emis.service.IEmisQuoteSendAreaService;
|
import com.xdadan.erp.emis.service.IEmisQuoteSendAreaService;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 寄件区域Controller
|
* 寄件区域Controller
|
||||||
@ -89,8 +87,9 @@ public class EmisQuoteSendAreaController extends EmisBaseController
|
|||||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteSendArea:add')")
|
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteSendArea:add')")
|
||||||
@Log(title = "寄件区域", businessType = BusinessType.INSERT)
|
@Log(title = "寄件区域", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody EmisQuoteSendArea emisQuoteSendArea)
|
public AjaxResult add(@RequestBody EmisQuoteSendArea emisQuoteSendArea) throws EmisBizError {
|
||||||
{
|
// 校验数据
|
||||||
|
emisQuoteSendAreaService.validateEmisQuoteSendArea(emisQuoteSendArea, true);
|
||||||
return toAjax(emisQuoteSendAreaService.insertEmisQuoteSendArea(emisQuoteSendArea));
|
return toAjax(emisQuoteSendAreaService.insertEmisQuoteSendArea(emisQuoteSendArea));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,8 +99,9 @@ public class EmisQuoteSendAreaController extends EmisBaseController
|
|||||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteSendArea:edit')")
|
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteSendArea:edit')")
|
||||||
@Log(title = "寄件区域", businessType = BusinessType.UPDATE)
|
@Log(title = "寄件区域", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody EmisQuoteSendArea emisQuoteSendArea)
|
public AjaxResult edit(@RequestBody EmisQuoteSendArea emisQuoteSendArea) throws EmisBizError {
|
||||||
{
|
// 校验数据
|
||||||
|
emisQuoteSendAreaService.validateEmisQuoteSendArea(emisQuoteSendArea, true);
|
||||||
return toAjax(emisQuoteSendAreaService.updateEmisQuoteSendArea(emisQuoteSendArea));
|
return toAjax(emisQuoteSendAreaService.updateEmisQuoteSendArea(emisQuoteSendArea));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,7 @@ package com.xdadan.erp.emis.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisQuoteDispAreaService
|
* @ClassName EmisQuoteDispAreaService
|
||||||
@ -66,4 +67,13 @@ public interface IEmisQuoteDispAreaService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisQuoteDispAreaByAreaId(Long areaId);
|
public int deleteEmisQuoteDispAreaByAreaId(Long areaId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验派件区域数据
|
||||||
|
*
|
||||||
|
* @param emisQuoteDispArea 派件区域
|
||||||
|
* @param isUpdate 是否为更新操作
|
||||||
|
* @throws EmisBizError 校验失败时抛出异常
|
||||||
|
*/
|
||||||
|
public void validateEmisQuoteDispArea(EmisQuoteDispArea emisQuoteDispArea, boolean isUpdate) throws EmisBizError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ package com.xdadan.erp.emis.service;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @ClassName EmisQuoteSendAreaService
|
* @ClassName EmisQuoteSendAreaService
|
||||||
@ -66,4 +67,13 @@ public interface IEmisQuoteSendAreaService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmisQuoteSendAreaByAreaId(Long areaId);
|
public int deleteEmisQuoteSendAreaByAreaId(Long areaId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验寄件区域数据
|
||||||
|
*
|
||||||
|
* @param emisQuoteSendArea 寄件区域
|
||||||
|
* @param isUpdate 是否为更新操作
|
||||||
|
* @throws EmisBizError 校验失败时抛出异常
|
||||||
|
*/
|
||||||
|
public void validateEmisQuoteSendArea(EmisQuoteSendArea emisQuoteSendArea, boolean isUpdate) throws EmisBizError;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@
|
|||||||
package com.xdadan.erp.emis.service.impl;
|
package com.xdadan.erp.emis.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -18,6 +20,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
||||||
import com.xdadan.erp.emis.mapper.EmisQuoteDispAreaMapper;
|
import com.xdadan.erp.emis.mapper.EmisQuoteDispAreaMapper;
|
||||||
import com.xdadan.erp.emis.service.IEmisQuoteDispAreaService;
|
import com.xdadan.erp.emis.service.IEmisQuoteDispAreaService;
|
||||||
|
import com.xdadan.erp.common.utils.StringUtils;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 派件区域Service业务层处理
|
* 派件区域Service业务层处理
|
||||||
@ -107,4 +112,45 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
|||||||
return emisQuoteDispAreaMapper.deleteEmisQuoteDispAreaByAreaId(areaId);
|
return emisQuoteDispAreaMapper.deleteEmisQuoteDispAreaByAreaId(areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验派件区域数据
|
||||||
|
*
|
||||||
|
* @param emisQuoteDispArea 派件区域
|
||||||
|
* @param isUpdate 是否为更新操作
|
||||||
|
* @throws EmisBizError 校验失败时抛出异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void validateEmisQuoteDispArea(EmisQuoteDispArea emisQuoteDispArea, boolean isUpdate) throws EmisBizError {
|
||||||
|
// 1. 校验区域名称和删除标志的唯一性
|
||||||
|
EmisQuoteDispArea queryParam = new EmisQuoteDispArea();
|
||||||
|
queryParam.setAreaName(emisQuoteDispArea.getAreaName());
|
||||||
|
queryParam.setDelFlag("0"); // 只查询未删除的记录
|
||||||
|
|
||||||
|
List<EmisQuoteDispArea> existingList = emisQuoteDispAreaMapper.selectEmisQuoteDispAreaList(queryParam);
|
||||||
|
|
||||||
|
if (isUpdate) {
|
||||||
|
// 更新时排除当前记录
|
||||||
|
existingList.removeIf(item -> item.getAreaId().equals(emisQuoteDispArea.getAreaId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existingList.isEmpty()) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.EXISTS, "区域名称已存在,请使用其他名称");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 校验area_site_code中每个站点代码不能重复
|
||||||
|
if (StringUtils.isNotEmpty(emisQuoteDispArea.getAreaSiteCode())) {
|
||||||
|
String[] siteCodes = emisQuoteDispArea.getAreaSiteCode().split(",");
|
||||||
|
Set<String> siteCodeSet = new HashSet<>();
|
||||||
|
|
||||||
|
for (String siteCode : siteCodes) {
|
||||||
|
String trimmedCode = siteCode.trim();
|
||||||
|
if (StringUtils.isNotEmpty(trimmedCode)) {
|
||||||
|
if (!siteCodeSet.add(trimmedCode)) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "区域站点代码中存在重复值:" + trimmedCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@
|
|||||||
package com.xdadan.erp.emis.service.impl;
|
package com.xdadan.erp.emis.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@ -18,6 +20,9 @@ import org.springframework.stereotype.Service;
|
|||||||
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
||||||
import com.xdadan.erp.emis.mapper.EmisQuoteSendAreaMapper;
|
import com.xdadan.erp.emis.mapper.EmisQuoteSendAreaMapper;
|
||||||
import com.xdadan.erp.emis.service.IEmisQuoteSendAreaService;
|
import com.xdadan.erp.emis.service.IEmisQuoteSendAreaService;
|
||||||
|
import com.xdadan.erp.common.utils.StringUtils;
|
||||||
|
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||||
|
import com.xdadan.erp.emis.domain.enumtype.EmisBizErrorType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 寄件区域Service业务层处理
|
* 寄件区域Service业务层处理
|
||||||
@ -106,4 +111,45 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
|||||||
return emisQuoteSendAreaMapper.deleteEmisQuoteSendAreaByAreaId(areaId);
|
return emisQuoteSendAreaMapper.deleteEmisQuoteSendAreaByAreaId(areaId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验寄件区域数据
|
||||||
|
*
|
||||||
|
* @param emisQuoteSendArea 寄件区域
|
||||||
|
* @param isUpdate 是否为更新操作
|
||||||
|
* @throws EmisBizError 校验失败时抛出异常
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void validateEmisQuoteSendArea(EmisQuoteSendArea emisQuoteSendArea, boolean isUpdate) throws EmisBizError {
|
||||||
|
// 1. 校验区域名称和删除标志的唯一性
|
||||||
|
EmisQuoteSendArea queryParam = new EmisQuoteSendArea();
|
||||||
|
queryParam.setAreaName(emisQuoteSendArea.getAreaName());
|
||||||
|
queryParam.setDelFlag("0"); // 只查询未删除的记录
|
||||||
|
|
||||||
|
List<EmisQuoteSendArea> existingList = emisQuoteSendAreaMapper.selectEmisQuoteSendAreaList(queryParam);
|
||||||
|
|
||||||
|
if (isUpdate) {
|
||||||
|
// 更新时排除当前记录
|
||||||
|
existingList.removeIf(item -> item.getAreaId().equals(emisQuoteSendArea.getAreaId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!existingList.isEmpty()) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.EXISTS, "区域名称已存在,请使用其他名称");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 校验area_site_code中每个站点代码不能重复
|
||||||
|
if (StringUtils.isNotEmpty(emisQuoteSendArea.getAreaSiteCode())) {
|
||||||
|
String[] siteCodes = emisQuoteSendArea.getAreaSiteCode().split(",");
|
||||||
|
Set<String> siteCodeSet = new HashSet<>();
|
||||||
|
|
||||||
|
for (String siteCode : siteCodes) {
|
||||||
|
String trimmedCode = siteCode.trim();
|
||||||
|
if (StringUtils.isNotEmpty(trimmedCode)) {
|
||||||
|
if (!siteCodeSet.add(trimmedCode)) {
|
||||||
|
throw new EmisBizError(EmisBizErrorType.PARAM_ERROR, "区域站点代码中存在重复值:" + trimmedCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user