Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
5e2a7ca68f
|
|
@ -5,6 +5,7 @@ import com.bonus.aqgqj.basis.entity.vo.AuditHistoryVo;
|
|||
import com.bonus.aqgqj.basis.entity.vo.ExperimentalDetailVo;
|
||||
import com.bonus.aqgqj.basis.entity.vo.ExperimentalVo;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -52,10 +53,45 @@ public interface ExamineMapper {
|
|||
|
||||
/**
|
||||
* 添加审核数据
|
||||
*
|
||||
* @param vo
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/24 20:49
|
||||
*/
|
||||
void checkData(AuditHistoryVo vo);
|
||||
|
||||
/**
|
||||
* 更新试验信息表审核状态
|
||||
*
|
||||
* @param vo
|
||||
* @param experId
|
||||
* @param status
|
||||
* @param auditStatus
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/25 9:16
|
||||
*/
|
||||
void updateExperStatus(@Param("params") AuditHistoryVo vo, @Param("experId") Long experId, @Param("status") Integer status, @Param("auditStatus") Integer auditStatus);
|
||||
|
||||
/**
|
||||
* 查询试验项是否都是通过
|
||||
*
|
||||
* @param vo
|
||||
* @return List<Integer>
|
||||
* @author cwchen
|
||||
* @date 2024/7/25 9:31
|
||||
*/
|
||||
List<Integer> getExperIsPass(AuditHistoryVo vo);
|
||||
|
||||
/**
|
||||
* 更新收样信息审核的状态
|
||||
* @param vo
|
||||
* @param audtiStatus
|
||||
* @param processStatus
|
||||
* @return void
|
||||
* @author cwchen
|
||||
* @date 2024/7/25 9:41
|
||||
*/
|
||||
void updateSampleStatus(@Param("params") AuditHistoryVo vo, @Param("audtiStatus") Integer audtiStatus, @Param("processStatus") Integer processStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import com.bonus.aqgqj.basis.entity.vo.TestVo;
|
|||
import com.bonus.aqgqj.basis.service.ExamineService;
|
||||
import com.bonus.aqgqj.utils.ServerResponse;
|
||||
import com.bonus.aqgqj.utils.SystemUtils;
|
||||
import com.bonus.aqgqj.webResult.Constants;
|
||||
import com.bonus.aqgqj.webResult.HttpStatus;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
|
@ -20,10 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @className:ExamineServiceImpl
|
||||
|
|
@ -85,18 +83,53 @@ public class ExamineServiceImpl implements ExamineService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse checkData(AuditHistoryVo vo) {
|
||||
try {
|
||||
if(vo.getExperIds() == null || vo.getExperIds().length == 0){
|
||||
if (vo.getExperIds() == null || vo.getExperIds().length == 0) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数不完整");
|
||||
}
|
||||
String validResult = validatorsUtils.valid(vo, AuditHistoryVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, validResult);
|
||||
}
|
||||
// 验证当前登录人是否有审批权限
|
||||
String result = isHasAuth(vo);
|
||||
if(StringUtils.isNotBlank(result)){
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, result);
|
||||
}
|
||||
SystemUtils.isExperimentalTeamLeader();
|
||||
for (Long experId : vo.getExperIds()) {
|
||||
vo.setExperId(experId);
|
||||
mapper.checkData(vo);
|
||||
// auditType 审核类型 1 审阅 2 审核 3 审批 auditStatus 审核结果 2 不通过 1通过
|
||||
Integer status = 0, auditStatus = 0;
|
||||
if (Objects.equals(vo.getAuditStatus(), Constants.PASS)) {
|
||||
// 审查不通过
|
||||
Integer[] valArr = handleData(vo, 1);
|
||||
status = valArr[0];
|
||||
auditStatus = valArr[1];
|
||||
// 更新试验信息表审核状态
|
||||
} else if (Objects.equals(vo.getAuditStatus(), Constants.NOT_PASS)) {
|
||||
// 审查不通过
|
||||
Integer[] valArr = handleData(vo, 2);
|
||||
status = valArr[0];
|
||||
auditStatus = valArr[1];
|
||||
}
|
||||
|
||||
mapper.updateExperStatus(vo, experId, status, auditStatus);
|
||||
}
|
||||
// 查询试验项是否都是通过,并更新收样信息审核的状态
|
||||
List<Integer> experIsPassList = mapper.getExperIsPass(vo);
|
||||
Integer audtiStatus = 0, processStatus = 0;
|
||||
if (experIsPassList.get(Constants.NOT_PASS_INDEX) > 0) {
|
||||
// 存在未通过项
|
||||
Integer[] valArr = handleData(vo, 3);
|
||||
processStatus = valArr[0];
|
||||
audtiStatus = valArr[1];
|
||||
} else if (Objects.equals(experIsPassList.get(Constants.ALL_EXPER_INDEX), experIsPassList.get(Constants.PASS_INDEX))) {
|
||||
// 全部通过
|
||||
Integer[] valArr = handleData(vo, 4);
|
||||
processStatus = valArr[0];
|
||||
audtiStatus = valArr[1];
|
||||
}
|
||||
mapper.updateSampleStatus(vo, audtiStatus, processStatus);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
|
@ -104,4 +137,91 @@ public class ExamineServiceImpl implements ExamineService {
|
|||
}
|
||||
return ServerResponse.createBySuccessMsg("操作成功");
|
||||
}
|
||||
|
||||
public Integer[] handleData(AuditHistoryVo vo, int type) {
|
||||
// type 1.试验项审查通过 2.试验项审查不通过 3.审查有不通过项 4.审查全部通过
|
||||
Integer[] valueArr = new Integer[2];
|
||||
if (type == Constants.TYPE1) {
|
||||
if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_1)) {
|
||||
// 审阅通过
|
||||
valueArr[0] = 2;
|
||||
valueArr[1] = 0;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_2)) {
|
||||
// 审核通过
|
||||
valueArr[0] = 3;
|
||||
valueArr[1] = 0;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_3)) {
|
||||
// 审批通过
|
||||
valueArr[0] = 4;
|
||||
valueArr[1] = 1;
|
||||
}
|
||||
} else if (type == Constants.TYPE2) {
|
||||
if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_1)) {
|
||||
// 审阅不通过
|
||||
valueArr[0] = 1;
|
||||
valueArr[1] = 2;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_2)) {
|
||||
// 审核不通过
|
||||
valueArr[0] = 2;
|
||||
valueArr[1] = 3;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_3)) {
|
||||
// 审批不通过
|
||||
valueArr[0] = 3;
|
||||
valueArr[1] = 4;
|
||||
}
|
||||
} else if (type == Constants.TYPE3) {
|
||||
if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_1)) {
|
||||
// 审阅
|
||||
valueArr[0] = 1;
|
||||
valueArr[1] = 2;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_2)) {
|
||||
// 审核
|
||||
valueArr[0] = 2;
|
||||
valueArr[1] = 2;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_3)) {
|
||||
// 审批
|
||||
valueArr[0] = 3;
|
||||
valueArr[1] = 2;
|
||||
}
|
||||
} else if (type == Constants.TYPE4) {
|
||||
if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_1)) {
|
||||
// 审阅
|
||||
valueArr[0] = 2;
|
||||
valueArr[1] = 0;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_2)) {
|
||||
// 审核
|
||||
valueArr[0] = 3;
|
||||
valueArr[1] = 0;
|
||||
} else if (Objects.equals(vo.getAuditType(), Constants.AUDIT_TYPE_3)) {
|
||||
// 审批
|
||||
valueArr[0] = 4;
|
||||
valueArr[1] = 1;
|
||||
}
|
||||
}
|
||||
return valueArr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是试验班组长、技术负责人、中心负责人角色
|
||||
* @param vo
|
||||
* @return String
|
||||
* @author cwchen
|
||||
* @date 2024/7/25 10:32
|
||||
*/
|
||||
public String isHasAuth(AuditHistoryVo vo) {
|
||||
if(Objects.equals(vo.getAuditType(),Constants.AUDIT_TYPE_1)){
|
||||
if (!SystemUtils.isExperimentalTeamLeader()) {
|
||||
return "该账号无审阅权限";
|
||||
}
|
||||
}else if(Objects.equals(vo.getAuditType(),Constants.AUDIT_TYPE_2)){
|
||||
if (!SystemUtils.isTechnicalDirector()) {
|
||||
return "该账号无审核权限";
|
||||
}
|
||||
}else if(Objects.equals(vo.getAuditType(),Constants.AUDIT_TYPE_3)){
|
||||
if (!SystemUtils.isCenterManager()) {
|
||||
return "该账号无审批权限";
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,14 +19,17 @@ public class SystemUtils {
|
|||
|
||||
/**
|
||||
* 自动注入
|
||||
*
|
||||
* @param windowsPath
|
||||
*/
|
||||
@Value("${file.windwos.upload_path}")
|
||||
public void setWindowsPath(String windowsPath) {
|
||||
SystemUtils.windowsPath = windowsPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动注入
|
||||
*
|
||||
* @param linuxPath
|
||||
*/
|
||||
@Value("${file.linux.upload_path}")
|
||||
|
|
@ -36,9 +39,10 @@ public class SystemUtils {
|
|||
|
||||
/**
|
||||
* 返回系统
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getSystem(){
|
||||
public static String getSystem() {
|
||||
String os = System.getProperty("os.name");
|
||||
//Windows操作系统
|
||||
if (os != null && os.toLowerCase().startsWith("windows")) {
|
||||
|
|
@ -53,58 +57,101 @@ public class SystemUtils {
|
|||
|
||||
/**
|
||||
* 获取文件上传路径
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static String getUploadPath(){
|
||||
String os=getSystem();
|
||||
System.err.println("当前系统是="+os);
|
||||
if(os.equals("windows")){
|
||||
public static String getUploadPath() {
|
||||
String os = getSystem();
|
||||
System.err.println("当前系统是=" + os);
|
||||
if (os.equals("windows")) {
|
||||
return windowsPath;
|
||||
}else if(os.equals("linux")){
|
||||
} else if (os.equals("linux")) {
|
||||
return linuxPath;
|
||||
}else{
|
||||
} else {
|
||||
return windowsPath;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是试验班组-班组成员
|
||||
*
|
||||
* @return Boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/23 9:30
|
||||
*/
|
||||
public static Boolean isExperimentalTeam(){
|
||||
if(UserUtil.getLoginUser() == null){
|
||||
public static Boolean isExperimentalTeam() {
|
||||
if (UserUtil.getLoginUser() == null) {
|
||||
return false;
|
||||
}
|
||||
String roleCode = StringUtils.isNotBlank(UserUtil.getLoginUser().getRoleCode()) ? UserUtil.getLoginUser().getRoleCode() : null;
|
||||
String teamId = StringUtils.isNotBlank(UserUtil.getLoginUser().getTeamId()) ? UserUtil.getLoginUser().getTeamId() : null;
|
||||
if(Objects.equals(Constants.EXPERIMPERIMENTALTEAMMEMBER,roleCode)&& teamId!=null){
|
||||
if (Objects.equals(Constants.EXPERIMPERIMENTALTEAMMEMBER, roleCode) && teamId != null) {
|
||||
return true;
|
||||
}else if(Objects.equals(Constants.ADMIDMINISTRATORS,roleCode) ){
|
||||
} else if (Objects.equals(Constants.ADMIDMINISTRATORS, roleCode)) {
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是试验班组-班组长
|
||||
* 是否是试验班组-班组长角色
|
||||
*
|
||||
* @return Boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/23 9:30
|
||||
*/
|
||||
public static Boolean isExperimentalTeamLeader(){
|
||||
if(UserUtil.getLoginUser() == null){
|
||||
public static Boolean isExperimentalTeamLeader() {
|
||||
if (UserUtil.getLoginUser() == null) {
|
||||
return false;
|
||||
}
|
||||
String roleCode = StringUtils.isNotBlank(UserUtil.getLoginUser().getRoleCode()) ? UserUtil.getLoginUser().getRoleCode() : null;
|
||||
String teamId = StringUtils.isNotBlank(UserUtil.getLoginUser().getTeamId()) ? UserUtil.getLoginUser().getTeamId() : null;
|
||||
if(Objects.equals(Constants.EXPERIMENTALTEAMLEADER,roleCode) && teamId!=null){
|
||||
if (Objects.equals(Constants.EXPERIMENTALTEAMLEADER, roleCode) && teamId != null) {
|
||||
return true;
|
||||
}else if(Objects.equals(Constants.ADMIDMINISTRATORS,roleCode) ){
|
||||
} else if (Objects.equals(Constants.ADMIDMINISTRATORS, roleCode)) {
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是技术负责人角色
|
||||
* @return Boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/25 10:28
|
||||
*/
|
||||
public static Boolean isTechnicalDirector() {
|
||||
if (UserUtil.getLoginUser() == null) {
|
||||
return false;
|
||||
}
|
||||
String roleCode = StringUtils.isNotBlank(UserUtil.getLoginUser().getRoleCode()) ? UserUtil.getLoginUser().getRoleCode() : null;
|
||||
if (Objects.equals(Constants.TECHNICALDIRECTOR, roleCode)) {
|
||||
return true;
|
||||
} else if (Objects.equals(Constants.ADMIDMINISTRATORS, roleCode)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是中心负责人角色
|
||||
* @return Boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/25 10:28
|
||||
*/
|
||||
public static Boolean isCenterManager() {
|
||||
if (UserUtil.getLoginUser() == null) {
|
||||
return false;
|
||||
}
|
||||
String roleCode = StringUtils.isNotBlank(UserUtil.getLoginUser().getRoleCode()) ? UserUtil.getLoginUser().getRoleCode() : null;
|
||||
if (Objects.equals(Constants.CENTERTRALMANAGER, roleCode)) {
|
||||
return true;
|
||||
} else if (Objects.equals(Constants.ADMIDMINISTRATORS, roleCode)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,9 +159,25 @@ public class Constants
|
|||
/**综合班组成员-收样权限*/
|
||||
public static final String INTEGRATEDTEAMMEMBER = "integratedTeamMember";
|
||||
|
||||
public static final String VALUE_DATA = "-1";
|
||||
public static final String VALUE_DATA2 = "0";
|
||||
public static final String VALUE_DATA3 = "1";
|
||||
/**审查通过*/
|
||||
public static final Integer PASS = 1;
|
||||
/**审查不通过*/
|
||||
public static final Integer NOT_PASS = 2;
|
||||
|
||||
/**审阅*/
|
||||
public static final Integer AUDIT_TYPE_1 = 1;
|
||||
/**审核*/
|
||||
public static final Integer AUDIT_TYPE_2 = 1;
|
||||
/**审批*/
|
||||
public static final Integer AUDIT_TYPE_3 = 1;
|
||||
|
||||
public static final Integer NOT_PASS_INDEX = 2;
|
||||
public static final Integer PASS_INDEX = 1;
|
||||
public static final Integer ALL_EXPER_INDEX = 0;
|
||||
public static final Integer TYPE1 = 1;
|
||||
public static final Integer TYPE2 = 2;
|
||||
public static final Integer TYPE3 = 3;
|
||||
public static final Integer TYPE4 = 4;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,15 @@
|
|||
INSERT INTO tb_audit_history(id,exper_id,audit_time,audit_user_id,audit_user_name,audit_status,audit_remark,audit_type) VALUES
|
||||
(null,#{experId},#{auditTime},#{auditUserId},#{auditUserName},#{auditStatus},#{auditRemark},#{auditType})
|
||||
</insert>
|
||||
<!--更新试验信息表审核状态-->
|
||||
<update id="updateExperStatus">
|
||||
UPDATE tb_exper SET status = #{status},audit_status = #{auditStatus},audit_user_name = #{params.auditUserName},audit_time = #{params.auditTime},audit_remakr = #{params.auditRemark}
|
||||
WHERE id = #{experId}
|
||||
</update>
|
||||
<!--更新收样信息审核的状态-->
|
||||
<update id="updateSampleStatus">
|
||||
UPDATE tb_sample SET audti_status = #{audtiStatus},process_status = #{processStatus} WHERE id = #{params.sampleId}
|
||||
</update>
|
||||
|
||||
<!--试验审查列表-->
|
||||
<select id="getList" resultType="com.bonus.aqgqj.basis.entity.vo.ExperimentalVo">
|
||||
|
|
@ -144,4 +153,30 @@
|
|||
FROM tb_exper_dev
|
||||
WHERE exper_id = #{experId}
|
||||
</select>
|
||||
<!--查询试验项是否都是通过-->
|
||||
<select id="getExperIsPass" resultType="java.lang.Integer">
|
||||
SELECT COUNT(*) FROM tb_exper WHERE sample_id = #{sampleId} AND del_flag = 0
|
||||
UNION ALL
|
||||
SELECT COUNT(*) FROM tb_exper WHERE sample_id = #{sampleId} AND del_flag = 0
|
||||
<if test="auditType == 1">
|
||||
AND status = 2 AND audit_status = 0
|
||||
</if>
|
||||
<if test="auditType == 2">
|
||||
AND status = 3 AND audit_status = 0
|
||||
</if>
|
||||
<if test="auditType == 3">
|
||||
AND status = 4 AND audit_status = 1
|
||||
</if>
|
||||
UNION ALL
|
||||
SELECT COUNT(*) FROM tb_exper WHERE sample_id = #{sampleId} AND del_flag = 0
|
||||
<if test="auditType == 1">
|
||||
AND status = 1 AND audit_status = 2
|
||||
</if>
|
||||
<if test="auditType == 2">
|
||||
AND status = 2 AND audit_status = 3
|
||||
</if>
|
||||
<if test="auditType == 3">
|
||||
AND status = 3 AND audit_status = 4
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue