@ -1,13 +1,33 @@
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.StudyFormPre ;
import com.hxhq.business.domain.MjyFfjl ;
import com.hxhq.business.domain.StudyFormFill ;
import com.hxhq.business.dto.mjy.DetailDto ;
import com.hxhq.business.dto.study.StudyFormFillListDto ;
import com.hxhq.business.enums.NormalEnum ;
import com.hxhq.business.enums.study.StudyFormFillBdztEnum ;
import com.hxhq.business.enums.study.StudyFormFillBdztEnum ;
import com.hxhq.business.enums.zykgl.JcgjlxEnum ;
import com.hxhq.business.enums.zykgl.JcmcysEnum ;
import com.hxhq.business.enums.zykgl.JlztEnum ;
import com.hxhq.business.form.study.StudyFormFillGcForm ;
import com.hxhq.business.form.study.StudyFormFillSearchForm ;
import com.hxhq.business.form.study.StudyFormPreSearchForm ;
import com.hxhq.business.form.study.StudyFormFillShfzForm ;
import com.hxhq.business.form.study.StudyFormFillSearchForm ;
import com.hxhq.business.service.IStudyFormFillJcgjService ;
import com.hxhq.business.service.IStudyFormFillQmxxService ;
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 com.hxhq.system.api.domain.SysUser ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import com.hxhq.business.mapper.StudyFormFillMapper ;
import com.hxhq.business.domain.StudyFormFill ;
@ -21,8 +41,13 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
* @date 2025 - 12 - 29
* /
@Service
public class StudyFormFillServiceImpl extends ServiceImpl < StudyFormFillMapper , StudyFormFill > implements IStudyFormFillService
{
public class StudyFormFillServiceImpl extends ServiceImpl < StudyFormFillMapper , StudyFormFill > implements IStudyFormFillService {
@Autowired
private IStudyFormFillJcgjService studyFormFillJcgjService ;
@Autowired
private IStudyFormFillQmxxService studyFormFillQmxxService ;
/ * *
* 查询试验 - 填报单列表
*
@ -30,8 +55,7 @@ public class StudyFormFillServiceImpl extends ServiceImpl
* @return 试验 - 填报单
* /
@Override
public List < StudyFormFillListDto > queryList ( StudyFormFillSearchForm form )
{
public List < StudyFormFillListDto > queryList ( StudyFormFillSearchForm form ) {
QueryWrapper < StudyFormFill > queryWrapper = Wrappers . query ( ) ;
queryWrapper . eq ( "t.del_flag" , "0" ) ;
if ( form . getUserId ( ) ! = null & & form . getUserId ( ) . longValue ( ) > 0 ) {
@ -40,6 +64,9 @@ public class StudyFormFillServiceImpl extends ServiceImpl
if ( form . getStudyId ( ) ! = null & & form . getStudyId ( ) . longValue ( ) > 0 ) {
queryWrapper . eq ( "t.study_id" , form . getStudyId ( ) ) ;
}
if ( form . getStudySubjectId ( ) ! = null & & form . getStudySubjectId ( ) . longValue ( ) > 0 ) {
queryWrapper . eq ( "t.study_subject_id" , form . getStudySubjectId ( ) ) ;
}
if ( StringUtils . isNoneBlank ( form . getBdbh ( ) ) ) {
queryWrapper . and ( p - > p . like ( "t.`bdbh`" , form . getBdbh ( ) ) ) ;
}
@ -47,7 +74,7 @@ public class StudyFormFillServiceImpl extends ServiceImpl
queryWrapper . and ( p - > p . like ( "t.`bdmc`" , form . getBdmc ( ) ) ) ;
}
if ( StringUtils . isNoneBlank ( form . getTemplateMc ( ) ) ) {
queryWrapper . and ( p - > p . like ( "t.`template_mc `" , form . getTemplateMc ( ) ) ) ;
queryWrapper . and ( p - > p . like ( "tm.`name `" , form . getTemplateMc ( ) ) ) ;
}
if ( StringUtils . isNoneBlank ( form . getTjsjks ( ) ) ) {
queryWrapper . apply ( "t.tjsj>={0}" , form . getTjsjks ( ) ) ;
@ -65,4 +92,338 @@ public class StudyFormFillServiceImpl extends ServiceImpl
return baseMapper . queryList ( queryWrapper ) ;
}
/ * *
* 详情
*
* @param id
* @return 详情
* /
@Override
public StudyFormFill queryInfo ( Long id ) {
if ( id = = null | | id . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
return baseMapper . queryInfo ( id ) ;
}
/ * *
* 加签 ok
*
* @param studyFormFill
* /
@Override
public void jq ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ) {
throw new ServiceException ( "表单不是填报状态,不能加签" ) ;
}
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "备注" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , studyFormFill . getQmyy ( ) , JcmcysEnum . orange . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFill . getId ( ) , studyFormFill . getQmyy ( ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 废止
*
* @param studyFormFill
* /
@Override
public void fz ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ) {
throw new ServiceException ( "表单不是填报状态,不能废止" ) ;
}
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . dfz . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "备注" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "申请废止" , JcmcysEnum . orange . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFill . getId ( ) , "申请废止" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 审核废止
*
* @param form
* /
@Override
public void shfz ( StudyFormFillShfzForm form ) {
/ / 验证签名人密码 todo 是否验证是不是sd ?
if ( form . getId ( ) = = null | | form . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( form . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . dfz . getValue ( ) ) ) {
throw new ServiceException ( "表单不是填报状态,不能废止" ) ;
}
if ( form . getQmyy ( ) . equals ( NormalEnum . yes . getValue ( ) ) ) {
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . yfz . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "原因" , form . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "废止通过" , JcmcysEnum . green . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "废止通过" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , form . getRemark ( ) ) ;
} else {
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "原因" , form . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "废止拒绝" , JcmcysEnum . red . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "废止拒绝" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , form . getRemark ( ) ) ;
}
}
/ * *
* 更换归属人
*
* @param studyFormFill
* /
@Override
public void ghgsr ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . dfz . getValue ( ) ) | | studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . yfz . getValue ( ) ) ) {
throw new ServiceException ( "表单已废止或待废止,不能更换归属人" ) ;
}
/ / 是否验证新的归属人 , 是否属于该实验 ? todo
studyFormFillOld . setUserId ( studyFormFill . getUserId ( ) ) ;
studyFormFillOld . setUserMc ( studyFormFill . getUserMc ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "更换归属人" , JcmcysEnum . orange . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "更换归属人" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 保存
*
* @param studyFormFill
* /
@Override
public void bc ( StudyFormFill studyFormFill ) {
if ( studyFormFill . getId ( ) ! = null ) {
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "信息不存在或已删除" ) ;
}
if ( ! SecurityUtils . getUserId ( ) . equals ( studyFormFillOld . getUserId ( ) ) ) {
throw new ServiceException ( "只能操作自己的表单" ) ;
}
studyFormFillOld . setBdmc ( studyFormFill . getBdmc ( ) ) ;
studyFormFillOld . setTemplateId ( studyFormFill . getTemplateId ( ) ) ;
studyFormFillOld . setBdnr ( studyFormFill . getBdnr ( ) ) ;
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
} else {
studyFormFill . setBdzt ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ;
studyFormFill . setUserId ( SecurityUtils . getUserId ( ) ) ;
studyFormFill . setUserMc ( SecurityUtils . getNickName ( ) ) ;
this . save ( studyFormFill ) ;
}
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "备注" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFill . getId ( ) , JcgjlxEnum . bj . getValue ( ) , "填写并保存" , JcmcysEnum . green . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFill . getId ( ) , "填写并保存" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 提交
*
* @param studyFormFill
* /
@Override
public void tj ( StudyFormFill studyFormFill ) {
/ / todo
}
/ * *
* 观察
*
* @param form
* /
@Override
public void gc ( StudyFormFillGcForm form ) {
/ / 验证签名人密码 todo
if ( form . getId ( ) = = null | | form . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( form . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ) {
throw new ServiceException ( "表单不是填报状态,不能观察" ) ;
}
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "生长情况" , form . getQmyy ( ) ) ;
formData . put ( "备注" , form . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , form . getQmyy ( ) , JcmcysEnum . orange . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , form . getQmyy ( ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , form . getRemark ( ) ) ;
}
/ * *
* 复核通过
*
* @param studyFormFill
* /
@Override
public void fhtg ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . ytj . getValue ( ) ) ) {
throw new ServiceException ( "表单不是已提交状态,不能复核" ) ;
}
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . ywcfh . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "备注" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "复核通过" , JcmcysEnum . green . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "复核通过" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 复核拒绝
*
* @param studyFormFill
* /
@Override
public void fhjj ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . ytj . getValue ( ) ) ) {
throw new ServiceException ( "表单不是已提交状态,不能复核" ) ;
}
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . tbz . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "原因" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "复核拒绝" , JcmcysEnum . red . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "复核拒绝" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 通过
*
* @param studyFormFill
* /
@Override
public void tg ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . ytj . getValue ( ) ) ) {
throw new ServiceException ( "表单不是已提交状态,不能复核" ) ;
}
studyFormFillOld . setBdzt ( StudyFormFillBdztEnum . ywc . getValue ( ) ) ;
this . updateById ( studyFormFillOld ) ;
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "原因" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "免复核通过" , JcmcysEnum . green . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "免复核通过" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
/ * *
* 审阅
*
* @param studyFormFill
* /
@Override
public void sy ( StudyFormFill studyFormFill ) {
/ / 验证签名人密码 todo
if ( studyFormFill . getId ( ) = = null | | studyFormFill . getId ( ) . longValue ( ) < 0 ) {
throw new ServiceException ( "参数id不正确" ) ;
}
StudyFormFill studyFormFillOld = this . getById ( studyFormFill . getId ( ) ) ;
if ( studyFormFillOld = = null ) {
throw new ServiceException ( "表单不存在或已删除" ) ;
}
if ( ! ( studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . ywcfh . getValue ( ) ) | | studyFormFillOld . getBdzt ( ) . equals ( StudyFormFillBdztEnum . ywc . getValue ( ) ) ) ) {
throw new ServiceException ( "表单不是已完成状态,不能审阅" ) ;
}
/ / 稽查轨迹
Map < String , String > formData = new LinkedHashMap < > ( ) ;
formData . put ( "备注" , studyFormFill . getRemark ( ) ) ;
studyFormFillJcgjService . saveJcgj ( studyFormFillOld . getId ( ) , JcgjlxEnum . lc . getValue ( ) , "已审阅" , JcmcysEnum . green . getValue ( ) , JctUtil . formatStr ( formData ) , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) ) ;
/ / 签名信息
studyFormFillQmxxService . saveQmxx ( studyFormFillOld . getId ( ) , "已审阅" , SecurityUtils . getUserId ( ) , SecurityUtils . getNickName ( ) , studyFormFill . getRemark ( ) ) ;
}
}