Browse Source

feat:[试验管理]编号生成

master
15881625488@163.com 3 months ago
parent
commit
ed14b8c1d4
5 changed files with 76 additions and 4 deletions
  1. +5
    -2
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java
  2. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/SnGen.java
  3. +56
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/enums/SnTypeEnum.java
  4. +1
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISnGenService.java
  5. +4
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SnGenServiceImpl.java

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

@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hxhq.business.domain.*;
import com.hxhq.business.dto.sj.SjListDto;
import com.hxhq.business.dto.study.StudyListDto;
import com.hxhq.business.enums.NormalEnum;
import com.hxhq.business.enums.SnTypeEnum;
import com.hxhq.business.enums.study.StudyStatusEnum;
import com.hxhq.business.form.common.SignForm;
import com.hxhq.business.form.sj.SjSearchListForm;
@ -74,11 +76,11 @@ public class PublicController extends BaseController {
@GetMapping("/getSn")
public AjaxResult getSn(Integer count) {
if (count == null || count.intValue() <= 1) {
return AjaxResult.success("操作成功",snGenService.getNewSn());
return AjaxResult.success("操作成功",snGenService.getNewSn(SnTypeEnum.wz.getValue()));
}else{
List<String> list = new ArrayList<>();
for (int i = 0; i < count;i++){
list.add(snGenService.getNewSn());
list.add(snGenService.getNewSn(SnTypeEnum.wz.getValue()));
}
return AjaxResult.success(list);
}
@ -127,6 +129,7 @@ public class PublicController extends BaseController {
@GetMapping("/templateList")
public TableDataInfo list(Template template) {
startPage();
template.setStatus(NormalEnum.yes.getValue());
List<Template> list = templateService.queryList(template);
return getDataTable(list);
}

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

@ -21,6 +21,16 @@ public class SnGen extends MpBaseEntity
/** 当前编号 */
private Integer sn;
/** 类型:1:物资;3:一般表单;5:填报表单 */
private Integer type;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public void setDate(String date)
{

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

@ -0,0 +1,56 @@
package com.hxhq.business.enums;
/**
* 类型1物资3一般表单5填报表单
* @author tanfei
*/
public enum SnTypeEnum {
/**
* 物资
*/
wz(1, "物资"),
/**
* 一般表单
*/
ybbd(3, "一般表单"),
/**
* 填报表单
*/
tbbd(5, "填报表单");
private int value;
private String text;
SnTypeEnum(int value, String text) {
this.value = value;
this.text = text;
}
public int getValue() {
return value;
}
public void setValue(int value) {
this.value = value;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public static SnTypeEnum getEnumByValue(int type) {
for (SnTypeEnum bt : values()) {
if (bt.value == type) {
return bt;
}
}
return null;
}
}

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

@ -16,5 +16,5 @@ public interface ISnGenService extends IService
* 获取新编号
* @return
*/
String getNewSn();
String getNewSn(Integer type);
}

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

@ -31,17 +31,20 @@ public class SnGenServiceImpl extends ServiceImpl implements
private final Lock lock = new ReentrantLock(true);
@Override
public String getNewSn() {
public String getNewSn(Integer type) {
lock.lock();
try {
Integer sort = 1;
String date = DateUtils.dateTimeNow("yyMMdd");
QueryWrapper<SnGen> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("date",date);
queryWrapper.eq("type",type);
if(count(queryWrapper)==0){
SnGen snGen = new SnGen();
snGen.setDate(date);
snGen.setSn(sort);
snGen.setSn(sort);
snGen.setType(type);
save(snGen);
}else{
baseMapper.addSn(date);

Loading…
Cancel
Save