Browse Source

feat:[试验管理][试验方法]未读标记

master
HanLong 3 months ago
parent
commit
1cfa733f3c
9 changed files with 205 additions and 10 deletions
  1. +0
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/PublicController.java
  2. +69
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java
  3. +11
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java
  4. +71
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java
  5. +10
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java
  6. +3
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java
  7. +2
    -2
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java
  8. +27
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java
  9. +12
    -7
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java

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

@ -184,7 +184,6 @@ public class PublicController extends BaseController {
@GetMapping("/sjList")
public TableDataInfo list(SjSearchListForm form)
{
form.setZjzt(1);
startPage();
List<SjListDto> list = sjService.queryList(form);
return getDataTable(list);

+ 69
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/SjController.java View File

@ -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<SjSubpackageForm.SjSubpackageItemForm> list = form.getList();
List<Sj> 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();
}
/**
* 试验物资列表
*/

+ 11
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSearchListForm.java View File

@ -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;
}
}

+ 71
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/sj/SjSubpackageForm.java View File

@ -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<SjSubpackageItemForm> 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<SjSubpackageItemForm> getList() {
return list;
}
public void setList(List<SjSubpackageItemForm> list) {
this.list = list;
}
}

+ 10
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/form/study/StudyMethodSearchForm.java View File

@ -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;
}

+ 3
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/ISjService.java View File

@ -26,6 +26,9 @@ public interface ISjService extends IService
* @return 试剂库存集合
*/
public List<SjListDto> queryList(SjSearchListForm form);
public List<SjListDto> queryPublicList(SjSearchListForm form);
Sj getSjByBh(String bh);
/**
* 获取试剂详情

+ 2
- 2
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java View File

@ -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);
}

+ 27
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/SjServiceImpl.java View File

@ -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<SjListDto> queryPublicList(SjSearchListForm form) {
QueryWrapper<Sj> 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<Sj> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(Sj::getBh, bh);
return this.getOne(queryWrapper);
}
@Override
public SjListDto getInfo(Long id) {
return baseMapper.queryInfo(id);

+ 12
- 7
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java View File

@ -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
public List<StudyMethod> queryList(StudyMethodSearchForm form) {
QueryWrapper<StudyMethod> 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
@Override
public void save(StudyMethodForm form) {
SysUser qmr = sysUserService.selectUserById(form.getQmrId());
// TODO
sysUserService.checkPassword(qmr, form.getQmrmm(), false);
StudyMethod studyMethod = new StudyMethod();
BeanUtils.copyProperties(form, studyMethod);
studyMethod.setUserId(qmr.getUserId());
@ -108,7 +112,8 @@ public class StudyMethodServiceImpl extends ServiceImpl
@Override
public void read(StudyMethodReadForm form) {
SysUser qmr = sysUserService.selectUserById(form.getQmrId());
// TODO
sysUserService.checkPassword(qmr, form.getQmrmm(), false);
StudyMethod studyMethod = this.getById(form.getStudyMethodId());
if(studyMethod == null) {
@ -134,7 +139,7 @@ public class StudyMethodServiceImpl extends ServiceImpl
}
@Override
public Boolean getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) {
public void getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) {
LambdaQueryWrapper<StudyMethodRead> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StudyMethodRead::getQmrId, userId)
.eq(StudyMethodRead::getStudyId, studyId);
@ -148,11 +153,11 @@ public class StudyMethodServiceImpl extends ServiceImpl
if(studySubjectId != null) {
studyMethodLambdaQueryWrapper.eq(StudyMethod::getStudySubjectId, studySubjectId);
}
long studyMethodCount = this.count(studyMethodLambdaQueryWrapper);
if(readCount == studyMethodCount) {
return true;
List<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper);
if(readCount != list.size()) {
String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(","));
throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]");
}
return false;
}
}

Loading…
Cancel
Save