Browse Source

fix:[资源库管理]麻精药申请单

master
15881625488@163.com 3 months ago
parent
commit
13802f0ac4
2 changed files with 99 additions and 8 deletions
  1. +37
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudyFormApply.java
  2. +62
    -8
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyFormApplyServiceImpl.java

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

@ -2,6 +2,7 @@ package com.hxhq.business.domain;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableName;
@ -26,6 +27,18 @@ public class StudyFormApply extends MpBaseEntity
/** 所属试验学科id */
private Long studySubjectId;
/** 试验id */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long syId;
/** 部门id */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long bmId;
/** sdid */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private Long sdId;
/** 表单编号 */
private String bdbh;
@ -117,6 +130,30 @@ public class StudyFormApply extends MpBaseEntity
@TableField(exist = false)
private String studyMc;
public Long getSyId() {
return syId;
}
public void setSyId(Long syId) {
this.syId = syId;
}
public Long getBmId() {
return bmId;
}
public void setBmId(Long bmId) {
this.bmId = bmId;
}
public Long getSdId() {
return sdId;
}
public void setSdId(Long sdId) {
this.sdId = sdId;
}
public String getTemplateMcEn() {
return templateMcEn;
}

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

@ -258,6 +258,24 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
public StudyFormApply bc(StudyFormApply studyFormApply) {
StudyFormApply result = null;
SysUser qmr = SecurityUtils.getLoginUser().getSysUser();
JSONObject bdnr = JSONObject.parseObject(studyFormApply.getBdnr());
if (bdnr != null) {
if (bdnr.getInteger("syId") != null) {
studyFormApply.setSyId(bdnr.getLong("syId"));
} else {
studyFormApply.setSyId(null);
}
if (bdnr.getInteger("bmId") != null) {
studyFormApply.setBmId(bdnr.getLong("bmId"));
} else {
studyFormApply.setBmId(null);
}
if (bdnr.getInteger("sdId") != null) {
studyFormApply.setSdId(bdnr.getLong("sdId"));
} else {
studyFormApply.setSdId(null);
}
}
if (studyFormApply.getId() != null) {
StudyFormApply studyFormApplyOld = this.queryInfo(studyFormApply.getId());
if (studyFormApplyOld == null) {
@ -266,6 +284,9 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
if (!qmr.getUserId().equals(studyFormApplyOld.getUserId())) {
throw new ServiceException("只能操作自己的表单");
}
studyFormApplyOld.setSyId(studyFormApply.getSyId());
studyFormApplyOld.setBmId(studyFormApply.getBmId());
studyFormApplyOld.setSdId(studyFormApply.getSdId());
studyFormApplyOld.setBdmc(studyFormApply.getBdmc());
studyFormApplyOld.setTemplateId(studyFormApply.getTemplateId());
studyFormApplyOld.setBdnr(studyFormApply.getBdnr());
@ -282,6 +303,7 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
}
result = studyFormApplyOld;
} else {
studyFormApply.setBdzt(StudyFormApplyBdztEnum.tbz.getValue());
studyFormApply.setUserId(qmr.getUserId());
studyFormApply.setBdbh(getSn(studyFormApply));
@ -315,6 +337,18 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
studyFormApply.setUserMc(SecurityUtils.getNickName());
studyFormApply.setBdbh(getSn(studyFormApply));
}
JSONObject bdnr = JSONObject.parseObject(studyFormApply.getBdnr());
if (bdnr != null) {
if (bdnr.getInteger("syId") != null) {
studyFormApply.setSyId(bdnr.getLong("syId"));
}
if (bdnr.getInteger("bmId") != null) {
studyFormApply.setBmId(bdnr.getLong("bmId"));
}
if (bdnr.getInteger("sdId") != null) {
studyFormApply.setSdId(bdnr.getLong("sdId"));
}
}
studyFormApply.setBdzt(StudyFormApplyBdztEnum.ytj.getValue());
studyFormApply.setTjsj(new Date());
this.saveOrUpdate(studyFormApply);
@ -496,8 +530,27 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
@Override
public void updateBdnr(StudyFormUpdateForm form) {
SysUser qmr = SecurityUtils.getLoginUser().getSysUser();
JSONObject bdnr = JSONObject.parseObject(form.getBdnr());
//更新表单内容
StudyFormApply studyFormApplyOld = this.queryInfo(form.getId());
if (bdnr != null) {
if (bdnr.getInteger("syId") != null) {
studyFormApplyOld.setSyId(bdnr.getLong("syId"));
} else {
studyFormApplyOld.setSyId(null);
}
if (bdnr.getInteger("bmId") != null) {
studyFormApplyOld.setBmId(bdnr.getLong("bmId"));
} else {
studyFormApplyOld.setBmId(null);
}
if (bdnr.getInteger("sdId") != null) {
studyFormApplyOld.setSdId(bdnr.getLong("sdId"));
} else {
studyFormApplyOld.setSdId(null);
}
}
studyFormApplyOld.setBdnr(form.getBdnr());
studyFormApplyOld.setZdxgjl(form.getZdxgjl());
this.updateById(studyFormApplyOld);
@ -588,23 +641,24 @@ public class StudyFormApplyServiceImpl extends ServiceImpl
/**
* 生成编号
*
* @param studyFormApply
* @return
*/
public String getSn(StudyFormApply studyFormApply){
Study study=studyService.getById(studyFormApply.getStudyId());
if(study==null){
public String getSn(StudyFormApply studyFormApply) {
Study study = studyService.getById(studyFormApply.getStudyId());
if (study == null) {
throw new ServiceException("试验不存在或已删除");
}
Template template=templateService.getById(studyFormApply.getTemplateId());
if(template==null){
Template template = templateService.getById(studyFormApply.getTemplateId());
if (template == null) {
throw new ServiceException("模板不存在或已删除");
}
SysDept dep=sysDeptService.selectDeptById(template.getDeptId());
if(dep==null){
SysDept dep = sysDeptService.selectDeptById(template.getDeptId());
if (dep == null) {
throw new ServiceException("学科不存在或已删除");
}
// MB+表单名缩写(底层模板名称)+版本号+试验编号+学科缩写+流水号
return "MB"+template.getShowSn()+study.getSn()+dep.getAbbr()+snGenService.getNewSn(SnTypeEnum.ybbd.getValue());
return "MB" + template.getShowSn() + study.getSn() + dep.getAbbr() + snGenService.getNewSn(SnTypeEnum.ybbd.getValue());
}
}

Loading…
Cancel
Save