Browse Source

feat:[试验管理]方法未阅读跳转

master
15881625488@163.com 2 months ago
parent
commit
6fd10ed6db
3 changed files with 11 additions and 6 deletions
  1. +1
    -2
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudyMethodController.java
  2. +2
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudyMethodService.java
  3. +8
    -3
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudyMethodServiceImpl.java

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

@ -106,8 +106,7 @@ public class StudyMethodController extends BaseController {
*/ */
@GetMapping(value = "/getReadAllMethodStatus") @GetMapping(value = "/getReadAllMethodStatus")
public AjaxResult getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) { public AjaxResult getReadAllMethodStatus(Long userId, Long studyId, Long studySubjectId) {
studyMethodService.checkAllMethodReadStatus(userId, studyId, studySubjectId);
return AjaxResult.success("成功");
return AjaxResult.success(studyMethodService.checkAllMethodReadStatus(userId, studyId, studySubjectId));
} }

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

@ -1,5 +1,6 @@
package com.hxhq.business.service; package com.hxhq.business.service;
import java.util.HashMap;
import java.util.List; import java.util.List;
import com.hxhq.business.domain.StudyMethod; import com.hxhq.business.domain.StudyMethod;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
@ -39,5 +40,5 @@ public interface IStudyMethodService extends IService
* @param studySubjectId 试验科学id * @param studySubjectId 试验科学id
* @return * @return
*/ */
void checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId);
HashMap<String,Object> checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId);
} }

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

@ -1,8 +1,10 @@
package com.hxhq.business.service.impl; package com.hxhq.business.service.impl;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hxhq.business.domain.Study; import com.hxhq.business.domain.Study;
@ -146,7 +148,8 @@ public class StudyMethodServiceImpl extends ServiceImpl
} }
@Override @Override
public void checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId) {
public HashMap<String,Object> checkAllMethodReadStatus(Long userId, Long studyId, Long studySubjectId) {
HashMap<String,Object> result=new HashMap<>();
Study study = studyService.getById(studyId); Study study = studyService.getById(studyId);
if(study==null){ if(study==null){
throw new ServiceException("信息不存在"); throw new ServiceException("信息不存在");
@ -171,10 +174,12 @@ public class StudyMethodServiceImpl extends ServiceImpl
} }
List<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper); List<StudyMethod> list = this.list(studyMethodLambdaQueryWrapper);
if(readCount != list.size()) { if(readCount != list.size()) {
String ffmc = list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(","));
throw new ServiceException("[" + ffmc + "方案还未阅读,请先阅读后再进行试验操作]");
String toUrl=study.getType().equals(StudyTypeEnum.sy.getValue())?("/study/enter/"+study.getId()+"/syff"):study.getType().equals(StudyTypeEnum.fsy.getValue())?("/nonTrial/enter/"+study.getId()+"/syff"):study.getType().equals(StudyTypeEnum.mjy.getValue())?("/drug/enter/"+study.getId()+"/syff"):"";
result.put("toUrl",toUrl);
result.put("ffmc","【" + list.stream().map(StudyMethod::getFfmc).collect(Collectors.joining(",")) + "】方法还未阅读,请先阅读后再进行操作]");
} }
} }
return result;
} }
} }

Loading…
Cancel
Save