demand: TMS系统 - 报价管理 - 寄件区域/派件区域 - 细节调整
committer: heyu
This commit is contained in:
parent
36bd1744b9
commit
fc8d32d0ea
@ -1,11 +1,11 @@
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisQuoteDispAreaController.java
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:04
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 派件区域 控制器 </p>
|
||||
*/
|
||||
|
||||
@ -13,6 +13,8 @@ package com.xdadan.erp.web.emis;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -37,7 +39,7 @@ import com.xdadan.erp.emis.service.IEmisQuoteDispAreaService;
|
||||
|
||||
/**
|
||||
* 派件区域Controller
|
||||
*
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:04
|
||||
*/
|
||||
@ -89,8 +91,9 @@ public class EmisQuoteDispAreaController extends EmisBaseController
|
||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteDispArea:add')")
|
||||
@Log(title = "派件区域", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisQuoteDispArea emisQuoteDispArea)
|
||||
{
|
||||
public AjaxResult add(@RequestBody EmisQuoteDispArea emisQuoteDispArea) throws EmisBizError {
|
||||
// 校验数据
|
||||
emisQuoteDispAreaService.validateEmisQuoteDispArea(emisQuoteDispArea, false);
|
||||
return toAjax(emisQuoteDispAreaService.insertEmisQuoteDispArea(emisQuoteDispArea));
|
||||
}
|
||||
|
||||
@ -100,8 +103,9 @@ public class EmisQuoteDispAreaController extends EmisBaseController
|
||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteDispArea:edit')")
|
||||
@Log(title = "派件区域", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisQuoteDispArea emisQuoteDispArea)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody EmisQuoteDispArea emisQuoteDispArea) throws EmisBizError {
|
||||
// 校验数据
|
||||
emisQuoteDispAreaService.validateEmisQuoteDispArea(emisQuoteDispArea, true);
|
||||
return toAjax(emisQuoteDispAreaService.updateEmisQuoteDispArea(emisQuoteDispArea));
|
||||
}
|
||||
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisQuoteSendAreaController.java
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:05
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 寄件区域 控制器 </p>
|
||||
*/
|
||||
|
||||
@ -14,7 +14,6 @@ package com.xdadan.erp.web.emis;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@ -25,19 +24,18 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
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.page.TableDataInfo;
|
||||
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.emis.domain.EmisQuoteSendArea;
|
||||
import com.xdadan.erp.emis.service.IEmisQuoteSendAreaService;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
* 寄件区域Controller
|
||||
*
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:05
|
||||
*/
|
||||
@ -89,8 +87,9 @@ public class EmisQuoteSendAreaController extends EmisBaseController
|
||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteSendArea:add')")
|
||||
@Log(title = "寄件区域", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody EmisQuoteSendArea emisQuoteSendArea)
|
||||
{
|
||||
public AjaxResult add(@RequestBody EmisQuoteSendArea emisQuoteSendArea) throws EmisBizError {
|
||||
// 校验数据
|
||||
emisQuoteSendAreaService.validateEmisQuoteSendArea(emisQuoteSendArea, true);
|
||||
return toAjax(emisQuoteSendAreaService.insertEmisQuoteSendArea(emisQuoteSendArea));
|
||||
}
|
||||
|
||||
@ -100,8 +99,9 @@ public class EmisQuoteSendAreaController extends EmisBaseController
|
||||
// @PreAuthorize("@ss.hasPermi('emis:emisQuoteSendArea:edit')")
|
||||
@Log(title = "寄件区域", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody EmisQuoteSendArea emisQuoteSendArea)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody EmisQuoteSendArea emisQuoteSendArea) throws EmisBizError {
|
||||
// 校验数据
|
||||
emisQuoteSendAreaService.validateEmisQuoteSendArea(emisQuoteSendArea, true);
|
||||
return toAjax(emisQuoteSendAreaService.updateEmisQuoteSendArea(emisQuoteSendArea));
|
||||
}
|
||||
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisQuoteDispAreaService.java
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:03
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 派件区域 服务类接口 </p>
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
* @ClassName EmisQuoteDispAreaService
|
||||
@ -18,18 +19,18 @@ import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:03
|
||||
*/
|
||||
public interface IEmisQuoteDispAreaService
|
||||
public interface IEmisQuoteDispAreaService
|
||||
{
|
||||
/**
|
||||
* 主键查询
|
||||
* @param areaId
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public EmisQuoteDispArea selectEmisQuoteDispAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 查询派件区域列表
|
||||
*
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @return 派件区域集合
|
||||
*/
|
||||
@ -37,7 +38,7 @@ public interface IEmisQuoteDispAreaService
|
||||
|
||||
/**
|
||||
* 新增派件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -45,7 +46,7 @@ public interface IEmisQuoteDispAreaService
|
||||
|
||||
/**
|
||||
* 修改派件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -53,7 +54,7 @@ public interface IEmisQuoteDispAreaService
|
||||
|
||||
/**
|
||||
* 批量删除派件区域
|
||||
*
|
||||
*
|
||||
* @param areaIds 需要删除的派件区域主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -61,9 +62,18 @@ public interface IEmisQuoteDispAreaService
|
||||
|
||||
/**
|
||||
* 删除派件区域信息
|
||||
*
|
||||
*
|
||||
* @param areaId 派件区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisQuoteDispAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 校验派件区域数据
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @param isUpdate 是否为更新操作
|
||||
* @throws EmisBizError 校验失败时抛出异常
|
||||
*/
|
||||
public void validateEmisQuoteDispArea(EmisQuoteDispArea emisQuoteDispArea, boolean isUpdate) throws EmisBizError;
|
||||
}
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisQuoteSendAreaService.java
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:05
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 寄件区域 服务类接口 </p>
|
||||
*/
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
||||
import com.xdadan.erp.emis.domain.exception.EmisBizError;
|
||||
|
||||
/**
|
||||
* @ClassName EmisQuoteSendAreaService
|
||||
@ -18,18 +19,18 @@ import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:05
|
||||
*/
|
||||
public interface IEmisQuoteSendAreaService
|
||||
public interface IEmisQuoteSendAreaService
|
||||
{
|
||||
/**
|
||||
* 主键查询
|
||||
* @param areaId
|
||||
* @return
|
||||
* @return
|
||||
*/
|
||||
public EmisQuoteSendArea selectEmisQuoteSendAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 查询寄件区域列表
|
||||
*
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @return 寄件区域集合
|
||||
*/
|
||||
@ -37,7 +38,7 @@ public interface IEmisQuoteSendAreaService
|
||||
|
||||
/**
|
||||
* 新增寄件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -45,7 +46,7 @@ public interface IEmisQuoteSendAreaService
|
||||
|
||||
/**
|
||||
* 修改寄件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -53,7 +54,7 @@ public interface IEmisQuoteSendAreaService
|
||||
|
||||
/**
|
||||
* 批量删除寄件区域
|
||||
*
|
||||
*
|
||||
* @param areaIds 需要删除的寄件区域主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
@ -61,9 +62,18 @@ public interface IEmisQuoteSendAreaService
|
||||
|
||||
/**
|
||||
* 删除寄件区域信息
|
||||
*
|
||||
*
|
||||
* @param areaId 寄件区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisQuoteSendAreaByAreaId(Long areaId);
|
||||
|
||||
/**
|
||||
* 校验寄件区域数据
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @param isUpdate 是否为更新操作
|
||||
* @throws EmisBizError 校验失败时抛出异常
|
||||
*/
|
||||
public void validateEmisQuoteSendArea(EmisQuoteSendArea emisQuoteSendArea, boolean isUpdate) throws EmisBizError;
|
||||
}
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisQuoteDispAreaServiceImpl.java
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:04
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 派件区域 实体类 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -18,10 +20,13 @@ import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisQuoteDispArea;
|
||||
import com.xdadan.erp.emis.mapper.EmisQuoteDispAreaMapper;
|
||||
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业务层处理
|
||||
*
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:04
|
||||
*/
|
||||
@ -33,7 +38,7 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 查询派件区域
|
||||
*
|
||||
*
|
||||
* @param areaId 派件区域主键
|
||||
* @return 派件区域
|
||||
*/
|
||||
@ -45,7 +50,7 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 查询派件区域列表
|
||||
*
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @return 派件区域
|
||||
*/
|
||||
@ -58,7 +63,7 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 新增派件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -72,7 +77,7 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 修改派件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteDispArea 派件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -85,7 +90,7 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 批量删除派件区域
|
||||
*
|
||||
*
|
||||
* @param areaIds 需要删除的派件区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -97,7 +102,7 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 删除派件区域信息
|
||||
*
|
||||
*
|
||||
* @param areaId 派件区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -107,4 +112,45 @@ public class EmisQuoteDispAreaServiceImpl extends EmisBaseService implements IEm
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,16 +1,18 @@
|
||||
/**
|
||||
/**
|
||||
* @Project: emis
|
||||
* @Title: EmisQuoteSendAreaServiceImpl.java
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:05
|
||||
* @Copyright: ShangHai Duta 2022 All rights reserved.
|
||||
* @version v1.0
|
||||
* @version v1.0
|
||||
* @Description: <p> 寄件区域 实体类 </p>
|
||||
*/
|
||||
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.xdadan.erp.emis.service.EmisBaseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -18,10 +20,13 @@ import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.domain.EmisQuoteSendArea;
|
||||
import com.xdadan.erp.emis.mapper.EmisQuoteSendAreaMapper;
|
||||
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业务层处理
|
||||
*
|
||||
*
|
||||
* @author linfso
|
||||
* @date 2024-01-12 08:40:05
|
||||
*/
|
||||
@ -33,7 +38,7 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 查询寄件区域
|
||||
*
|
||||
*
|
||||
* @param areaId 寄件区域主键
|
||||
* @return 寄件区域
|
||||
*/
|
||||
@ -45,7 +50,7 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 查询寄件区域列表
|
||||
*
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @return 寄件区域
|
||||
*/
|
||||
@ -58,7 +63,7 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 新增寄件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -71,7 +76,7 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 修改寄件区域
|
||||
*
|
||||
*
|
||||
* @param emisQuoteSendArea 寄件区域
|
||||
* @return 结果
|
||||
*/
|
||||
@ -84,7 +89,7 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 批量删除寄件区域
|
||||
*
|
||||
*
|
||||
* @param areaIds 需要删除的寄件区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -96,7 +101,7 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
|
||||
/**
|
||||
* 删除寄件区域信息
|
||||
*
|
||||
*
|
||||
* @param areaId 寄件区域主键
|
||||
* @return 结果
|
||||
*/
|
||||
@ -106,4 +111,45 @@ public class EmisQuoteSendAreaServiceImpl extends EmisBaseService implements IEm
|
||||
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