班组评价

This commit is contained in:
cwchen 2024-03-14 13:24:18 +08:00
parent ff362c3876
commit e8908512a8
3 changed files with 35 additions and 3 deletions

View File

@ -3,6 +3,10 @@ package com.securitycontrol.entity.system.base.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
/**
* @authorcwchen
@ -17,9 +21,13 @@ public class TeamQuEvalVo {
private String evalId;
@ApiModelProperty(value = "班组ID")
@NotBlank(message = "班组ID不能为空", groups = {TeamQuEvalVo.Query.class})
@Length(max = 100, message = "班组ID字符长度不能超过100", groups = {TeamQuEvalVo.Query.class})
private String teamId;
@ApiModelProperty(value = "班组名称")
@NotBlank(message = "班组名称不能为空", groups = {TeamQuEvalVo.Query.class})
@Length(max = 30, message = "班组名称字符长度不能超过30", groups = {TeamQuEvalVo.Query.class})
private String teamName;
@ApiModelProperty(value = "班组长")
@ -35,12 +43,22 @@ public class TeamQuEvalVo {
private String evaluator;
@ApiModelProperty(value = "星级分")
@NotBlank(message = "评价星级不能为空", groups = {TeamQuEvalVo.Query.class})
@Pattern(regexp="^([1-9]||10)$", message="评价星级为1-5星",groups = {TeamQuEvalVo.Query.class})
private String score;
@ApiModelProperty(value = "评价内容")
@NotBlank(message = "评价内容不能为空", groups = {TeamQuEvalVo.Query.class})
@Length(max = 100, message = "评价内容字符长度不能超过100", groups = {TeamQuEvalVo.Query.class})
private String content;
@ApiModelProperty(value = "1.新增 2.修改")
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Integer type;
/**
* 查询条件限制
*/
public interface Query {
}
}

View File

@ -16,20 +16,25 @@ spring:
cloud:
nacos:
discovery:
username: nacos
password: nacos
namespace: jjzhgd
# 服务注册地址
server-addr: 127.0.0.1:8848
namespace: jjzhgd
# server-addr: 10.138.225.186:28848
# server-addr: 10.138.225.186:28848
config:
# 配置中心地址
server-addr: 127.0.0.1:8848
namespace: jjzhgd
# 配置文件格式
file-extension: yml
#server-addr: 10.145.34.32:8848
# 共享配置
shared-configs:
- vsc-dev.yml
username: nacos
password: nacos
namespace: jjzhgd
# server-addr: 10.138.132.188:18848
management:
server:
port: -1

View File

@ -4,7 +4,9 @@ import com.securitycontrol.common.core.utils.StringUtils;
import com.securitycontrol.common.core.utils.aes.DateTimeHelper;
import com.securitycontrol.common.core.web.domain.AjaxResult;
import com.securitycontrol.common.security.utils.SecurityUtils;
import com.securitycontrol.common.security.utils.ValidatorsUtils;
import com.securitycontrol.entity.system.base.dto.TeamQuEvalDto;
import com.securitycontrol.entity.system.base.vo.ProVo;
import com.securitycontrol.entity.system.base.vo.TeamQuEvalVo;
import com.securitycontrol.system.base.mapper.ITeamQuEvalMapper;
import com.securitycontrol.system.base.service.ITeamQuEvalService;
@ -31,6 +33,9 @@ public class TeamQuEvalServiceImpl implements ITeamQuEvalService {
@Resource(name = "ITeamQuEvalMapper")
private ITeamQuEvalMapper mapper;
@Resource(name = "ValidatorsUtils")
private ValidatorsUtils validatorsUtils;
@Override
public List<TeamQuEvalVo> getTeamQuEvalLists(TeamQuEvalDto dto) {
List<TeamQuEvalVo> list = new ArrayList<>();
@ -42,6 +47,10 @@ public class TeamQuEvalServiceImpl implements ITeamQuEvalService {
@Transactional(rollbackFor = Exception.class)
public AjaxResult addOrUpdateTeamEval(TeamQuEvalVo vo) {
try {
String validResult = validatorsUtils.valid(vo, TeamQuEvalVo.Query.class);
if (StringUtils.isNotBlank(validResult)) {
return AjaxResult.error(validResult);
}
if (SecurityUtils.getLoginUser() != null && SecurityUtils.getLoginUser().getSysUser() != null) {
vo.setEvaluator(SecurityUtils.getLoginUser().getSysUser().getUserName());
}