From e682fd0d2416ec219cfea4c91e17fd1dd51a31af Mon Sep 17 00:00:00 2001 From: aike <17730485278@139.com> Date: Mon, 13 Oct 2025 09:11:37 +0800 Subject: [PATCH] =?UTF-8?q?demand:=20=20TMS=E7=B3=BB=E7=BB=9F=EF=BC=9A?= =?UTF-8?q?=E8=BF=90=E5=8D=95=E5=BD=95=E5=85=A5=E6=8A=A5=E5=85=B3=E6=B8=85?= =?UTF-8?q?=E5=85=B3=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit committer: heyu --- .../web/emis/EmisCustomsLevelController.java | 137 +++++++++++++ .../erp/emis/domain/EmisCustomsLevel.java | 51 +++++ .../emis/mapper/EmisCustomsLevelMapper.java | 45 +++++ .../service/IEmisCustomsLevelService.java | 38 ++++ .../impl/EmisCustomsLevelServiceImpl.java | 183 ++++++++++++++++++ .../mapper/EmisCustomsLevelMapper.xml | 109 +++++++++++ 6 files changed, 563 insertions(+) create mode 100644 emis-biz-web/src/main/java/com/xdadan/erp/web/emis/EmisCustomsLevelController.java create mode 100644 emis-biz/src/main/java/com/xdadan/erp/emis/domain/EmisCustomsLevel.java create mode 100644 emis-biz/src/main/java/com/xdadan/erp/emis/mapper/EmisCustomsLevelMapper.java create mode 100644 emis-biz/src/main/java/com/xdadan/erp/emis/service/IEmisCustomsLevelService.java create mode 100644 emis-biz/src/main/java/com/xdadan/erp/emis/service/impl/EmisCustomsLevelServiceImpl.java create mode 100644 emis-biz/src/main/resources/mapper/EmisCustomsLevelMapper.xml 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报关清关级别维护 实体类
+ */ + +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报关清关级别维护 服务类接口
+ */ +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报关清关级别维护 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