自定义日志写入
parent
5a8ef40e18
commit
6bbb49f0a1
|
@ -1,7 +1,9 @@
|
||||||
package aiyh.utils;
|
package aiyh.utils;
|
||||||
|
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.interfaces.script_util.CusScriptFunInterface;
|
import aiyh.utils.interfaces.script_util.CusScriptFunInterface;
|
||||||
import aiyh.utils.tool.org.apache.commons.jexl3.*;
|
import aiyh.utils.tool.org.apache.commons.jexl3.*;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -20,6 +22,7 @@ public class ScriptUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object invokeScript(String script, Map<String, Object> params, CusScriptFunInterface scriptFunInterface) {
|
public static Object invokeScript(String script, Map<String, Object> params, CusScriptFunInterface scriptFunInterface) {
|
||||||
|
try {
|
||||||
JexlContext jc = new MapContext();
|
JexlContext jc = new MapContext();
|
||||||
if(null != scriptFunInterface){
|
if(null != scriptFunInterface){
|
||||||
jc.set(scriptFunInterface.getClass().getSimpleName(), scriptFunInterface);
|
jc.set(scriptFunInterface.getClass().getSimpleName(), scriptFunInterface);
|
||||||
|
@ -29,5 +32,10 @@ public class ScriptUtil {
|
||||||
}
|
}
|
||||||
JexlExpression expression = JEXL.createExpression(script);
|
JexlExpression expression = JEXL.createExpression(script);
|
||||||
return expression.evaluate(jc);
|
return expression.evaluate(jc);
|
||||||
|
}catch (Exception e){
|
||||||
|
Util.getLogger().error(Util.logStr("script expression evaluate error! current script : {}, current params : {}", script, JSONObject.toJSONString(params)));
|
||||||
|
Util.logErrorStr(e);
|
||||||
|
throw new CustomerException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
package xuanran.wang.log.cus_api_log;
|
package aiyh.utils.api_log.cus_api_log;
|
||||||
|
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.annotations.CusApiLogTable;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.dto.CusApiLogBaseDto;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.mapper.CusApiLogMapper;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.pojo.CusApiLogPojo;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.recordset.MapperBuilderSql;
|
import aiyh.utils.recordset.MapperBuilderSql;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import xuanran.wang.log.cus_api_log.annotations.CusApiLogTable;
|
|
||||||
import xuanran.wang.log.cus_api_log.dto.CusApiLogBaseDto;
|
|
||||||
import xuanran.wang.log.cus_api_log.mapper.CusApiLogMapper;
|
|
||||||
import xuanran.wang.log.cus_api_log.pojo.CusApiLogPojo;
|
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
@ -28,6 +28,13 @@ public class CusApiLogUtil {
|
||||||
insertApiLog(dto, -1);
|
insertApiLog(dto, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>向建模中写日志</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 15:33
|
||||||
|
* @param dto 日志实体类
|
||||||
|
* @param modelId 模块id
|
||||||
|
**/
|
||||||
public static void insertApiLog(CusApiLogBaseDto dto, int modelId){
|
public static void insertApiLog(CusApiLogBaseDto dto, int modelId){
|
||||||
CusApiLogPojo pojo = parseDto(dto);
|
CusApiLogPojo pojo = parseDto(dto);
|
||||||
String tableName = pojo.getTableName();
|
String tableName = pojo.getTableName();
|
||||||
|
@ -51,6 +58,14 @@ public class CusApiLogUtil {
|
||||||
Util.rebuildModeDataShare(modeDataId, modelId, 1);
|
Util.rebuildModeDataShare(modeDataId, modelId, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>初始化日志类对象</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 15:34
|
||||||
|
* @param requestInfo 流程requestInfo
|
||||||
|
* @param clazz 日志类对象
|
||||||
|
* @return 日志类对象
|
||||||
|
**/
|
||||||
public static <T extends CusApiLogBaseDto> T initCusApiLogDto(RequestInfo requestInfo, Class<T> clazz){
|
public static <T extends CusApiLogBaseDto> T initCusApiLogDto(RequestInfo requestInfo, Class<T> clazz){
|
||||||
T obj;
|
T obj;
|
||||||
try {
|
try {
|
||||||
|
@ -70,6 +85,12 @@ public class CusApiLogUtil {
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>解析实体类</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 15:35
|
||||||
|
* @param dto 日志类对象
|
||||||
|
**/
|
||||||
private static CusApiLogPojo parseDto(CusApiLogBaseDto dto){
|
private static CusApiLogPojo parseDto(CusApiLogBaseDto dto){
|
||||||
String tableName = null;
|
String tableName = null;
|
||||||
Class<? extends CusApiLogBaseDto> childClass = dto.getClass();
|
Class<? extends CusApiLogBaseDto> childClass = dto.getClass();
|
||||||
|
@ -99,6 +120,13 @@ public class CusApiLogUtil {
|
||||||
return CusApiLogPojo.builder().tableName(tableName).params(params).build();
|
return CusApiLogPojo.builder().tableName(tableName).params(params).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>解析实体类上的表名</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 15:35
|
||||||
|
* @param clazz 实体类class
|
||||||
|
* @return 表名
|
||||||
|
**/
|
||||||
private static String parseTableName(Class<?> clazz){
|
private static String parseTableName(Class<?> clazz){
|
||||||
CusApiLogTable apiLogTable = clazz.getAnnotation(CusApiLogTable.class);
|
CusApiLogTable apiLogTable = clazz.getAnnotation(CusApiLogTable.class);
|
||||||
if(apiLogTable != null){
|
if(apiLogTable != null){
|
|
@ -1,4 +1,4 @@
|
||||||
package xuanran.wang.log.cus_api_log.annotations;
|
package aiyh.utils.api_log.cus_api_log.annotations;
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
import java.lang.annotation.*;
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package xuanran.wang.log.cus_api_log.dto;
|
package aiyh.utils.api_log.cus_api_log.dto;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.annotations.CusApiLogTable;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import xuanran.wang.log.cus_api_log.annotations.CusApiLogTable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>接口日志实体类</h1>
|
* <h1>接口日志实体类</h1>
|
|
@ -1,8 +1,10 @@
|
||||||
package xuanran.wang.log.cus_api_log.dto;
|
package aiyh.utils.api_log.cus_api_log.dto;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
|
||||||
import lombok.*;
|
import lombok.AllArgsConstructor;
|
||||||
import xuanran.wang.log.cus_api_log.annotations.CusApiLogTable;
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1></h1>
|
|
@ -1,4 +1,4 @@
|
||||||
package xuanran.wang.log.cus_api_log.interfaces;
|
package aiyh.utils.api_log.cus_api_log.interfaces;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1></h1>
|
|
@ -1,6 +1,7 @@
|
||||||
package xuanran.wang.log.cus_api_log.mapper;
|
package aiyh.utils.api_log.cus_api_log.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,6 +1,9 @@
|
||||||
package xuanran.wang.log.cus_api_log.pojo;
|
package aiyh.utils.api_log.cus_api_log.pojo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package xuanran.wang.rest_test;
|
package aiyh.utils.cus_rest;
|
||||||
|
|
||||||
import aiyh.utils.ThreadPoolConfig;
|
import aiyh.utils.ThreadPoolConfig;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.CusApiLogUtil;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.dto.CusApiLogBaseDto;
|
||||||
|
import aiyh.utils.cus_rest.impl.CusGetRequest;
|
||||||
|
import aiyh.utils.cus_rest.impl.CusPostRequest;
|
||||||
|
import aiyh.utils.cus_rest.interfaces.CusApiRequestInterface;
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
import xuanran.wang.log.cus_api_log.CusApiLogUtil;
|
|
||||||
import xuanran.wang.log.cus_api_log.dto.CusApiLogBaseDto;
|
|
||||||
import xuanran.wang.rest_test.impl.CusGetRequest;
|
|
||||||
import xuanran.wang.rest_test.impl.CusPostRequest;
|
|
||||||
import xuanran.wang.rest_test.interfaces.CusApiRequestInterface;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,5 +1,6 @@
|
||||||
package xuanran.wang.rest_test;
|
package aiyh.utils.cus_rest;
|
||||||
|
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
@ -9,7 +10,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.type.TypeFactory;
|
import com.fasterxml.jackson.databind.type.TypeFactory;
|
||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,9 +1,9 @@
|
||||||
package xuanran.wang.rest_test.impl;
|
package aiyh.utils.cus_rest.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.cus_rest.interfaces.CusApiRequestInterface;
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
import xuanran.wang.rest_test.interfaces.CusApiRequestInterface;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,9 +1,10 @@
|
||||||
package xuanran.wang.rest_test.impl;
|
package aiyh.utils.cus_rest.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.cus_rest.interfaces.CusApiRequestInterface;
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import aiyh.utils.httpUtil.util.HttpUtils;
|
import aiyh.utils.httpUtil.util.HttpUtils;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
import xuanran.wang.rest_test.interfaces.CusApiRequestInterface;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -21,4 +22,5 @@ public class CusPostRequest implements CusApiRequestInterface {
|
||||||
public ResponeVo execute(String url, Object params, Map<String, String> headers, CusRestTemplateResponse cusSuccess) throws IOException {
|
public ResponeVo execute(String url, Object params, Map<String, String> headers, CusRestTemplateResponse cusSuccess) throws IOException {
|
||||||
return httpUtils.apiPostObject(url, params, headers);
|
return httpUtils.apiPostObject(url, params, headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package xuanran.wang.rest_test.interfaces;
|
package aiyh.utils.cus_rest.interfaces;
|
||||||
|
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -0,0 +1,15 @@
|
||||||
|
package aiyh.utils.cus_rest.interfaces;
|
||||||
|
|
||||||
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>自定义解密类</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/4/10 13:20
|
||||||
|
*/
|
||||||
|
public interface CusDataDecipher {
|
||||||
|
Map<String, Object> decoder(ResponeVo responeVo);
|
||||||
|
}
|
|
@ -1,12 +1,12 @@
|
||||||
package xuanran.wang.rest_test.pojo;
|
package aiyh.utils.cus_rest.pojo;
|
||||||
|
|
||||||
|
import aiyh.utils.api_log.cus_api_log.dto.CusApiLogBaseDto;
|
||||||
|
import aiyh.utils.cus_rest.interfaces.CusDataDecipher;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import weaver.xuanran.wang.common.service.CusDataDecipher;
|
|
||||||
import xuanran.wang.log.cus_api_log.dto.CusApiLogBaseDto;
|
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiConsumer;
|
import java.util.function.BiConsumer;
|
|
@ -0,0 +1,107 @@
|
||||||
|
package com.engine.kq.wfset.action;
|
||||||
|
|
||||||
|
import com.engine.kq.biz.KQAttProcSetComInfo;
|
||||||
|
import com.engine.kq.biz.KQFlowActiontBiz;
|
||||||
|
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||||
|
import com.engine.kq.log.KQLog;
|
||||||
|
import com.engine.kq.wfset.bean.SplitBean;
|
||||||
|
import com.engine.kq.wfset.util.KQFlowLeaveUtil;
|
||||||
|
import com.engine.kq.wfset.util.SplitActionUtil;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.interfaces.workflow.action.RollBackAction;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.workflow.workflow.WorkflowComInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兼容E8的请假扣减action
|
||||||
|
*/
|
||||||
|
public class KqDeductionVacationAction extends BaseBean implements Action, RollBackAction {
|
||||||
|
private KQLog kqLog = new KQLog();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
//e8 的状态标识
|
||||||
|
int DEDUCTION = 0;
|
||||||
|
int FREEZE = 1;
|
||||||
|
int RELEASE = 2;
|
||||||
|
this.writeLog("KqDeductionVacationAction", "do action on request:" + request.getRequestid());
|
||||||
|
String requestid = request.getRequestid();
|
||||||
|
kqLog.info("do KqDeductionVacationAction on requestid:"+requestid);
|
||||||
|
int requestidInt = Util.getIntValue(requestid, 0);
|
||||||
|
|
||||||
|
String workflowid = request.getWorkflowid();
|
||||||
|
String formid = new WorkflowComInfo().getFormId(workflowid);
|
||||||
|
KQAttProcSetComInfo kqAttProcSetComInfo = new KQAttProcSetComInfo();
|
||||||
|
int cur_kqtype = Util.getIntValue(kqAttProcSetComInfo.getkqType(workflowid),-1);
|
||||||
|
|
||||||
|
if(cur_kqtype != KqSplitFlowTypeEnum.LEAVE.getFlowtype()){
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
KQFlowLeaveUtil kqFlowLeaveUtil = new KQFlowLeaveUtil();
|
||||||
|
KQFlowActiontBiz kqFlowActiontBiz = new KQFlowActiontBiz();
|
||||||
|
ResourceComInfo rci = new ResourceComInfo();
|
||||||
|
|
||||||
|
List<SplitBean> splitBeans = new ArrayList<SplitBean>();
|
||||||
|
DateTimeFormatter datetimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String proc_set_sql = "select * from kq_att_proc_set where field001 = ? and field002 = ? ";
|
||||||
|
rs.executeQuery(proc_set_sql, workflowid,formid);
|
||||||
|
if(rs.next()){
|
||||||
|
String proc_set_id = rs.getString("id");
|
||||||
|
//得到这个考勤流程设置是否使用明细
|
||||||
|
String usedetails = rs.getString("usedetail");
|
||||||
|
int kqtype = Util.getIntValue(rs.getString("field006"));
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
if(requestidInt > 0){
|
||||||
|
map.put("requestId", "and t.requestId = " + requestidInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> sqlMap = kqFlowActiontBiz.handleSql(proc_set_id, usedetails, requestidInt,kqtype,map);
|
||||||
|
Map<String,String> result = kqFlowLeaveUtil.handleKQLeaveAction(sqlMap, splitBeans, datetimeFormatter, Util.getIntValue(workflowid), requestidInt, rci);
|
||||||
|
if(!result.isEmpty()){
|
||||||
|
String error = Util.null2String(result.get("message"));
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(error);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//先在这里执行扣减动作
|
||||||
|
SplitActionUtil.handleLeaveAction(splitBeans,requestid);
|
||||||
|
//然后再把扣减的了数据更新下KQ_ATT_VACATION表
|
||||||
|
String updateFreezeSql = "update KQ_ATT_VACATION set status=? where requestId=? and workflowId = ? ";
|
||||||
|
boolean isUpdate = rs.executeUpdate(updateFreezeSql,DEDUCTION,requestid,workflowid);
|
||||||
|
if(!isUpdate){
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(82823,weaver.general.ThreadVarLanguage.getLang())+"action"+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005361,weaver.general.ThreadVarLanguage.getLang())+""+updateFreezeSql+"("+DEDUCTION+","+requestid+","+workflowid+")");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
writeLog(e);
|
||||||
|
request.getRequestManager().setMessageid("11111" + request.getRequestid() + "22222");
|
||||||
|
request.getRequestManager().setMessagecontent("请假流程【扣减action】报错,请联系管理员!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String executeRollBack(RequestInfo request) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,183 @@
|
||||||
|
package com.engine.kq.wfset.action;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.engine.kq.biz.KQAttProcSetComInfo;
|
||||||
|
import com.engine.kq.biz.KQFlowActiontBiz;
|
||||||
|
import com.engine.kq.biz.KQLeaveRulesBiz;
|
||||||
|
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||||
|
import com.engine.kq.log.KQLog;
|
||||||
|
import com.engine.kq.wfset.bean.SplitBean;
|
||||||
|
import com.engine.kq.wfset.util.KQFlowLeaveUtil;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.workflow.workflow.WorkflowComInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兼容E8的请假冻结action
|
||||||
|
*/
|
||||||
|
public class KqFreezeVacationAction extends BaseBean implements Action {
|
||||||
|
private KQLog kqLog = new KQLog();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
//e8 的状态标识
|
||||||
|
int DEDUCTION = 0;
|
||||||
|
int FREEZE = 1;
|
||||||
|
int RELEASE = 2;
|
||||||
|
this.writeLog("KqFreezeVacationAction", "do action on request:" + request.getRequestid());
|
||||||
|
String requestid = request.getRequestid();
|
||||||
|
kqLog.info("do KqFreezeVacationAction on requestid:"+requestid);
|
||||||
|
int requestidInt = Util.getIntValue(requestid, 0);
|
||||||
|
|
||||||
|
String workflowid = request.getWorkflowid();
|
||||||
|
String formid = new WorkflowComInfo().getFormId(workflowid);
|
||||||
|
KQAttProcSetComInfo kqAttProcSetComInfo = new KQAttProcSetComInfo();
|
||||||
|
int cur_kqtype = Util.getIntValue(kqAttProcSetComInfo.getkqType(workflowid),-1);
|
||||||
|
|
||||||
|
if(cur_kqtype != KqSplitFlowTypeEnum.LEAVE.getFlowtype()){
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<SplitBean> splitBeans = new ArrayList<SplitBean>();
|
||||||
|
|
||||||
|
KQFlowLeaveUtil kqFlowLeaveUtil = new KQFlowLeaveUtil();
|
||||||
|
KQFlowActiontBiz kqFlowActiontBiz = new KQFlowActiontBiz();
|
||||||
|
ResourceComInfo rci = new ResourceComInfo();
|
||||||
|
DateTimeFormatter datetimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
RecordSet rs1 = new RecordSet();
|
||||||
|
String proc_set_sql = "select * from kq_att_proc_set where field001 = ? and field002 = ? ";
|
||||||
|
rs.executeQuery(proc_set_sql, workflowid,formid);
|
||||||
|
if(rs.next()){
|
||||||
|
String proc_set_id = rs.getString("id");
|
||||||
|
//得到这个考勤流程设置是否使用明细
|
||||||
|
String usedetails = rs.getString("usedetail");
|
||||||
|
int kqtype = Util.getIntValue(rs.getString("field006"));
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
if(requestidInt > 0){
|
||||||
|
map.put("requestId", "and t.requestId = " + requestidInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, String> sqlMap = kqFlowActiontBiz.handleSql(proc_set_id, usedetails, requestidInt,kqtype,map);
|
||||||
|
Map<String,String> result = kqFlowLeaveUtil.handleKQLeaveAction(sqlMap, splitBeans, datetimeFormatter, Util.getIntValue(workflowid), requestidInt, rci);
|
||||||
|
if(!result.isEmpty()){
|
||||||
|
String error = Util.null2String(result.get("message"));
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(error);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* add by xuanran.Wang
|
||||||
|
*/
|
||||||
|
this.handlerSplitBean(splitBeans, request.getRequestManager().getBillTableName(), requestid);
|
||||||
|
kqLog.info("KqFreezeVacationAction splitBeans:"+ JSON.toJSONString(splitBeans));
|
||||||
|
String batchSql = "insert into KQ_ATT_VACATION (requestId,workflowId,dataid,detailid,resourceId,fromDate,fromTime,toDate,toTime,duration,newLeaveType,durationrule,status)"+
|
||||||
|
" values(?,?,?,?,?,?,?,?,?,?,?,?,?) ";
|
||||||
|
List<List> params = new ArrayList<List>();
|
||||||
|
|
||||||
|
String delSql = "delete from KQ_ATT_VACATION where requestId=?";
|
||||||
|
List<List> delparams = new ArrayList<List>();
|
||||||
|
|
||||||
|
for(SplitBean bean : splitBeans){
|
||||||
|
List<Object> beanParams = new ArrayList<Object>();
|
||||||
|
String newLeaveType = bean.getNewLeaveType();
|
||||||
|
//这个表里只存储含有假期余额的
|
||||||
|
boolean balanceEnable = KQLeaveRulesBiz.getBalanceEnable(newLeaveType);
|
||||||
|
kqLog.info("KqFreezeVacationAction newLeaveType:"+ newLeaveType+":balanceEnable:"+balanceEnable);
|
||||||
|
if(!balanceEnable) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
beanParams.add(bean.getRequestId());
|
||||||
|
beanParams.add(bean.getWorkflowId());
|
||||||
|
beanParams.add(bean.getDataId());
|
||||||
|
beanParams.add(bean.getDetailId());
|
||||||
|
beanParams.add(bean.getResourceId());
|
||||||
|
beanParams.add(bean.getFromDate());
|
||||||
|
beanParams.add(bean.getFromTime());
|
||||||
|
beanParams.add(bean.getToDate());
|
||||||
|
beanParams.add(bean.getToTime());
|
||||||
|
beanParams.add(bean.getDuration());
|
||||||
|
beanParams.add(bean.getNewLeaveType());
|
||||||
|
beanParams.add(bean.getDurationrule());
|
||||||
|
beanParams.add(FREEZE);
|
||||||
|
params.add(beanParams);
|
||||||
|
|
||||||
|
List<Object> delParam = new ArrayList<Object>();
|
||||||
|
delParam.add(bean.getRequestId());
|
||||||
|
delparams.add(delParam);
|
||||||
|
}
|
||||||
|
if(!params.isEmpty()){
|
||||||
|
boolean delOk = rs1.executeBatchSql(delSql, delparams);
|
||||||
|
if(!delOk){
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(1232,weaver.general.ThreadVarLanguage.getLang())+"action"+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005361,weaver.general.ThreadVarLanguage.getLang())+""+params);
|
||||||
|
kqLog.info("KqFreezeVacationAction删除数据失败:"+requestid);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean isOk = rs1.executeBatchSql(batchSql, params);
|
||||||
|
if(!isOk){
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(1232,weaver.general.ThreadVarLanguage.getLang())+"action"+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005361,weaver.general.ThreadVarLanguage.getLang())+""+params);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
kqLog.info("KqFreezeVacationAction没有冻结数据:"+requestid);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
kqLog.info("KqFreezeVacationAction:"+e);
|
||||||
|
request.getRequestManager().setMessageid("11111" + request.getRequestid() + "22222");
|
||||||
|
request.getRequestManager().setMessagecontent("请假流程【冻结action】报错,请联系管理员!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>对考勤实体类做修改</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 15:13
|
||||||
|
* @param splitBeans 考勤实体类
|
||||||
|
* @param billTable 表名
|
||||||
|
* @param requestId 请求id
|
||||||
|
**/
|
||||||
|
public void handlerSplitBean(List<SplitBean> splitBeans, String billTable, String requestId){
|
||||||
|
try {
|
||||||
|
RecordSet tempRs = new RecordSet();
|
||||||
|
String sql = "select duration from " + billTable + " where requestid = ?";
|
||||||
|
if(CollectionUtils.isNotEmpty(splitBeans)){
|
||||||
|
if (tempRs.execute(sql, requestId) && tempRs.next()) {
|
||||||
|
for (SplitBean splitBean : splitBeans) {
|
||||||
|
String workflowDuration = Util.null2String(tempRs.getString(1));
|
||||||
|
if(StringUtils.isBlank(workflowDuration)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
splitBean.setDuration(workflowDuration);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
kqLog.info("handlerSplitBean sql execute error! sql : " + sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
kqLog.info("handlerSplitBean error!: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.engine.kq.wfset.action;
|
||||||
|
|
||||||
|
import com.engine.kq.biz.KQFLowEventLogBiz;
|
||||||
|
import com.engine.kq.biz.KQFlowActiontBiz;
|
||||||
|
import com.engine.kq.biz.KQOvertimeLogBiz;
|
||||||
|
import com.engine.kq.log.KQLog;
|
||||||
|
import com.engine.kq.wfset.bean.SplitBean;
|
||||||
|
import com.engine.kq.wfset.util.KQFlowOvertimeUtil;
|
||||||
|
import com.engine.kq.wfset.util.SplitActionUtil;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.resource.ResourceComInfo;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.workflow.workflow.WorkflowComInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兼容E8的加班生成调休action
|
||||||
|
*/
|
||||||
|
public class KqPaidLeaveAction extends BaseBean implements Action {
|
||||||
|
private KQLog kqLog = new KQLog();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
this.writeLog("KqPaidLeaveAction", "do action on request:" + request.getRequestid());
|
||||||
|
String requestid = request.getRequestid();
|
||||||
|
kqLog.info("do KqPaidLeaveAction on requestid:"+requestid);
|
||||||
|
int requestidInt = Util.getIntValue(requestid, 0);
|
||||||
|
|
||||||
|
String workflowid = request.getWorkflowid();
|
||||||
|
String formid = new WorkflowComInfo().getFormId(workflowid);
|
||||||
|
KQFLowEventLogBiz kqfLowEventLogBiz = new KQFLowEventLogBiz();
|
||||||
|
String logKey = "|key|requestid|"+requestid;
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<SplitBean> splitBeans = new ArrayList<SplitBean>();
|
||||||
|
|
||||||
|
KQFlowActiontBiz kqFlowActiontBiz = new KQFlowActiontBiz();
|
||||||
|
KQFlowOvertimeUtil kqFlowOvertimeUtil = new KQFlowOvertimeUtil();
|
||||||
|
ResourceComInfo rci = new ResourceComInfo();
|
||||||
|
DateTimeFormatter datetimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm");
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String proc_set_sql = "select * from kq_att_proc_set where field001 = ? and field002 = ? ";
|
||||||
|
rs.executeQuery(proc_set_sql, workflowid,formid);
|
||||||
|
|
||||||
|
Map<String,Object> eventLogMap = Maps.newHashMap();
|
||||||
|
eventLogMap.put("proc_set_sql", proc_set_sql);
|
||||||
|
eventLogMap.put("workflowid", workflowid);
|
||||||
|
eventLogMap.put("formid", formid);
|
||||||
|
|
||||||
|
String uuid = "";
|
||||||
|
if(rs.next()){
|
||||||
|
String proc_set_id = rs.getString("id");
|
||||||
|
//得到这个考勤流程设置是否使用明细
|
||||||
|
String usedetails = rs.getString("usedetail");
|
||||||
|
int kqtype = Util.getIntValue(rs.getString("field006"));
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
if(requestidInt > 0){
|
||||||
|
map.put("requestId", "and t.requestId = " + requestidInt);
|
||||||
|
}
|
||||||
|
Map<String, String> sqlMap = kqFlowActiontBiz.handleSql(proc_set_id, usedetails, requestidInt,kqtype,map);
|
||||||
|
|
||||||
|
uuid = kqfLowEventLogBiz.logEvent("request|Creatorid|"+request.getCreatorid(),eventLogMap,"KqPaidLeaveAction|触发生成调休action"+logKey);
|
||||||
|
Map<String,String> result = kqFlowOvertimeUtil.handleKQOvertimeAction(sqlMap, splitBeans, datetimeFormatter, Util.getIntValue(workflowid), requestidInt, rci,uuid);
|
||||||
|
if(!result.isEmpty()){
|
||||||
|
String error = Util.null2String(result.get("message"));
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(error);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 生成调休 在归档的时候再单独处理下加班规则第二种情况
|
||||||
|
SplitActionUtil.handleOverTimeAction(splitBeans, requestid,false,uuid);
|
||||||
|
} catch (Exception e) {
|
||||||
|
writeLog(e);
|
||||||
|
request.getRequestManager().setMessageid("11111" + request.getRequestid() + "22222");
|
||||||
|
request.getRequestManager().setMessagecontent("加班流程【加班时间转为可调休时间action】报错,请联系管理员!");
|
||||||
|
StringWriter errorsWriter = new StringWriter();
|
||||||
|
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||||
|
kqLog.info("加班流程【加班时间转为可调休时间action】报错,请联系管理员!"+errorsWriter.toString());
|
||||||
|
Map<String,Object> eventLogMap = Maps.newHashMap();
|
||||||
|
eventLogMap.put("action_error", errorsWriter.toString());
|
||||||
|
String uuid = kqfLowEventLogBiz.logEvent("request|Creatorid|"+request.getCreatorid(),eventLogMap,"KqPaidLeaveAction|触发生成调休action"+logKey);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.engine.kq.wfset.action;
|
||||||
|
|
||||||
|
import com.engine.kq.biz.KQAttProcSetComInfo;
|
||||||
|
import com.engine.kq.enums.KqSplitFlowTypeEnum;
|
||||||
|
import com.engine.kq.log.KQLog;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 兼容E8的请假释放action
|
||||||
|
*/
|
||||||
|
public class KqReleaseVacationAction extends BaseBean implements Action {
|
||||||
|
private KQLog kqLog = new KQLog();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
//e8 的状态标识
|
||||||
|
int RELEASE = 2;
|
||||||
|
this.writeLog("KqReleaseVacationAction", "do action on request:" + request.getRequestid());
|
||||||
|
String requestid = request.getRequestid();
|
||||||
|
kqLog.info("do KqReleaseVacationAction on requestid:"+requestid);
|
||||||
|
int requestidInt = Util.getIntValue(requestid, 0);
|
||||||
|
String workflowid = request.getWorkflowid();
|
||||||
|
KQAttProcSetComInfo kqAttProcSetComInfo = new KQAttProcSetComInfo();
|
||||||
|
int cur_kqtype = Util.getIntValue(kqAttProcSetComInfo.getkqType(workflowid),-1);
|
||||||
|
|
||||||
|
if(cur_kqtype != KqSplitFlowTypeEnum.LEAVE.getFlowtype()){
|
||||||
|
return Action.SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String updateFreezeSql = "update KQ_ATT_VACATION set status=2 where requestId=? and workflowId = ? ";
|
||||||
|
boolean isUpdate = rs.executeUpdate(updateFreezeSql,requestidInt,workflowid);
|
||||||
|
if(!isUpdate){
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(""+weaver.systeminfo.SystemEnv.getHtmlLabelName(82824,weaver.general.ThreadVarLanguage.getLang())+"action"+weaver.systeminfo.SystemEnv.getHtmlLabelName(10005361,weaver.general.ThreadVarLanguage.getLang())+"("+RELEASE+","+requestid+","+workflowid+")");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
writeLog(e);
|
||||||
|
request.getRequestManager().setMessageid("11111" + request.getRequestid() + "22222");
|
||||||
|
request.getRequestManager().setMessagecontent("请假流程【释放action】报错,请联系管理员!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.engine.kq.wfset.action;
|
||||||
|
|
||||||
|
import com.engine.kq.biz.KQFlowActiontBiz;
|
||||||
|
import com.engine.kq.log.KQLog;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.interfaces.workflow.action.Action;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
import weaver.workflow.workflow.WorkflowComInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考勤流程数据拆分action
|
||||||
|
*/
|
||||||
|
public class KqSplitAction extends BaseBean implements Action {
|
||||||
|
private KQLog kqLog = new KQLog();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String execute(RequestInfo request) {
|
||||||
|
this.writeLog("KqSplitAction", "do action on request:" + request.getRequestid());
|
||||||
|
String requestid = request.getRequestid();
|
||||||
|
kqLog.info("do KqSplitAction on requestid:"+requestid);
|
||||||
|
int requestidInt = Util.getIntValue(requestid, 0);
|
||||||
|
|
||||||
|
String workflowid = request.getWorkflowid();
|
||||||
|
String formid = new WorkflowComInfo().getFormId(workflowid);
|
||||||
|
|
||||||
|
try {
|
||||||
|
KQFlowActiontBiz kqFlowActiontBiz = new KQFlowActiontBiz();
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String proc_set_sql = "select * from kq_att_proc_set where field001 = ? and field002 = ? ";
|
||||||
|
rs.executeQuery(proc_set_sql, workflowid,formid);
|
||||||
|
if(rs.next()){
|
||||||
|
String proc_set_id = rs.getString("id");
|
||||||
|
//得到这个考勤流程设置是否使用明细
|
||||||
|
String usedetails = rs.getString("usedetail");
|
||||||
|
|
||||||
|
int kqtype = Util.getIntValue(rs.getString("field006"));
|
||||||
|
kqLog.info("do action on kqtype:" + kqtype+":requestidInt:"+requestidInt);
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
if(requestidInt > 0){
|
||||||
|
map.put("requestId", "and t.requestId = " + requestidInt);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String,String> result = kqFlowActiontBiz.handleKQFlowAction(proc_set_id, usedetails, requestidInt, kqtype, Util.getIntValue(workflowid), false,false,map);
|
||||||
|
|
||||||
|
if(!result.isEmpty()){
|
||||||
|
String error = Util.null2String(result.get("message"));
|
||||||
|
request.getRequestManager().setMessageid("666" + request.getRequestid() + "999");
|
||||||
|
request.getRequestManager().setMessagecontent(error);
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
kqLog.info("流程数据报错:KqSplitAction:");
|
||||||
|
StringWriter errorsWriter = new StringWriter();
|
||||||
|
e.printStackTrace(new PrintWriter(errorsWriter));
|
||||||
|
kqLog.info(errorsWriter.toString());
|
||||||
|
request.getRequestManager().setMessageid("11111" + request.getRequestid() + "22222");
|
||||||
|
request.getRequestManager().setMessagecontent("【考勤报表统计action】报错,请联系管理员!");
|
||||||
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Action.SUCCESS;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1></h1>
|
* <h1></h1>
|
||||||
*
|
*
|
||||||
|
@ -15,11 +17,14 @@ import lombok.NoArgsConstructor;
|
||||||
@Builder
|
@Builder
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class CheckErrorInfo {
|
public class CheckErrorFieldInfo {
|
||||||
private String tableName;
|
private String tableName;
|
||||||
private String dataId;
|
private String dataId;
|
||||||
private String errorFieldName;
|
private String errorFieldName;
|
||||||
private String errorMsg;
|
private String errorMsg;
|
||||||
private Object currentValue;
|
private Object currentValue;
|
||||||
private String mainId;
|
private String mainId;
|
||||||
|
private String url;
|
||||||
|
private Map<String, Object> mainMap;
|
||||||
|
private Map<String, Object> detailMap;
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package weaver.xuanran.wang.xk_hospital.model_check.entity;
|
package weaver.xuanran.wang.xk_hospital.model_check.entity;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -24,4 +25,5 @@ public class XkModelCusCheckFiledConfig {
|
||||||
private String modelTableName;
|
private String modelTableName;
|
||||||
private List<ModelFieldInfo> modelFieldNameList;
|
private List<ModelFieldInfo> modelFieldNameList;
|
||||||
private String cusWhere;
|
private String cusWhere;
|
||||||
|
private String noCheckExpression;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ package weaver.xuanran.wang.xk_hospital.model_check.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.ModelFieldInfo;
|
import weaver.xuanran.wang.xk_hospital.model_check.entity.ModelFieldInfo;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckConfig;
|
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckFiledConfig;
|
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckFiledConfig;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckFiledGroupConfig;
|
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckFiledGroupConfig;
|
||||||
|
|
||||||
|
@ -25,7 +24,7 @@ public interface XkModelCusCheckMapper {
|
||||||
"from $t{modelTableName}_dt2 a " +
|
"from $t{modelTableName}_dt2 a " +
|
||||||
"left join workflow_mode_table_view b " +
|
"left join workflow_mode_table_view b " +
|
||||||
"on a.model_table = b.id " +
|
"on a.model_table = b.id " +
|
||||||
"where enable = 0")
|
"where enable = 0 or enable is null")
|
||||||
@Associations( @Association(property = "modelFieldNameList", column = "model_field", id = @Id(value = String.class,methodId = 1)))
|
@Associations( @Association(property = "modelFieldNameList", column = "model_field", id = @Id(value = String.class,methodId = 1)))
|
||||||
List<XkModelCusCheckFiledConfig> queryConditionList(@ParamMapper("modelTableName")String modelTableName);
|
List<XkModelCusCheckFiledConfig> queryConditionList(@ParamMapper("modelTableName")String modelTableName);
|
||||||
|
|
||||||
|
@ -76,4 +75,9 @@ public interface XkModelCusCheckMapper {
|
||||||
String queryCusSqlDate(@SqlString String sql,
|
String queryCusSqlDate(@SqlString String sql,
|
||||||
@ParamMapper("mainMap") Map<String, Object> mainMap,
|
@ParamMapper("mainMap") Map<String, Object> mainMap,
|
||||||
@ParamMapper("detailMap") Map<String, Object> detailMap);
|
@ParamMapper("detailMap") Map<String, Object> detailMap);
|
||||||
|
|
||||||
|
@Select(custom = true)
|
||||||
|
String select(@SqlString String sql,
|
||||||
|
@ParamMapper("main") Map<String, Object> param1,
|
||||||
|
@ParamMapper("detail") Map<String, Object> param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,13 @@ package weaver.xuanran.wang.xk_hospital.model_check.service;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.function.Bi4Function;
|
import aiyh.utils.function.Bi4Function;
|
||||||
import aiyh.utils.tool.Assert;
|
import aiyh.utils.response_deal.ResponseMappingDeal;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.map.MapUtil;
|
||||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
import aiyh.utils.zwl.common.ToolUtil;
|
import aiyh.utils.zwl.common.ToolUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.*;
|
import weaver.xuanran.wang.xk_hospital.model_check.entity.*;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.mapper.XkModelCusCheckMapper;
|
import weaver.xuanran.wang.xk_hospital.model_check.mapper.XkModelCusCheckMapper;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.util.CheckRuleMethodUtil;
|
import weaver.xuanran.wang.xk_hospital.model_check.util.CheckRuleMethodUtil;
|
||||||
|
@ -28,32 +29,48 @@ import java.util.stream.Collectors;
|
||||||
public class XkModelCusCheckService {
|
public class XkModelCusCheckService {
|
||||||
|
|
||||||
private final XkModelCusCheckMapper mapper = Util.getMapper(XkModelCusCheckMapper.class);
|
private final XkModelCusCheckMapper mapper = Util.getMapper(XkModelCusCheckMapper.class);
|
||||||
|
|
||||||
private final ToolUtil toolUtil = new ToolUtil();
|
private final ToolUtil toolUtil = new ToolUtil();
|
||||||
|
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取建模自定义校验配置</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 13:17
|
||||||
|
**/
|
||||||
public List<XkModelCusCheckFiledConfig> getFieldCheckRuleConfigList(){
|
public List<XkModelCusCheckFiledConfig> getFieldCheckRuleConfigList(){
|
||||||
String configTableName = Util.null2DefaultStr(toolUtil.getSystemParamValue("checkRuleConfigTableName"), "uf_yyhcfxgz");
|
String configTableName = Util.null2DefaultStr(toolUtil.getSystemParamValue("checkRuleConfigTableName"), "uf_yyhcfxgz");
|
||||||
return mapper.queryConditionList(configTableName);
|
return mapper.queryConditionList(configTableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>校验所有数据</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 13:18
|
||||||
|
* @param configList 所有配置
|
||||||
|
**/
|
||||||
public void checkModelData(List<XkModelCusCheckFiledConfig> configList){
|
public void checkModelData(List<XkModelCusCheckFiledConfig> configList){
|
||||||
// 根据建模表名进行分组 查找出每个表对应有哪些校验规则事项
|
// 根据建模表名进行分组 查找出每个表对应有哪些校验规则事项
|
||||||
Map<String, List<XkModelCusCheckFiledConfig>> map = configList.stream().collect(Collectors.groupingBy(XkModelCusCheckFiledConfig::getModelTableName));
|
Map<String, List<XkModelCusCheckFiledConfig>> map = configList.stream().collect(Collectors.groupingBy(XkModelCusCheckFiledConfig::getModelTableName));
|
||||||
List<CheckErrorInfo> result = new ArrayList<>();
|
if(MapUtil.isEmpty(map)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<CheckErrorFieldInfo> result = new ArrayList<>();
|
||||||
for (Map.Entry<String, List<XkModelCusCheckFiledConfig>> entry : map.entrySet()) {
|
for (Map.Entry<String, List<XkModelCusCheckFiledConfig>> entry : map.entrySet()) {
|
||||||
// 在对每个表的第一个字段做分组 找出主表和明细表
|
// 在对每个表的第一个字段做分组 找出主表和明细表
|
||||||
List<XkModelCusCheckFiledConfig> filedConfigs = entry.getValue();
|
List<XkModelCusCheckFiledConfig> filedConfigs = entry.getValue();
|
||||||
Map<String, List<XkModelCusCheckFiledConfig>> configMap = filedConfigs.stream()
|
Map<String, List<XkModelCusCheckFiledConfig>> configMap = filedConfigs.stream()
|
||||||
.collect(Collectors.groupingBy(item->item.getModelFieldNameList().get(0).getTableName()));
|
.collect(Collectors.groupingBy(item->item.getModelFieldNameList().get(0).getTableName()));
|
||||||
System.out.println("configMap : \n" + JSONObject.toJSONString(configMap));
|
Util.getLogger().info("configMap : \n" + JSONObject.toJSONString(configMap));
|
||||||
// 主表表名
|
// 主表表名
|
||||||
String mainTableName = entry.getKey();
|
String mainTableName = entry.getKey();
|
||||||
|
String modelId = Util.getModeIdByTableName(mainTableName);
|
||||||
// 主表数据
|
// 主表数据
|
||||||
List<Map<String, Object>> modelList = mapper.queryModelMain(mainTableName,"");
|
List<Map<String, Object>> modelMainList = mapper.queryModelMain(mainTableName,"");
|
||||||
// 主表校验规则配置
|
// 主表校验规则配置
|
||||||
List<XkModelCusCheckFiledConfig> mainTableConfig = configMap.remove(mainTableName);
|
List<XkModelCusCheckFiledConfig> mainTableConfig = configMap.remove(mainTableName);
|
||||||
// 先处理主表数据
|
// 先处理主表数据
|
||||||
checkModel(mainTableName, new HashMap<>(), modelList, mainTableConfig, result);
|
this.checkModel(mainTableName, new ArrayList<>(), modelMainList, mainTableConfig, result, modelId, 0);
|
||||||
// 明细数据
|
// 明细数据
|
||||||
for (Map.Entry<String, List<XkModelCusCheckFiledConfig>> detailEntry : configMap.entrySet()) {
|
for (Map.Entry<String, List<XkModelCusCheckFiledConfig>> detailEntry : configMap.entrySet()) {
|
||||||
String detailTable = detailEntry.getKey();
|
String detailTable = detailEntry.getKey();
|
||||||
|
@ -61,26 +78,35 @@ public class XkModelCusCheckService {
|
||||||
if(CollectionUtils.isEmpty(detailModel)){
|
if(CollectionUtils.isEmpty(detailModel)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 主表的mainId
|
|
||||||
String detailMainId = Util.null2DefaultStr(detailModel.get(0).get("mainid"), "");
|
|
||||||
if(StrUtil.isBlank(detailMainId)){
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<Map<String, Object>> mainList = modelList.stream().filter(item -> {
|
|
||||||
String id = Util.null2DefaultStr(item.get("id"), "");
|
|
||||||
return StrUtil.isNotBlank(id) && detailMainId.equals(id);
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
if(CollectionUtils.isEmpty(mainList)){
|
|
||||||
Util.getLogger()
|
|
||||||
.error(Util.logStr("当前明细表: {}, detailMainId: {} 在主表数据集合中没找到对应的主表数据! 当前主表数据集合: {}", detailTable, detailMainId, JSONObject.toJSONString(modelList)));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
List<XkModelCusCheckFiledConfig> detailConfig = detailEntry.getValue();
|
List<XkModelCusCheckFiledConfig> detailConfig = detailEntry.getValue();
|
||||||
checkModel(detailTable, mainList.get(0), detailModel, detailConfig, result);
|
this.checkModel(detailTable, modelMainList, detailModel, detailConfig, result, modelId, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("result : \n" + JSONObject.toJSONString(result));
|
String checkErrorDataDel = Util.null2DefaultStr(toolUtil.getSystemParamValue("checkErrorDataDel"),"checkErrorDataDel");
|
||||||
|
if(CollectionUtils.isEmpty(result)){
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
ResponseMappingDeal deal = new ResponseMappingDeal();
|
||||||
|
Util.getLogger().info("校验不符合规则数据: \n" + JSONObject.toJSONString(result));
|
||||||
|
List<Map<String, Object>> list = convertListEntityToListMap(result);
|
||||||
|
Map<String, Object> data = new HashMap<>();
|
||||||
|
data.put("data", list);
|
||||||
|
deal.doResponseSync(checkErrorDataDel, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将实体类集合转成map集合</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 13:21
|
||||||
|
* @param entities 实体类集合
|
||||||
|
* @return List<Map>
|
||||||
|
**/
|
||||||
|
public static <T> List<Map<String, Object>> convertListEntityToListMap(List<T> entities) {
|
||||||
|
return entities.stream()
|
||||||
|
.map(entity -> (Map<String, Object>) OBJECT_MAPPER.convertValue(entity, Map.class))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String buildWhereSql(String modelWhereSql, boolean joinQuery){
|
public String buildWhereSql(String modelWhereSql, boolean joinQuery){
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
@ -97,40 +123,137 @@ public class XkModelCusCheckService {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>按照规则校验数据</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 13:21
|
||||||
|
* @param tableName 当前表名
|
||||||
|
* @param mainMapList 主表map集合
|
||||||
|
* @param modelList 建模数据集合
|
||||||
|
* @param configs 配置对象
|
||||||
|
* @param result 不符合校验规则的对象集合
|
||||||
|
* @param modelId 建模模块id
|
||||||
|
* @param type 类型 0: 主表, 1: 明细表
|
||||||
|
**/
|
||||||
public void checkModel(String tableName,
|
public void checkModel(String tableName,
|
||||||
Map<String, Object> mainMap,
|
List<Map<String, Object>> mainMapList,
|
||||||
List<Map<String, Object>> modelList,
|
List<Map<String, Object>> modelList,
|
||||||
List<XkModelCusCheckFiledConfig> configs,
|
List<XkModelCusCheckFiledConfig> configs,
|
||||||
List<CheckErrorInfo> result){
|
List<CheckErrorFieldInfo> result,
|
||||||
|
String modelId,
|
||||||
|
int type){
|
||||||
if(CollectionUtils.isEmpty(configs) || CollectionUtils.isEmpty(modelList)){
|
if(CollectionUtils.isEmpty(configs) || CollectionUtils.isEmpty(modelList)){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Map<String, Object> tempMainMap;
|
Map<String, Object> tempMainMap;
|
||||||
for (Map<String, Object> map : modelList) {
|
for (Map<String, Object> map : modelList) {
|
||||||
|
boolean isMain = type == 0;
|
||||||
|
tempMainMap = isMain ? map : parseMainMap(mainMapList, map, tableName);
|
||||||
for (XkModelCusCheckFiledConfig config : configs) {
|
for (XkModelCusCheckFiledConfig config : configs) {
|
||||||
int viewType = config.getModelFieldNameList().get(0).getViewType();
|
if(noCheckHandler(config, tempMainMap, map)){
|
||||||
boolean isMain = viewType == 0;
|
|
||||||
tempMainMap = isMain ? map : mainMap;
|
|
||||||
Bi4Function<XkModelCusCheckFiledConfig, XkModelCusCheckFiledGroupConfig, Map<String, Object>, Map<String, Object>, Boolean> function = CheckRuleMethodUtil.CHECK_RULE_MAP.get(config.getCheckRule());
|
|
||||||
if(function == null){
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Boolean check = function.apply(config, null, tempMainMap, map);
|
Bi4Function<XkModelCusCheckFiledConfig, XkModelCusCheckFiledGroupConfig, Map<String, Object>, Map<String, Object>, Boolean> function = CheckRuleMethodUtil.CHECK_RULE_MAP.get(config.getCheckRule());
|
||||||
|
if(function == null){
|
||||||
|
Util.getLogger().error("获取执行函数为null! current rule : [ " + config.getCheckRule() + " ]");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
boolean check;
|
||||||
|
try {
|
||||||
|
check = function.apply(config, null, tempMainMap, map);
|
||||||
|
}catch (Exception e){
|
||||||
|
Util.getLogger().error("执行校验失败!" + e.getMessage());
|
||||||
|
check = false;
|
||||||
|
}
|
||||||
if(!check){
|
if(!check){
|
||||||
|
result.add(buildCheckErrorFieldInfo(config, tempMainMap, map, tableName, isMain, modelId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>跳过校验</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 14:16
|
||||||
|
* @param config 配置对象
|
||||||
|
* @param tempMainMap 临时主表
|
||||||
|
* @param map 建模map
|
||||||
|
* @return 是否符合跳过
|
||||||
|
**/
|
||||||
|
public boolean noCheckHandler(XkModelCusCheckFiledConfig config,
|
||||||
|
Map<String, Object> tempMainMap,
|
||||||
|
Map<String, Object> map){
|
||||||
|
try {
|
||||||
|
String expression = config.getNoCheckExpression();
|
||||||
|
if(StrUtil.isNotBlank(expression)){
|
||||||
|
Bi4Function<XkModelCusCheckFiledConfig, XkModelCusCheckFiledGroupConfig, Map<String, Object>, Map<String, Object>, Boolean> function =
|
||||||
|
CheckRuleMethodUtil.CHECK_RULE_MAP.get(99);
|
||||||
|
if(function != null){
|
||||||
|
return function.apply(config, null, tempMainMap, map);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
Util.getLogger().error("noCheckHandler error!" + e.getMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>构造不合规对象</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/31 13:24
|
||||||
|
* @param config 配置对象
|
||||||
|
* @param tempMainMap 主表对象
|
||||||
|
* @param map 当前数据map
|
||||||
|
* @param tableName 表名
|
||||||
|
* @param isMain 是否主表
|
||||||
|
* @param modelId 模块id
|
||||||
|
* @return 错误信息对象
|
||||||
|
**/
|
||||||
|
public CheckErrorFieldInfo buildCheckErrorFieldInfo(XkModelCusCheckFiledConfig config,
|
||||||
|
Map<String, Object> tempMainMap,
|
||||||
|
Map<String, Object> map,
|
||||||
|
String tableName,
|
||||||
|
boolean isMain,
|
||||||
|
String modelId){
|
||||||
String fieldName = config.getModelFieldNameList().get(0).getFieldName();
|
String fieldName = config.getModelFieldNameList().get(0).getFieldName();
|
||||||
String mainId = Util.null2DefaultStr(tempMainMap.get("id"), "");
|
String mainId = Util.null2DefaultStr(tempMainMap.get("id"), "");
|
||||||
String itemId = Util.null2DefaultStr(map.get("id"), "");
|
String itemId = Util.null2DefaultStr(map.get("id"), "");
|
||||||
CheckErrorInfo errorInfo = CheckErrorInfo.builder()
|
return CheckErrorFieldInfo.builder()
|
||||||
.errorMsg(config.getErrorMsg())
|
.errorMsg(config.getErrorMsg())
|
||||||
.errorFieldName(fieldName)
|
.errorFieldName(fieldName)
|
||||||
.tableName(tableName)
|
.tableName(tableName)
|
||||||
.dataId(isMain ? mainId : itemId)
|
.dataId(isMain ? mainId : itemId)
|
||||||
.currentValue(map.get(fieldName))
|
.currentValue(map.get(fieldName))
|
||||||
|
.mainMap(tempMainMap)
|
||||||
|
.detailMap(map)
|
||||||
.mainId(mainId)
|
.mainId(mainId)
|
||||||
|
.url("/spa/cube/index.html#/main/cube/card?billid="+mainId+"&type=0&modeId="+modelId+"&formId="+config.getModelTable())
|
||||||
.build();
|
.build();
|
||||||
result.add(errorInfo);
|
}
|
||||||
}
|
|
||||||
}
|
/**
|
||||||
}
|
* <h1>解析明细对应的主表对象</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/27 17:31
|
||||||
|
* @param modelMainList 主表集合
|
||||||
|
* @param detailMap 明细对象
|
||||||
|
* @param detailTable 明细表名
|
||||||
|
* @return 主表对象
|
||||||
|
**/
|
||||||
|
public Map<String, Object> parseMainMap(List<Map<String, Object>> modelMainList,
|
||||||
|
Map<String, Object> detailMap,
|
||||||
|
String detailTable){
|
||||||
|
List<Map<String, Object>> mainList = modelMainList.stream().filter(item -> {
|
||||||
|
String id = Util.null2DefaultStr(item.get("id"), "");
|
||||||
|
return StrUtil.isNotBlank(id) && Util.null2DefaultStr(detailMap.get("mainid"),"").equals(id);
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
if(CollectionUtils.isEmpty(mainList)){
|
||||||
|
Util.getLogger()
|
||||||
|
.error(Util.logStr("当前明细表: {}, detailMainId: {} 在主表数据集合中没找到对应的主表数据! 当前主表数据集合: {}", detailTable, detailMap.get("mainid"), JSONObject.toJSONString(modelMainList)));
|
||||||
|
}
|
||||||
|
return mainList.get(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package weaver.xuanran.wang.xk_hospital.model_check.util;
|
||||||
import aiyh.utils.ScriptUtil;
|
import aiyh.utils.ScriptUtil;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.annotation.MethodRuleNo;
|
import aiyh.utils.annotation.MethodRuleNo;
|
||||||
import aiyh.utils.excention.CustomerException;
|
|
||||||
import aiyh.utils.function.Bi4Function;
|
import aiyh.utils.function.Bi4Function;
|
||||||
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
@ -16,6 +16,8 @@ import weaver.xuanran.wang.xk_hospital.model_check.mapper.XkModelCusCheckMapper;
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>检查方法校验工具</h1>
|
* <h1>检查方法校验工具</h1>
|
||||||
|
@ -63,12 +65,7 @@ public class CheckRuleMethodUtil {
|
||||||
Map<String, Object> detailMap) {
|
Map<String, Object> detailMap) {
|
||||||
boolean check = true;
|
boolean check = true;
|
||||||
for (ModelFieldInfo fieldInfo : filedConfig.getModelFieldNameList()) {
|
for (ModelFieldInfo fieldInfo : filedConfig.getModelFieldNameList()) {
|
||||||
int mainOrDetail = fieldInfo.getViewType();
|
check = StrUtil.isNotBlank(parseFieldValue(fieldInfo, mainMap, detailMap));
|
||||||
if(mainOrDetail == 0){
|
|
||||||
check = StrUtil.isNotBlank(Util.null2DefaultStr(mainMap.get(fieldInfo.getFieldName()),""));
|
|
||||||
}else {
|
|
||||||
check = StrUtil.isNotBlank(Util.null2DefaultStr(detailMap.get(fieldInfo.getFieldName()),""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return check;
|
return check;
|
||||||
}
|
}
|
||||||
|
@ -80,12 +77,7 @@ public class CheckRuleMethodUtil {
|
||||||
Map<String, Object> detailMap) {
|
Map<String, Object> detailMap) {
|
||||||
try {
|
try {
|
||||||
for (ModelFieldInfo fieldInfo : filedConfig.getModelFieldNameList()) {
|
for (ModelFieldInfo fieldInfo : filedConfig.getModelFieldNameList()) {
|
||||||
int mainOrDetail = fieldInfo.getViewType();
|
Integer.valueOf(parseFieldValue(fieldInfo, mainMap, detailMap));
|
||||||
if(mainOrDetail == 0) {
|
|
||||||
Integer.parseInt(Util.null2DefaultStr(mainMap.get(fieldInfo.getFieldName()), ""));
|
|
||||||
}else {
|
|
||||||
Integer.parseInt(Util.null2DefaultStr(detailMap.get(fieldInfo.getFieldName()), ""));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -165,28 +157,27 @@ public class CheckRuleMethodUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @MethodRuleNo(value = 6, desc = "自定义表达式")
|
@MethodRuleNo(value = 99, desc = "自定义表达式")
|
||||||
private static boolean checkCustomerExpression(XkModelCusCheckFiledConfig filedConfig,
|
private static boolean checkCustomerExpression(XkModelCusCheckFiledConfig filedConfig,
|
||||||
XkModelCusCheckFiledGroupConfig groupConfig,
|
XkModelCusCheckFiledGroupConfig groupConfig,
|
||||||
Map<String, Object> mainMap,
|
Map<String, Object> mainMap,
|
||||||
Map<String, Object> detailMap) {
|
Map<String, Object> detailMap) {
|
||||||
// String expression = Util.sbc2dbcCase(filedConfig.getCheckExpression());
|
String expression = Util.sbc2dbcCase(filedConfig.getCheckExpression());
|
||||||
// if(StrUtil.isBlank(expression)){
|
if(StrUtil.isBlank(expression)){
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// try {
|
|
||||||
// if(filedConfig.getMainOrDetail() == 0){
|
|
||||||
// return (Boolean)ScriptUtil.invokeScript(expression, mainMap, CUS_SCRIPT_FUN);
|
|
||||||
// } else {
|
|
||||||
// return (Boolean)ScriptUtil.invokeScript(expression, detailMap, CUS_SCRIPT_FUN);
|
|
||||||
// }
|
|
||||||
// }catch (Exception e){
|
|
||||||
// log.error("自定义表达式执行失败! " + e.getMessage());
|
|
||||||
// Util.logErrorStr(e);
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
Map<String, Object> appentDtMap = detailMap.entrySet()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(entry -> "dt." + entry.getKey(), Map.Entry::getValue));
|
||||||
|
mainMap.putAll(appentDtMap);
|
||||||
|
return (Boolean)ScriptUtil.invokeScript(expression, mainMap, CUS_SCRIPT_FUN);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("自定义表达式执行失败! " + e.getMessage());
|
||||||
|
Util.logErrorStr(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@MethodRuleNo(value = 4, desc = "两个日期相差月数")
|
@MethodRuleNo(value = 4, desc = "两个日期相差月数")
|
||||||
private static boolean twoDateSubMonth(XkModelCusCheckFiledConfig filedConfig,
|
private static boolean twoDateSubMonth(XkModelCusCheckFiledConfig filedConfig,
|
||||||
|
@ -194,12 +185,12 @@ public class CheckRuleMethodUtil {
|
||||||
Map<String, Object> mainMap,
|
Map<String, Object> mainMap,
|
||||||
Map<String, Object> detailMap) {
|
Map<String, Object> detailMap) {
|
||||||
List<ModelFieldInfo> fieldNameList = filedConfig.getModelFieldNameList();
|
List<ModelFieldInfo> fieldNameList = filedConfig.getModelFieldNameList();
|
||||||
if(!checkFieldConf(fieldNameList)){
|
if(checkFieldConf(fieldNameList)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Map<String, Object> dateMap = parse2DateMap(filedConfig, fieldNameList, mainMap, detailMap);
|
Map<String, Object> dateMap = parse2DateMap(filedConfig, fieldNameList, mainMap, detailMap);
|
||||||
String scriptStr = "CusJexlFunctions.twoDateSubNoFormat(beginDate,endDate,1) " + filedConfig.getCheckExpression();
|
String scriptStr = "CusJexlFunctions.twoDateSubNoFormat(beginDate,endDate,1) " + filedConfig.getCheckExpression();
|
||||||
return (boolean) ScriptUtil.invokeScript(scriptStr, dateMap);
|
return (boolean) ScriptUtil.invokeScript(scriptStr, dateMap, CUS_SCRIPT_FUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -231,12 +222,12 @@ public class CheckRuleMethodUtil {
|
||||||
Map<String, Object> mainMap,
|
Map<String, Object> mainMap,
|
||||||
Map<String, Object> detailMap) {
|
Map<String, Object> detailMap) {
|
||||||
List<ModelFieldInfo> fieldNameList = filedConfig.getModelFieldNameList();
|
List<ModelFieldInfo> fieldNameList = filedConfig.getModelFieldNameList();
|
||||||
if(!checkFieldConf(fieldNameList)){
|
if(checkFieldConf(fieldNameList)){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Map<String, Object> dateMap = parse2DateMap(filedConfig, fieldNameList, mainMap, detailMap);
|
Map<String, Object> dateMap = parse2DateMap(filedConfig, fieldNameList, mainMap, detailMap);
|
||||||
String scriptStr = "CusJexlFunctions.compare2Date(beginDate,endDate) " + filedConfig.getCheckExpression();
|
String scriptStr = "CusJexlFunctions.compare2Date(beginDate,endDate)";
|
||||||
return (boolean) ScriptUtil.invokeScript(scriptStr, dateMap);
|
return (boolean) ScriptUtil.invokeScript(scriptStr, dateMap, CUS_SCRIPT_FUN);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String sqlHandle(String cusSql){
|
public static String sqlHandle(String cusSql){
|
||||||
|
@ -253,49 +244,45 @@ public class CheckRuleMethodUtil {
|
||||||
public static boolean checkFieldConf(List<ModelFieldInfo> fieldNameList) {
|
public static boolean checkFieldConf(List<ModelFieldInfo> fieldNameList) {
|
||||||
if (CollectionUtils.isEmpty(fieldNameList) || fieldNameList.size() > 2) {
|
if (CollectionUtils.isEmpty(fieldNameList) || fieldNameList.size() > 2) {
|
||||||
Util.getLogger().error("校验规则选择日期相差月数时, 表单字段不能超过2个!");
|
Util.getLogger().error("校验规则选择日期相差月数时, 表单字段不能超过2个!");
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public static Map<String, Object> parse2DateMap(XkModelCusCheckFiledConfig filedConfig,
|
public static Map<String, Object> parse2DateMap(XkModelCusCheckFiledConfig filedConfig,
|
||||||
List<ModelFieldInfo> fieldNameList,
|
List<ModelFieldInfo> fieldNameList,
|
||||||
Map<String, Object> mainMap,
|
Map<String, Object> mainMap,
|
||||||
Map<String, Object> detailMap) {
|
Map<String, Object> detailMap) {
|
||||||
String beginDate = "";
|
|
||||||
String endDate = "";
|
|
||||||
Map<String, Object> dateMap = new HashMap<>();
|
Map<String, Object> dateMap = new HashMap<>();
|
||||||
// 如果只勾选了一个字段
|
String beginDate;
|
||||||
if(fieldNameList.size() == 1){
|
String endDate;
|
||||||
String cusWhere = filedConfig.getCusWhere();
|
|
||||||
if(StrUtil.isNotBlank(cusWhere)){
|
|
||||||
String sql = sqlHandle(cusWhere);
|
|
||||||
endDate = mapper.queryCusSqlDate(sql, mainMap, detailMap);
|
|
||||||
if(StrUtil.isBlank(endDate)){
|
|
||||||
endDate = TimeUtil.getCurrentDateString();
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
endDate = TimeUtil.getCurrentDateString();
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
for (int i = 0; i < fieldNameList.size(); i++) {
|
|
||||||
ModelFieldInfo fieldInfo = fieldNameList.get(i);
|
|
||||||
String date;
|
|
||||||
if (fieldInfo.getViewType() == 0) {
|
|
||||||
date = Util.null2DefaultStr(mainMap.get(fieldInfo.getFieldName()),"");
|
|
||||||
}else {
|
|
||||||
date = Util.null2DefaultStr(detailMap.get(fieldInfo.getFieldName()),"");
|
|
||||||
}
|
|
||||||
if(i == 0){
|
|
||||||
beginDate = date;
|
|
||||||
}else {
|
|
||||||
endDate = date;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (fieldNameList.size() == 1) {
|
||||||
|
String customerValue = filedConfig.getCustomerValue();
|
||||||
|
endDate = StrUtil.isNotBlank(customerValue)
|
||||||
|
? mapper.queryCusSqlDate(sqlHandle(customerValue), mainMap, detailMap)
|
||||||
|
: TimeUtil.getCurrentDateString();
|
||||||
|
beginDate = parseFieldValue(fieldNameList.get(0), mainMap, detailMap);
|
||||||
|
} else {
|
||||||
|
List<String> dates = fieldNameList.stream()
|
||||||
|
.map(fieldInfo -> parseFieldValue(fieldInfo, mainMap, detailMap))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
beginDate = dates.get(0);
|
||||||
|
endDate = dates.size() > 1 ? dates.get(1) : TimeUtil.getCurrentDateString();
|
||||||
}
|
}
|
||||||
dateMap.put("endDate", endDate);
|
dateMap.put("endDate", endDate);
|
||||||
dateMap.put("beginDate", beginDate);
|
dateMap.put("beginDate", beginDate);
|
||||||
return dateMap;
|
return dateMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String parseFieldValue(ModelFieldInfo fieldInfo,
|
||||||
|
Map<String, Object> mainMap,
|
||||||
|
Map<String, Object> detailMap){
|
||||||
|
if (fieldInfo.getViewType() == 0) {
|
||||||
|
return Util.null2DefaultStr(mainMap.get(fieldInfo.getFieldName()),"");
|
||||||
|
}else {
|
||||||
|
return Util.null2DefaultStr(detailMap.get(fieldInfo.getFieldName()),"");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,22 +214,22 @@ public class CusJexlFunctions implements CusScriptFunInterface {
|
||||||
LocalDate secondLocalDate = parseDateStr2LocalDate(secondDate, secondDateFormat);
|
LocalDate secondLocalDate = parseDateStr2LocalDate(secondDate, secondDateFormat);
|
||||||
switch (type){
|
switch (type){
|
||||||
case 0:{
|
case 0:{
|
||||||
return ChronoUnit.YEARS.between(firstLocalDate, secondLocalDate);
|
return Math.abs(ChronoUnit.YEARS.between(firstLocalDate, secondLocalDate));
|
||||||
}
|
}
|
||||||
case 1:{
|
case 1:{
|
||||||
return ChronoUnit.MONTHS.between(firstLocalDate, secondLocalDate);
|
return Math.abs(ChronoUnit.MONTHS.between(firstLocalDate, secondLocalDate));
|
||||||
}
|
}
|
||||||
case 2:{
|
case 2:{
|
||||||
return ChronoUnit.DAYS.between(firstLocalDate, secondLocalDate);
|
return Math.abs(ChronoUnit.DAYS.between(firstLocalDate, secondLocalDate));
|
||||||
}
|
}
|
||||||
case 3:{
|
case 3:{
|
||||||
return ChronoUnit.HOURS.between(firstLocalDate, secondLocalDate);
|
return Math.abs(ChronoUnit.HOURS.between(firstLocalDate, secondLocalDate));
|
||||||
}
|
}
|
||||||
case 4:{
|
case 4:{
|
||||||
return ChronoUnit.MINUTES.between(firstLocalDate, secondLocalDate);
|
return Math.abs(ChronoUnit.MINUTES.between(firstLocalDate, secondLocalDate));
|
||||||
}
|
}
|
||||||
case 5:{
|
case 5:{
|
||||||
return ChronoUnit.SECONDS.between(firstLocalDate, secondLocalDate);
|
return Math.abs(ChronoUnit.SECONDS.between(firstLocalDate, secondLocalDate));
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package xuanran.wang.http_test.test;
|
package xuanran.wang.http_test.test;
|
||||||
|
|
||||||
|
import aiyh.utils.cus_rest.CusRestTemplate;
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
import xuanran.wang.rest_test.CusRestTemplate;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
package xuanran.wang.log.cus_api_log.test;
|
package xuanran.wang.log.test;
|
||||||
|
|
||||||
|
import aiyh.utils.api_log.cus_api_log.CusApiLogUtil;
|
||||||
|
import aiyh.utils.api_log.cus_api_log.dto.DemoDto;
|
||||||
|
import aiyh.utils.cus_rest.CusRestTemplate;
|
||||||
|
import aiyh.utils.cus_rest.pojo.CusRestTemplateResponse;
|
||||||
import aiyh.utils.httpUtil.ResponeVo;
|
import aiyh.utils.httpUtil.ResponeVo;
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.workflow.request.RequestManager;
|
import weaver.workflow.request.RequestManager;
|
||||||
import xuanran.wang.rest_test.pojo.CusRestTemplateResponse;
|
|
||||||
import xuanran.wang.log.cus_api_log.CusApiLogUtil;
|
|
||||||
import xuanran.wang.log.cus_api_log.dto.DemoDto;
|
|
||||||
import xuanran.wang.rest_test.CusRestTemplate;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
|
@ -1,19 +0,0 @@
|
||||||
package xuanran.wang.rest_test;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1></h1>
|
|
||||||
*
|
|
||||||
* @author xuanran.wang
|
|
||||||
* @date 2023/7/7 11:44
|
|
||||||
*/
|
|
||||||
@Data
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
public class Stu{
|
|
||||||
private String blance;
|
|
||||||
private String name;
|
|
||||||
private String tel;
|
|
||||||
private String age;
|
|
||||||
}
|
|
|
@ -1,14 +1,20 @@
|
||||||
package xuanran.wang.xk_hospital.test;
|
package xuanran.wang.xk_hospital.test;
|
||||||
|
|
||||||
import aiyh.utils.ScriptUtil;
|
import aiyh.utils.ScriptUtil;
|
||||||
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.tool.org.apache.commons.jexl3.*;
|
import aiyh.utils.tool.org.apache.commons.jexl3.*;
|
||||||
import basetest.BaseTest;
|
import basetest.BaseTest;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.engine.core.cfg.EngineConfigurationImpl;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
import weaver.general.TimeUtil;
|
import weaver.general.TimeUtil;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckConfig;
|
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckConfig;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckFiledConfig;
|
import weaver.xuanran.wang.xk_hospital.model_check.entity.XkModelCusCheckFiledConfig;
|
||||||
|
import weaver.xuanran.wang.xk_hospital.model_check.mapper.XkModelCusCheckMapper;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.service.XkModelCusCheckService;
|
import weaver.xuanran.wang.xk_hospital.model_check.service.XkModelCusCheckService;
|
||||||
import weaver.xuanran.wang.xk_hospital.model_check.util.CusJexlFunctions;
|
import weaver.xuanran.wang.xk_hospital.model_check.util.CusJexlFunctions;
|
||||||
|
|
||||||
|
@ -29,6 +35,8 @@ public class XkHospitalCheckModelTest extends BaseTest {
|
||||||
|
|
||||||
private final XkModelCusCheckService service = new XkModelCusCheckService();
|
private final XkModelCusCheckService service = new XkModelCusCheckService();
|
||||||
private static final CusJexlFunctions FUN = new CusJexlFunctions();
|
private static final CusJexlFunctions FUN = new CusJexlFunctions();
|
||||||
|
private final XkModelCusCheckMapper mapper = Util.getMapper(XkModelCusCheckMapper.class);
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testA(){
|
public void testA(){
|
||||||
|
@ -61,6 +69,19 @@ public class XkHospitalCheckModelTest extends BaseTest {
|
||||||
public void testC(){
|
public void testC(){
|
||||||
System.out.println(FUN.compare2Date("2023-07-26", "2023-07-27"));
|
System.out.println(FUN.compare2Date("2023-07-26", "2023-07-27"));
|
||||||
System.out.println(FUN.normalDateStrSubCurrentMonthAbs("2023-08-01"));
|
System.out.println(FUN.normalDateStrSubCurrentMonthAbs("2023-08-01"));
|
||||||
System.out.println(FUN.twoDateSubNoFormat("2023-08-01", "2023-09-01", 2));
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
map.put("beginDate","2023-04-26" );
|
||||||
|
map.put("endDate", "2023-07-27");
|
||||||
|
String scriptStr = "CusJexlFunctions.twoDateSubNoFormat(beginDate,endDate,1) " + " >= 3";
|
||||||
|
boolean b = (boolean) ScriptUtil.invokeScript(scriptStr, map, FUN);
|
||||||
|
System.out.println("b => " + b);
|
||||||
|
System.out.println(FUN.twoDateSubNoFormat("2023-04-26", "2023-07-27", 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testD(){
|
||||||
|
Logger log = LoggerFactory.getLogger(XkHospitalCheckModelTest.class);
|
||||||
|
log.info("test log");
|
||||||
|
log.info("this is format : 参数1: {}, 参数2: {}","a", "b");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue