From 2d7b79524ce6a2d8580542dee5cf7b7d1bcc4f06 Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Fri, 30 Jan 2026 20:07:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[=E6=A8=A1=E6=9D=BF=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20=E6=A0=87=E5=8F=B7=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/PublicController.java | 6 ++--- .../business/controller/TemplateController.java | 2 +- .../main/java/com/hxhq/business/domain/SnGen.java | 13 +++++++++- .../com/hxhq/business/domain/StudyFormFill.java | 11 ++++++++ .../java/com/hxhq/business/enums/SnTypeEnum.java | 13 +++------- .../java/com/hxhq/business/mapper/SnGenMapper.java | 2 +- .../com/hxhq/business/service/ISnGenService.java | 13 +++------- .../business/service/impl/SnGenServiceImpl.java | 20 +++++++-------- .../service/impl/StudyFormApplyServiceImpl.java | 13 +++++----- .../service/impl/StudyFormFillServiceImpl.java | 30 ++++++++++++++++++---- .../service/impl/StudyFormPlanServiceImpl.java | 10 +++----- .../service/impl/StudyFormPreServiceImpl.java | 26 +++++++++++++++---- .../main/resources/mapper/business/SnGenMapper.xml | 2 +- 13 files changed, 102 insertions(+), 59 deletions(-) diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java index 2c30c9c..693b7dd 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java @@ -74,17 +74,17 @@ public class PublicController extends BaseController { /** * 获取编号 * @param count - * @param my 母液编号(分装用) + * @param type 母液编号(分装用) * @return */ @GetMapping("/getSn") - public AjaxResult getSn(Integer count,String my) { + public AjaxResult getSn(Integer count,String pre,Integer type) { if (count == null || count.intValue() <= 1) { count = 1; } List list = new ArrayList<>(); for (int i = 0; i < count;i++){ - list.add(snGenService.getNewSn(SnTypeEnum.wz.getValue(),my)); + list.add(snGenService.getNewSn(pre,type)); } return AjaxResult.success(list); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java index 5579ddd..c179615 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java @@ -54,7 +54,7 @@ public class TemplateController extends BaseController @PostMapping("/save") public AjaxResult save(@RequestBody Template template) { - template.setShowSn("MB-"+PinyinUtil.getFirstLetter(template.getName(),"").toUpperCase()+"V01"); + template.setShowSn("MB-"+PinyinUtil.getFirstLetter(template.getName(),"").toUpperCase()+"-V01"); templateService.saveOrUpdate(template); return AjaxResult.success(); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java index cfd99e4..fd81ad7 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java @@ -15,15 +15,26 @@ public class SnGen extends MpBaseEntity { private static final long serialVersionUID = 1L; + /** 前缀 */ + private String pre; + /** 日期 */ private String date; /** 当前编号 */ private Integer sn; - /** 类型:1:物资;3:一般表单;5:填报表单 */ + /** 类型:1:需要日期;2不需要日期 */ private Integer type; + public String getPre() { + return pre; + } + + public void setPre(String pre) { + this.pre = pre; + } + public Integer getType() { return type; } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java index 80c6b0a..88bd9e3 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java @@ -27,6 +27,9 @@ public class StudyFormFill extends MpBaseEntity /** 所属试验学科id */ private Long studySubjectId; + /** 所属试验学科id */ + private Long studyFormPreId; + /** 表单编号 */ private String bdbh; @@ -320,6 +323,14 @@ public class StudyFormFill extends MpBaseEntity this.studySubjectId = studySubjectId; } + public Long getStudyFormPreId() { + return studyFormPreId; + } + + public void setStudyFormPreId(Long studyFormPreId) { + this.studyFormPreId = studyFormPreId; + } + public Date getTjsj() { return tjsj; } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java index 4af12fd..aacf02c 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java @@ -7,19 +7,14 @@ package com.hxhq.business.enums; public enum SnTypeEnum { /** - * 物资 + * 需要年月日 */ - wz(1, "物资"), + date(1, "需要年月日"), /** - * 一般表单 + * 不需要 */ - ybbd(3, "一般表单"), - - /** - * 填报表单 - */ - tbbd(5, "填报表单"); + noDate(3, "不需要"); private int value; private String text; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SnGenMapper.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SnGenMapper.java index 593f12b..e89858d 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SnGenMapper.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SnGenMapper.java @@ -16,5 +16,5 @@ public interface SnGenMapper extends BaseMapper * 递增id * @param date */ - void addSn(@Param("date") String date,@Param("type") Integer type); + void addSn(@Param("pre") String pre,@Param("date") String date,@Param("type") Integer type); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java index 5591a01..6325a15 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java @@ -14,16 +14,9 @@ public interface ISnGenService extends IService { /** * 获取新编号 - * @param type - * @param my 母液编号(分装用) + * @param pre 前置编号 + * @param type 类型1需要年月日,2需要年月日 * @return */ - String getNewSn(Integer type, String my); - - /** - * 获取新编号 - * @param type - * @return - */ - String getNewSn(Integer type); + String getNewSn(String pre, Integer type); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java index 9f56c43..fd52930 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java @@ -6,7 +6,8 @@ import java.util.concurrent.locks.ReentrantLock; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; - import com.hxhq.common.core.utils.DateUtils; +import com.hxhq.business.enums.SnTypeEnum; +import com.hxhq.common.core.utils.DateUtils; import com.hxhq.common.core.utils.SpringUtils; import com.hxhq.common.core.utils.StringUtils; import com.hxhq.common.redis.service.RedisService; @@ -32,25 +33,27 @@ public class SnGenServiceImpl extends ServiceImpl implements private final Lock lock = new ReentrantLock(true); @Override - public String getNewSn(Integer type, String my) { + public String getNewSn(String pre, Integer type) { lock.lock(); try { Integer sort = 1; - String date = StringUtils.isBlank(my)? DateUtils.dateTimeNow("yyMMdd"):my; + String date = type.equals(SnTypeEnum.date.getValue())? DateUtils.dateTimeNow("yyMMdd"):""; QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("pre",pre); queryWrapper.eq("date",date); queryWrapper.eq("type",type); if(count(queryWrapper)==0){ SnGen snGen = new SnGen(); + snGen.setPre(pre); snGen.setDate(date); - snGen.setSn(sort); snGen.setType(type); + snGen.setSn(sort); save(snGen); }else{ - baseMapper.addSn(date,type); + baseMapper.addSn(pre,date,type); sort = getOne(queryWrapper,false).getSn(); } - return (StringUtils.isBlank(my)?(date+"-"):"")+String.format("%03d", sort); + return "-"+ (type.equals(SnTypeEnum.date.getValue())?(date+"-"):"")+String.format("%03d", sort); } catch (Exception e) { log.error("getNewSn执行被中断", e); } finally { @@ -58,9 +61,4 @@ public class SnGenServiceImpl extends ServiceImpl implements } return null; } - - @Override - public String getNewSn(Integer type) { - return getNewSn(type,null); - } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java index bf2fb9d..1049fa2 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java @@ -58,6 +58,8 @@ public class StudyFormApplyServiceImpl extends ServiceImpl - update t_sn_gen set sn = sn+1 where `date`=#{date} and `type`=#{type} and del_flag='0' + update t_sn_gen set sn = sn+1 where `pre`=#{pre} and `date`=#{date} and `type`=#{type} and del_flag='0' \ No newline at end of file