From 1cfa733f3c477892814e49df5d07e08b63971cb6 Mon Sep 17 00:00:00 2001 From: HanLong <404402223@qq.com> Date: Tue, 20 Jan 2026 15:48:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:[=E8=AF=95=E9=AA=8C=E7=AE=A1=E7=90=86][?= =?UTF-8?q?=E8=AF=95=E9=AA=8C=E6=96=B9=E6=B3=95]=E6=9C=AA=E8=AF=BB?= =?UTF-8?q?=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hxhq/business/controller/PublicController.java | 1 - .../com/hxhq/business/controller/SjController.java | 69 +++++++++++++++++++++ .../hxhq/business/form/sj/SjSearchListForm.java | 11 ++++ .../hxhq/business/form/sj/SjSubpackageForm.java | 71 ++++++++++++++++++++++ .../business/form/study/StudyMethodSearchForm.java | 10 +++ .../java/com/hxhq/business/service/ISjService.java | 3 + .../hxhq/business/service/IStudyMethodService.java | 4 +- .../hxhq/business/service/impl/SjServiceImpl.java | 27 ++++++++ .../service/impl/StudyMethodServiceImpl.java | 19 +++--- 9 files changed, 205 insertions(+), 10 deletions(-) create mode 100644 hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java index 8f266b8..3577f8c 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java @@ -184,7 +184,6 @@ public class PublicController extends BaseController { @GetMapping("/sjList") public TableDataInfo list(SjSearchListForm form) { - form.setZjzt(1); startPage(); List list = sjService.queryList(form); return getDataTable(list); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java index 1c62b9e..2629daf 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java @@ -1,10 +1,14 @@ package com.hxhq.business.controller; +import java.util.ArrayList; +import java.util.Date; import java.util.List; import com.hxhq.business.domain.*; import com.hxhq.business.dto.gsp.GspListDto; import com.hxhq.business.dto.sj.SjListDto; +import com.hxhq.business.enums.zykgl.JyztEnum; +import com.hxhq.business.enums.zykgl.ZjztEnum; import com.hxhq.business.form.gsp.GspSearchListForm; import com.hxhq.business.form.mjy.GdForm; import com.hxhq.business.form.sj.*; @@ -13,6 +17,7 @@ import com.hxhq.business.service.ISjTzService; import com.hxhq.business.service.ISjJcgjService; import com.hxhq.common.security.annotation.RequiresPermissions; import com.hxhq.common.security.utils.SecurityUtils; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -40,6 +45,70 @@ public class SjController extends BaseController @Autowired private ISjTzService sjTzService; + + /** + * 开始配置 + * @return + */ + @PostMapping("/startConfiguration") + public AjaxResult startConfiguration(@RequestBody SjBjForm form) { + Sj sj = sjService.getSjByBh(form.getBh()); + if(sj == null) { + sj = new Sj(); + BeanUtils.copyProperties(form, sj); + sj.setPzrq(new Date()); + sjService.save(sj); + } + + return success(); + } + + /** + * 配置完成 + * @param form + * @return + */ + @PostMapping("/configurationCompleted") + public AjaxResult configurationCompleted(@RequestBody SjBjForm form) { + Sj sj = sjService.getSjByBh(form.getBh()); + if(sj == null) { + sj = new Sj(); + BeanUtils.copyProperties(form, sj); + sj.setZjzt(ZjztEnum.rk.getValue()); + sj.setJyzt(JyztEnum.wjy.getValue()); + sjService.save(sj); + } else { + BeanUtils.copyProperties(form, sj); + sj.setZjzt(ZjztEnum.rk.getValue()); + sj.setJyzt(JyztEnum.wjy.getValue()); + sjService.updateById(sj); + } + + return success(); + } + + /** + * 配置完成 + * @param form + * @return + */ + @PostMapping("/subpackage") + public AjaxResult subpackage(@RequestBody SjSubpackageForm form) { + List list = form.getList(); + List sjList = new ArrayList<>(); + for (SjSubpackageForm.SjSubpackageItemForm sjSubpackageItemForm : list) { + Sj sj = new Sj(); + sj.setBh(sjSubpackageItemForm.getBh()); + sj.setKc(sjSubpackageItemForm.getKc()); + sj.setKcdw(sjSubpackageItemForm.getKcdw()); + sj.setStudyId(form.getStudyId()); + sj.setStudyFormId(form.getStudyFormId()); + sjList.add(sj); + } + sjService.saveBatch(sjList); + return success(); + } + /** * 试验物资列表 */ diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java index a43d9ef..0a51746 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java @@ -29,6 +29,9 @@ public class SjSearchListForm { /** 试验id */ private Long studyId; + /** 试验表单id */ + private Long studyFormId; + /** 试验名称 */ private String studyName; @@ -114,4 +117,12 @@ public class SjSearchListForm { public void setEndDate(String endDate) { this.endDate = endDate; } + + public Long getStudyFormId() { + return studyFormId; + } + + public void setStudyFormId(Long studyFormId) { + this.studyFormId = studyFormId; + } } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java new file mode 100644 index 0000000..bff1086 --- /dev/null +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java @@ -0,0 +1,71 @@ +package com.hxhq.business.form.sj; + +import java.util.List; + +public class SjSubpackageForm { + + /** 试验id */ + private Long studyId; + + /** 试验表单id */ + private Long studyFormId; + + /** 分装数据 */ + private List list; + + public static class SjSubpackageItemForm { + private String bh; + + private String kc; + + private String kcdw; + + public String getBh() { + return bh; + } + + public void setBh(String bh) { + this.bh = bh; + } + + public String getKc() { + return kc; + } + + public void setKc(String kc) { + this.kc = kc; + } + + public String getKcdw() { + return kcdw; + } + + public void setKcdw(String kcdw) { + this.kcdw = kcdw; + } + } + + public Long getStudyId() { + return studyId; + } + + public void setStudyId(Long studyId) { + this.studyId = studyId; + } + + public Long getStudyFormId() { + return studyFormId; + } + + public void setStudyFormId(Long studyFormId) { + this.studyFormId = studyFormId; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } +} diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java index c36cec6..b7bd6d5 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java @@ -2,6 +2,8 @@ package com.hxhq.business.form.study; public class StudyMethodSearchForm { + private Long studyId; + /** 所属试验-学科id */ private Long studySubjectId; @@ -18,6 +20,14 @@ public class StudyMethodSearchForm { /** 是否已读 0-未读 1-已读 */ private Integer zt; + public Long getStudyId() { + return studyId; + } + + public void setStudyId(Long studyId) { + this.studyId = studyId; + } + public Long getStudySubjectId() { return studySubjectId; } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java index 5f5c56d..14d16f8 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java @@ -26,6 +26,9 @@ public interface ISjService extends IService * @return 试剂库存集合 */ public List queryList(SjSearchListForm form); + public List queryPublicList(SjSearchListForm form); + + Sj getSjByBh(String bh); /** * 获取试剂详情 diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java index dfadc26..ed67731 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java @@ -37,7 +37,7 @@ public interface IStudyMethodService extends IService * @param userId 用户id * @param studyId 试验id * @param studySubjectId 试验科学id - * @return true 表示全部已读 false 表示有未读的 + * @return */ - Boolean getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId); + void getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId); } diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java index fb7f226..2fe87b2 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java @@ -2,6 +2,7 @@ package com.hxhq.business.service.impl; import java.math.BigDecimal; import java.util.*; +import java.util.function.Consumer; import java.util.stream.Collectors; import cn.hutool.json.JSONUtil; @@ -102,6 +103,32 @@ public class SjServiceImpl extends ServiceImpl implements ISjServi } @Override + public List queryPublicList(SjSearchListForm form) { + QueryWrapper queryWrapper = Wrappers.query(); + queryWrapper.eq("s.del_flag", 0); + queryWrapper.and(p -> p.apply("(s.zjzt = #{0} OR (s.zjzt IS NULL AND s.study_form_id = #{1}))" + , ZjztEnum.rk.getValue(), form.getStudyFormId())); + if(StringUtils.isNotEmpty(form.getMc())) { + queryWrapper.like("s.mc", form.getMc()); + } + if(StringUtils.isNotEmpty(form.getBh())) { + queryWrapper.like("s.bh", form.getBh()); + } + if(StringUtils.isNotEmpty(form.getStudyName())) { + queryWrapper.like("t.name", form.getStudyName()); + } + queryWrapper.orderByDesc("s.id"); + return baseMapper.queryList(queryWrapper); + } + + @Override + public Sj getSjByBh(String bh) { + LambdaQueryWrapper queryWrapper = new LambdaQueryWrapper<>(); + queryWrapper.eq(Sj::getBh, bh); + return this.getOne(queryWrapper); + } + + @Override public SjListDto getInfo(Long id) { return baseMapper.queryInfo(id); diff --git a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java index d48e8d3..058c0f5 100644 --- a/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java +++ b/hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java @@ -1,6 +1,7 @@ package com.hxhq.business.service.impl; import java.util.List; +import java.util.stream.Collectors; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -52,6 +53,9 @@ public class StudyMethodServiceImpl extends ServiceImpl queryList(StudyMethodSearchForm form) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("m.del_flag", 0); + if(form.getStudyId() != null) { + queryWrapper.eq("m.study_id", form.getStudyId()); + } if(form.getStudySubjectId() != null) { queryWrapper.eq("m.study_subject_id", form.getStudySubjectId()); } @@ -84,7 +88,7 @@ public class StudyMethodServiceImpl extends ServiceImpl queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(StudyMethodRead::getQmrId, userId) .eq(StudyMethodRead::getStudyId, studyId); @@ -148,11 +153,11 @@ public class StudyMethodServiceImpl extends ServiceImpl list = this.list(studyMethodLambdaQueryWrapper); + if(readCount != list.size()) { + String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")); + throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]"); } - return false; } }