保时捷定时任务,前端代码,util优化
parent
f2b3189e4f
commit
87771e9426
|
@ -23,7 +23,6 @@ log
|
||||||
# should NOT be excluded as they contain compiler settings and other important
|
# should NOT be excluded as they contain compiler settings and other important
|
||||||
# information for Eclipse / Flash Builder.
|
# information for Eclipse / Flash Builder.
|
||||||
|
|
||||||
/target/
|
|
||||||
/log/
|
/log/
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/src/main/resources/WEB-INF/prop/weaver.properties
|
/src/main/resources/WEB-INF/prop/weaver.properties
|
||||||
|
@ -44,6 +43,7 @@ src/main/resources/WEB-INF/sqllog/
|
||||||
java.io.tempdir/
|
java.io.tempdir/
|
||||||
ecology-9-dev.iml
|
ecology-9-dev.iml
|
||||||
src/test/resources/font
|
src/test/resources/font
|
||||||
|
src/main/resources/WEB-INF/vm/outFile
|
||||||
|
target/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,6 +75,12 @@ WfForm.bindFieldChangeEvent = function (fieldMarkStr, funobj = (obj, id, value)
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WfForm.bindDetailFieldChangeEvent = function (fieldMarkStr, funobj = (id, rowIndex, value) => {
|
||||||
|
}) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
WfForm.controlBtnDisabled = function (isDisabled) {
|
WfForm.controlBtnDisabled = function (isDisabled) {
|
||||||
// isDisabled boolean 是 true:按钮全部置灰不可操作,false:恢复按钮可操作状态
|
// isDisabled boolean 是 true:按钮全部置灰不可操作,false:恢复按钮可操作状态
|
||||||
// function subimtForm(params){
|
// function subimtForm(params){
|
||||||
|
@ -133,6 +139,16 @@ WfForm.changeFieldValue = function (fieldMark, valueInfo) {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取流览框显示值
|
||||||
|
* fieldMark String 是 字段标示,格式field${字段ID}_${明细行号}
|
||||||
|
* splitChar String 否 分隔符,默认以逗号分隔
|
||||||
|
* @param fieldMark
|
||||||
|
* @param splitChar
|
||||||
|
*/
|
||||||
|
WfForm.getBrowserShowName = function (fieldMark, splitChar) {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* ******************* 建模表开发依赖 ******************* */
|
/* ******************* 建模表开发依赖 ******************* */
|
||||||
|
|
||||||
|
@ -151,3 +167,6 @@ ModeList.dataLoadAfter = function (data) {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,18 @@ class ConfigWorkflowTitle {
|
||||||
|| item.type === RulesType.SELECT_VALUE
|
|| item.type === RulesType.SELECT_VALUE
|
||||||
|| item.type === RulesType.RADIO_VALUE).forEach(item => filedArr.push(item.fieldName))
|
|| item.type === RulesType.RADIO_VALUE).forEach(item => filedArr.push(item.fieldName))
|
||||||
this.addListenerEvent(filedArr)
|
this.addListenerEvent(filedArr)
|
||||||
|
this.addListenerSubmitEvent()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听提交流程动作
|
||||||
|
*/
|
||||||
|
addListenerSubmitEvent = () => {
|
||||||
|
Utils.registerAction(WfForm.OPER_SAVE + "," + WfForm.OPER_SUBMIT, callback => {
|
||||||
|
this.changeWorkflowTitle()
|
||||||
|
callback()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -78,6 +90,12 @@ class RulesType {
|
||||||
let year = date.getFullYear();
|
let year = date.getFullYear();
|
||||||
let month = date.getMonth() + 1;
|
let month = date.getMonth() + 1;
|
||||||
let day = date.getDay();
|
let day = date.getDay();
|
||||||
|
if (month < 10) {
|
||||||
|
month = '0' + month
|
||||||
|
}
|
||||||
|
if (day < 10) {
|
||||||
|
day = '0' + day
|
||||||
|
}
|
||||||
return year + "-" + month + "-" + day
|
return year + "-" + month + "-" + day
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,13 +119,13 @@ class RulesType {
|
||||||
// 当前月份
|
// 当前月份
|
||||||
static CURRENT_MONTH = {
|
static CURRENT_MONTH = {
|
||||||
value: 7,
|
value: 7,
|
||||||
run: () => new Date().getMonth() + 1
|
run: () => new Date().getMonth() + 1 < 10 ? new Date().getMonth() + 1 : '0' + new Date().getMonth() + 1
|
||||||
|
|
||||||
}
|
}
|
||||||
// 当前天数
|
// 当前天数
|
||||||
static CURRENT_DAY = {
|
static CURRENT_DAY = {
|
||||||
value: 8,
|
value: 8,
|
||||||
run: () => new Date().getDay()
|
run: () => new Date().getDay() < 10 ? new Date().getDay() : '0' + new Date().getDay()
|
||||||
|
|
||||||
}
|
}
|
||||||
// 当前小时
|
// 当前小时
|
||||||
|
@ -145,6 +163,13 @@ class RulesType {
|
||||||
return result.join("")
|
return result.join("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
static BROWSER_SHOW_NAME = {
|
||||||
|
value: 14,
|
||||||
|
run: item => {
|
||||||
|
let fieldId = Utils.convertNameObjToId(item.fieldName)
|
||||||
|
return WfForm.getBrowserShowName(fieldId)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -208,7 +208,7 @@ window.workflowCus = Object.assign(window.workflowCus ? window.workflowCus : {},
|
||||||
getLevelByScore: async function (config) {
|
getLevelByScore: async function (config) {
|
||||||
let scoreFiled = config.scoreFiled
|
let scoreFiled = config.scoreFiled
|
||||||
let score = Utils.getFiledValueByName(scoreFiled);
|
let score = Utils.getFiledValueByName(scoreFiled);
|
||||||
if(score == 0 || score == ''){
|
if (score == 0 || score == '') {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let result = await Utils.api({
|
let result = await Utils.api({
|
||||||
|
@ -232,16 +232,69 @@ $(() => {
|
||||||
levelField: "level1"
|
levelField: "level1"
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
setTimeout(()=>{
|
setTimeout(() => {
|
||||||
WfForm.bindFieldChangeEvent(Utils.convertNameObjToId(config.scoreFiled),()=>{
|
WfForm.bindFieldChangeEvent(Utils.convertNameObjToId(config.scoreFiled), () => {
|
||||||
console.log("asdfasdfasdfsadfasdf")
|
|
||||||
window.workflowCus.getLevelByScore(config)
|
window.workflowCus.getLevelByScore(config)
|
||||||
})
|
})
|
||||||
window.workflowCus.getLevelByScore(config)
|
window.workflowCus.getLevelByScore(config)
|
||||||
},100)
|
}, 100)
|
||||||
}catch (err){
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
/* ******************* apa流程通过apa分数字段带出level字段eng ******************* */
|
/* ******************* apa流程通过apa分数字段带出level字段eng ******************* */
|
||||||
|
|
||||||
|
|
||||||
|
/* ******************* apa(employee)流程明细分数控制 ******************* */
|
||||||
|
function addChangeEventListener(configItem) {
|
||||||
|
let fieldIds = Utils.convertNameToIdUtil([{
|
||||||
|
fieldName: configItem.selfEvaluationScore,
|
||||||
|
table: configItem.table
|
||||||
|
}, {
|
||||||
|
fieldName: configItem.leaderScore,
|
||||||
|
table: configItem.table
|
||||||
|
}])
|
||||||
|
WfForm.bindDetailFieldChangeEvent(fieldIds, (id, rowIndex, value) => {
|
||||||
|
if (value == '') {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (value >= 1 && value <= 5) {
|
||||||
|
if (value % 0.5 !== 0) {
|
||||||
|
showHint(id + "_" + rowIndex)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
showHint(id + "_" + rowIndex)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function showHint(id) {
|
||||||
|
WfForm.showMessage(`Evaluate your target completion by selecting a score.
|
||||||
|
The scores are of 0.5 break-down.
|
||||||
|
5 - Outstanding
|
||||||
|
4 - Exceeds Expectations
|
||||||
|
3 - Meets Expectations
|
||||||
|
2 - Needs Improvement
|
||||||
|
1 - Unsatisfactory`, 2, 10)
|
||||||
|
setTimeout(() => {
|
||||||
|
WfForm.changeFieldValue(id, {value: ""})
|
||||||
|
}, 100)
|
||||||
|
}
|
||||||
|
|
||||||
|
$(() => {
|
||||||
|
let employeeDetailConfig = [{
|
||||||
|
table: 'detail_1',
|
||||||
|
selfEvaluationScore: 'zp',
|
||||||
|
leaderScore: 'ldpf'
|
||||||
|
}, {
|
||||||
|
table: 'detail_2',
|
||||||
|
selfEvaluationScore: 'zp',
|
||||||
|
leaderScore: 'ldpf'
|
||||||
|
}]
|
||||||
|
employeeDetailConfig.forEach(item => {
|
||||||
|
addChangeEventListener(item)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/* ******************* apa(employee)流程明细分数控制end ******************* */
|
|
@ -1,6 +1,7 @@
|
||||||
package aiyh.utils;
|
package aiyh.utils;
|
||||||
|
|
||||||
import aiyh.utils.action.CusBaseAction;
|
import aiyh.utils.action.CusBaseAction;
|
||||||
|
import aiyh.utils.action.SafeCusActionProcessInterface;
|
||||||
import aiyh.utils.annotation.*;
|
import aiyh.utils.annotation.*;
|
||||||
import aiyh.utils.annotation.recordset.SqlMapper;
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
import aiyh.utils.entity.*;
|
import aiyh.utils.entity.*;
|
||||||
|
@ -45,6 +46,8 @@ import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.soa.workflow.request.RequestService;
|
import weaver.soa.workflow.request.RequestService;
|
||||||
import weaver.systeminfo.SystemEnv;
|
import weaver.systeminfo.SystemEnv;
|
||||||
import weaver.workflow.request.RequestManager;
|
import weaver.workflow.request.RequestManager;
|
||||||
|
import weaver.workflow.workflow.WorkflowBillComInfo;
|
||||||
|
import weaver.workflow.workflow.WorkflowComInfo;
|
||||||
import weaver.workflow.workflow.WorkflowVersion;
|
import weaver.workflow.workflow.WorkflowVersion;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
@ -54,10 +57,7 @@ import java.beans.IntrospectionException;
|
||||||
import java.beans.Introspector;
|
import java.beans.Introspector;
|
||||||
import java.beans.PropertyDescriptor;
|
import java.beans.PropertyDescriptor;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.*;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.lang.reflect.Modifier;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
@ -95,6 +95,7 @@ public class Util extends weaver.general.Util {
|
||||||
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
|
public static final String UF_CUS_DEV_CONFIG = "uf_cus_dev_config";
|
||||||
private static final UtilService utilService = new UtilService();
|
private static final UtilService utilService = new UtilService();
|
||||||
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
private static final RecordsetUtil recordsetUtil = new RecordsetUtil();
|
||||||
|
private static final RecordsetUtil recordsetTransUtil = new RecordsetUtil();
|
||||||
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
|
private static final UtilMapper mapper = recordsetUtil.getMapper(UtilMapper.class);
|
||||||
private static final Map<String, Logger> otherLog = new HashMap<>(8);
|
private static final Map<String, Logger> otherLog = new HashMap<>(8);
|
||||||
static ToolUtil toolUtil = new ToolUtil();
|
static ToolUtil toolUtil = new ToolUtil();
|
||||||
|
@ -1989,7 +1990,7 @@ public class Util extends weaver.general.Util {
|
||||||
* @author youHong.ai ******************************************
|
* @author youHong.ai ******************************************
|
||||||
*/
|
*/
|
||||||
public static <T> T getTransMapper(Class<T> t) {
|
public static <T> T getTransMapper(Class<T> t) {
|
||||||
return recordsetUtil.getMapper(t, false);
|
return recordsetTransUtil.getMapper(t, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2007,7 +2008,7 @@ public class Util extends weaver.general.Util {
|
||||||
if (t.getAnnotation(SqlMapper.class) == null) {
|
if (t.getAnnotation(SqlMapper.class) == null) {
|
||||||
throw new BindingException("can not find SqlMapper annotation!");
|
throw new BindingException("can not find SqlMapper annotation!");
|
||||||
}
|
}
|
||||||
return recordsetUtil.getRsManager().commit(t.getName());
|
return recordsetTransUtil.getRsManager().commit(t.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2025,7 +2026,7 @@ public class Util extends weaver.general.Util {
|
||||||
if (t.getAnnotation(SqlMapper.class) == null) {
|
if (t.getAnnotation(SqlMapper.class) == null) {
|
||||||
throw new BindingException("can not find SqlMapper annotation!");
|
throw new BindingException("can not find SqlMapper annotation!");
|
||||||
}
|
}
|
||||||
return recordsetUtil.getRsManager().rollback(t.getName());
|
return recordsetTransUtil.getRsManager().rollback(t.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3537,4 +3538,48 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
return pathParamMap;
|
return pathParamMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Object executeActionProcess(String process, RequestInfo requestInfo) {
|
||||||
|
if (StringUtils.isNullOrEmpty(process)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
RequestManager requestManager = requestInfo.getRequestManager();
|
||||||
|
String billTable = requestManager.getBillTableName();
|
||||||
|
String requestId = requestInfo.getRequestid();
|
||||||
|
User user = requestInfo.getRequestManager().getUser();
|
||||||
|
int workflowId = requestManager.getWorkflowid();
|
||||||
|
// 操作类型 submit - 提交 reject - 退回 等
|
||||||
|
String src = requestManager.getSrc();
|
||||||
|
if ("".equals(billTable)) {
|
||||||
|
WorkflowComInfo workflowComInfo = new WorkflowComInfo();
|
||||||
|
String formId = workflowComInfo.getFormId(String.valueOf(workflowId));
|
||||||
|
WorkflowBillComInfo workflowBillComInfo = new WorkflowBillComInfo();
|
||||||
|
billTable = workflowBillComInfo.getTablename(formId);
|
||||||
|
}
|
||||||
|
Class<SafeCusActionProcessInterface> clazz = SafeCusActionProcessInterface.class;
|
||||||
|
Class<?> aClass;
|
||||||
|
try {
|
||||||
|
aClass = Class.forName(process);
|
||||||
|
} catch (ClassNotFoundException e) {
|
||||||
|
throw new IllegalArgumentException("未能找到自定义接口:" + process);
|
||||||
|
}
|
||||||
|
if (!clazz.isAssignableFrom(aClass)) {
|
||||||
|
throw new IllegalArgumentException("自定义接口:" + process + " 不是"
|
||||||
|
+ clazz.getName() + "的子类或实现类!");
|
||||||
|
}
|
||||||
|
Constructor<?> constructor;
|
||||||
|
try {
|
||||||
|
constructor = aClass.getConstructor();
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new IllegalArgumentException(process + "没有空参构造方法,无法获取构造方法对象!");
|
||||||
|
}
|
||||||
|
SafeCusActionProcessInterface o;
|
||||||
|
try {
|
||||||
|
o = (SafeCusActionProcessInterface) constructor.newInstance();
|
||||||
|
} catch (InstantiationException | IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new IllegalArgumentException("无法构造" + process + "对象!");
|
||||||
|
}
|
||||||
|
Map<String, String> pathParam = Util.parseCusInterfacePathParam(process);
|
||||||
|
return o.execute(pathParam, requestId, billTable, workflowId, user, requestInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import weaver.interfaces.schedule.BaseCronJob;
|
||||||
public abstract class CusBaseCronJob extends BaseCronJob {
|
public abstract class CusBaseCronJob extends BaseCronJob {
|
||||||
|
|
||||||
|
|
||||||
Logger log = Util.getLogger();
|
protected Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,8 +39,7 @@ public abstract class CusBaseCronJob extends BaseCronJob {
|
||||||
* <i>2022/12/4 13:59</i>
|
* <i>2022/12/4 13:59</i>
|
||||||
* ******************************************
|
* ******************************************
|
||||||
*
|
*
|
||||||
* @author youHong.ai
|
* @author youHong.ai ******************************************
|
||||||
* ******************************************
|
|
||||||
*/
|
*/
|
||||||
public abstract void runCode();
|
public abstract void runCode();
|
||||||
|
|
||||||
|
@ -51,8 +50,7 @@ public abstract class CusBaseCronJob extends BaseCronJob {
|
||||||
* ******************************************
|
* ******************************************
|
||||||
*
|
*
|
||||||
* @param e 异常类
|
* @param e 异常类
|
||||||
* @author youHong.ai
|
* @author youHong.ai ******************************************
|
||||||
* ******************************************
|
|
||||||
*/
|
*/
|
||||||
public void exceptionCallback(Throwable e) {
|
public void exceptionCallback(Throwable e) {
|
||||||
log.error("execute cronJon failure! error detail msg \n" + Util.getErrString(e));
|
log.error("execute cronJon failure! error detail msg \n" + Util.getErrString(e));
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
package aiyh.utils.action;
|
||||||
|
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>流程自定义前置后置处理方法</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-10 13:19</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@FunctionalInterface
|
||||||
|
|
||||||
|
public interface SafeCusActionProcessInterface {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>execute 流程action处理方法</h2>
|
||||||
|
* <i>2023/1/10 13:21</i>
|
||||||
|
* ************************************************************
|
||||||
|
*
|
||||||
|
* @param pathParams 路径参数
|
||||||
|
* @param requestId 流程请求id
|
||||||
|
* @param billTable 流程主表表名
|
||||||
|
* @param workflowId 流程workflowId
|
||||||
|
* @param user 流程当前操作人
|
||||||
|
* @param requestInfo action参数
|
||||||
|
* @return Object 返回值
|
||||||
|
* @author youHong.ai ******************************************
|
||||||
|
*/
|
||||||
|
|
||||||
|
Object execute(Map<String, String> pathParams, String requestId, String billTable, int workflowId,
|
||||||
|
User user, RequestInfo requestInfo);
|
||||||
|
}
|
|
@ -281,8 +281,8 @@ public class HttpUtils {
|
||||||
|
|
||||||
public ResponeVo apiGet(String url, Map<String, Object> params, Map<String, String> headers) throws IOException {
|
public ResponeVo apiGet(String url, Map<String, Object> params, Map<String, String> headers) throws IOException {
|
||||||
Map<String, Object> paramsMap = paramsHandle(params);
|
Map<String, Object> paramsMap = paramsHandle(params);
|
||||||
String getUrl = urlHandle(url, paramsMap);
|
|
||||||
Map<String, String> headerMap = headersHandle(headers);
|
Map<String, String> headerMap = headersHandle(headers);
|
||||||
|
String getUrl = urlHandle(url, paramsMap);
|
||||||
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
HttpGet httpGet = new HttpGet(getUrl.trim());
|
HttpGet httpGet = new HttpGet(getUrl.trim());
|
||||||
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
for (Map.Entry<String, String> entry : headerMap.entrySet()) {
|
||||||
|
@ -409,6 +409,13 @@ public class HttpUtils {
|
||||||
return baseRequest(httpConnection, httpPost);
|
return baseRequest(httpConnection, httpPost);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ResponeVo apiPost(String url, List<Object> params, Map<String, String> headers) throws IOException {
|
||||||
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
|
Map<String, String> headerMap = headersHandle(headers);
|
||||||
|
HttpPost httpPost = handleHttpPost(url, headerMap, params);
|
||||||
|
return baseRequest(httpConnection, httpPost);
|
||||||
|
}
|
||||||
|
|
||||||
public ResponeVo apiPostObject(String url, Object params, Map<String, String> headers) throws IOException {
|
public ResponeVo apiPostObject(String url, Object params, Map<String, String> headers) throws IOException {
|
||||||
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url, this.credentialsProvider);
|
||||||
Map<String, String> headerMap = headersHandle(headers);
|
Map<String, String> headerMap = headersHandle(headers);
|
||||||
|
@ -1031,6 +1038,10 @@ public class HttpUtils {
|
||||||
return handleHttpPostObject(url, headerMap, paramsMap);
|
return handleHttpPostObject(url, headerMap, paramsMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HttpPost handleHttpPost(String url, Map<String, String> headerMap, List<Object> params) throws UnsupportedEncodingException {
|
||||||
|
return handleHttpPostObject(url, headerMap, params);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>上传文件</h2>
|
* <h2>上传文件</h2>
|
||||||
*
|
*
|
||||||
|
|
|
@ -22,7 +22,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class RsThreadLocalManager {
|
public class RsThreadLocalManager {
|
||||||
|
|
||||||
private final ConcurrentHashMap<Long, Map<String, RsThreadLocalMap>> rsMap = new ConcurrentHashMap<>();
|
private static final ConcurrentHashMap<Long, Map<String, RsThreadLocalMap>> rsMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
|
private final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.api.youhong.ai.pcn.mode.apadefaultyear.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.api.youhong.ai.pcn.mode.apadefaultyear.service.DefaultQueryYearService;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import javax.ws.rs.Consumes;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>查询默认的apa年份过滤默认年</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-05 14:54</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Path("ayh/mode/default-year")
|
||||||
|
public class DefaultQueryYearController {
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
private final DefaultQueryYearService service = new DefaultQueryYearService();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>getYear 获取默认的搜索年份</h2>
|
||||||
|
* <i>2023/1/5 15:09</i>
|
||||||
|
* ************************************************************
|
||||||
|
*
|
||||||
|
* @return String 年份响应数据
|
||||||
|
* @author youHong.ai ******************************************
|
||||||
|
*/
|
||||||
|
@Path("/get-year")
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String getYear() {
|
||||||
|
try {
|
||||||
|
return ApiResult.success(service.getYear());
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("get default year error! exception msg is: \n" + Util.getErrString(e));
|
||||||
|
return ApiResult.error(e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.api.youhong.ai.pcn.mode.apadefaultyear.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>查询数据库数据</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-05 15:04</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SqlMapper
|
||||||
|
public interface DefaultQueryYearMapper {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>selectYearById 通过数据ID查询对应年份</h2>
|
||||||
|
* <i>2023/1/5 15:08</i>
|
||||||
|
* ************************************************************
|
||||||
|
*
|
||||||
|
* @param id 数据id
|
||||||
|
* @return String 对应年份
|
||||||
|
* @author youHong.ai ******************************************
|
||||||
|
*/
|
||||||
|
@Select("select nf from uf_hrfunction where id = #{id}")
|
||||||
|
String selectYearById(Integer id);
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
package com.api.youhong.ai.pcn.mode.apadefaultyear.service;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import cn.hutool.core.lang.Assert;
|
||||||
|
import com.api.youhong.ai.pcn.mode.apadefaultyear.mapper.DefaultQueryYearMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取年份</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-05 15:02</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DefaultQueryYearService {
|
||||||
|
|
||||||
|
|
||||||
|
private final DefaultQueryYearMapper mapper = Util.getMapper(DefaultQueryYearMapper.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>getYear 查询默认搜索年份</h2>
|
||||||
|
* <i>2023/1/5 15:06</i>
|
||||||
|
* ************************************************************
|
||||||
|
*
|
||||||
|
* @return String 默认搜索年份
|
||||||
|
* @author youHong.ai ******************************************
|
||||||
|
*/
|
||||||
|
public String getYear() {
|
||||||
|
String year = mapper.selectYearById(1);
|
||||||
|
Assert.notBlank(year, "query year is null or blank!");
|
||||||
|
return year;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package weaver.youhong.ai.pcn.schedule.addrolebyhasundering;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.CusBaseCronJob;
|
||||||
|
import aiyh.utils.annotation.ActionDefaultTestValue;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.engine.hrm.service.impl.RolesMembersServiceImpl;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.youhong.ai.pcn.schedule.addrolebyhasundering.mapper.RegisterRoleMemberByHasUnderingCronJobMapper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将有下属的用户添加到指定的角色</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-10 15:20</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@ActionDesc(author = "youHong.ai", value = "将有下属的用户添加到指定的角色")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class RegisterRoleMemberByHasUnderingCronJob extends CusBaseCronJob {
|
||||||
|
|
||||||
|
private final RegisterRoleMemberByHasUnderingCronJobMapper mapper = Util.getMapper(RegisterRoleMemberByHasUnderingCronJobMapper.class);
|
||||||
|
|
||||||
|
@RequiredMark("角色id")
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionDefaultTestValue("2")
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCode() {
|
||||||
|
List<Integer> resourcesIds = mapper.selectResources();
|
||||||
|
if (Objects.isNull(resourcesIds) || resourcesIds.isEmpty()) {
|
||||||
|
log.info(Util.logStr("can not query resourceIds"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = new User(1);
|
||||||
|
RolesMembersServiceImpl service = ServiceUtil.getService(RolesMembersServiceImpl.class, user);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("roleId", roleId);
|
||||||
|
map.put("resourcetype", 1);
|
||||||
|
map.put("resourceid", Util.intJoin(resourcesIds, ","));
|
||||||
|
map.put("rolelevel", 2);
|
||||||
|
map.put("cmd", "addRolesMembers");
|
||||||
|
Map<String, Object> result = service.saveRolesMembers(map, user);
|
||||||
|
String status = Util.null2String(result.get("status"));
|
||||||
|
if (!"1".equals(status)) {
|
||||||
|
log.error(Util.logStr("add roles members fail!, service params is [{}],service return result is [{}]",
|
||||||
|
JSON.toJSONString(map),
|
||||||
|
JSON.toJSONString(result)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package weaver.youhong.ai.pcn.schedule.addrolebyhasundering.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>添加人力资源人员到角色成员中</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-04 15:07</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SqlMapper
|
||||||
|
public interface RegisterRoleMemberByHasUnderingCronJobMapper {
|
||||||
|
|
||||||
|
|
||||||
|
@Select("select MANAGERID " +
|
||||||
|
"from hrmresource where MANAGERID <> 0 and MANAGERID is not null group by MANAGERID")
|
||||||
|
List<Integer> selectResources();
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
package weaver.youhong.ai.pcn.schedule.addrolemember;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.action.CusBaseCronJob;
|
||||||
|
import aiyh.utils.annotation.ActionDefaultTestValue;
|
||||||
|
import aiyh.utils.annotation.ActionDesc;
|
||||||
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.engine.hrm.service.impl.RolesMembersServiceImpl;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.youhong.ai.pcn.schedule.addrolemember.mapper.RegisterRoleMemberMapper;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>添加指定条件的人力资源人员到角色成员中</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-04 14:58</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@ActionDesc(author = "youHong.ai", value = "添加指定条件的人力资源人员到角色成员中")
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class RegisterRoleMemberCronJob extends CusBaseCronJob {
|
||||||
|
|
||||||
|
private final RegisterRoleMemberMapper mapper = Util.getMapper(RegisterRoleMemberMapper.class);
|
||||||
|
|
||||||
|
@RequiredMark("职级字段的字段名称")
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionDefaultTestValue("field3")
|
||||||
|
private String rankField;
|
||||||
|
|
||||||
|
@RequiredMark("角色id")
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionDefaultTestValue("2")
|
||||||
|
private String roleId;
|
||||||
|
|
||||||
|
@RequiredMark("对应职级id,多个id用','分割,如7,8")
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionDefaultTestValue("7,8")
|
||||||
|
private String rankIds;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void runCode() {
|
||||||
|
List<Integer> resourcesIds = mapper.selectResources(rankField, rankIds);
|
||||||
|
if (Objects.isNull(resourcesIds) || resourcesIds.isEmpty()) {
|
||||||
|
log.info(Util.logStr("can not query resourceIds by [{}] in [{}]", rankField, rankIds));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
User user = new User(1);
|
||||||
|
RolesMembersServiceImpl service = ServiceUtil.getService(RolesMembersServiceImpl.class, user);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("roleId", roleId);
|
||||||
|
map.put("resourcetype", 1);
|
||||||
|
map.put("resourceid", Util.intJoin(resourcesIds, ","));
|
||||||
|
map.put("rolelevel", 2);
|
||||||
|
map.put("cmd", "addRolesMembers");
|
||||||
|
Map<String, Object> result = service.saveRolesMembers(map, user);
|
||||||
|
String status = Util.null2String(result.get("status"));
|
||||||
|
if (!"1".equals(status)) {
|
||||||
|
log.error(Util.logStr("add roles members fail!, service params is [{}],service return result is [{}]",
|
||||||
|
JSON.toJSONString(map),
|
||||||
|
JSON.toJSONString(result)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package weaver.youhong.ai.pcn.schedule.addrolemember.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>添加人力资源人员到角色成员中</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-04 15:07</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SqlMapper
|
||||||
|
public interface RegisterRoleMemberMapper {
|
||||||
|
|
||||||
|
@Select(
|
||||||
|
"select hrm.id\n " +
|
||||||
|
"from hrmresource hrm \n " +
|
||||||
|
" inner join cus_fielddata cus \n " +
|
||||||
|
" on cus.ID = hrm.ID \n " +
|
||||||
|
" and cus.SCOPEID = 1 \n " +
|
||||||
|
" and cus.SCOPE = 'HrmCustomFieldByInfoType' \n" +
|
||||||
|
" and cus.$t{rankField} in ($t{rankIds})"
|
||||||
|
)
|
||||||
|
List<Integer> selectResources(@ParamMapper("rankField") String rankField,
|
||||||
|
@ParamMapper("rankIds") String rankIds);
|
||||||
|
}
|
|
@ -0,0 +1,61 @@
|
||||||
|
package youhong.ai.pcn;
|
||||||
|
|
||||||
|
import aiyh.utils.GenerateFileUtil;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import basetest.BaseTest;
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.engine.hrm.service.impl.RolesMembersServiceImpl;
|
||||||
|
import org.junit.Test;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.youhong.ai.pcn.schedule.addrolebyhasundering.RegisterRoleMemberByHasUnderingCronJob;
|
||||||
|
import weaver.youhong.ai.pcn.schedule.addrolemember.RegisterRoleMemberCronJob;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-01-04 13:38</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class RolesTest extends BaseTest {
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
User user = new User(1);
|
||||||
|
RolesMembersServiceImpl service = ServiceUtil.getService(RolesMembersServiceImpl.class, user);
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("roleId", 2);
|
||||||
|
map.put("resourcetype", 1);
|
||||||
|
map.put("resourceid", 90);
|
||||||
|
map.put("rolelevel", 2);
|
||||||
|
map.put("cmd", "addRolesMembers");
|
||||||
|
Map<String, Object> stringObjectMap = service.saveRolesMembers(map, user);
|
||||||
|
System.out.println(stringObjectMap);
|
||||||
|
/* String sql = " INSERT INTO HrmRoleMembers ( roleid ,resourceid ,rolelevel ,resourcetype ,alllevel ," +
|
||||||
|
" seclevelfrom ,seclevelto ,subdepid ,jobtitlelevel) " +
|
||||||
|
" VALUES ( " + roleId + ", " + arrObjIds[i] + " , '" + rolelevel + "', '" + resourcetype + "', " +
|
||||||
|
" " + (alllevel.length() == 0 ? "null" : alllevel) + "," +
|
||||||
|
(seclevelfrom.length() == 0 ? "null" : seclevelfrom) + "," +
|
||||||
|
" " + (seclevelto.length() == 0 ? "null" : seclevelto) + ", " +
|
||||||
|
(subdepid.length() == 0 ? "null" : "'" + subdepid + "'") + "," +
|
||||||
|
(jobtitlelevel.length() == 0 ? "null" : jobtitlelevel) + ")";*/
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCronJob() {
|
||||||
|
Util.cronJobTest(RegisterRoleMemberCronJob.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void generateDoc() {
|
||||||
|
GenerateFileUtil.createCronJobDocument(RegisterRoleMemberByHasUnderingCronJob.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue