Browse Source

feat: [模板管理] 标号修改

master
memorylkf 2 months ago
parent
commit
2d7b79524c
13 changed files with 102 additions and 59 deletions
  1. +3
    -3
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java
  2. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java
  3. +12
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java
  4. +11
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java
  5. +4
    -9
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java
  6. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SnGenMapper.java
  7. +3
    -10
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java
  8. +9
    -11
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java
  9. +7
    -6
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java
  10. +25
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java
  11. +4
    -6
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanServiceImpl.java
  12. +21
    -5
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreServiceImpl.java
  13. +1
    -1
      hxhq-modules/hxhq-system/src/main/resources/mapper/business/SnGenMapper.xml

+ 3
- 3
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java View File

@ -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<String> 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);
}

+ 1
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/TemplateController.java View File

@ -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();
}

+ 12
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java View File

@ -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;
}

+ 11
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormFill.java View File

@ -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;
}

+ 4
- 9
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java View File

@ -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;

+ 1
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/mapper/SnGenMapper.java View File

@ -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);
}

+ 3
- 10
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java View File

@ -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);
}

+ 9
- 11
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java View File

@ -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<SnGen> 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);
}
}

+ 7
- 6
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java View File

@ -58,6 +58,8 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
private ISysDeptService sysDeptService;
@Autowired
private INoticeService noticeService;
@Autowired
private IStudySubjectService studySubjectService;
/**
* 查询试验-申请单列表
@ -669,12 +671,11 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
if (template == null) {
throw new ServiceException("模板不存在或已删除");
}
SysDept dep = sysDeptService.selectDeptById(template.getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
}
// MB+表单名缩写(底层模板名称)+版本号+试验编号+学科缩写+流水号
return template.getShowSn() + "-" + study.getSn() + "-" + dep.getAbbr() + "-" + snGenService.getNewSn(SnTypeEnum.ybbd.getValue());
//学科缩写:新增配制计划表学科简称SD非试验表单学科简称GG麻精药表单学科简称GSP
// 有预填的=预填编号+流水号没有得=模板编号+试验编号+学科缩写+01+流水号
String pre = template.getShowSn() + "-" + study.getSn() + "-GSP-01";
return pre+ snGenService.getNewSn(pre,SnTypeEnum.noDate.getValue());
}

+ 25
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormFillServiceImpl.java View File

@ -65,6 +65,10 @@ public class StudyFormFillServiceImpl extends ServiceImpl
private IMjyService mjyService;
@Autowired
private IGyzjService gyzjService;
@Autowired
private IStudyFormPreService studyFormPreService;
@Autowired
private IStudySubjectService studySubjectService;
/**
* 查询试验-填报单列表
@ -730,12 +734,28 @@ public class StudyFormFillServiceImpl extends ServiceImpl
if (template == null) {
throw new ServiceException("模板不存在或已删除");
}
SysDept dep = sysDeptService.selectDeptById(template.getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
//学科缩写:新增配制计划表学科简称SD非试验表单学科简称GG麻精药表单学科简称GSP
String abbr = "";
if(studyFormFill.getStudyFormPreId()==null){
if(study.getType().equals(StudyTypeEnum.sy.getValue())){
SysDept dep = sysDeptService.selectDeptById(studySubjectService.getById(studyFormFill.getStudySubjectId()).getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
}
abbr = dep.getAbbr();
}
if(study.getType().equals(StudyTypeEnum.fsy.getValue())){
abbr = "GG";
}
if(study.getType().equals(StudyTypeEnum.mjy.getValue())){
abbr = "GSP";
}
}
// MB+表单名缩写(底层模板名称)+版本号+试验编号+学科缩写+流水号+流水号
return template.getShowSn() + "-" + study.getSn() + "-" + dep.getAbbr() + "-" + snGenService.getNewSn(SnTypeEnum.tbbd.getValue()) + "-" + snGenService.getNewSn(SnTypeEnum.tbbd.getValue());
// 有预填的=预填编号+流水号没有得=模板编号+试验编号+学科缩写+01+流水号
String pre = studyFormFill.getStudyFormPreId()==null?
(template.getShowSn() + "-" + study.getSn() + "-" + abbr+"-01")
:studyFormPreService.getById(studyFormFill.getStudyFormPreId()).getBdbh();
return pre + snGenService.getNewSn(pre,SnTypeEnum.noDate.getValue());
}

+ 4
- 6
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPlanServiceImpl.java View File

@ -477,12 +477,10 @@ public class StudyFormPlanServiceImpl extends ServiceImpl
if (template == null) {
throw new ServiceException("模板不存在或已删除");
}
SysDept dep = sysDeptService.selectDeptById(template.getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
}
// MB+表单名缩写(底层模板名称)+版本号+试验编号+学科缩写+流水号
return template.getShowSn() + "-" + study.getSn() + "-" + dep.getAbbr() + "-" + snGenService.getNewSn(SnTypeEnum.ybbd.getValue());
//学科缩写:新增配制计划表学科简称SD非试验表单学科简称GG麻精药表单学科简称GSP
// 有预填的=预填编号+流水号没有得=模板编号+试验编号+学科缩写+01+流水号
String pre = template.getShowSn() + "-" + study.getSn() + "-SD-01";
return pre + snGenService.getNewSn(pre,SnTypeEnum.noDate.getValue());
}

+ 21
- 5
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormPreServiceImpl.java View File

@ -63,6 +63,8 @@ public class StudyFormPreServiceImpl extends ServiceImpl
private ISysDeptService sysDeptService;
@Autowired
private INoticeService noticeService;
@Autowired
private IStudySubjectService studySubjectService;
/**
* 查询试验-预填单列表
@ -598,12 +600,26 @@ public class StudyFormPreServiceImpl extends ServiceImpl
if (template == null) {
throw new ServiceException("模板不存在或已删除");
}
SysDept dep = sysDeptService.selectDeptById(template.getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
//学科缩写:新增配制计划表学科简称SD非试验表单学科简称GG麻精药表单学科简称GSP
String abbr = "";
if(study.getType().equals(StudyTypeEnum.sy.getValue())){
SysDept dep = sysDeptService.selectDeptById(studySubjectService.getById(studyFormPre.getStudySubjectId()).getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
}
abbr = dep.getAbbr();
}
if(study.getType().equals(StudyTypeEnum.fsy.getValue())){
abbr = "GG";
}
if(study.getType().equals(StudyTypeEnum.mjy.getValue())){
abbr = "GSP";
}
// MB+表单名缩写(底层模板名称)+版本号+试验编号+学科缩写+流水号
return template.getShowSn() + "-" + study.getSn() + "-" + dep.getAbbr() + "-" + snGenService.getNewSn(SnTypeEnum.ybbd.getValue());
// 模板编号+试验编号+学科缩写+流水号
String pre = template.getShowSn() + "-" + study.getSn() + "-" + abbr;
return pre + snGenService.getNewSn(pre,SnTypeEnum.noDate.getValue());
}
/**

+ 1
- 1
hxhq-modules/hxhq-system/src/main/resources/mapper/business/SnGenMapper.xml View File

@ -4,6 +4,6 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hxhq.business.mapper.SnGenMapper">
<update id="addSn">
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'
</update>
</mapper>

Loading…
Cancel
Save