试验管理
This commit is contained in:
parent
ba9a224e85
commit
27469e94ce
|
|
@ -1,7 +1,10 @@
|
|||
package com.bonus.aqgqj.basis.entity.dto;
|
||||
|
||||
import com.bonus.aqgqj.base.entity.PageEntity;
|
||||
import com.bonus.aqgqj.utils.UserUtil;
|
||||
import lombok.Data;
|
||||
import org.apache.catalina.User;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* @className:ParamsDto
|
||||
|
|
@ -42,4 +45,18 @@ public class ParamsDto extends PageEntity {
|
|||
*/
|
||||
private Long[] ids;
|
||||
|
||||
/**
|
||||
* 角色编码
|
||||
*/
|
||||
private String roleCode = UserUtil.getLoginUser() !=null && StringUtils.isNotBlank(UserUtil.getLoginUser().getRoleCode()) ? UserUtil.getLoginUser().getRoleCode() : null;
|
||||
/**
|
||||
* 班组ID
|
||||
*/
|
||||
private String teamId = UserUtil.getLoginUser() !=null && StringUtils.isNotBlank(UserUtil.getLoginUser().getTeamId()) ? UserUtil.getLoginUser().getTeamId() : "-1";
|
||||
|
||||
/**
|
||||
* 是否是班组长
|
||||
*/
|
||||
private String isTeamLeader = UserUtil.getLoginUser() !=null && StringUtils.isNotBlank(UserUtil.getLoginUser().getIsTeamLeader()) ? UserUtil.getLoginUser().getIsTeamLeader() : "0";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class ExperConfigVo {
|
|||
* 创建人
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long createUser = UserUtil.getLoginUser().getId();
|
||||
private Long createUser = UserUtil.getLoginUser() !=null ? UserUtil.getLoginUser().getId() : -1;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
@ -71,7 +71,7 @@ public class ExperConfigVo {
|
|||
* 修改人
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long updateUser = UserUtil.getLoginUser().getId();
|
||||
private Long updateUser = UserUtil.getLoginUser() !=null ? UserUtil.getLoginUser().getId() : -1;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ public class TestVo {
|
|||
* 创建人
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long createUser = UserUtil.getLoginUser().getId();
|
||||
private Long createUser = UserUtil.getLoginUser() !=null ? UserUtil.getLoginUser().getId() : -1;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
|
|
@ -134,7 +134,7 @@ public class TestVo {
|
|||
* 修改人
|
||||
*/
|
||||
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
|
||||
private Long updateUser = UserUtil.getLoginUser().getId();
|
||||
private Long updateUser = UserUtil.getLoginUser() !=null ? UserUtil.getLoginUser().getId() : -1;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -360,4 +360,5 @@ public class ExperimentStandardServiceImpl implements ExperimentStandardService
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import com.bonus.aqgqj.basis.entity.vo.*;
|
|||
import com.bonus.aqgqj.basis.service.ExperimentalService;
|
||||
import com.bonus.aqgqj.utils.DateTimeHelper;
|
||||
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;
|
||||
|
|
@ -124,6 +125,9 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public ServerResponse addTestData(TestVo vo) {
|
||||
try {
|
||||
if(!SystemUtils.isExperimentalTeam()){
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法添加试验数据");
|
||||
}
|
||||
// 整体数据校验数据
|
||||
String validResult = validatorsUtils.valid(vo, TestVo.Query.class);
|
||||
if (StringUtils.isNotBlank(validResult)) {
|
||||
|
|
@ -194,6 +198,9 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
if(vo.getId() == null){
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "参数不完整");
|
||||
}
|
||||
if(!SystemUtils.isExperimentalTeam()){
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法修改试验数据");
|
||||
}
|
||||
// 处于审核流程中的数据无法进行修改
|
||||
int isCheck = mapper.isCheck(vo.getId());
|
||||
if(isCheck > 0){
|
||||
|
|
@ -323,6 +330,9 @@ public class ExperimentalServiceImpl implements ExperimentalService {
|
|||
if(dto.getIds() == null || dto.getIds().length == 0){
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR,"未提交审查数据");
|
||||
}
|
||||
if(!SystemUtils.isExperimentalTeam()){
|
||||
return ServerResponse.createByErrorMsg(HttpStatus.ERROR, "非试验班组,无法提交审查数据");
|
||||
}
|
||||
// 判断提交数据中是否存在流程数据或者存在待试验项
|
||||
List<Long> list = Arrays.asList(dto.getIds());
|
||||
int result = mapper.isNotEditData(list);
|
||||
|
|
|
|||
|
|
@ -115,6 +115,8 @@ public class SysUser extends PageEntity {
|
|||
private String roleCode;
|
||||
/**班组ID*/
|
||||
private String teamId;
|
||||
/**是否是班组长*/
|
||||
private String isTeamLeader;
|
||||
|
||||
|
||||
public interface Status {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,13 @@
|
|||
package com.bonus.aqgqj.utils;
|
||||
|
||||
import com.bonus.aqgqj.webResult.Constants;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class SystemUtils {
|
||||
|
|
@ -63,9 +67,51 @@ public class SystemUtils {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 是否是试验班组-试验人员
|
||||
* @return Boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/23 9:30
|
||||
*/
|
||||
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() : "-1";
|
||||
String isTeamLeader = StringUtils.isNotBlank(UserUtil.getLoginUser().getIsTeamLeader()) ? UserUtil.getLoginUser().getIsTeamLeader() : "0";
|
||||
if(Objects.equals(Constants.EXPERIMENTALTEAM,roleCode)
|
||||
&& !Objects.equals(Constants.VALUE_DATA,teamId)
|
||||
&& Objects.equals(isTeamLeader,Constants.VALUE_DATA2)){
|
||||
return true;
|
||||
}else if(Objects.equals(Constants.ADMIDMINISTRATORS,roleCode) ){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是试验班组-班组长
|
||||
* @return Boolean
|
||||
* @author cwchen
|
||||
* @date 2024/7/23 9:30
|
||||
*/
|
||||
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() : "-1";
|
||||
String isTeamLeader = StringUtils.isNotBlank(UserUtil.getLoginUser().getIsTeamLeader()) ? UserUtil.getLoginUser().getIsTeamLeader() : "0";
|
||||
if(Objects.equals(Constants.EXPERIMENTALTEAM,roleCode)
|
||||
&& !Objects.equals(Constants.VALUE_DATA,teamId)
|
||||
&& Objects.equals(isTeamLeader,Constants.VALUE_DATA3)){
|
||||
return true;
|
||||
}else if(Objects.equals(Constants.ADMIDMINISTRATORS,roleCode) ){
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,5 +144,20 @@ public class Constants
|
|||
public static final String ERROR_RESULT2 = "不通过";
|
||||
public static final String SUCCESS_RESULT = "合格";
|
||||
|
||||
/**管理员*/
|
||||
public static final String ADMIDMINISTRATORS = "administrators";
|
||||
/**技术负责人*/
|
||||
public static final String TECHNICALDIRECTOR = "technicalDirector";
|
||||
/**中心负责人*/
|
||||
public static final String CENTERTRALMANAGER = "centerManager";
|
||||
/**试验班组*/
|
||||
public static final String EXPERIMENTALTEAM = "experimentalTeam";
|
||||
/**综合班组*/
|
||||
public static final String INTEGRATEDTEAM = "integratedTeam";
|
||||
|
||||
public static final String VALUE_DATA = "-1";
|
||||
public static final String VALUE_DATA2 = "0";
|
||||
public static final String VALUE_DATA3 = "1";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -293,6 +293,14 @@
|
|||
<if test="devTypeCode != null and devTypeCode!=''">
|
||||
AND INSTR(tsd.sampleDevCode,#{devTypeCode})
|
||||
</if>
|
||||
<if test="roleCode != 'administrators'">
|
||||
<if test="roleCode == 'experimentalTeam' and teamId != '-1' and isTeamLeader == '0'">
|
||||
AND ts.team_id = #{teamId}
|
||||
</if>
|
||||
<if test="(roleCode != 'experimentalTeam') or (roleCode == 'experimentalTeam' and teamId != '-1' and isTeamLeader == '1')">
|
||||
AND ts.team_id = -1
|
||||
</if>
|
||||
</if>
|
||||
ORDER BY FIELD(audtiStatus, '审阅不通过','审核不通过','审批不通过','待试验','待提交','待审阅','待审核','待审批','试验结束') ASC,dispatch_time ASC
|
||||
</select>
|
||||
<!--试验详情列表-->
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
<select id="getUser" parameterType="String" resultType="com.bonus.aqgqj.model.SysUser">
|
||||
select t.id,t.user_name as username,t.login_name as loginName,
|
||||
t.password,t.state,t.role_id as roleId,t.login_type loginType,t.new_user newUser,
|
||||
sr.role_code AS roleCode,sr.role_name AS roleName,t.team_id AS teamId
|
||||
sr.role_code AS roleCode,sr.role_name AS roleName,t.team_id AS teamId,t.is_team_leader AS isTeamLeader
|
||||
from sys_user t
|
||||
LEFT JOIN sys_role sr ON t.role_id = sr.role_id AND sr.del_flag = 0
|
||||
where t.login_name = #{username}
|
||||
|
|
|
|||
Loading…
Reference in New Issue