Browse Source

feat: [试验管理] 默认选中自己所在学科

master
memorylkf 4 days ago
parent
commit
9e5a392aaf
6 changed files with 53 additions and 4 deletions
  1. +2
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/controller/StudySubjectController.java
  2. +16
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudySubject.java
  3. +7
    -0
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudySubjectService.java
  4. +3
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/IStudySubjectUserService.java
  5. +15
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectServiceImpl.java
  6. +10
    -1
      hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectUserServiceImpl.java

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

@ -38,7 +38,8 @@ public class StudySubjectController extends BaseController
if(studyId==null || studyId.longValue()<=0){
return AjaxResult.success(new ArrayList<>());
}
return AjaxResult.success(studySubjectService.getListByStudyId(studyId));
List<StudySubject> list = studySubjectService.getListByStudyId(studyId);
return AjaxResult.success(studySubjectService.initUserIdList(list));
}
/**

+ 16
- 0
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/domain/StudySubject.java View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.hxhq.common.core.domain.MpBaseEntity;
import java.util.List;
/**
* 试验-学科对象 t_study_subject
@ -37,6 +39,12 @@ public class StudySubject extends MpBaseEntity
@TableField(exist = false)
private Boolean select;
/**
* 设置的用户id列表
*/
@TableField(exist = false)
private List<Long> userIdList;
public void setStudyId(Long studyId)
{
@ -95,4 +103,12 @@ public class StudySubject extends MpBaseEntity
public void setSelect(Boolean select) {
this.select = select;
}
public List<Long> getUserIdList() {
return userIdList;
}
public void setUserIdList(List<Long> userIdList) {
this.userIdList = userIdList;
}
}

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

@ -21,6 +21,13 @@ public interface IStudySubjectService extends IService
List<StudySubject> getListByStudyId(Long studyId);
/**
* 设置学科下的用户idList用于前端subject默认选中
* @param list
* @return
*/
List<StudySubject> initUserIdList(List<StudySubject> list);
/**
* 获取试验下的学科设置信息(含未设置的学科)
* @param studyId
* @return

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

@ -28,8 +28,10 @@ public interface IStudySubjectUserService extends IService
/**
* 根据studySubjectId进下删除
* @param studyId
* @param studySubjectId
* @param signRemark
*/
void deleteByStudySubjectId(Long studySubjectId);
void deleteByStudySubjectId(Long studyId, Long studySubjectId,String signRemark);
}

+ 15
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectServiceImpl.java View File

@ -92,6 +92,20 @@ public class StudySubjectServiceImpl extends ServiceImpl
}
@Override
public List<StudySubject> initUserIdList(List<StudySubject> list) {
if(list.size()>0){
QueryWrapper<StudySubjectUser> queryWrapper = new QueryWrapper<>();
queryWrapper.in("study_subject_id",list.stream().map(o->o.getId()).collect(Collectors.toList()));
queryWrapper.select("study_subject_id,user_id");
List<StudySubjectUser> userList = studySubjectUserService.list(queryWrapper);
for(StudySubject l : list){
l.setUserIdList(userList.stream().filter(o->o.getStudySubjectId().equals(l.getId())).map(o->o.getUserId()).collect(Collectors.toList()));
}
}
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void saveInfo(StudySubjectSaveForm form) {
Study study = studyService.getById(form.getStudyId());
@ -147,7 +161,7 @@ public class StudySubjectServiceImpl extends ServiceImpl
removeBatchByIds(deleteList);
for(StudySubject del : deleteList){
studySubjectUserService.deleteByStudySubjectId(del.getId());
studySubjectUserService.deleteByStudySubjectId(study.getId(),del.getId(),form.getSign().getRemark());
}
}

+ 10
- 1
hxhq-modules/hxhq-system/src/main/java/com/hxhq/business/service/impl/StudySubjectUserServiceImpl.java View File

@ -117,9 +117,18 @@ public class StudySubjectUserServiceImpl extends ServiceImpl
}
@Override
public void deleteByStudySubjectId(Long studySubjectId) {
public void deleteByStudySubjectId(Long studyId, Long studySubjectId,String signRemark) {
QueryWrapper<StudySubjectUser> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("study_subject_id",studySubjectId);
List<StudySubjectUser> userList = list(queryWrapper);
if(userList.size()>0){
List<String> deleteNameList = userList.stream().map(o->o.getUserName()).collect(Collectors.toList());
if(deleteNameList.size()>0){
Map<String, String> formData = new LinkedHashMap<>();
formData.put("删除人员", String.join(",",deleteNameList));
studyJcgjService.saveInfo(studyId, JcgjlxEnum.ry, JcmcysEnum.blue,"人员变更", JctUtil.formatStr(formData), SecurityUtils.getUserId(),SecurityUtils.getNickName(),signRemark);
}
}
remove(queryWrapper);
}
}

Loading…
Cancel
Save