From b8186fd14dfebded19f8da9c1c87bb18634b6bb9 Mon Sep 17 00:00:00 2001 From: memorylkf <312904636@qq.com> Date: Tue, 6 Jan 2026 16:54:35 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20[=E8=A1=A8=E5=8D=95=E7=AE=A1=E7=90=86]?= =?UTF-8?q?=20[=E9=9D=9E=E8=AF=95=E9=AA=8C=E8=A1=A8=E5=8D=95]=20=E9=9D=9E?= =?UTF-8?q?=E8=AF=95=E9=AA=8C=E8=A1=A8=E5=8D=95=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/NonTrialController.java | 296 +++++++++++++++++++++ .../hxhq/business/controller/StudyController.java | 5 + .../main/java/com/hxhq/business/domain/Study.java | 22 ++ .../hxhq/business/form/study/StudySearchForm.java | 12 + .../business/service/impl/StudyServiceImpl.java | 3 + .../main/resources/mapper/business/StudyMapper.xml | 2 +- 6 files changed, 339 insertions(+), 1 deletion(-) create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/NonTrialController.java diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/NonTrialController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/NonTrialController.java new file mode 100644 index 0000000..d6fb0b0 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/NonTrialController.java @@ -0,0 +1,296 @@ +package com.hxhq.business.controller; + +import com.alibaba.fastjson2.JSONObject; +import com.hxhq.business.domain.Study; +import com.hxhq.business.domain.StudyJcgj; +import com.hxhq.business.dto.study.StudyListDto; +import com.hxhq.business.enums.study.StudyStatusEnum; +import com.hxhq.business.enums.study.StudyTypeEnum; +import com.hxhq.business.form.common.SignForm; +import com.hxhq.business.form.study.StudySaveForm; +import com.hxhq.business.form.study.StudySearchForm; +import com.hxhq.business.service.IStudyJcgjService; +import com.hxhq.business.service.IStudyService; +import com.hxhq.common.core.utils.StringUtils; +import com.hxhq.common.core.web.controller.BaseController; +import com.hxhq.common.core.web.domain.AjaxResult; +import com.hxhq.common.core.web.page.TableDataInfo; +import com.hxhq.common.security.annotation.RequiresPermissions; +import com.hxhq.common.security.utils.SecurityUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +/** + * 试验Controller + * + * @author hxhq + * @date 2025-12-24 + */ +@RestController +@RequestMapping("/business/nonTrial") +public class NonTrialController extends BaseController +{ + @Autowired + private IStudyService studyService; + @Autowired + private IStudyJcgjService studyJcgjService; + + /** + * 查询试验列表 + */ + @GetMapping("/list") + @RequiresPermissions("business:form:nonTrial:list") + public TableDataInfo list(StudySearchForm form) + { + form.setType(StudyTypeEnum.fsy.getValue()); + startPage(); + List list = studyService.queryList(form); + TableDataInfo table = getDataTable(list); + table.setRows(initFormCount((List)table.getRows())); + return table; + } + + /** + * 设置表单数 + * @param list + * @return + */ + private List initFormCount(List list){ + if(list.size()>0){ + List countList = studyService.queryFormCountList(list.stream().map(o->o.getId()).collect(Collectors.toList())); + for(StudyListDto l : list){ + List matchList = countList.stream().filter(o->o.getId().equals(l.getId())).collect(Collectors.toList()); + if(matchList.size()>0){ + l.setFormCount(matchList.get(0).getFormCount()); + l.setFormFinishCount(matchList.get(0).getFormFinishCount()); + }else{ + l.setFormCount(0); + l.setFormFinishCount(0); + } + + } + } + return list; + } + + /** + * 获取试验详细信息 + */ + @RequiresPermissions({"business:form:nonTrial:add", "business:form:nonTrial:edit", "business:form:nonTrial:detail"}) + @GetMapping(value = "/info") + public AjaxResult getInfo(Long id) + { + Study study = studyService.getById(id); + if(study==null){ + return AjaxResult.error("信息不存在"); + } + StudyListDto info = JSONObject.parseObject(JSONObject.toJSONString(study),StudyListDto.class); + List idList = new ArrayList<>(); + idList.add(info.getId()); + List countList = studyService.queryFormCountList(idList); + if(countList.size()>0){ + info.setFormCount(countList.get(0).getFormCount()); + }else{ + info.setFormCount(0); + } + return AjaxResult.success(info); + } + + /** + * 新增/编辑试验信息 + */ + @RequiresPermissions({"business:form:nonTrial:add", "business:form:nonTrial:edit"}) + @PostMapping("/save") + public AjaxResult save(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + if(study==null){ + return AjaxResult.error("参数有误"); + } + if(StringUtils.isBlank(study.getName())){ + return AjaxResult.error("试验名称不能为空"); + } + if(StringUtils.isBlank(study.getSn())){ + return AjaxResult.error("试验编号不能为空"); + } + if(study.getLeader()==null || study.getLeader().longValue()<=0){ + return AjaxResult.error("试验负责人不能为空"); + } + if(study.getStatus()==null || study.getStatus().intValue()<=0){ + return AjaxResult.error("状态值有误"); + } + if(!study.getStatus().equals(StudyStatusEnum.cg.getValue()) && !study.getStatus().equals(StudyStatusEnum.syz.getValue())){ + return AjaxResult.error("状态有误"); + } + if(study.getId()==null){ + study.setType(StudyTypeEnum.fsy.getValue()); + study.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDept().getDeptId()); + study.setDeptName(SecurityUtils.getLoginUser().getSysUser().getDept().getDeptName()); + } + studyService.saveInfo(form); + return AjaxResult.success(); + } + + /** + * 稽查轨迹列表 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:detail"}) + @GetMapping("/jcgjList") + public TableDataInfo jcgjList(StudyJcgj form) + { + startPage(); + List list = studyJcgjService.queryList(form); + return getDataTable(list); + } + + /** + * 删除试验信息 + */ + @RequiresPermissions({"business:form:nonTrial:remove"}) + @PostMapping("/delete") + public AjaxResult delete(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + SignForm sign = form.getSign(); + if(study==null || sign==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0){ + return AjaxResult.error("参数有误"); + } + studyService.del(form); + return AjaxResult.success(); + } + + /** + * 检查锁定 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:sd"}) + @PostMapping("/checkSd") + public AjaxResult checkSd(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + if(study==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0){ + return AjaxResult.error("参数有误"); + } + studyService.checkSd(studyService.getById(study.getId())); + return AjaxResult.success(); + } + + /** + * 锁定 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:sd"}) + @PostMapping("/sd") + public AjaxResult sd(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + SignForm sign = form.getSign(); + if(study==null || sign==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0){ + return AjaxResult.error("参数有误"); + } + studyService.sd(form); + return AjaxResult.success(); + } + + /** + * 解锁 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:js"}) + @PostMapping("/js") + public AjaxResult js(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + SignForm sign = form.getSign(); + if(study==null || sign==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0){ + return AjaxResult.error("参数有误"); + } + studyService.js(form); + return AjaxResult.success(); + } + + /** + * 归档 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:gd"}) + @PostMapping("/gd") + public AjaxResult gd(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + SignForm sign = form.getSign(); + if(study==null || sign==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0){ + return AjaxResult.error("参数有误"); + } + studyService.gd(form); + return AjaxResult.success(); + } + + /** + * 解档 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:jd"}) + @PostMapping("/jd") + public AjaxResult jd(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + SignForm sign = form.getSign(); + if(study==null || sign==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0){ + return AjaxResult.error("参数有误"); + } + studyService.jd(form); + return AjaxResult.success(); + } + + /** + * 借阅 + * @param form + * @return + */ + @RequiresPermissions({"business:form:nonTrial:jy"}) + @PostMapping("/jy") + public AjaxResult jy(@RequestBody StudySaveForm form) + { + Study study = form.getStudy(); + SignForm sign = form.getSign(); + if(study==null || sign==null){ + return AjaxResult.error("参数有误"); + } + if(study.getId()==null || study.getId().longValue()<=0 || StringUtils.isBlank(sign.getStartDate()) || StringUtils.isBlank(sign.getEndDate())){ + return AjaxResult.error("参数有误"); + } + studyService.jy(form); + return AjaxResult.success(); + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java index 963b5a7..82aa7f6 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyController.java @@ -10,6 +10,7 @@ import com.hxhq.business.domain.MjyJcgj; import com.hxhq.business.domain.StudyJcgj; import com.hxhq.business.dto.study.StudyListDto; import com.hxhq.business.enums.study.StudyStatusEnum; +import com.hxhq.business.enums.study.StudyTypeEnum; import com.hxhq.business.form.common.SignForm; import com.hxhq.business.form.study.StudySaveForm; import com.hxhq.business.form.study.StudySearchForm; @@ -47,6 +48,7 @@ public class StudyController extends BaseController @RequiresPermissions("business:study:list") public TableDataInfo list(StudySearchForm form) { + form.setType(StudyTypeEnum.sy.getValue()); startPage(); List list = studyService.queryList(form); TableDataInfo table = getDataTable(list); @@ -126,6 +128,9 @@ public class StudyController extends BaseController if(!study.getStatus().equals(StudyStatusEnum.cg.getValue()) && !study.getStatus().equals(StudyStatusEnum.syz.getValue())){ return AjaxResult.error("状态有误"); } + if(study.getId()==null){ + study.setType(StudyTypeEnum.sy.getValue()); + } studyService.saveInfo(form); return AjaxResult.success(); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.java index 0b48489..f9b4cd0 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/Study.java @@ -45,6 +45,12 @@ public class Study extends MpBaseEntity /** 借阅结束日期 */ private String borrowEndDate; + /** 所属部门:非试验需要 */ + private Long deptId; + + /** 所属部门名称:非试验需要 */ + private String deptName; + @Compare(name = "试验简述") private String remark; @@ -130,6 +136,22 @@ public class Study extends MpBaseEntity this.borrowEndDate = borrowEndDate; } + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + @Override public String getRemark() { return remark; diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java index 5aa9e89..d124f1a 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudySearchForm.java @@ -5,6 +5,10 @@ package com.hxhq.business.form.study; */ public class StudySearchForm { /** + * 类型 + */ + private Integer type; + /** * 名称 */ private String name; @@ -29,6 +33,14 @@ public class StudySearchForm { */ private String leaderName; + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + public String getName() { return name; } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java index 3500e2f..50a0779 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyServiceImpl.java @@ -59,6 +59,9 @@ public class StudyServiceImpl extends ServiceImpl implements { QueryWrapper queryWrapper = Wrappers.query(); queryWrapper.eq("s.del_flag","0"); + if(form.getType()!=null && form.getType().intValue()>0){ + queryWrapper.eq("s.type",form.getType()); + } if(StringUtils.isNoneBlank(form.getName())){ queryWrapper.like("s.name",form.getName()); } diff --git a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml index 38dbba9..97097ef 100644 --- a/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml +++ b/hxhq-modules/hxhq-system/src/main/resources/mapper/business/StudyMapper.xml @@ -4,7 +4,7 @@ "http://mybatis.org/dtd/mybatis-3-mapper.dtd">