diff --git a/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCustomsLevelController.java b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCustomsLevelController.java
new file mode 100644
index 000000000..80ed34e37
--- /dev/null
+++ b/emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCustomsLevelController.java
@@ -0,0 +1,137 @@
+/**
+ * @Project: emis
+ * @Title: EmisCustomsLevelController.java
+ * @author heyu
+ * @date 2025-10-09 10:00:00
+ * @version v1.0
+ * @Description:
报关清关级别维护 控制器
+ */
+package com.xdadan.erp.web.emis;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+
+import com.alibaba.fastjson.JSONObject;
+import com.xdadan.erp.emis.domain.exception.EmisBizError;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DuplicateKeyException;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import com.xdadan.erp.common.annotation.Log;
+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.poi.ExcelUtil;
+
+import com.xdadan.erp.emis.domain.EmisCustomsLevel;
+import com.xdadan.erp.emis.service.IEmisCustomsLevelService;
+
+@RestController
+@RequestMapping("/emis/emisCustomsLevel")
+public class EmisCustomsLevelController extends EmisBaseController {
+ @Autowired
+ private IEmisCustomsLevelService emisCustomsLevelService;
+
+ /**
+ * 查询报关清关级别维护列表
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(EmisCustomsLevel emisCustomsLevel) {
+ startPage();
+ List list = emisCustomsLevelService.selectEmisCustomsLevelList(emisCustomsLevel);
+ return getDataTable(list);
+ }
+
+ /**
+ * 检查是否重复
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:list')")
+ @GetMapping("/checkUnique")
+ public AjaxResult checkUnique(EmisCustomsLevel emisCustomsLevel) {
+ int cnt = emisCustomsLevelService.checkUnique(emisCustomsLevel);
+ return AjaxResult.success("检查成功", cnt);
+ }
+
+ /**
+ * 导出报关清关级别维护列表
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:export')")
+ @Log(title = "报关清关级别维护", businessType = BusinessType.EXPORT)
+ @PostMapping("/export")
+ public void export(HttpServletResponse response, EmisCustomsLevel emisCustomsLevel) {
+ List list = emisCustomsLevelService.selectEmisCustomsLevelList(emisCustomsLevel);
+ ExcelUtil util = new ExcelUtil(EmisCustomsLevel.class);
+ util.exportExcel(response, list, "报关清关级别维护数据");
+ }
+
+ /**
+ * 获取详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id) {
+ return AjaxResult.success(emisCustomsLevelService.selectEmisCustomsLevelById(id));
+ }
+
+ /**
+ * 新增
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:add')")
+ @Log(title = "报关清关级别维护", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody EmisCustomsLevel emisCustomsLevel) {
+ return toAjax(emisCustomsLevelService.insertEmisCustomsLevel(emisCustomsLevel));
+ }
+
+ /**
+ * Excel草稿方式新增
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:draftSubmitLevel')")
+ @PostMapping(value = "/draftSubmitLevel")
+ public AjaxResult draftSubmitLevel(@RequestBody EmisCustomsLevel emisCustomsLevel) {
+ JSONObject jObjOut = new JSONObject();
+ String result = "success";
+ String msg = "提交成功";
+ try {
+ emisCustomsLevelService.draftSubmitLevel(emisCustomsLevel);
+ jObjOut.put("levelDetail", emisCustomsLevel);
+ } catch (DuplicateKeyException e) {
+ e.printStackTrace();
+ result = "fail";
+ msg = "数据重复";
+ } catch (Exception ex) {
+ result = "fail";
+ ex.printStackTrace();
+ msg = "系统异常:" + ex.getMessage();
+ // 兼容业务异常格式
+ if (ex instanceof EmisBizError) {
+ msg = ((EmisBizError) ex).getErrorCode() + ":" + ex.getMessage();
+ }
+ }
+ jObjOut.put("result", result);
+ jObjOut.put("msg", msg);
+ return AjaxResult.success("成功", jObjOut);
+ }
+
+ /**
+ * 修改
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:edit')")
+ @Log(title = "报关清关级别维护", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody EmisCustomsLevel emisCustomsLevel) {
+ return toAjax(emisCustomsLevelService.updateEmisCustomsLevel(emisCustomsLevel));
+ }
+
+ /**
+ * 删除
+ */
+ @PreAuthorize("@ss.hasPermi('emis:emisCustomsLevel:remove')")
+ @Log(title = "报关清关级别维护", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids) {
+ return toAjax(emisCustomsLevelService.deleteEmisCustomsLevelByIds(ids));
+ }
+}
diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisCustomsLevel.java b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisCustomsLevel.java
new file mode 100644
index 000000000..5f25dc84a
--- /dev/null
+++ b/emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisCustomsLevel.java
@@ -0,0 +1,51 @@
+/**
+ * @Project: emis
+ * @Title: EmisCustomsLevel.java
+ * @author heyu
+ * @date 2025-10-09 10:00:00
+ * @Copyright: ShangHai Duta 2022 All rights reserved.
+ * @version v1.0
+ * @Description: 报关清关级别维护 实体类
+ */
+
+package com.xdadan.erp.emis.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.xdadan.erp.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @ClassName EmisCustomsLevel
+ * @Description 报关清关级别维护
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class EmisCustomsLevel extends BaseEntity {
+ private static final long serialVersionUID = 1L;
+
+ /* 主键 id */
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+ /* 客户名称(不允许包含空格和特殊符号) */
+ private String customerName;
+
+ /* 类别(1:绿色、2:黄色、3:红色、4:黑色) */
+ private String category;
+
+ /* 报关/清关(1:报关、2:清关) */
+ private String bizType;
+
+ /* 开始时间(精确到日) */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date startDate;
+
+ /* 结束时间(精确到日) */
+ @JsonFormat(pattern = "yyyy-MM-dd")
+ private Date endDate;
+}
diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisCustomsLevelMapper.java b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisCustomsLevelMapper.java
new file mode 100644
index 000000000..319034731
--- /dev/null
+++ b/emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisCustomsLevelMapper.java
@@ -0,0 +1,45 @@
+/**
+ * @Project: emis
+ * @Title: EmisCustomsLevelMapper.java
+ * @author heyu
+ * @date 2025-10-09 10:00:00
+ * @version v1.0
+ * @Description: 报关清关级别维护 Mapper 接口
+ * Warning : This file is generate by ai tools,don't edit!!!
+ */
+package com.xdadan.erp.emis.mapper;
+
+import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.xdadan.erp.emis.domain.EmisCustomsLevel;
+
+/**
+ * @ClassName EmisCustomsLevelMapper
+ * @Description
+ *
+ * 报关清关级别维护 Mapper 接口
+ *
+ */
+public interface EmisCustomsLevelMapper extends BaseMapper {
+ /** 主键查询 */
+ public EmisCustomsLevel selectEmisCustomsLevelById(Long id);
+
+ /** 查询列表 */
+ public List selectEmisCustomsLevelList(EmisCustomsLevel emisCustomsLevel);
+
+ /** 新增 */
+ public int insertEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
+
+ /** 修改 */
+ public int updateEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
+
+ /** 删除 */
+ public int deleteEmisCustomsLevelById(Long id);
+
+ /** 批量删除 */
+ public int deleteEmisCustomsLevelByIds(Long[] ids);
+
+ /** 重复校验(客户名称 + 业务类型区分 + 时间重叠) */
+ public int checkUnique(EmisCustomsLevel emisCustomsLevel);
+}
+
diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisCustomsLevelService.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisCustomsLevelService.java
new file mode 100644
index 000000000..a468e207e
--- /dev/null
+++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisCustomsLevelService.java
@@ -0,0 +1,38 @@
+/**
+ * @Project: emis
+ * @Title: IEmisCustomsLevelService.java
+ * @author heyu
+ * @date 2025-10-09 10:00:00
+ * @version v1.0
+ * @Description: 报关清关级别维护 服务类接口
+ */
+package com.xdadan.erp.emis.service;
+
+import java.util.List;
+import com.xdadan.erp.emis.domain.EmisCustomsLevel;
+
+public interface IEmisCustomsLevelService {
+ /** 主键查询 */
+ public EmisCustomsLevel selectEmisCustomsLevelById(Long id);
+
+ /** 查询列表 */
+ public List selectEmisCustomsLevelList(EmisCustomsLevel emisCustomsLevel);
+
+ /** 重复校验 */
+ public int checkUnique(EmisCustomsLevel emisCustomsLevel);
+
+ /** 草稿新增 */
+ public void draftSubmitLevel(EmisCustomsLevel emisCustomsLevel);
+
+ /** 新增 */
+ public int insertEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
+
+ /** 修改 */
+ public int updateEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel);
+
+ /** 批量删除 */
+ public int deleteEmisCustomsLevelByIds(Long[] ids);
+
+ /** 删除 */
+ public int deleteEmisCustomsLevelById(Long id);
+}
diff --git a/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java
new file mode 100644
index 000000000..87c7429c4
--- /dev/null
+++ b/emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java
@@ -0,0 +1,183 @@
+/**
+ * @Project: emis
+ * @Title: EmisCustomsLevelServiceImpl.java
+ * @author heyu
+ * @date 2025-10-09 10:00:00
+ * @version v1.0
+ * @Description: 报关清关级别维护 Service 实现
+ */
+package com.xdadan.erp.emis.service.impl;
+
+import java.util.List;
+import java.util.regex.Pattern;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.xdadan.erp.emis.domain.EmisCustomsLevel;
+import com.xdadan.erp.emis.mapper.EmisCustomsLevelMapper;
+import com.xdadan.erp.emis.service.IEmisCustomsLevelService;
+
+@Service
+public class EmisCustomsLevelServiceImpl implements IEmisCustomsLevelService {
+ @Autowired
+ private EmisCustomsLevelMapper emisCustomsLevelMapper;
+
+ private static final Pattern INVALID_NAME_PATTERN = Pattern
+ .compile("[\\s`~!@#$%^&*()+=|{}':;',\\[\\]\\.<>/?!¥…()—【】‘;:”“’。,、?]");
+
+ /**
+ * 将前端传来的name转换为对应的code
+ *
+ * @param emisCustomsLevel 报关清关级别对象
+ */
+ private void convertNameToCode(EmisCustomsLevel emisCustomsLevel) {
+ if (emisCustomsLevel == null) {
+ return;
+ }
+
+ // 转换类别name为code
+ if (StringUtils.isNotBlank(emisCustomsLevel.getCategory())) {
+ String categoryCode = convertCategoryNameToCode(emisCustomsLevel.getCategory());
+ emisCustomsLevel.setCategory(categoryCode);
+ }
+
+ // 转换业务类型name为code
+ if (StringUtils.isNotBlank(emisCustomsLevel.getBizType())) {
+ String bizTypeCode = convertBizTypeNameToCode(emisCustomsLevel.getBizType());
+ emisCustomsLevel.setBizType(bizTypeCode);
+ }
+ }
+
+ /**
+ * 转换类别名称到代码
+ *
+ * @param categoryName 类别名称
+ * @return 类别代码
+ */
+ private String convertCategoryNameToCode(String categoryName) {
+ if (StringUtils.isBlank(categoryName)) {
+ return categoryName;
+ }
+
+ switch (categoryName.trim()) {
+ case "绿色":
+ return "1";
+ case "黄色":
+ return "2";
+ case "红色":
+ return "3";
+ case "黑色":
+ return "4";
+ default:
+ // 如果已经是数字代码,直接返回
+ if ("1".equals(categoryName) || "2".equals(categoryName)
+ || "3".equals(categoryName) || "4".equals(categoryName)) {
+ return categoryName;
+ }
+ throw new IllegalArgumentException("不支持的类别名称: " + categoryName);
+ }
+ }
+
+ /**
+ * 转换业务类型名称到代码
+ *
+ * @param bizTypeName 业务类型名称
+ * @return 业务类型代码
+ */
+ private String convertBizTypeNameToCode(String bizTypeName) {
+ if (StringUtils.isBlank(bizTypeName)) {
+ return bizTypeName;
+ }
+
+ switch (bizTypeName.trim()) {
+ case "报关":
+ return "1";
+ case "清关":
+ return "2";
+ default:
+ // 如果已经是数字代码,直接返回
+ if ("1".equals(bizTypeName) || "2".equals(bizTypeName)) {
+ return bizTypeName;
+ }
+ throw new IllegalArgumentException("不支持的业务类型名称: " + bizTypeName);
+ }
+ }
+
+ private void validate(EmisCustomsLevel po) {
+ if (po == null) {
+ throw new IllegalArgumentException("参数为空");
+ }
+ if (StringUtils.isBlank(po.getCustomerName())) {
+ throw new IllegalArgumentException("客户名称不能为空");
+ }
+ if (INVALID_NAME_PATTERN.matcher(po.getCustomerName()).find()) {
+ throw new IllegalArgumentException("客户名称不能包含空格或特殊符号");
+ }
+ if (StringUtils.isBlank(po.getCategory()) || !("1".equals(po.getCategory()) || "2".equals(po.getCategory())
+ || "3".equals(po.getCategory()) || "4".equals(po.getCategory()))) {
+ throw new IllegalArgumentException("类别不合法");
+ }
+ if (StringUtils.isBlank(po.getBizType()) || !("1".equals(po.getBizType()) || "2".equals(po.getBizType()))) {
+ throw new IllegalArgumentException("业务类型不合法");
+ }
+ if (po.getStartDate() == null || po.getEndDate() == null) {
+ throw new IllegalArgumentException("开始时间和结束时间不能为空");
+ }
+ if (po.getEndDate().before(po.getStartDate())) {
+ throw new IllegalArgumentException("结束时间不能早于开始时间");
+ }
+ int cnt = emisCustomsLevelMapper.checkUnique(po);
+ if (cnt > 0) {
+ throw new IllegalArgumentException("已存在同客户同类型记录");
+ }
+ }
+
+ @Override
+ public EmisCustomsLevel selectEmisCustomsLevelById(Long id) {
+ return emisCustomsLevelMapper.selectEmisCustomsLevelById(id);
+ }
+
+ @Override
+ public List selectEmisCustomsLevelList(EmisCustomsLevel emisCustomsLevel) {
+ return emisCustomsLevelMapper.selectEmisCustomsLevelList(emisCustomsLevel);
+ }
+
+ @Override
+ public int checkUnique(EmisCustomsLevel emisCustomsLevel) {
+ return emisCustomsLevelMapper.checkUnique(emisCustomsLevel);
+ }
+
+ @Override
+ public int insertEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel) {
+ // 转换前端传来的name为code
+ convertNameToCode(emisCustomsLevel);
+ validate(emisCustomsLevel);
+ return emisCustomsLevelMapper.insertEmisCustomsLevel(emisCustomsLevel);
+ }
+
+ @Override
+ public void draftSubmitLevel(EmisCustomsLevel emisCustomsLevel) {
+ // 转换前端传来的name为code
+ convertNameToCode(emisCustomsLevel);
+ validate(emisCustomsLevel);
+ emisCustomsLevelMapper.insertEmisCustomsLevel(emisCustomsLevel);
+ }
+
+ @Override
+ public int updateEmisCustomsLevel(EmisCustomsLevel emisCustomsLevel) {
+ // 转换前端传来的name为code
+ convertNameToCode(emisCustomsLevel);
+ validate(emisCustomsLevel);
+ return emisCustomsLevelMapper.updateEmisCustomsLevel(emisCustomsLevel);
+ }
+
+ @Override
+ public int deleteEmisCustomsLevelByIds(Long[] ids) {
+ return emisCustomsLevelMapper.deleteEmisCustomsLevelByIds(ids);
+ }
+
+ @Override
+ public int deleteEmisCustomsLevelById(Long id) {
+ return emisCustomsLevelMapper.deleteEmisCustomsLevelById(id);
+ }
+}
diff --git a/emis-biz/src/main/resources/mapper/EmisCustomsLevelMapper.xml b/emis-biz/src/main/resources/mapper/EmisCustomsLevelMapper.xml
new file mode 100644
index 000000000..0faf2e3e4
--- /dev/null
+++ b/emis-biz/src/main/resources/mapper/EmisCustomsLevelMapper.xml
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, customer_name, category, biz_type, start_date, end_date,
+ remark, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
+ from emis_customs_level
+
+
+
+
+
+
+
+
+
+ insert into emis_customs_level
+
+ customer_name,
+ category,
+ biz_type,
+ start_date,
+ end_date,
+ remark,
+ create_by,
+ create_time,
+ create_site,
+ del_flag
+
+
+ #{customerName},
+ #{category},
+ #{bizType},
+ #{startDate},
+ #{endDate},
+ #{remark},
+ #{createBy},
+ #{createTime},
+ #{createSite},
+ '0'
+
+
+
+
+ update emis_customs_level
+
+ customer_name = #{customerName},
+ category = #{category},
+ biz_type = #{bizType},
+ start_date = #{startDate},
+ end_date = #{endDate},
+ update_by = #{updateBy},
+ update_time = #{updateTime},
+ update_site = #{updateSite},
+
+ where id = #{id}
+
+
+
+ update emis_customs_level set del_flag='2', update_time=now() where id = #{id}
+
+
+
+ update emis_customs_level set del_flag='2', update_time=now() where id in
+ #{id}
+
+
+
+
+