Commit 03b11eb1 by Administrator

Merge branch 'tzq' into 'develop'

Tzq

See merge request 8timerv2/8timerapiv200!81
parents f91cba87 a5608fa0
......@@ -7,11 +7,7 @@ import java.util.List;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.Signature;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
import org.springframework.validation.BeanPropertyBindingResult;
import org.springframework.validation.ObjectError;
......@@ -25,12 +21,12 @@ import cn.timer.api.aspect.lang.bean.ValidationError;
import cn.timer.api.utils.ResultUtil;
/**
* 校验信息返回
* 校验信息返回-(闲置)
*
* @author TZQ
*/
@Aspect
@Component
//@Aspect
//@Component
public class BindingResultAspect {
// @annotation配置织入点
......@@ -40,7 +36,7 @@ public class BindingResultAspect {
// }
// execution 配置织入点 -匹配 cn.timer.api.controller 包下的所有子包的类的方法
@Pointcut("execution(* cn.timer.api.controller.spmk.*.*(..))")
// @Pointcut("execution(* cn.timer.api.controller.spmk.*.*(..))")
public void clazzPointCut(){
}
......@@ -53,45 +49,41 @@ public class BindingResultAspect {
// }
// @Around("bindingResultPointCut() && args(..,bindingResult)")
@Around("clazzPointCut()")
public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
Long startTime = System.currentTimeMillis();
Object retVal;
Object[] objs = joinPoint.getArgs();
List<Object> listObj = CollectionUtil.toList(objs);
BeanPropertyBindingResult optional = (BeanPropertyBindingResult)listObj.stream()
.filter(p -> "BeanPropertyBindingResult".equals(ClassUtil.getClassName(p, true)))
.findFirst()
.orElse(null);
if(optional != null && optional.hasErrors()){
List<ObjectError> ls = optional.getAllErrors();
List<ValidationError> listVe = new ArrayList<ValidationError>();
ValidationError ve;
for (ObjectError one : ls) {
String fieldString = one.getCodes().length >= 1 ? one.getCodes()[0] : "";
if (fieldString != null) {
fieldString = fieldString.substring(fieldString.lastIndexOf(".") + 1);
}
// for (String str : one.getCodes()) {
// System.err.println(str);
// @Around("clazzPointCut()")
// public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
// Long startTime = System.currentTimeMillis();
// Object retVal;
// Object[] objs = joinPoint.getArgs();
// List<Object> listObj = CollectionUtil.toList(objs);
// BeanPropertyBindingResult optional = (BeanPropertyBindingResult)listObj.stream()
// .filter(p -> "BeanPropertyBindingResult".equals(ClassUtil.getClassName(p, true)))
// .findFirst()
// .orElse(null);
// if(optional != null && optional.hasErrors()){
// List<ObjectError> ls = optional.getAllErrors();
// List<ValidationError> listVe = new ArrayList<ValidationError>();
// ValidationError ve;
// for (ObjectError one : ls) {
//
// String fieldString = one.getCodes().length >= 1 ? one.getCodes()[0] : "";
// if (fieldString != null) {
// fieldString = fieldString.substring(fieldString.lastIndexOf(".") + 1);
// }
//
// ve = ValidationError.builder().field(fieldString).msg(one.getDefaultMessage()).build();
// listVe.add(ve);
//
// }
// retVal = ResultUtil.error(listVe);
// }else {
// retVal = joinPoint.proceed(joinPoint.getArgs());
// }
// Console.log("返回内容 {}: " ,JSONObject.toJSONString(retVal));
// Long endtime = System.currentTimeMillis();
// Console.log("执行耗时为{}:" ,endtime-startTime + "ms");
//
// return retVal;
// }
ve = ValidationError.builder().field(fieldString).msg(one.getDefaultMessage()).build();
listVe.add(ve);
}
retVal = ResultUtil.error(listVe);
}else {
retVal = joinPoint.proceed(joinPoint.getArgs());
}
Console.log("返回内容 {}: " ,JSONObject.toJSONString(retVal));
Long endtime = System.currentTimeMillis();
Console.log("执行耗时为{}:" ,endtime-startTime + "ms");
return retVal;
}
protected void handleDataScope(final JoinPoint joinPoint)
{
......
......@@ -28,8 +28,8 @@ public interface YgEnumInterface {
* 男女
*/
@Getter
enum sex implements YgEnumInterface{
MAN(0,"男"),WOMAN(1,"女");
enum sex implements YgEnumInterface {
MAN(0, "男"), WOMAN(1, "女");
private Integer type;
......@@ -39,18 +39,21 @@ public interface YgEnumInterface {
this.type = type;
this.name = name;
}
public static String isMan(String index) {
sex mow = (index == null || index.length() == 0) ? sex.MAN : (index.indexOf(sex.MAN.name)!= -1)||(index.indexOf(sex.MAN.type)!= -1) ? sex.MAN:sex.WOMAN;
sex mow = (index == null || index.length() == 0) ? sex.MAN
: (index.indexOf(sex.MAN.name) != -1) || (index.indexOf(sex.MAN.type) != -1) ? sex.MAN : sex.WOMAN;
return mow.type.toString();
}
}
/**
* 员工类型
*/
@Getter
enum YgJobType implements YgEnumInterface{
QUANZHI(0, "全"),SHIXI(1, "实习"),JIANZHI(2, "兼"),LWPQ(3, "劳务派遣"),
LAOWU(4, "劳务"),PAIQIAN(5, "派遣"),WAIBAO(6, "外包"),TUIXIU(7, "退休");
enum YgJobType implements YgEnumInterface {
QUANZHI(0, "全"), SHIXI(1, "实习"), JIANZHI(2, "兼"), LWPQ(3, "劳务派遣"), LAOWU(4, "劳务"), PAIQIAN(5, "派遣"),
WAIBAO(6, "外包"), TUIXIU(7, "退休");
private Integer type;
......@@ -63,9 +66,11 @@ public interface YgEnumInterface {
public static String choose(String index) {
YgJobType result = YgJobType.QUANZHI;
if(index == null || index.length() == 0) return result.type.toString();
if (index == null || index.length() == 0)
return result.type.toString();
for (YgJobType item : YgJobType.values()) {
if (index.indexOf(item.getType()) !=-1 ||index.indexOf(item.getName()) !=-1 ) result = item;
if (index.indexOf(item.getType()) != -1 || index.indexOf(item.getName()) != -1)
result = item;
}
return result.type.toString();
}
......@@ -75,8 +80,8 @@ public interface YgEnumInterface {
* 员工状态
*/
@Getter
enum jobStatus implements YgEnumInterface{
SHIYONG(0,"试用"),ZHENSHI(1,"正式"),LIZHIZHONG(2,"离职中"),YILIZHI(3,"已离职");
enum jobStatus implements YgEnumInterface {
SHIYONG(0, "试用"), ZHENSHI(1, "正式"), LIZHIZHONG(2, "离职中"), YILIZHI(3, "已离职");
private Integer type;
......@@ -86,21 +91,23 @@ public interface YgEnumInterface {
this.type = type;
this.name = name;
}
public static String isZhen(String index) {
jobStatus zos = (index == null || index.length() == 0) ? YgEnumInterface.jobStatus.ZHENSHI: (index.indexOf(jobStatus.ZHENSHI.name)!= -1)||(index.indexOf(jobStatus.ZHENSHI.type)!= -1) ? jobStatus.ZHENSHI:jobStatus.SHIYONG;
jobStatus zos = (index == null || index.length() == 0) ? YgEnumInterface.jobStatus.ZHENSHI
: (index.indexOf(jobStatus.ZHENSHI.name) != -1) || (index.indexOf(jobStatus.ZHENSHI.type) != -1)
? jobStatus.ZHENSHI
: jobStatus.SHIYONG;
return zos.type.toString();
}
}
/**
* 入职日期
*/
@Getter
enum rzTime implements YgEnumInterface{
ZHEN("--","yyyy-M-d"),XIE("//","yyyy/M/d"),
DIAN("..","yyyy.M.d"),NYR("年月日","yyyy年M月d日");
enum rzTime implements YgEnumInterface {
ZHEN("--", "yyyy-M-d"), XIE("//", "yyyy/M/d"), DIAN("..", "yyyy.M.d"), NYR("年月日", "yyyy年M月d日");
private String type;
......@@ -112,7 +119,7 @@ public interface YgEnumInterface {
}
public static String tranTime(String index) {
//String str ="2013/11/12";
// String str ="2013/11/12";
if (index == null) {
return null;
}
......@@ -124,42 +131,51 @@ public interface YgEnumInterface {
return result2;
}
/*
* public static String tranTime(String index) { DateFormat zhenFormat = new
* SimpleDateFormat(ZHEN.name); String result = zhenFormat.format(new Date());
* if (index == null || index.length() == 0) return result; Pattern pattern =
* Pattern.compile("^[0-9]{8}$"); if (pattern.matcher(index).matches()) { result
* = index.substring(0, 4) + "-" + index.substring(4, 6) + "-" +
* index.substring(6, 8); return result; } String s =
* index.replaceAll("([1-9]+[0-9]*|0)(\\.[\\d]+)?", ""); for (rzTime item :
* rzTime.values()) { if (s.indexOf(item.type) != -1) { DateFormat dateFormat =
* new SimpleDateFormat(item.name); try { result = new
* SimpleDateFormat(ZHEN.name).format(dateFormat.parse(index)); return result; }
* catch (ParseException e) { e.printStackTrace(); return result; } } } return
* result; }
*/
// public static String tranTime(String index) {
// DateFormat zhenFormat = new SimpleDateFormat(ZHEN.name);
// String result = zhenFormat.format(new Date());
// if (index == null || index.length() == 0)
// return result;
// Pattern pattern = Pattern.compile("^[0-9]{8}$");
// if (pattern.matcher(index).matches()) {
// result = index.substring(0, 4) + "-" + index.substring(4, 6) + "-" + index.substring(6, 8);
// return result;
// }
// String s = index.replaceAll("([1-9]+[0-9]*|0)(\\.[\\d]+)?", "");
// for (rzTime item : rzTime.values()) {
// if (s.indexOf(item.type) != -1) {
// DateFormat dateFormat = new SimpleDateFormat(item.name);
// try {
// result = new SimpleDateFormat(ZHEN.name).format(dateFormat.parse(index));
// return result;
// } catch (ParseException e) {
// e.printStackTrace();
// return result;
// }
// }
// }
// return result;
// }
public static String tranTime2(String result) {
String isYear ="^(?:(?!0000)[0-9]{4} -(?:(?:0[1-9]|1[0-2]) -(?:0[1-9]|1[0-9]|2[0-8]) |(?:0[13-9]|1[0-2]) -(?:29|30) |(?:0[13578]|1[02]) -31 )|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00) -02 -29 )$";
String isYear = "^(?:(?!0000)[0-9]{4} -(?:(?:0[1-9]|1[0-2]) -(?:0[1-9]|1[0-9]|2[0-8]) |(?:0[13-9]|1[0-2]) -(?:29|30) |(?:0[13578]|1[02]) -31 )|(?:[0-9]{2}(?:0[48]|[2468][048]|[13579][26])|(?:0[48]|[2468][048]|[13579][26])00) -02 -29 )$";
Pattern pattern = Pattern.compile(isYear);
if (pattern.matcher(result).matches()) {
return result;
}else {
} else {
result = new SimpleDateFormat(ZHEN.name).format(new Date());
return result;
}
}
}
/**
* 试用期
*/
@Getter
enum syq implements YgEnumInterface{
ZERO(0,"无"),ONE(1,"一"),TWO(2,"二"),THREE(3,"三"),FOUR(4,"四"),FIVE(5,"五"),SIX(6,"六");
enum syq implements YgEnumInterface {
ZERO(0, "无"), ONE(1, "一"), TWO(2, "二"), THREE(3, "三"), FOUR(4, "四"), FIVE(5, "五"), SIX(6, "六");
private Integer type;
......@@ -169,11 +185,14 @@ public interface YgEnumInterface {
this.type = type;
this.name = name;
}
public static String choose(String index) {
syq result = syq.ZERO;
if (index == null || index.length() == 0) result.type.toString();
if (index == null || index.length() == 0)
result.type.toString();
for (syq item : syq.values()) {
if (index.indexOf(item.getName()) !=-1 ||index.indexOf(item.getType()) !=-1 ) result=item;
if (index.indexOf(item.getName()) != -1 || index.indexOf(item.getType()) != -1)
result = item;
}
return result.type.toString();
}
......@@ -183,51 +202,66 @@ public interface YgEnumInterface {
* 工龄
*/
@Getter
enum workage implements YgEnumInterface{
//NEW(0,183),HALF(1,365),ONE(2,548),ONEHALF(3,730),TWO(4,913),LONG(5,10000);
NEW(0,30,0),ROOKIE(31,183,0),HALF(184,365,0),ONE(366,548,0),ONEHALF(549,730,0),TWO(731,1000,0),LONG(1001,10000,0);
enum workage implements YgEnumInterface {
// NEW(0,183),HALF(1,365),ONE(2,548),ONEHALF(3,730),TWO(4,913),LONG(5,10000);
NEW(0, 30, 0), ROOKIE(31, 183, 0), HALF(184, 365, 0), ONE(366, 548, 0), ONEHALF(549, 730, 0), TWO(731, 1000, 0),
LONG(1001, 10000, 0);
private Integer begin;
private Integer end;
private Integer number;
workage(Integer begin, Integer end,Integer number) {
workage(Integer begin, Integer end, Integer number) {
this.begin = begin;
this.end = end;
this.number = number;
}
public static Map<String, Integer> choose(List<YgbintuDto> bintu) {
for (YgbintuDto b : bintu) {
Integer index = b.getWorkage();
for (workage item : workage.values()) {
if (index>= item.begin && index<=item.end) item.number++;
if (index >= item.begin && index <= item.end)
item.number++;
}
}
Map<String, Integer> result = new HashMap<String, Integer>();
result.put("本月新入职", NEW.number);
result.put("x<0.5", NEW.number+ROOKIE.number);
result.put("x<0.5", NEW.number + ROOKIE.number);
result.put("0.5<x<1", HALF.number);
result.put("1<x<1.5", ONE.number);
result.put("1.5<x<2", ONEHALF.number);
result.put("2<x<3", TWO.number);
result.put("x++", LONG.number);
NEW.number=0;ROOKIE.number=0;HALF.number=0;ONE.number=0;ONEHALF.number=0;TWO.number=0;LONG.number=0;
NEW.number = 0;
ROOKIE.number = 0;
HALF.number = 0;
ONE.number = 0;
ONEHALF.number = 0;
TWO.number = 0;
LONG.number = 0;
return result;
}
}
/**
* 年龄
*/
@Getter
enum age implements YgEnumInterface{
//NEW(0,183),HALF(1,365),ONE(2,548),ONEHALF(3,730),TWO(4,913),LONG(5,10000);
CHILD(1,17,0),TEEN(18,25,0),YOUNG(26,32,0),MAN(33,38,0),MIDDLE(39,45,0),OLD(46,1000,0);
enum age implements YgEnumInterface {
// NEW(0,183),HALF(1,365),ONE(2,548),ONEHALF(3,730),TWO(4,913),LONG(5,10000);
CHILD(1, 17, 0), TEEN(18, 25, 0), YOUNG(26, 32, 0), MAN(33, 38, 0), MIDDLE(39, 45, 0), OLD(46, 1000, 0);
private Integer begin;
private Integer end;
private Integer number;
age(Integer begin, Integer end,Integer number) {
age(Integer begin, Integer end, Integer number) {
this.begin = begin;
this.end = end;
this.number = number;
}
public static Map<String, Integer> choose(List<YgbintuDto> bintu) {
Integer average = 0;
Integer i = 0;
......@@ -235,7 +269,9 @@ public interface YgEnumInterface {
for (YgbintuDto b : bintu) {
Integer index = b.getAge();
for (; i < age.values().length; i++) {
if (index>= age.values()[i].begin && index<=age.values()[i].end) age.values()[i].number++;j++;
if (index >= age.values()[i].begin && index <= age.values()[i].end)
age.values()[i].number++;
j++;
}
average = average + index;
}
......@@ -246,9 +282,14 @@ public interface YgEnumInterface {
result.put("32-38", MAN.number);
result.put("38-45", MIDDLE.number);
result.put("45以上", OLD.number);
Integer pInjun = j>0 ?(average/j) :0;
Integer pInjun = j > 0 ? (average / j) : 0;
result.put("平均年龄", pInjun);
CHILD.number =0;TEEN.number=0;YOUNG.number=0;MAN.number=0;MIDDLE.number=0;OLD.number=0;
CHILD.number = 0;
TEEN.number = 0;
YOUNG.number = 0;
MAN.number = 0;
MIDDLE.number = 0;
OLD.number = 0;
return result;
}
}
......
package cn.timer.api.config.exception;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import cn.timer.api.aspect.lang.bean.ValidationError;
import cn.timer.api.utils.Result;
import cn.timer.api.utils.ResultUtil;
......@@ -57,4 +65,31 @@ public class GlobalExceptionHandler {
}
return ResultUtil.error(e.getCode(), e.getMessage());
}
/**
* 自定义验证异常
*/
@ExceptionHandler(MethodArgumentNotValidException.class)
public Object validExceptionHandler(MethodArgumentNotValidException e)
{
// log.error("1--------"+e.getMessage());
// log.error("2--------"+JSONUtil.parse(e.getBindingResult().getAllErrors()));
// String message = e.getBindingResult().getFieldError().getDefaultMessage();
// String field = e.getBindingResult().getFieldError().getField();
List<ObjectError> ls = e.getBindingResult().getAllErrors();
List<ValidationError> listVe = new ArrayList<ValidationError>();
ValidationError ve;
for (ObjectError one : ls) {
String fieldString = one.getCodes().length >= 1 ? one.getCodes()[0] : "";
if (fieldString != null) {
fieldString = fieldString.substring(fieldString.lastIndexOf(".") + 1);
}
ve = ValidationError.builder().field(fieldString).msg(one.getDefaultMessage()).build();
listVe.add(ve);
}
return ResultUtil.error(listVe);
}
}
package cn.timer.api.config.exception;
public class ValidationMsg {
public static final String NULL = "参数必须为空";
public static final String NOTNULL = "参数值不能为空";
public static final String NOTEMPTY = "参数值不能为空";
public static final String NOTBLANK = "参数键值不能为空";
public static final String ASSERTTRUE = "参数值必须为true";
public static final String ASSERTFALSE = "参数值必须为false";
public static final String PATTERN = "参数值格式不符";
public static final String SIZE = "参数长度不符";
public static final String MIN = "参数值太小";
public static final String MAX = "参数值太大";
public static final String DECIMALMIN = "参数值太小";
public static final String DECIMALMAX = "参数值太大";
public static final String DIGITS = "参数值大小不在有效范围内";
public static final String PAST = "参数值必须为过去日期";
public static final String FUTURE = "参数值必须为未来日期";
public static final String EMAIL = "参数值格式必须为邮箱地址";
public static final String LENGTH = "参数值长度不在有效范围内";
public static final String RANGE = "参数值不在有效范围内";
}
......@@ -22,9 +22,10 @@ public class MyConfiguration {
// 创建配置类
FastJsonConfig config = new FastJsonConfig();
config.setSerializerFeatures(
SerializerFeature.WriteNullListAsEmpty,
SerializerFeature.WriteMapNullValue,
SerializerFeature.WriteNullStringAsEmpty
SerializerFeature.PrettyFormat
// SerializerFeature.WriteNullListAsEmpty,
// SerializerFeature.WriteMapNullValue,
// SerializerFeature.WriteNullStringAsEmpty
);
//此处是全局处理方式
......
......@@ -75,7 +75,7 @@ public class WebSecurityConfig implements WebMvcConfigurer {
// 2.添加fastJson的配置信息,比如,是否需要格式化返回的json数据
FastJsonConfig fastJsonConfig = new FastJsonConfig();
// 时间格式化
// fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
fastJsonConfig.setDateFormat("yyyy-MM-dd HH:mm:ss");
// fastJsonConfig.setDateFormat("yyyy-MM-dd");
// 空值特别处理
// WriteNullListAsEmpty 将Collection类型字段的字段空值输出为[]
......
......@@ -9,6 +9,8 @@ import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -167,7 +169,7 @@ public class SpmkController {
@PostMapping(value = "/save_approval_template")
@ApiOperation(value = "5.新增或编辑-审批模板", httpMethod = "POST", notes = "新增或编辑-审批模板")
@ApiOperationSupport(order = 5)
public Result<Object> saveAt(@Valid @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto,BindingResult bindingResult){
public Result<Object> saveAt(@Validated @RequestBody SpmkApprovalTemplateDto spmkApprovalTemplateDto){
Integer approvalTemplateGId = spmkApprovalTemplateDto.getApprovalTemplateGId();
if (ObjectUtil.isNull(approvalTemplateGId))
return ResultUtil.error("操作失败!-1");
......@@ -415,8 +417,7 @@ public class SpmkController {
@ApiOperation(value = "17.发起审批", httpMethod = "POST", notes = "发起审批")
@ApiOperationSupport(order = 17)
@Transactional(rollbackFor = Exception.class)
// @BindingResultCtrol(title = "发起审批")
public Result<Object> saveCa(@CurrentUser UserBean userBean,@Valid @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto,BindingResult bindingResult) throws Exception{
public Result<Object> saveCa(@CurrentUser UserBean userBean,@Validated @RequestBody SpmkApproveSummaryDto spmkApproveSummaryDto) throws Exception{
YgglMainEmp ygglMainEmp = YgglMainEmp.builder().build().selectOne(new QueryWrapper<YgglMainEmp>()
.lambda()
.select(YgglMainEmp::getHeadUrl,YgglMainEmp::getName)
......@@ -545,7 +546,7 @@ public class SpmkController {
@Transactional(rollbackFor = Exception.class)
@ApiOperationSupport(order = 20)
// @BindingResultCtrol(title = "审批人审批")
public Result<Object> approving(@Valid @RequestBody ApprovingDto approvingDto, BindingResult bindingResult) throws Exception {
public Result<Object> approving(@Validated @RequestBody ApprovingDto approvingDto) throws Exception {
SpmkApproveDetail ad = SpmkApproveDetail.builder().build().selectOne(new QueryWrapper<SpmkApproveDetail>()
.lambda()
.select(SpmkApproveDetail::getId,
......@@ -615,7 +616,7 @@ public class SpmkController {
@PostMapping(value = "/select_my_approve")
@ApiOperation(value = "21.查询列表-我审批的/抄送我的-分页", httpMethod = "POST", notes = "查询列表-我审批的-关键字、审批状态、发起时间-分页")
@ApiOperationSupport(order = 21)
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @RequestBody MySummaryQueryDto mySummaryQueryDto) {
public Result<Object> selectMyAs(@CurrentUser UserBean userBean, @Validated @RequestBody MySummaryQueryDto mySummaryQueryDto) throws MethodArgumentNotValidException{
IPage<SpmkApproveSummary> page = new Page<SpmkApproveSummary>(
mySummaryQueryDto.getCurrentPage() == null ? 1 : mySummaryQueryDto.getCurrentPage(),
mySummaryQueryDto.getTotalPage() == null ? 10 : mySummaryQueryDto.getTotalPage());
......@@ -625,7 +626,6 @@ public class SpmkController {
IPage<SpmkApproveSummary> pageAs = spmkApproveSummaryMapper.selectPageByQueryForEmpNum(page, mySummaryQueryDto);
List<SpmkApproveSummary> listAs = pageAs.getRecords();
return ResultUtil.data(pageAs, listAs, "操作成功!");
}
......@@ -681,7 +681,6 @@ public class SpmkController {
@ApiOperation(value = "90.(开发使用)删除-审批数据", httpMethod = "DELETE", notes = "审批组、自定义审批、审批汇总、审批详情、审批执行记录、审批执行人记录 所有数据")
@ApiOperationSupport(order = 90)
public Result<Object> deleteApprovalData(@CurrentUser UserBean userBean){
spmkApprovalGMapper.delete(null);
spmkCustomApprovalMapper.delete(null);
spmkApproveSummaryMapper.delete(null);
......
......@@ -1548,7 +1548,7 @@ public class YgglController {
updateWrapper.eq("emp_num", empNum);
UpdateWrapper<YgglMainLzb> updateWrapper1 = new UpdateWrapper<YgglMainLzb>();
updateWrapper1.eq("emp_num", empNum);
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(3).build().update(updateWrapper);
YgglMainEmp.builder().empNum(lzygQueryDto.getEmpNum()).jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).build().update(updateWrapper);
YgglMainLzb.builder().jobStatus(YgEnumInterface.jobStatus.LIZHIZHONG.getType()).lzTime(lzygQueryDto.getLzTime())
.lzyy(lzygQueryDto.getLzyy()).lzbz(lzygQueryDto.getLzbz()).build().update(updateWrapper1);
......@@ -1816,7 +1816,7 @@ public class YgglController {
@ApiOperation(value = "查询员工列表", httpMethod = "GET", notes = "接口发布说明")
@ApiOperationSupport(order = 62)
public Result<List<YgQueryDto>> queryEmpMessage(@CurrentUser UserBean userBean) {
List<YgQueryDto> ygQueryDto = ygglMainEmpMapper.queryEmpMessage(userBean);
List<YgQueryDto> ygQueryDto = ygglMainEmpMapper.queryEmpMessage(userBean.getOrgCode());
for (YgQueryDto yg : ygQueryDto) {
if (StringUtil.isEmpty(yg.getHeadUrl())) {
yg.setHeadUrl("");
......
......@@ -2,6 +2,7 @@ package cn.timer.api.dao.yggl;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -46,7 +47,7 @@ public interface YgglMainEmpMapper extends BaseMapper<YgglMainEmp> {
* @param userBean
* @return
*/
List<YgQueryDto> queryEmpMessage(UserBean userBean);
List<YgQueryDto> queryEmpMessage(@Param("orgCode") Integer orgCode);
/**
......
......@@ -2,6 +2,7 @@ package cn.timer.api.dto.spmk;
import javax.validation.constraints.NotNull;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -14,22 +15,22 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class ApprovingDto {
@NotNull(message = "asId为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批汇总id", example = "2", required = true)
private Integer asId;
@NotNull(message = "executeRecordId为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批执行记录id", example = "10", required = true)
private Integer executeRecordId;
@NotNull(message = "executorId为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "执行人记录id", example = "10", required = true)
private Integer executorId;
@ApiModelProperty(value = "意见", example = "同意、拒绝")
private String opinion;
@NotNull(message = "sts为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "状态 2同意 3拒绝 4转派", example = "2", required = true)
private Integer sts;
......
......@@ -2,9 +2,11 @@ package cn.timer.api.dto.spmk;
import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import cn.timer.api.config.exception.ValidationMsg;
import cn.timer.api.utils.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -34,9 +36,9 @@ public class MySummaryQueryDto extends Page{
@ApiModelProperty(value = "结束时间 ", example = "2020-10-10 10:10:10")
private String endTime;
@NotNull(message = "type为空")
@DecimalMax(value = "2",message = "type 只能为 0我发起的 1抄送我的 2我审批的")
@DecimalMin(value = "0",message = "type 只能为 0我发起的 1抄送我的 2我审批的")
@NotNull(message = ValidationMsg.NOTNULL)
@DecimalMax(value = "2",message = ValidationMsg.DECIMALMAX+" 只能为 0我发起的 1抄送我的 2我审批的")
@DecimalMin(value = "0",message = ValidationMsg.DECIMALMIN+" 只能为 0我发起的 1抄送我的 2我审批的")
@ApiModelProperty(value = "0我发起的 1抄送我的 2我审批的", example = "0")
private Integer type;
......
......@@ -11,6 +11,7 @@ import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import cn.hutool.json.JSONObject;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -26,15 +27,15 @@ public class SpmkApprovalTemplateDto {
@ApiModelProperty(value = "编号 编号", example = "101")
private Integer id;
@NotNull(message = "approvalTemplateGId为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批模板组id 当前用户ID", example = "101")
private Integer approvalTemplateGId;
@NotBlank(message = "iconUrl为空")
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "审批图标地址 ", example = "审批图标地址")
private String iconUrl;
@NotBlank(message = "name为空")
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "审批名称 ", example = "审批名称")
private String name;
......@@ -47,7 +48,7 @@ public class SpmkApprovalTemplateDto {
@ApiModelProperty(value = "排序 由于区分关键字,命名后缀加s", example = "101")
private Integer ranks;
@NotBlank(message = "isOpinion为空 是否必填 意见 0是 1否")
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "审批意见 是否必填 意见 0是 1否", example = "101")
private Integer isOpinion;
......@@ -57,17 +58,17 @@ public class SpmkApprovalTemplateDto {
@ApiModelProperty(value = "创建时间 ", example = "创建时间")
private Date createTime;
@NotNull(message = "assoType为空")
@DecimalMax(value = "9",message = "assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@DecimalMin(value = "0",message = "assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@NotNull(message = ValidationMsg.NOTNULL)
@DecimalMax(value = "9",message = ValidationMsg.DECIMALMAX +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@DecimalMin(value = "0",message = ValidationMsg.DECIMALMIN +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4加班 5请假 6出差 7外出 8补卡 9调薪", example = "1")
private Integer assoType;
@NotEmpty(message = "froms为空")
@NotEmpty(message = ValidationMsg.NOTEMPTY)
@ApiModelProperty(value = "审批表单 ", example = "审批表单")
private List<JSONObject> froms;
@NotNull(message = "router为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批流程 ", example = "审批流程")
private Router router;
......
......@@ -8,6 +8,7 @@ import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import cn.hutool.json.JSONObject;
import cn.timer.api.config.exception.ValidationMsg;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -23,36 +24,36 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
public class SpmkApproveSummaryDto{
@NotBlank(message = "title为空")
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "标题 ", example = "标题", required = true)
private String title;
@NotBlank(message = "approveName为空")
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "审批名称 ", example = "审批名称", required = true)
private String approveName;
@ApiModelProperty(value = "摘要", example = "摘要", required = true)
private String digest;
@NotBlank(message = "initiator为空")
@NotBlank(message = ValidationMsg.NOTBLANK)
@ApiModelProperty(value = "发起人名称 ", example = "发起人名称", required = true)
private String initiator;
@NotNull(message = "assoType为空")
@DecimalMax(value = "9",message = "assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@DecimalMin(value = "0",message = "assoType 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@NotNull(message = ValidationMsg.NOTNULL)
@DecimalMax(value = "9",message = ValidationMsg.DECIMALMAX +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@DecimalMin(value = "0",message = ValidationMsg.DECIMALMIN +" 只能为 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡 ")
@ApiModelProperty(value = "关联类型 0无 1转正 2离职 3调岗 4招聘 5加班 6请假 7出差 8外出 9补卡", example = "1")
private Integer assoType;
@NotNull(message = "requestData为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "申请数据 ", example = "申请数据", required = true)
private JSONObject requestData;
@NotNull(message = "froms为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批表单 ", example = "数组", required = true)
private List<JSONObject> froms;
@NotNull(message = "router为空")
@NotNull(message = ValidationMsg.NOTNULL)
@ApiModelProperty(value = "审批流程", example = "审批流程", required = true)
private Router router;
......
......@@ -107,9 +107,9 @@
WHERE a.org_code = #{param.orgCode}
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT(#{param.query},'%') or
a.initiator like CONCAT(#{param.query},'%') or
a.id like CONCAT(#{param.query},'%')
a.title like CONCAT('%',#{param.query},'%') or
a.initiator like CONCAT('%',#{param.query},'%') or
a.id like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.sts != null">
......@@ -159,9 +159,9 @@
</if>
<if test="param.query != null and param.query != ''">
and (
a.title like CONCAT(#{param.query},'%') or
a.initiator like CONCAT(#{param.query},'%') or
a.id like CONCAT(#{param.query},'%')
a.title like CONCAT('%',#{param.query},'%') or
a.initiator like CONCAT('%',#{param.query},'%') or
a.id like CONCAT('%',#{param.query},'%')
)
</if>
<if test="param.startTime != null and param.startTime != ''">
......
......@@ -193,9 +193,9 @@
<!-- 查询员工信息 搜索 分页 -->
<select id="queryEmpMessage" resultType="cn.timer.api.dto.yggl.YgQueryDto">
SELECT
a. NAME empName,
a.name empName,
a.emp_num empNum,
b. NAME deptName,
b.name deptName,
a.rz_time rzTime,
a.job_type jobType,
a.phone phone,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment