|
|
|
@ -1,11 +1,26 @@ |
|
|
|
package com.hxhq.business.service.impl; |
|
|
|
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.hxhq.business.domain.StudyFormPlan; |
|
|
|
import com.hxhq.business.dto.study.StudyFormPlanListDto; |
|
|
|
import com.hxhq.business.enums.study.StudyFormPlanBdztEnum; |
|
|
|
import com.hxhq.business.enums.zykgl.JcgjlxEnum; |
|
|
|
import com.hxhq.business.enums.zykgl.JcmcysEnum; |
|
|
|
import com.hxhq.business.form.study.StudyFormPlanSearchForm; |
|
|
|
import com.hxhq.business.service.IStudyFormPlanJcgjService; |
|
|
|
import com.hxhq.business.service.IStudyFormPlanQmxxService; |
|
|
|
import com.hxhq.business.utils.JctUtil; |
|
|
|
import com.hxhq.common.core.exception.ServiceException; |
|
|
|
import com.hxhq.common.core.utils.StringUtils; |
|
|
|
import com.hxhq.common.security.utils.SecurityUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import com.hxhq.business.mapper.StudyFormPlanMapper; |
|
|
|
import com.hxhq.business.domain.StudyFormPlan; |
|
|
|
import com.hxhq.business.service.IStudyFormPlanService; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
|
|
@ -18,17 +33,250 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
@Service |
|
|
|
public class StudyFormPlanServiceImpl extends ServiceImpl<StudyFormPlanMapper, StudyFormPlan> implements IStudyFormPlanService |
|
|
|
{ |
|
|
|
@Autowired |
|
|
|
private IStudyFormPlanJcgjService studyFormPlanJcgjService; |
|
|
|
@Autowired |
|
|
|
private IStudyFormPlanQmxxService studyFormPlanQmxxService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 查询试验-配置计划列表 |
|
|
|
* 查询试验-填报单列表 |
|
|
|
* |
|
|
|
* @param studyFormPlan 试验-配置计划 |
|
|
|
* @return 试验-配置计划 |
|
|
|
* @param form 试验-填报单 |
|
|
|
* @return 试验-填报单 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public List<StudyFormPlan> queryList(StudyFormPlan studyFormPlan) |
|
|
|
{ |
|
|
|
public List<StudyFormPlanListDto> queryList(StudyFormPlanSearchForm form) { |
|
|
|
QueryWrapper<StudyFormPlan> queryWrapper = Wrappers.query(); |
|
|
|
return this.list(queryWrapper); |
|
|
|
queryWrapper.eq("t.del_flag", "0"); |
|
|
|
if (form.getUserId() != null && form.getUserId().longValue() > 0) { |
|
|
|
queryWrapper.eq("t.user_id", form.getUserId()); |
|
|
|
} |
|
|
|
if (form.getStudyId() != null && form.getStudyId().longValue() > 0) { |
|
|
|
queryWrapper.eq("t.study_id", form.getStudyId()); |
|
|
|
} |
|
|
|
|
|
|
|
if (StringUtils.isNoneBlank(form.getBdbh())) { |
|
|
|
queryWrapper.and(p -> p.like("t.`bdbh`", form.getBdbh())); |
|
|
|
} |
|
|
|
if (StringUtils.isNoneBlank(form.getBdmc())) { |
|
|
|
queryWrapper.and(p -> p.like("t.`bdmc`", form.getBdmc())); |
|
|
|
} |
|
|
|
if (StringUtils.isNoneBlank(form.getCjsjks())) { |
|
|
|
queryWrapper.apply("t.create_time>={0}", form.getCjsjks()); |
|
|
|
} |
|
|
|
if (StringUtils.isNoneBlank(form.getCjsjjs())) { |
|
|
|
queryWrapper.apply("t.create_time<{0}", form.getCjsjjs()); |
|
|
|
} |
|
|
|
queryWrapper.orderByDesc("t.create_time"); |
|
|
|
return baseMapper.queryList(queryWrapper); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 详情 |
|
|
|
* |
|
|
|
* @param id |
|
|
|
* @return 详情 |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public StudyFormPlan queryInfo(Long id) { |
|
|
|
if (id == null || id.longValue() < 0) { |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
return baseMapper.queryInfo(id); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 更换归属人 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void ghgsr(StudyFormPlan studyFormPlan) { |
|
|
|
//验证签名人密码 todo |
|
|
|
if (studyFormPlan.getId() == null || studyFormPlan.getId().longValue() < 0) { |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
StudyFormPlan studyFormPlanOld = this.getById(studyFormPlan.getId()); |
|
|
|
if (studyFormPlanOld == null) { |
|
|
|
throw new ServiceException("表单不存在或已删除"); |
|
|
|
} |
|
|
|
//稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
formData.put("新归属人",studyFormPlan.getRemark()); |
|
|
|
formData.put("原归属人",studyFormPlanOld.getRemark()); |
|
|
|
formData.put("原因",studyFormPlan.getRemark()); |
|
|
|
|
|
|
|
//是否验证新的归属人,是否属于该实验? todo |
|
|
|
studyFormPlanOld.setUserId(studyFormPlan.getUserId()); |
|
|
|
studyFormPlanOld.setUserMc(studyFormPlan.getUserMc()); |
|
|
|
this.updateById(studyFormPlanOld); |
|
|
|
|
|
|
|
studyFormPlanJcgjService.saveJcgj(studyFormPlanOld.getId(), JcgjlxEnum.lc.getValue(), "更换归属人", JcmcysEnum.orange.getValue(), JctUtil.formatStr(formData), SecurityUtils.getUserId(), SecurityUtils.getNickName()); |
|
|
|
//签名信息 |
|
|
|
studyFormPlanQmxxService.saveQmxx(studyFormPlanOld.getId(),"更换归属人",SecurityUtils.getUserId(),SecurityUtils.getNickName(),studyFormPlan.getRemark()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 保存 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void bc(StudyFormPlan studyFormPlan) { |
|
|
|
if(studyFormPlan.getId()!=null){ |
|
|
|
StudyFormPlan studyFormPlanOld=this.getById(studyFormPlan.getId()); |
|
|
|
if(studyFormPlanOld==null){ |
|
|
|
throw new ServiceException("信息不存在或已删除"); |
|
|
|
} |
|
|
|
if(!SecurityUtils.getUserId().equals(studyFormPlanOld.getUserId())){ |
|
|
|
throw new ServiceException("只能操作自己的表单"); |
|
|
|
} |
|
|
|
studyFormPlanOld.setBdmc(studyFormPlan.getBdmc()); |
|
|
|
studyFormPlanOld.setTemplateId(studyFormPlan.getTemplateId()); |
|
|
|
studyFormPlanOld.setBdnr(studyFormPlan.getBdnr()); |
|
|
|
studyFormPlanOld.setBdzt(StudyFormPlanBdztEnum.tbz.getValue()); |
|
|
|
this.updateById(studyFormPlanOld); |
|
|
|
}else{ |
|
|
|
studyFormPlan.setBdzt(StudyFormPlanBdztEnum.tbz.getValue()); |
|
|
|
studyFormPlan.setUserId(SecurityUtils.getUserId()); |
|
|
|
studyFormPlan.setUserMc(SecurityUtils.getNickName()); |
|
|
|
this.save(studyFormPlan); |
|
|
|
} |
|
|
|
//稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
formData.put("备注",studyFormPlan.getRemark()); |
|
|
|
studyFormPlanJcgjService.saveJcgj(studyFormPlan.getId(), JcgjlxEnum.bj.getValue(), "填写并保存", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData), SecurityUtils.getUserId(), SecurityUtils.getNickName()); |
|
|
|
//签名信息 |
|
|
|
studyFormPlanQmxxService.saveQmxx(studyFormPlan.getId(),"填写并保存",SecurityUtils.getUserId(),SecurityUtils.getNickName(),studyFormPlan.getRemark()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 提交 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void tj(StudyFormPlan studyFormPlan) { |
|
|
|
//todo |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 复核通过 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void fhtg(StudyFormPlan studyFormPlan) { |
|
|
|
//验证签名人密码 todo |
|
|
|
if (studyFormPlan.getId() == null || studyFormPlan.getId().longValue() < 0) { |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
StudyFormPlan studyFormPlanOld = this.getById(studyFormPlan.getId()); |
|
|
|
if (studyFormPlanOld == null) { |
|
|
|
throw new ServiceException("表单不存在或已删除"); |
|
|
|
} |
|
|
|
if (!studyFormPlanOld.getBdzt().equals(StudyFormPlanBdztEnum.ytj.getValue()) ) { |
|
|
|
throw new ServiceException("表单不是已提交状态,不能复核"); |
|
|
|
} |
|
|
|
studyFormPlanOld.setBdzt(StudyFormPlanBdztEnum.ywcfh.getValue()); |
|
|
|
this.updateById(studyFormPlanOld); |
|
|
|
//稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
formData.put("备注",studyFormPlan.getRemark()); |
|
|
|
studyFormPlanJcgjService.saveJcgj(studyFormPlanOld.getId(), JcgjlxEnum.lc.getValue(), "复核通过", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData), SecurityUtils.getUserId(), SecurityUtils.getNickName()); |
|
|
|
//签名信息 |
|
|
|
studyFormPlanQmxxService.saveQmxx(studyFormPlanOld.getId(),"复核通过",SecurityUtils.getUserId(),SecurityUtils.getNickName(),studyFormPlan.getRemark()); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 复核拒绝 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void fhjj(StudyFormPlan studyFormPlan) { |
|
|
|
//验证签名人密码 todo |
|
|
|
if (studyFormPlan.getId() == null || studyFormPlan.getId().longValue() < 0) { |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
StudyFormPlan studyFormPlanOld = this.getById(studyFormPlan.getId()); |
|
|
|
if (studyFormPlanOld == null) { |
|
|
|
throw new ServiceException("表单不存在或已删除"); |
|
|
|
} |
|
|
|
if (!studyFormPlanOld.getBdzt().equals(StudyFormPlanBdztEnum.ytj.getValue()) ) { |
|
|
|
throw new ServiceException("表单不是已提交状态,不能复核"); |
|
|
|
} |
|
|
|
studyFormPlanOld.setBdzt(StudyFormPlanBdztEnum.tbz.getValue()); |
|
|
|
this.updateById(studyFormPlanOld); |
|
|
|
//稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
formData.put("原因",studyFormPlan.getRemark()); |
|
|
|
studyFormPlanJcgjService.saveJcgj(studyFormPlanOld.getId(), JcgjlxEnum.lc.getValue(), "复核拒绝", JcmcysEnum.red.getValue(), JctUtil.formatStr(formData), SecurityUtils.getUserId(), SecurityUtils.getNickName()); |
|
|
|
//签名信息 |
|
|
|
studyFormPlanQmxxService.saveQmxx(studyFormPlanOld.getId(),"复核拒绝",SecurityUtils.getUserId(),SecurityUtils.getNickName(),studyFormPlan.getRemark()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 通过 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void tg(StudyFormPlan studyFormPlan) { |
|
|
|
//验证签名人密码 todo |
|
|
|
if (studyFormPlan.getId() == null || studyFormPlan.getId().longValue() < 0) { |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
StudyFormPlan studyFormPlanOld = this.getById(studyFormPlan.getId()); |
|
|
|
if (studyFormPlanOld == null) { |
|
|
|
throw new ServiceException("表单不存在或已删除"); |
|
|
|
} |
|
|
|
if (!studyFormPlanOld.getBdzt().equals(StudyFormPlanBdztEnum.ytj.getValue()) ) { |
|
|
|
throw new ServiceException("表单不是已提交状态,不能复核"); |
|
|
|
} |
|
|
|
studyFormPlanOld.setBdzt(StudyFormPlanBdztEnum.ywc.getValue()); |
|
|
|
this.updateById(studyFormPlanOld); |
|
|
|
//稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
formData.put("原因",studyFormPlan.getRemark()); |
|
|
|
studyFormPlanJcgjService.saveJcgj(studyFormPlanOld.getId(), JcgjlxEnum.lc.getValue(), "免复核通过", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData), SecurityUtils.getUserId(), SecurityUtils.getNickName()); |
|
|
|
//签名信息 |
|
|
|
studyFormPlanQmxxService.saveQmxx(studyFormPlanOld.getId(),"免复核通过",SecurityUtils.getUserId(),SecurityUtils.getNickName(),studyFormPlan.getRemark()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 审阅 |
|
|
|
* |
|
|
|
* @param studyFormPlan |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public void sy(StudyFormPlan studyFormPlan) { |
|
|
|
//验证签名人密码 todo |
|
|
|
if (studyFormPlan.getId() == null || studyFormPlan.getId().longValue() < 0) { |
|
|
|
throw new ServiceException("参数id不正确"); |
|
|
|
} |
|
|
|
StudyFormPlan studyFormPlanOld = this.getById(studyFormPlan.getId()); |
|
|
|
if (studyFormPlanOld == null) { |
|
|
|
throw new ServiceException("表单不存在或已删除"); |
|
|
|
} |
|
|
|
if (!(studyFormPlanOld.getBdzt().equals(StudyFormPlanBdztEnum.ywcfh.getValue())||studyFormPlanOld.getBdzt().equals(StudyFormPlanBdztEnum.ywc.getValue())) ) { |
|
|
|
throw new ServiceException("表单不是已完成状态,不能审阅"); |
|
|
|
} |
|
|
|
//稽查轨迹 |
|
|
|
Map<String, String> formData = new LinkedHashMap<>(); |
|
|
|
formData.put("备注",studyFormPlan.getRemark()); |
|
|
|
studyFormPlanJcgjService.saveJcgj(studyFormPlanOld.getId(), JcgjlxEnum.lc.getValue(), "已审阅", JcmcysEnum.green.getValue(), JctUtil.formatStr(formData), SecurityUtils.getUserId(), SecurityUtils.getNickName()); |
|
|
|
//签名信息 |
|
|
|
studyFormPlanQmxxService.saveQmxx(studyFormPlanOld.getId(),"已审阅",SecurityUtils.getUserId(),SecurityUtils.getNickName(),studyFormPlan.getRemark()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |