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