Merge branch 'dev' of https://gitea.yeyaguitu.cn/ecology/ebu_ecology_dev1 into dev
commit
2ce07ae713
|
@ -159,13 +159,13 @@ logPath=/Users/aoey.oct.22/company/Fan_wei/code/idea/ecology9-project/log
|
||||||
lib/classbeanLib/下的jar包对应ecology/classbean下的class文件,具体更换方式需要先进入到ecology/classbean目录中,打开终端(处于当前ecology/classbean目录中),执行一下代码
|
lib/classbeanLib/下的jar包对应ecology/classbean下的class文件,具体更换方式需要先进入到ecology/classbean目录中,打开终端(处于当前ecology/classbean目录中),执行一下代码
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
jar -cvf ecology-dev-lib.jar com DBstep weaver
|
jar -cvf ecology-dev-lib.jar getLogFilePath DBstep weaver
|
||||||
```
|
```
|
||||||
|
|
||||||
进入ecology/web-inf/classes执行如下代码
|
进入ecology/web-inf/classes执行如下代码
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
jar -cvf web-inf-class-lib.jar com weaver org
|
jar -cvf web-inf-class-lib.jar getLogFilePath weaver org
|
||||||
```
|
```
|
||||||
|
|
||||||
将生成的jar包替换掉原来的jar包即可
|
将生成的jar包替换掉原来的jar包即可
|
||||||
|
|
|
@ -9,6 +9,42 @@ const WfForm = {
|
||||||
isMobile: () => {
|
isMobile: () => {
|
||||||
// true表示是eMobile、微信、钉钉等移动终端,false代表PC端
|
// true表示是eMobile、微信、钉钉等移动终端,false代表PC端
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* 4.6 函数式自定义渲染表单字段
|
||||||
|
* 最低版本要求:KB900190701
|
||||||
|
*
|
||||||
|
* 以函数返回值方式自定义渲染表单字段,支持全部的字段类型,可实现基于原组件追加/复写/重新布局等等
|
||||||
|
*
|
||||||
|
* 建议结合ecode工具,放到模块加载前调用,使用JSX,可实现与表单字段渲染有关的二次开发
|
||||||
|
*
|
||||||
|
* 此接口的优先级高于4.4、4.5,即使用此接口代理的字段,如再使用4.4、4.5会直接无效
|
||||||
|
*
|
||||||
|
* proxyFieldContentComp: function(fieldid,fn)
|
||||||
|
* @param convertFieldNameToId
|
||||||
|
* @param customerRender
|
||||||
|
*/
|
||||||
|
proxyFieldContentComp(convertFieldNameToId, customerRender = (info, compFn) => {
|
||||||
|
// console.log("字段id:",info.fieldid);
|
||||||
|
// console.log("明细行号:",info.rowIndex);
|
||||||
|
// console.log("字段只读必填属性:",info.viewAttr);
|
||||||
|
// console.log("字段值:",info.fieldValue);
|
||||||
|
// //返回自定义渲染的组件
|
||||||
|
// return React.createElement("div", {}, ["想怎么玩就怎么玩"]);
|
||||||
|
// //返回原组件
|
||||||
|
// return compFn();
|
||||||
|
// //返回基于原组件的复写组件
|
||||||
|
// return React.createElement("div", {}, ["前置组件",compFn(),"后置组件"]);
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* //如果此接口调用在代码块、custompage等(非模块加载前调用),需强制渲染字段一次
|
||||||
|
* WfForm.forceRenderField("field111");
|
||||||
|
* @param field
|
||||||
|
*/
|
||||||
|
forceRenderField(field) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
WfForm.OPER_SAVE = '保存'
|
WfForm.OPER_SAVE = '保存'
|
||||||
WfForm.OPER_SUBMIT = '提交/批准/提交需反馈/不需反馈等'
|
WfForm.OPER_SUBMIT = '提交/批准/提交需反馈/不需反馈等'
|
||||||
|
|
|
@ -59,7 +59,7 @@ function initTimeoutDate(){
|
||||||
console.log('计算下次超时日期 ', computeTimeoutDate);
|
console.log('计算下次超时日期 ', computeTimeoutDate);
|
||||||
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
var trackingLine = parseInt(WfForm.getFieldValue(trackingLineField));
|
||||||
var detail2LineNum = WfForm.getDetailRowCount("detail_2");
|
var detail2LineNum = WfForm.getDetailRowCount("detail_2");
|
||||||
setTimeout(()=>{
|
setTimeout(function (){
|
||||||
WfForm.changeFieldValue(timeoutRemindDateFiled, {value: computeTimeoutDate});
|
WfForm.changeFieldValue(timeoutRemindDateFiled, {value: computeTimeoutDate});
|
||||||
// 判断流程提交走向
|
// 判断流程提交走向
|
||||||
console.log('主表跟踪触发行数 : ', trackingLine)
|
console.log('主表跟踪触发行数 : ', trackingLine)
|
||||||
|
@ -101,7 +101,10 @@ function getCurrentDate() {
|
||||||
|
|
||||||
function parseDate(date) {
|
function parseDate(date) {
|
||||||
var currentYear = date.getFullYear();
|
var currentYear = date.getFullYear();
|
||||||
var currentMonth = date.getMonth() + 1; // getMonth()返回0~11,需要加1
|
var currentMonth = date.getMonth() + 1;// getMonth()返回0~11,需要加1
|
||||||
|
if(currentMonth < 10){
|
||||||
|
currentMonth = '0' + currentMonth;
|
||||||
|
}
|
||||||
var currentDay = date.getDate();
|
var currentDay = date.getDate();
|
||||||
return currentYear + '-' + currentMonth + '-' + currentDay;
|
return currentYear + '-' + currentMonth + '-' + currentDay;
|
||||||
}
|
}
|
||||||
|
|
|
@ -787,4 +787,126 @@ $(() => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
/* ******************* 年假计算 end ******************* */
|
/* ******************* 年假计算 end ******************* */
|
||||||
|
|
||||||
|
|
||||||
|
/* ******************* youhong.ai 明细字段合并主表,序号内容换行展示 start ******************* */
|
||||||
|
$(() => {
|
||||||
|
const config = {
|
||||||
|
// 明细表
|
||||||
|
detail: 'detail_3',
|
||||||
|
// 明细字段
|
||||||
|
detailField: 'jbxxnr',
|
||||||
|
// 主表字段
|
||||||
|
mainField: 'jbxxnr'
|
||||||
|
}
|
||||||
|
|
||||||
|
function runJs() {
|
||||||
|
let rowIndexStr = WfForm.getDetailAllRowIndexStr(config.detail);
|
||||||
|
let rowIndexArr = rowIndexStr.split(",");
|
||||||
|
let value = ""
|
||||||
|
rowIndexArr.forEach(item => {
|
||||||
|
let fieldId = WfForm.convertFieldNameToId(config.detailField, config.detail) + "_" + item
|
||||||
|
let fieldValue = WfForm.getFieldValue(fieldId);
|
||||||
|
value += (+item + 1) + "、" + fieldValue + "\n";
|
||||||
|
})
|
||||||
|
WfForm.changeFieldValue(WfForm.convertFieldNameToId(config.mainField), {value})
|
||||||
|
}
|
||||||
|
|
||||||
|
WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, (callback) => {
|
||||||
|
runJs()
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
|
||||||
|
})
|
||||||
|
/* ******************* youhong.ai 明细字段合并主表,序号内容换行展示 end ******************* */
|
||||||
|
|
||||||
|
|
||||||
|
/* ******************* youhong.ai 取明细行中最早时间的一行,将数据放到主表 start ******************* */
|
||||||
|
$(() => {
|
||||||
|
const config = {
|
||||||
|
// 明细表
|
||||||
|
detail: 'detail_1',
|
||||||
|
// 映射关系
|
||||||
|
mapping: [{
|
||||||
|
// 明细表字段
|
||||||
|
detailField: 'jbsj',
|
||||||
|
// 主表字段
|
||||||
|
mainField: 'zzjsrq',
|
||||||
|
}, {
|
||||||
|
// 明细表字段
|
||||||
|
detailField: 'jbtd',
|
||||||
|
// 主表字段
|
||||||
|
mainField: 'jbqd',
|
||||||
|
}],
|
||||||
|
dateSort: 'jbsj'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function runJs() {
|
||||||
|
let rowIndexStr = WfForm.getDetailAllRowIndexStr(config.detail);
|
||||||
|
let rowIndexArray = rowIndexStr.split(",");
|
||||||
|
const detailData = []
|
||||||
|
rowIndexArray.forEach(item => {
|
||||||
|
let obj = {}
|
||||||
|
config.mapping.forEach(mapping => {
|
||||||
|
obj[mapping.detailField] = WfForm.getFieldValue(WfForm.convertFieldNameToId(mapping.detailField, config.detail) + "_" + item)
|
||||||
|
})
|
||||||
|
detailData.push(obj)
|
||||||
|
})
|
||||||
|
console.log(detailData)
|
||||||
|
let minDateObj = filterByMinDate(detailData, config.dateSort);
|
||||||
|
console.log(minDateObj)
|
||||||
|
config.mapping.forEach(item => {
|
||||||
|
WfForm.changeFieldValue(WfForm.convertFieldNameToId(item.mainField), {
|
||||||
|
value: minDateObj[item.detailField]
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
function filterByMinDate(arr, key) {
|
||||||
|
return arr.reduce((min, obj) => {
|
||||||
|
if (!min || new Date(obj[key]) <= new Date(min[key])) {
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
return min;
|
||||||
|
}, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, (callback) => {
|
||||||
|
runJs()
|
||||||
|
callback()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
/* ******************* youhong.ai 取明细行中最早时间的一行,将数据放到主表 end ******************* */
|
||||||
|
|
||||||
|
/* ******************* youhong.ai 主表选择框自定义渲染为进度条 start ******************* */
|
||||||
|
$(() => {
|
||||||
|
const field = 'jz'
|
||||||
|
const config = {
|
||||||
|
'-1': 0,
|
||||||
|
'0': 20,
|
||||||
|
'1': 40,
|
||||||
|
'2': 60,
|
||||||
|
'3': 80,
|
||||||
|
'4': 100,
|
||||||
|
}
|
||||||
|
|
||||||
|
function customerRender(info, compFn) {
|
||||||
|
let fieldValue = info.fieldValue;
|
||||||
|
if (!fieldValue) {
|
||||||
|
fieldValue = '-1'
|
||||||
|
}
|
||||||
|
let {WeaProgress} = ecCom
|
||||||
|
return React.createElement(WeaProgress, {
|
||||||
|
strokeColor: '#6c8dc1',
|
||||||
|
percent: config[fieldValue]
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
WfForm.proxyFieldContentComp(WfForm.convertFieldNameToId(field).replace("field", ""), customerRender)
|
||||||
|
setTimeout(() => {
|
||||||
|
WfForm.forceRenderField(WfForm.convertFieldNameToId(field));
|
||||||
|
}, 500)
|
||||||
|
})
|
||||||
|
/* ******************* youhong.ai 主表选择框自定义渲染为进度条 end ******************* */
|
||||||
|
|
|
@ -106,4 +106,122 @@ $(() => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
/* ******************* youhong.ai 流程部分 end ******************* */
|
/* ******************* youhong.ai 流程部分 end ******************* */
|
||||||
|
|
||||||
|
|
||||||
|
/* ******************* youhong.ai 编号验证是否存在 start ******************* */
|
||||||
|
$(() => {
|
||||||
|
const config = {
|
||||||
|
ecId: '',
|
||||||
|
tableName: '',
|
||||||
|
field: 'fwbh',
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author youhong.ai
|
||||||
|
* @desc 发起请求
|
||||||
|
*/
|
||||||
|
function api(requestOptions = {
|
||||||
|
url: "",
|
||||||
|
type: "GET",
|
||||||
|
data: "",
|
||||||
|
isAsync: true,
|
||||||
|
success: () => {
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
},
|
||||||
|
contentType: 'application/json',
|
||||||
|
beforeSend: () => {
|
||||||
|
}
|
||||||
|
}) {
|
||||||
|
let options = Object.assign({
|
||||||
|
url: "",
|
||||||
|
type: "GET",
|
||||||
|
data: "",
|
||||||
|
isAsync: true,
|
||||||
|
success: () => {
|
||||||
|
},
|
||||||
|
error: () => {
|
||||||
|
},
|
||||||
|
complete: () => {
|
||||||
|
},
|
||||||
|
contentType: 'application/json',
|
||||||
|
beforeSend: () => {
|
||||||
|
}
|
||||||
|
}, requestOptions)
|
||||||
|
return $.ajax(options)
|
||||||
|
}
|
||||||
|
|
||||||
|
function findReact(dom, traverseUp = 0) {
|
||||||
|
const key = Object.keys(dom).find(key => {
|
||||||
|
return key.startsWith("__reactFiber$") // react 17+
|
||||||
|
|| key.startsWith("__reactInternalInstance$")
|
||||||
|
|| key.startsWith("__reactEventHandlers$"); // react <17
|
||||||
|
});
|
||||||
|
const domFiber = dom[key];
|
||||||
|
if (domFiber == null) return null;
|
||||||
|
// react <16
|
||||||
|
if (domFiber._currentElement) {
|
||||||
|
let compFiber = domFiber._currentElement._owner;
|
||||||
|
for (let i = 0; i < traverseUp; i++) {
|
||||||
|
compFiber = compFiber._currentElement._owner;
|
||||||
|
}
|
||||||
|
return compFiber._instance;
|
||||||
|
}
|
||||||
|
// react 16+
|
||||||
|
const GetCompFiber = fiber => {
|
||||||
|
let parentFiber = fiber.return;
|
||||||
|
while (typeof parentFiber.type == "string") {
|
||||||
|
parentFiber = parentFiber.return;
|
||||||
|
}
|
||||||
|
return parentFiber;
|
||||||
|
};
|
||||||
|
let compFiber = GetCompFiber(domFiber);
|
||||||
|
for (let i = 0; i < traverseUp; i++) {
|
||||||
|
compFiber = GetCompFiber(compFiber);
|
||||||
|
}
|
||||||
|
return compFiber.stateNode;
|
||||||
|
}
|
||||||
|
|
||||||
|
function runJs() {
|
||||||
|
let node = findReact($(`button[ecid='${config.ecId}']`)[0])
|
||||||
|
let baseInfo = WfForm.getBaseInfo();
|
||||||
|
baseInfo.workflowid
|
||||||
|
if (baseInfo.requestid == -1) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (node) {
|
||||||
|
let click = node.props.onClick;
|
||||||
|
node.props.onClick = (e) => {
|
||||||
|
api({
|
||||||
|
url: `/api/aiyh/taibao/bh/check-number?tableName=${config.tableName}&field=${config.field}&requestId=${baseInfo.requestid}`,
|
||||||
|
success(res) {
|
||||||
|
if (res && res.code == 200) {
|
||||||
|
if (res.data) {
|
||||||
|
// 存在编号,提示是否需要编号
|
||||||
|
WfForm.showConfirm("编号一存在,是否重新编号?", function () {
|
||||||
|
click(e)
|
||||||
|
}, function () {
|
||||||
|
// 不重新编号,刷新
|
||||||
|
window.location.reload()
|
||||||
|
}, {
|
||||||
|
title: "编号确认", //弹确认框的title,仅PC端有效
|
||||||
|
okText: "确认", //自定义确认按钮名称
|
||||||
|
cancelText: "取消" //自定义取消按钮名称
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
click(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
runJs()
|
||||||
|
})
|
||||||
|
/* ******************* youhong.ai 编号验证是否存在 end ******************* */
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -85,10 +85,11 @@ public class GenerateFileUtil {
|
||||||
if (hasRequired) {
|
if (hasRequired) {
|
||||||
// 必填参数
|
// 必填参数
|
||||||
RequiredMark requiredMark = declaredField.getAnnotation(RequiredMark.class);
|
RequiredMark requiredMark = declaredField.getAnnotation(RequiredMark.class);
|
||||||
String fieldDesc = requiredMark.value();
|
String fieldDesc = requiredMark.desc();
|
||||||
Map<String, String> param = new HashMap<>();
|
Map<String, String> param = new HashMap<>(8);
|
||||||
param.put("name", name);
|
param.put("name", name);
|
||||||
param.put("desc", fieldDesc);
|
param.put("desc", fieldDesc);
|
||||||
|
param.put("example", requiredMark.value());
|
||||||
param.put("isRequired", "是");
|
param.put("isRequired", "是");
|
||||||
boolean hasDefaultTestValue = declaredField.isAnnotationPresent(ActionDefaultTestValue.class);
|
boolean hasDefaultTestValue = declaredField.isAnnotationPresent(ActionDefaultTestValue.class);
|
||||||
if (hasDefaultTestValue) {
|
if (hasDefaultTestValue) {
|
||||||
|
@ -105,9 +106,10 @@ public class GenerateFileUtil {
|
||||||
ActionOptionalParam actionOptionalParam = declaredField.getAnnotation(ActionOptionalParam.class);
|
ActionOptionalParam actionOptionalParam = declaredField.getAnnotation(ActionOptionalParam.class);
|
||||||
String fieldDesc = actionOptionalParam.desc();
|
String fieldDesc = actionOptionalParam.desc();
|
||||||
String defaultValue = actionOptionalParam.value();
|
String defaultValue = actionOptionalParam.value();
|
||||||
Map<String, String> param = new HashMap<>();
|
Map<String, String> param = new HashMap<>(8);
|
||||||
param.put("name", name);
|
param.put("name", name);
|
||||||
param.put("desc", fieldDesc);
|
param.put("desc", fieldDesc);
|
||||||
|
param.put("example", defaultValue);
|
||||||
param.put("isRequired", "否");
|
param.put("isRequired", "否");
|
||||||
param.put("defaultValue", defaultValue);
|
param.put("defaultValue", defaultValue);
|
||||||
paramList.add(param);
|
paramList.add(param);
|
||||||
|
|
|
@ -12,14 +12,14 @@ import java.util.Map;
|
||||||
* @author youHong.ai
|
* @author youHong.ai
|
||||||
*/
|
*/
|
||||||
public class ScriptUtil {
|
public class ScriptUtil {
|
||||||
private static final JexlEngine jexl = new JexlBuilder().create();
|
private static final JexlEngine JEXL = new JexlBuilder().create();
|
||||||
|
|
||||||
public static Object invokeScript(String script, Map<String, Object> params) {
|
public static Object invokeScript(String script, Map<String, Object> params) {
|
||||||
JexlContext jc = new MapContext();
|
JexlContext jc = new MapContext();
|
||||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||||
jc.set(entry.getKey(), entry.getValue());
|
jc.set(entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
JexlExpression expression = jexl.createExpression(script);
|
JexlExpression expression = JEXL.createExpression(script);
|
||||||
return expression.evaluate(jc);
|
return expression.evaluate(jc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -244,7 +244,7 @@ public class Util extends weaver.general.Util {
|
||||||
str = str.substring(0, str.length() - 1);
|
str = str.substring(0, str.length() - 1);
|
||||||
}
|
}
|
||||||
if (str.trim().startsWith(removeSeparator)) {
|
if (str.trim().startsWith(removeSeparator)) {
|
||||||
str = str.substring(1);
|
str = str.substring(removeSeparator.length());
|
||||||
}
|
}
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
@ -1210,9 +1210,15 @@ public class Util extends weaver.general.Util {
|
||||||
Properties prop = new Properties();
|
Properties prop = new Properties();
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
InputStream inputStream = null;
|
InputStream inputStream = null;
|
||||||
|
InputStreamReader reader = null;
|
||||||
try {
|
try {
|
||||||
inputStream = new BufferedInputStream(new FileInputStream(path));
|
inputStream = new BufferedInputStream(new FileInputStream(path));
|
||||||
prop.load(inputStream);
|
/**
|
||||||
|
* <h2>解决配置文件中 值包含中文乱码问题</h2>
|
||||||
|
* <h2>xuanran.wang 2023-06-26 10:16</h2>
|
||||||
|
**/
|
||||||
|
reader = new InputStreamReader(inputStream, StandardCharsets.UTF_8);
|
||||||
|
prop.load(reader);
|
||||||
Enumeration<?> enumeration = prop.propertyNames();
|
Enumeration<?> enumeration = prop.propertyNames();
|
||||||
while (enumeration.hasMoreElements()) {
|
while (enumeration.hasMoreElements()) {
|
||||||
String key = String.valueOf(enumeration.nextElement());
|
String key = String.valueOf(enumeration.nextElement());
|
||||||
|
@ -1222,6 +1228,9 @@ public class Util extends weaver.general.Util {
|
||||||
throw new RuntimeException("找不到文件:" + path);
|
throw new RuntimeException("找不到文件:" + path);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
}
|
}
|
||||||
|
@ -3025,6 +3034,10 @@ public class Util extends weaver.general.Util {
|
||||||
return mapper.selectDocImageInfo(docId);
|
return mapper.selectDocImageInfo(docId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DocImageInfo selectImageInfoByImageId(String imageFileId) {
|
||||||
|
return mapper.selectImageInfoByImageId(imageFileId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文档信息
|
* 查询文档信息
|
||||||
*
|
*
|
||||||
|
@ -3578,15 +3591,99 @@ public class Util extends weaver.general.Util {
|
||||||
String field = matcher.group("field");
|
String field = matcher.group("field");
|
||||||
String otherKeyStr = matcher.group("other");
|
String otherKeyStr = matcher.group("other");
|
||||||
Object o = valueHandler(arg, field);
|
Object o = valueHandler(arg, field);
|
||||||
|
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
throw new CustomerException(Util.logStr("can not get value of [{}] from [{}], this keyStr is [{}]",
|
throw new CustomerException(Util.logStr("can not get value of [{}] from [{}], this keyStr is [{}]",
|
||||||
field, JSON.toJSONString(arg), keyStr));
|
field, JSON.toJSONString(arg), keyStr));
|
||||||
}
|
}
|
||||||
|
if (o instanceof Collection) {
|
||||||
|
return new CustomerException("can not supper array value!");
|
||||||
|
}
|
||||||
return getValueByKeyStr(otherKeyStr, o);
|
return getValueByKeyStr(otherKeyStr, o);
|
||||||
}
|
}
|
||||||
throw new CustomerException("Unable to find value of key [" + keyStr + "]");
|
throw new CustomerException("Unable to find value of key [" + keyStr + "]");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>通过keyStr获取value</h2>
|
||||||
|
*
|
||||||
|
* @param keyStr keyString
|
||||||
|
* @param arg map对象
|
||||||
|
* @return value
|
||||||
|
*/
|
||||||
|
public static ValueOrList getValueOrListByKeyStr(String keyStr, Object arg) {
|
||||||
|
if (arg == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!keyStr.contains(".")) {
|
||||||
|
Object o = valueHandler(arg, keyStr);
|
||||||
|
ValueOrList valueOrList = new ValueOrList();
|
||||||
|
valueOrList.setValue(o);
|
||||||
|
valueOrList.setKey(keyStr);
|
||||||
|
return valueOrList;
|
||||||
|
}
|
||||||
|
String pattern = "(?<field>^[\\w]+[\\w$]*)\\.*(?<other>(\\S+)*)";
|
||||||
|
Pattern compile = Pattern.compile(pattern);
|
||||||
|
Matcher matcher = compile.matcher(keyStr);
|
||||||
|
if (matcher.find()) {
|
||||||
|
String field = matcher.group("field");
|
||||||
|
String otherKeyStr = matcher.group("other");
|
||||||
|
Object o = valueHandler(arg, field);
|
||||||
|
if (null == o) {
|
||||||
|
throw new CustomerException(Util.logStr("can not get value of [{}] from [{}], this keyStr is [{}]",
|
||||||
|
field, JSON.toJSONString(arg), keyStr));
|
||||||
|
}
|
||||||
|
if (o instanceof Collection) {
|
||||||
|
ValueOrList valueOrList = new ValueOrList();
|
||||||
|
valueOrList.setValue(o);
|
||||||
|
valueOrList.setArray(true);
|
||||||
|
valueOrList.setKey(field);
|
||||||
|
return valueOrList;
|
||||||
|
}
|
||||||
|
return getValueOrListByKeyStr(otherKeyStr, o);
|
||||||
|
}
|
||||||
|
throw new CustomerException("Unable to find value of key [" + keyStr + "]");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class ValueOrList {
|
||||||
|
private String key;
|
||||||
|
private boolean isArray;
|
||||||
|
private Object value;
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isArray() {
|
||||||
|
return isArray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArray(boolean array) {
|
||||||
|
isArray = array;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(Object value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "ValueOrList{" +
|
||||||
|
"key='" + key + '\'' +
|
||||||
|
", isArray=" + isArray +
|
||||||
|
", value=" + value +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>获取value</h2>
|
* <h2>获取value</h2>
|
||||||
*
|
*
|
||||||
|
@ -3970,4 +4067,6 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -200,6 +200,7 @@ public abstract class SafeCusBaseAction implements Action {
|
||||||
String billTable = requestManager.getBillTableName();
|
String billTable = requestManager.getBillTableName();
|
||||||
String id = mapper.selectIdByRequest(billTable, requestInfo.getRequestid());
|
String id = mapper.selectIdByRequest(billTable, requestInfo.getRequestid());
|
||||||
result.put("id", id);
|
result.put("id", id);
|
||||||
|
result.put("requestid", requestInfo.getRequestid());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,4 +41,18 @@ public class DocImageInfo {
|
||||||
/** 文件类型 */
|
/** 文件类型 */
|
||||||
@SqlOracleDbFieldAnn("DOC_FILE_TYPE")
|
@SqlOracleDbFieldAnn("DOC_FILE_TYPE")
|
||||||
private Integer docFileType;
|
private Integer docFileType;
|
||||||
|
/** 文件路径 */
|
||||||
|
@SqlOracleDbFieldAnn("PATH")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/** 加密code */
|
||||||
|
@SqlOracleDbFieldAnn("AES_CODE")
|
||||||
|
private String aesCode;
|
||||||
|
|
||||||
|
/** 文件token */
|
||||||
|
@SqlOracleDbFieldAnn("TOKEN_KEY")
|
||||||
|
private String tokenKey;
|
||||||
|
/** 缩略图 */
|
||||||
|
@SqlOracleDbFieldAnn("MINI_IMG_PATH")
|
||||||
|
private String miniImgPath;
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,7 @@ public class FieldViewInfo {
|
||||||
@SqlOracleDbFieldAnn("FIELD_HTML_TYPE")
|
@SqlOracleDbFieldAnn("FIELD_HTML_TYPE")
|
||||||
|
|
||||||
private String fieldHtmlType;
|
private String fieldHtmlType;
|
||||||
|
|
||||||
|
|
||||||
|
private Object value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -121,7 +121,7 @@ public class HttpUtils {
|
||||||
return getUrl;
|
return getUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String serializeParams(Map<String, Object> params) {
|
public static String serializeParams(Map<String, Object> params) {
|
||||||
if (params != null && params.size() > 0) {
|
if (params != null && params.size() > 0) {
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||||
|
@ -1113,6 +1113,9 @@ public class HttpUtils {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isBean(Object o) {
|
private boolean isBean(Object o) {
|
||||||
|
if (Objects.isNull(o)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (o instanceof Number) {
|
if (o instanceof Number) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1122,9 +1125,6 @@ public class HttpUtils {
|
||||||
if (o instanceof Boolean) {
|
if (o instanceof Boolean) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (Objects.isNull(o)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return !o.getClass().isPrimitive();
|
return !o.getClass().isPrimitive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,28 +56,34 @@ public interface UtilMapper {
|
||||||
|
|
||||||
|
|
||||||
@Select("select di.id id,dc.id doc_id," +
|
@Select("select di.id id,dc.id doc_id," +
|
||||||
|
"img.FILEREALPATH path,img.AESCODE aes_code,img.TOKENKEY token_key,MINIIMGPATH mini_img_path," +
|
||||||
"di.imagefileid image_file_id," +
|
"di.imagefileid image_file_id," +
|
||||||
"dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," +
|
"dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," +
|
||||||
"(case when imagefilename = '' or imagefilename is null then dc.DOCSUBJECT else imagefilename end) image_file_name " +
|
"(case when di.imagefilename = '' or di.imagefilename is null then dc.DOCSUBJECT else di.imagefilename end) image_file_name " +
|
||||||
"from DocDetail dc " +
|
"from DocDetail dc " +
|
||||||
|
"left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " +
|
||||||
"left join docimagefile di on (dc.id = #{docId} and dc.id = di.docid) " +
|
"left join docimagefile di on (dc.id = #{docId} and dc.id = di.docid) " +
|
||||||
"where dc.id = #{docId} ")
|
"where dc.id = #{docId} ")
|
||||||
DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
|
DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId);
|
||||||
|
|
||||||
@Select("select di.id id,dc.id doc_id," +
|
@Select("select di.id id,dc.id doc_id," +
|
||||||
|
"img.FILEREALPATH path,img.AESCODE aes_code,img.TOKENKEY token_key,MINIIMGPATH mini_img_path," +
|
||||||
"di.imagefileid image_file_id, di.docfiletype doc_file_type," +
|
"di.imagefileid image_file_id, di.docfiletype doc_file_type," +
|
||||||
"dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," +
|
"dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," +
|
||||||
"(case when imagefilename = '' or imagefilename is null then dc.DOCSUBJECT else imagefilename end) image_file_name " +
|
"(case when di.imagefilename = '' or di.imagefilename is null then dc.DOCSUBJECT else di.imagefilename end) image_file_name " +
|
||||||
"from DocDetail dc " +
|
"from DocDetail dc " +
|
||||||
|
"left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " +
|
||||||
"left join docimagefile di on (dc.id in ($t{docIds}) and dc.id = di.docid )" +
|
"left join docimagefile di on (dc.id in ($t{docIds}) and dc.id = di.docid )" +
|
||||||
"where dc.id in ($t{docIds})")
|
"where dc.id in ($t{docIds})")
|
||||||
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String docIds);
|
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String docIds);
|
||||||
|
|
||||||
@Select("select di.id id,dc.id doc_id," +
|
@Select("select di.id id,dc.id doc_id," +
|
||||||
|
"img.FILEREALPATH path,img.AESCODE aes_code,img.TOKENKEY token_key,MINIIMGPATH mini_img_path," +
|
||||||
"di.imagefileid image_file_id, di.docfiletype doc_file_type," +
|
"di.imagefileid image_file_id, di.docfiletype doc_file_type," +
|
||||||
"dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," +
|
"dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," +
|
||||||
"(case when imagefilename = '' or imagefilename is null then dc.DOCSUBJECT else imagefilename end) image_file_name " +
|
"(case when di.imagefilename = '' or di.imagefilename is null then dc.DOCSUBJECT else di.imagefilename end) image_file_name " +
|
||||||
"from DocDetail dc " +
|
"from DocDetail dc " +
|
||||||
|
"left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " +
|
||||||
"left join docimagefile di on (dc.id in ($t{docIds}) and dc.id = di.docid )" +
|
"left join docimagefile di on (dc.id in ($t{docIds}) and dc.id = di.docid )" +
|
||||||
"where dc.id in ($t{docIds})")
|
"where dc.id in ($t{docIds})")
|
||||||
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
|
List<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String[] docIds);
|
||||||
|
@ -197,4 +203,20 @@ public interface UtilMapper {
|
||||||
|
|
||||||
@Select("select id, tablename table_name, indexdesc index_desc from mode_bill_info_view where id = #{id}")
|
@Select("select id, tablename table_name, indexdesc index_desc from mode_bill_info_view where id = #{id}")
|
||||||
ModelTableInfo selectModelTableInfo(Integer id);
|
ModelTableInfo selectModelTableInfo(Integer id);
|
||||||
|
|
||||||
|
@Select("select di.id id,dc.id doc_id, " +
|
||||||
|
"img.FILEREALPATH path,img.AESCODE aes_code,img.TOKENKEY token_key,img.MINIIMGPATH mini_img_path," +
|
||||||
|
" di.imagefileid image_file_id, " +
|
||||||
|
" dc.DOCCREATEDATE doc_create_date, " +
|
||||||
|
" dc.DOCCREATETIME doc_create_time, " +
|
||||||
|
" (case when " +
|
||||||
|
" di.imagefilename = '' or di.imagefilename is null " +
|
||||||
|
" then dc.DOCSUBJECT " +
|
||||||
|
" else di.imagefilename end " +
|
||||||
|
" ) image_file_name " +
|
||||||
|
"from imagefile img " +
|
||||||
|
"left join docimagefile di on img.IMAGEFILEID = di.IMAGEFILEID " +
|
||||||
|
"left join docdetail dc on di.DOCID = dc.ID " +
|
||||||
|
" where img.IMAGEFILEID = #{imageId}")
|
||||||
|
DocImageInfo selectImageInfoByImageId(String imageFileId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -336,18 +336,18 @@ public class ResultMapper {
|
||||||
if ("FLOAT".equalsIgnoreCase(columnType) || "DOUBLE".equalsIgnoreCase(columnType) || "DECIMAL".equalsIgnoreCase(columnType)) {
|
if ("FLOAT".equalsIgnoreCase(columnType) || "DOUBLE".equalsIgnoreCase(columnType) || "DECIMAL".equalsIgnoreCase(columnType)) {
|
||||||
|
|
||||||
if (Objects.nonNull(toLowerCase)) {
|
if (Objects.nonNull(toLowerCase)) {
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getFloat(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
|
||||||
} else {
|
} else {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getFloat(i + 1));
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(i + 1));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getFloat(i + 1));
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(i + 1));
|
||||||
}
|
}
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getFloat(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getFloat(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getString(i + 1));
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i], rs.getFloat(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i], rs.getString(i + 1));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -475,39 +475,58 @@ public class ResultMapper {
|
||||||
} else {
|
} else {
|
||||||
columnType = columnTypeName[i];
|
columnType = columnTypeName[i];
|
||||||
}
|
}
|
||||||
|
String value = rs.getString(i + 1);
|
||||||
|
String valueCloumn = rs.getString(columnName[i]);
|
||||||
if ("int".equalsIgnoreCase(columnType) || "long".equalsIgnoreCase(columnType) || "number".equalsIgnoreCase(columnType) || "MEDIUMINT".equalsIgnoreCase(columnType) || "TINYINT".equalsIgnoreCase(columnType) || "SMALLINT".equalsIgnoreCase(columnType) || "BIGINT".equalsIgnoreCase(columnType) || "INTEGER".equalsIgnoreCase(columnType)) {
|
if ("int".equalsIgnoreCase(columnType) || "long".equalsIgnoreCase(columnType) || "number".equalsIgnoreCase(columnType) || "MEDIUMINT".equalsIgnoreCase(columnType) || "TINYINT".equalsIgnoreCase(columnType) || "SMALLINT".equalsIgnoreCase(columnType) || "BIGINT".equalsIgnoreCase(columnType) || "INTEGER".equalsIgnoreCase(columnType)) {
|
||||||
|
|
||||||
if (Objects.nonNull(toLowerCase)) {
|
if (Objects.nonNull(toLowerCase)) {
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getInt(i + 1));
|
try {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), Integer.parseInt(value));
|
||||||
|
} catch (Exception e) {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), value);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getInt(columnName[i]));
|
try {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), Integer.parseInt(valueCloumn));
|
||||||
|
} catch (Exception e) {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), valueCloumn);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getInt(i + 1));
|
try {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), Integer.parseInt(value));
|
||||||
|
} catch (Exception e) {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), Integer.parseInt(value));
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), Integer.parseInt(value));
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i], Integer.parseInt(value));
|
||||||
|
} catch (Exception e) {
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), value);
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), value);
|
||||||
|
((Map<? super Object, ? super Object>) o).put(columnName[i], value);
|
||||||
}
|
}
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getInt(i + 1));
|
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getInt(i + 1));
|
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i], rs.getInt(i + 1));
|
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ("FLOAT".equalsIgnoreCase(columnType) || "DOUBLE".equalsIgnoreCase(columnType) || "DECIMAL".equalsIgnoreCase(columnType)) {
|
if ("FLOAT".equalsIgnoreCase(columnType) || "DOUBLE".equalsIgnoreCase(columnType) || "DECIMAL".equalsIgnoreCase(columnType)) {
|
||||||
|
|
||||||
if (Objects.nonNull(toLowerCase)) {
|
if (Objects.nonNull(toLowerCase)) {
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), value);
|
||||||
} else {
|
} else {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(columnName[i]));
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), valueCloumn);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(columnName[i]));
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), valueCloumn);
|
||||||
}
|
}
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), value);
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), value);
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i], rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i], value);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -535,18 +554,18 @@ public class ResultMapper {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Objects.nonNull(toLowerCase)) {
|
if (Objects.nonNull(toLowerCase)) {
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), value);
|
||||||
} else {
|
} else {
|
||||||
if (enable) {
|
if (enable) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(columnName[i]));
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), valueCloumn);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
if (DBConstant.DB_TYPE_ORACLE.equals(rs.getDBType())) {
|
||||||
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(Util.toCamelCase(columnName[i]), value);
|
||||||
}
|
}
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toLowerCase(), value);
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i].toUpperCase(), value);
|
||||||
((Map<? super Object, ? super Object>) o).put(columnName[i], rs.getString(i + 1));
|
((Map<? super Object, ? super Object>) o).put(columnName[i], value);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -268,7 +268,8 @@ public class SqlHandler {
|
||||||
}
|
}
|
||||||
Object o = ((Map<?, ?>) arg).get(key);
|
Object o = ((Map<?, ?>) arg).get(key);
|
||||||
if (null == o) {
|
if (null == o) {
|
||||||
return "";
|
// 如果值是null 则直接返回hull
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
if (o instanceof Character || o instanceof String) {
|
if (o instanceof Character || o instanceof String) {
|
||||||
// 处理字符类型
|
// 处理字符类型
|
||||||
|
|
|
@ -21,7 +21,7 @@ import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
* 集合的stream操作封装
|
* 集合的stream操作封装
|
||||||
*
|
*
|
||||||
* @author 528910437@QQ.COM, VampireAchao<achao1441470436@gmail.com>Lion Li>
|
* @author 528910437@QQ.COM, VampireAchao<achao1441470436@gmail.getLogFilePath>Lion Li>
|
||||||
* @since 5.5.2
|
* @since 5.5.2
|
||||||
*/
|
*/
|
||||||
public class CollStreamUtil {
|
public class CollStreamUtil {
|
||||||
|
|
|
@ -8,7 +8,7 @@ package aiyh.utils.tool.cn.hutool.core.date;
|
||||||
* @see #Q3
|
* @see #Q3
|
||||||
* @see #Q4
|
* @see #Q4
|
||||||
*
|
*
|
||||||
* @author zhfish(https://github.com/zhfish)
|
* @author zhfish(https://github.getLogFilePath/zhfish)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public enum Quarter {
|
public enum Quarter {
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class ColorUtil {
|
||||||
* 3. RGB形式,例如:13,148,252
|
* 3. RGB形式,例如:13,148,252
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
* 方法来自:com.lnwazg.kit
|
* 方法来自:getLogFilePath.lnwazg.kit
|
||||||
*
|
*
|
||||||
* @param colorName 颜色的英文名,16进制表示或RGB表示
|
* @param colorName 颜色的英文名,16进制表示或RGB表示
|
||||||
* @return {@link Color}
|
* @return {@link Color}
|
||||||
|
|
|
@ -2015,7 +2015,7 @@ public class ImgUtil {
|
||||||
* 3. RGB形式,例如:13,148,252
|
* 3. RGB形式,例如:13,148,252
|
||||||
* </pre>
|
* </pre>
|
||||||
* <p>
|
* <p>
|
||||||
* 方法来自:com.lnwazg.kit
|
* 方法来自:getLogFilePath.lnwazg.kit
|
||||||
*
|
*
|
||||||
* @param colorName 颜色的英文名,16进制表示或RGB表示
|
* @param colorName 颜色的英文名,16进制表示或RGB表示
|
||||||
* @return {@link Color}
|
* @return {@link Color}
|
||||||
|
|
|
@ -992,7 +992,7 @@ public class FileUtil extends PathUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建临时文件<br>
|
* 创建临时文件<br>
|
||||||
* 创建后的文件名为 prefix[Randon].suffix From com.jodd.io.FileUtil
|
* 创建后的文件名为 prefix[Randon].suffix From getLogFilePath.jodd.io.FileUtil
|
||||||
*
|
*
|
||||||
* @param prefix 前缀,至少3个字符
|
* @param prefix 前缀,至少3个字符
|
||||||
* @param suffix 后缀,如果null则使用默认.tmp
|
* @param suffix 后缀,如果null则使用默认.tmp
|
||||||
|
|
|
@ -116,9 +116,9 @@ public class NioUtil {
|
||||||
* @param outChannel 输出通道
|
* @param outChannel 输出通道
|
||||||
* @return 输入通道的字节数
|
* @return 输入通道的字节数
|
||||||
* @throws IOException 发生IO错误
|
* @throws IOException 发生IO错误
|
||||||
* @link http://androidxref.com/6.0.1_r10/xref/libcore/luni/src/main/java/java/nio/FileChannelImpl.java
|
* @link http://androidxref.getLogFilePath/6.0.1_r10/xref/libcore/luni/src/main/java/java/nio/FileChannelImpl.java
|
||||||
* @link http://androidxref.com/7.0.0_r1/xref/libcore/ojluni/src/main/java/sun/nio/ch/FileChannelImpl.java
|
* @link http://androidxref.getLogFilePath/7.0.0_r1/xref/libcore/ojluni/src/main/java/sun/nio/ch/FileChannelImpl.java
|
||||||
* @link http://androidxref.com/7.0.0_r1/xref/libcore/ojluni/src/main/native/FileChannelImpl.c
|
* @link http://androidxref.getLogFilePath/7.0.0_r1/xref/libcore/ojluni/src/main/native/FileChannelImpl.c
|
||||||
* @author z8g
|
* @author z8g
|
||||||
* @since 5.7.21
|
* @since 5.7.21
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -77,8 +77,8 @@ public class WatchServer extends Thread implements Closeable, Serializable {
|
||||||
* 设置监听选项,例如监听频率等,可设置项包括:
|
* 设置监听选项,例如监听频率等,可设置项包括:
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* 1、com.sun.nio.file.StandardWatchEventKinds
|
* 1、getLogFilePath.sun.nio.file.StandardWatchEventKinds
|
||||||
* 2、com.sun.nio.file.SensitivityWatchEventModifier
|
* 2、getLogFilePath.sun.nio.file.SensitivityWatchEventModifier
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param modifiers 监听选项,例如监听频率等
|
* @param modifiers 监听选项,例如监听频率等
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class ClassScanner implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 扫描该包路径下所有class文件
|
* 扫描该包路径下所有class文件
|
||||||
*
|
*
|
||||||
* @param packageName 包路径 com | com. | com.abs | com.abs.
|
* @param packageName 包路径 getLogFilePath | getLogFilePath. | getLogFilePath.abs | getLogFilePath.abs.
|
||||||
* @return 类集合
|
* @return 类集合
|
||||||
*/
|
*/
|
||||||
public static Set<Class<?>> scanPackage(String packageName) {
|
public static Set<Class<?>> scanPackage(String packageName) {
|
||||||
|
@ -153,10 +153,10 @@ public class ClassScanner implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫描包路径下和所有在classpath中加载的类,满足class过滤器条件的所有class文件,<br>
|
* 扫描包路径下和所有在classpath中加载的类,满足class过滤器条件的所有class文件,<br>
|
||||||
* 如果包路径为 com.abs + A.class 但是输入 abs会产生classNotFoundException<br>
|
* 如果包路径为 getLogFilePath.abs + A.class 但是输入 abs会产生classNotFoundException<br>
|
||||||
* 因为className 应该为 com.abs.A 现在却成为abs.A,此工具类对该异常进行忽略处理<br>
|
* 因为className 应该为 getLogFilePath.abs.A 现在却成为abs.A,此工具类对该异常进行忽略处理<br>
|
||||||
*
|
*
|
||||||
* @param packageName 包路径 com | com. | com.abs | com.abs.
|
* @param packageName 包路径 getLogFilePath | getLogFilePath. | getLogFilePath.abs | getLogFilePath.abs.
|
||||||
* @param classFilter class过滤器,过滤掉不需要的class
|
* @param classFilter class过滤器,过滤掉不需要的class
|
||||||
* @return 类集合
|
* @return 类集合
|
||||||
* @since 5.7.5
|
* @since 5.7.5
|
||||||
|
@ -167,10 +167,10 @@ public class ClassScanner implements Serializable {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫描包路径下满足class过滤器条件的所有class文件,<br>
|
* 扫描包路径下满足class过滤器条件的所有class文件,<br>
|
||||||
* 如果包路径为 com.abs + A.class 但是输入 abs会产生classNotFoundException<br>
|
* 如果包路径为 getLogFilePath.abs + A.class 但是输入 abs会产生classNotFoundException<br>
|
||||||
* 因为className 应该为 com.abs.A 现在却成为abs.A,此工具类对该异常进行忽略处理<br>
|
* 因为className 应该为 getLogFilePath.abs.A 现在却成为abs.A,此工具类对该异常进行忽略处理<br>
|
||||||
*
|
*
|
||||||
* @param packageName 包路径 com | com. | com.abs | com.abs.
|
* @param packageName 包路径 getLogFilePath | getLogFilePath. | getLogFilePath.abs | getLogFilePath.abs.
|
||||||
* @param classFilter class过滤器,过滤掉不需要的class
|
* @param classFilter class过滤器,过滤掉不需要的class
|
||||||
* @return 类集合
|
* @return 类集合
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
*
|
*
|
||||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||||
* or visit www.oracle.com if you need additional information or have any
|
* or visit www.oracle.getLogFilePath if you need additional information or have any
|
||||||
* questions.
|
* questions.
|
||||||
*/
|
*/
|
||||||
package aiyh.utils.tool.cn.hutool.core.lang;
|
package aiyh.utils.tool.cn.hutool.core.lang;
|
||||||
|
|
|
@ -26,12 +26,12 @@ import java.util.regex.Pattern;
|
||||||
*
|
*
|
||||||
* <p>例子: </p>
|
* <p>例子: </p>
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>{@code com/t?st.jsp} — 匹配 {@code com/test.jsp} 或 {@code com/tast.jsp} 或 {@code com/txst.jsp}</li>
|
* <li>{@code getLogFilePath/t?st.jsp} — 匹配 {@code getLogFilePath/test.jsp} 或 {@code getLogFilePath/tast.jsp} 或 {@code getLogFilePath/txst.jsp}</li>
|
||||||
* <li>{@code com/*.jsp} — 匹配{@code com}目录下全部 {@code .jsp}文件</li>
|
* <li>{@code getLogFilePath/*.jsp} — 匹配{@code getLogFilePath}目录下全部 {@code .jsp}文件</li>
|
||||||
* <li>{@code com/**/test.jsp} — 匹配{@code com}目录下全部 {@code test.jsp}文件</li>
|
* <li>{@code getLogFilePath/**/test.jsp} — 匹配{@code getLogFilePath}目录下全部 {@code test.jsp}文件</li>
|
||||||
* <li>{@code cn/hutool/**/*.jsp} — 匹配{@code cn/hutool}路径下全部{@code .jsp} 文件</li>
|
* <li>{@code cn/hutool/**/*.jsp} — 匹配{@code cn/hutool}路径下全部{@code .jsp} 文件</li>
|
||||||
* <li>{@code org/**/servlet/bla.jsp} — 匹配{@code cn/hutool/servlet/bla.jsp} 或{@code cn/hutool/testing/servlet/bla.jsp} 或 {@code org/servlet/bla.jsp}</li>
|
* <li>{@code org/**/servlet/bla.jsp} — 匹配{@code cn/hutool/servlet/bla.jsp} 或{@code cn/hutool/testing/servlet/bla.jsp} 或 {@code org/servlet/bla.jsp}</li>
|
||||||
* <li>{@code com/{filename:\\w+}.jsp} 匹配 {@code com/test.jsp} 并将 {@code test} 关联到 {@code filename} 变量</li>
|
* <li>{@code getLogFilePath/{filename:\\w+}.jsp} 匹配 {@code getLogFilePath/test.jsp} 并将 {@code test} 关联到 {@code filename} 变量</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* <p><strong>注意:</strong> 表达式和路径必须都为绝对路径或都为相对路径。
|
* <p><strong>注意:</strong> 表达式和路径必须都为绝对路径或都为相对路径。
|
||||||
|
|
|
@ -3830,11 +3830,11 @@ public class CharSequenceUtil {
|
||||||
* <pre>
|
* <pre>
|
||||||
* StrUtil.hide(null,*,*)=null
|
* StrUtil.hide(null,*,*)=null
|
||||||
* StrUtil.hide("",0,*)=""
|
* StrUtil.hide("",0,*)=""
|
||||||
* StrUtil.hide("jackduan@163.com",-1,4) ****duan@163.com
|
* StrUtil.hide("jackduan@163.getLogFilePath",-1,4) ****duan@163.getLogFilePath
|
||||||
* StrUtil.hide("jackduan@163.com",2,3) ja*kduan@163.com
|
* StrUtil.hide("jackduan@163.getLogFilePath",2,3) ja*kduan@163.getLogFilePath
|
||||||
* StrUtil.hide("jackduan@163.com",3,2) jackduan@163.com
|
* StrUtil.hide("jackduan@163.getLogFilePath",3,2) jackduan@163.getLogFilePath
|
||||||
* StrUtil.hide("jackduan@163.com",16,16) jackduan@163.com
|
* StrUtil.hide("jackduan@163.getLogFilePath",16,16) jackduan@163.getLogFilePath
|
||||||
* StrUtil.hide("jackduan@163.com",16,17) jackduan@163.com
|
* StrUtil.hide("jackduan@163.getLogFilePath",16,17) jackduan@163.getLogFilePath
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @param str 字符串
|
* @param str 字符串
|
||||||
|
@ -3857,7 +3857,7 @@ public class CharSequenceUtil {
|
||||||
* StrUtil.desensitized("09157518479", DesensitizedUtil.DesensitizedType.FIXED_PHONE)) = "0915*****79"
|
* StrUtil.desensitized("09157518479", DesensitizedUtil.DesensitizedType.FIXED_PHONE)) = "0915*****79"
|
||||||
* StrUtil.desensitized("18049531999", DesensitizedUtil.DesensitizedType.MOBILE_PHONE)) = "180****1999"
|
* StrUtil.desensitized("18049531999", DesensitizedUtil.DesensitizedType.MOBILE_PHONE)) = "180****1999"
|
||||||
* StrUtil.desensitized("北京市海淀区马连洼街道289号", DesensitizedUtil.DesensitizedType.ADDRESS)) = "北京市海淀区马********"
|
* StrUtil.desensitized("北京市海淀区马连洼街道289号", DesensitizedUtil.DesensitizedType.ADDRESS)) = "北京市海淀区马********"
|
||||||
* StrUtil.desensitized("duandazhi-jack@gmail.com.cn", DesensitizedUtil.DesensitizedType.EMAIL)) = "d*************@gmail.com.cn"
|
* StrUtil.desensitized("duandazhi-jack@gmail.getLogFilePath.cn", DesensitizedUtil.DesensitizedType.EMAIL)) = "d*************@gmail.getLogFilePath.cn"
|
||||||
* StrUtil.desensitized("1234567890", DesensitizedUtil.DesensitizedType.PASSWORD)) = "**********"
|
* StrUtil.desensitized("1234567890", DesensitizedUtil.DesensitizedType.PASSWORD)) = "**********"
|
||||||
* StrUtil.desensitized("苏D40000", DesensitizedUtil.DesensitizedType.CAR_LICENSE)) = "苏D4***0"
|
* StrUtil.desensitized("苏D40000", DesensitizedUtil.DesensitizedType.CAR_LICENSE)) = "苏D4***0"
|
||||||
* StrUtil.desensitized("11011111222233333256", DesensitizedType.BANK_CARD)) = "1101 **** **** **** 3256"
|
* StrUtil.desensitized("11011111222233333256", DesensitizedType.BANK_CARD)) = "1101 **** **** **** 3256"
|
||||||
|
|
|
@ -8,7 +8,7 @@ import java.util.concurrent.ExecutionException;
|
||||||
* {@link CompletableFuture}异步工具类<br>
|
* {@link CompletableFuture}异步工具类<br>
|
||||||
* {@link CompletableFuture} 是 Future 的改进,可以通过传入回调对象,在任务完成后调用之
|
* {@link CompletableFuture} 是 Future 的改进,可以通过传入回调对象,在任务完成后调用之
|
||||||
*
|
*
|
||||||
* @author achao1441470436@gmail.com
|
* @author achao1441470436@gmail.getLogFilePath
|
||||||
* @since 5.7.17
|
* @since 5.7.17
|
||||||
*/
|
*/
|
||||||
public class AsyncUtil {
|
public class AsyncUtil {
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class ClassUtil {
|
||||||
* 例如:ClassUtil这个类<br>
|
* 例如:ClassUtil这个类<br>
|
||||||
*
|
*
|
||||||
* <pre>
|
* <pre>
|
||||||
* isSimple为false: "com.xiaoleilu.hutool.util.ClassUtil"
|
* isSimple为false: "getLogFilePath.xiaoleilu.hutool.util.ClassUtil"
|
||||||
* isSimple为true: "ClassUtil"
|
* isSimple为true: "ClassUtil"
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
@ -216,7 +216,7 @@ public class ClassUtil {
|
||||||
/**
|
/**
|
||||||
* 扫描该包路径下所有class文件
|
* 扫描该包路径下所有class文件
|
||||||
*
|
*
|
||||||
* @param packageName 包路径 com | com. | com.abs | com.abs.
|
* @param packageName 包路径 getLogFilePath | getLogFilePath. | getLogFilePath.abs | getLogFilePath.abs.
|
||||||
* @return 类集合
|
* @return 类集合
|
||||||
* @see ClassScanner#scanPackage(String)
|
* @see ClassScanner#scanPackage(String)
|
||||||
*/
|
*/
|
||||||
|
@ -226,10 +226,10 @@ public class ClassUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 扫描包路径下满足class过滤器条件的所有class文件,<br>
|
* 扫描包路径下满足class过滤器条件的所有class文件,<br>
|
||||||
* 如果包路径为 com.abs + A.class 但是输入 abs会产生classNotFoundException<br>
|
* 如果包路径为 getLogFilePath.abs + A.class 但是输入 abs会产生classNotFoundException<br>
|
||||||
* 因为className 应该为 com.abs.A 现在却成为abs.A,此工具类对该异常进行忽略处理,有可能是一个不完善的地方,以后需要进行修改<br>
|
* 因为className 应该为 getLogFilePath.abs.A 现在却成为abs.A,此工具类对该异常进行忽略处理,有可能是一个不完善的地方,以后需要进行修改<br>
|
||||||
*
|
*
|
||||||
* @param packageName 包路径 com | com. | com.abs | com.abs.
|
* @param packageName 包路径 getLogFilePath | getLogFilePath. | getLogFilePath.abs | getLogFilePath.abs.
|
||||||
* @param classFilter class过滤器,过滤掉不需要的class
|
* @param classFilter class过滤器,过滤掉不需要的class
|
||||||
* @return 类集合
|
* @return 类集合
|
||||||
*/
|
*/
|
||||||
|
@ -626,7 +626,7 @@ public class ClassUtil {
|
||||||
* 非单例模式,如果是非静态方法,每次创建一个新对象
|
* 非单例模式,如果是非静态方法,每次创建一个新对象
|
||||||
*
|
*
|
||||||
* @param <T> 对象类型
|
* @param <T> 对象类型
|
||||||
* @param classNameWithMethodName 类名和方法名表达式,类名与方法名用{@code .}或{@code #}连接 例如:com.xiaoleilu.hutool.StrUtil.isEmpty 或 com.xiaoleilu.hutool.StrUtil#isEmpty
|
* @param classNameWithMethodName 类名和方法名表达式,类名与方法名用{@code .}或{@code #}连接 例如:getLogFilePath.xiaoleilu.hutool.StrUtil.isEmpty 或 getLogFilePath.xiaoleilu.hutool.StrUtil#isEmpty
|
||||||
* @param args 参数,必须严格对应指定方法的参数类型和数量
|
* @param args 参数,必须严格对应指定方法的参数类型和数量
|
||||||
* @return 返回结果
|
* @return 返回结果
|
||||||
*/
|
*/
|
||||||
|
@ -640,7 +640,7 @@ public class ClassUtil {
|
||||||
* 执行非static方法时,必须满足对象有默认构造方法<br>
|
* 执行非static方法时,必须满足对象有默认构造方法<br>
|
||||||
*
|
*
|
||||||
* @param <T> 对象类型
|
* @param <T> 对象类型
|
||||||
* @param classNameWithMethodName 类名和方法名表达式,例如:com.xiaoleilu.hutool.StrUtil#isEmpty或com.xiaoleilu.hutool.StrUtil.isEmpty
|
* @param classNameWithMethodName 类名和方法名表达式,例如:getLogFilePath.xiaoleilu.hutool.StrUtil#isEmpty或com.xiaoleilu.hutool.StrUtil.isEmpty
|
||||||
* @param isSingleton 是否为单例对象,如果此参数为false,每次执行方法时创建一个新对象
|
* @param isSingleton 是否为单例对象,如果此参数为false,每次执行方法时创建一个新对象
|
||||||
* @param args 参数,必须严格对应指定方法的参数类型和数量
|
* @param args 参数,必须严格对应指定方法的参数类型和数量
|
||||||
* @return 返回结果
|
* @return 返回结果
|
||||||
|
@ -956,7 +956,7 @@ public class ClassUtil {
|
||||||
/**
|
/**
|
||||||
* 获得给定类所在包的名称<br>
|
* 获得给定类所在包的名称<br>
|
||||||
* 例如:<br>
|
* 例如:<br>
|
||||||
* com.xiaoleilu.hutool.util.ClassUtil =》 com.xiaoleilu.hutool.util
|
* getLogFilePath.xiaoleilu.hutool.util.ClassUtil =》 getLogFilePath.xiaoleilu.hutool.util
|
||||||
*
|
*
|
||||||
* @param clazz 类
|
* @param clazz 类
|
||||||
* @return 包名
|
* @return 包名
|
||||||
|
@ -976,7 +976,7 @@ public class ClassUtil {
|
||||||
/**
|
/**
|
||||||
* 获得给定类所在包的路径<br>
|
* 获得给定类所在包的路径<br>
|
||||||
* 例如:<br>
|
* 例如:<br>
|
||||||
* com.xiaoleilu.hutool.util.ClassUtil =》 com/xiaoleilu/hutool/util
|
* getLogFilePath.xiaoleilu.hutool.util.ClassUtil =》 getLogFilePath/xiaoleilu/hutool/util
|
||||||
*
|
*
|
||||||
* @param clazz 类
|
* @param clazz 类
|
||||||
* @return 包名
|
* @return 包名
|
||||||
|
|
|
@ -14,7 +14,7 @@ import java.util.Objects;
|
||||||
* 坐标转换相关参考: https://tool.lu/coordinate/<br>
|
* 坐标转换相关参考: https://tool.lu/coordinate/<br>
|
||||||
* 参考:https://github.com/JourWon/coordinate-transform
|
* 参考:https://github.com/JourWon/coordinate-transform
|
||||||
*
|
*
|
||||||
* @author hongzhe.qin(qin462328037at163.com), looly
|
* @author hongzhe.qin(qin462328037at163.getLogFilePath), looly
|
||||||
* @since 5.7.16
|
* @since 5.7.16
|
||||||
*/
|
*/
|
||||||
public class CoordinateUtil {
|
public class CoordinateUtil {
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class DesensitizedUtil {
|
||||||
* DesensitizedUtil.desensitized("09157518479", DesensitizedUtil.DesensitizedType.FIXED_PHONE)) = "0915*****79"
|
* DesensitizedUtil.desensitized("09157518479", DesensitizedUtil.DesensitizedType.FIXED_PHONE)) = "0915*****79"
|
||||||
* DesensitizedUtil.desensitized("18049531999", DesensitizedUtil.DesensitizedType.MOBILE_PHONE)) = "180****1999"
|
* DesensitizedUtil.desensitized("18049531999", DesensitizedUtil.DesensitizedType.MOBILE_PHONE)) = "180****1999"
|
||||||
* DesensitizedUtil.desensitized("北京市海淀区马连洼街道289号", DesensitizedUtil.DesensitizedType.ADDRESS)) = "北京市海淀区马********"
|
* DesensitizedUtil.desensitized("北京市海淀区马连洼街道289号", DesensitizedUtil.DesensitizedType.ADDRESS)) = "北京市海淀区马********"
|
||||||
* DesensitizedUtil.desensitized("duandazhi-jack@gmail.com.cn", DesensitizedUtil.DesensitizedType.EMAIL)) = "d*************@gmail.com.cn"
|
* DesensitizedUtil.desensitized("duandazhi-jack@gmail.getLogFilePath.cn", DesensitizedUtil.DesensitizedType.EMAIL)) = "d*************@gmail.getLogFilePath.cn"
|
||||||
* DesensitizedUtil.desensitized("1234567890", DesensitizedUtil.DesensitizedType.PASSWORD)) = "**********"
|
* DesensitizedUtil.desensitized("1234567890", DesensitizedUtil.DesensitizedType.PASSWORD)) = "**********"
|
||||||
* DesensitizedUtil.desensitized("苏D40000", DesensitizedUtil.DesensitizedType.CAR_LICENSE)) = "苏D4***0"
|
* DesensitizedUtil.desensitized("苏D40000", DesensitizedUtil.DesensitizedType.CAR_LICENSE)) = "苏D4***0"
|
||||||
* DesensitizedUtil.desensitized("11011111222233333256", DesensitizedUtil.DesensitizedType.BANK_CARD)) = "1101 **** **** **** 3256"
|
* DesensitizedUtil.desensitized("11011111222233333256", DesensitizedUtil.DesensitizedType.BANK_CARD)) = "1101 **** **** **** 3256"
|
||||||
|
@ -252,7 +252,7 @@ public class DesensitizedUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【电子邮箱】邮箱前缀仅显示第一个字母,前缀其他隐藏,用星号代替,@及后面的地址显示,比如:d**@126.com
|
* 【电子邮箱】邮箱前缀仅显示第一个字母,前缀其他隐藏,用星号代替,@及后面的地址显示,比如:d**@126.getLogFilePath
|
||||||
*
|
*
|
||||||
* @param email 邮箱
|
* @param email 邮箱
|
||||||
* @return 脱敏后的邮箱
|
* @return 脱敏后的邮箱
|
||||||
|
|
|
@ -14,7 +14,7 @@ package aiyh.utils.tool.cn.hutool.core.util;
|
||||||
* <li>....</li>
|
* <li>....</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
*
|
*
|
||||||
* @author xl7@qq.com
|
* @author xl7@qq.getLogFilePath
|
||||||
* @since 5.5.8
|
* @since 5.5.8
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ public class XmlUtil {
|
||||||
/**
|
/**
|
||||||
* 默认的DocumentBuilderFactory实现
|
* 默认的DocumentBuilderFactory实现
|
||||||
*/
|
*/
|
||||||
private static String defaultDocumentBuilderFactory = "com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
|
private static String defaultDocumentBuilderFactory = "getLogFilePath.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否打开命名空间支持
|
* 是否打开命名空间支持
|
||||||
|
@ -621,7 +621,7 @@ public class XmlUtil {
|
||||||
/**
|
/**
|
||||||
* 创建{@link DocumentBuilderFactory}
|
* 创建{@link DocumentBuilderFactory}
|
||||||
* <p>
|
* <p>
|
||||||
* 默认使用"com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"<br>
|
* 默认使用"getLogFilePath.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl"<br>
|
||||||
* 如果使用第三方实现,请调用{@link #disableDefaultDocumentBuilderFactory()}
|
* 如果使用第三方实现,请调用{@link #disableDefaultDocumentBuilderFactory()}
|
||||||
* </p>
|
* </p>
|
||||||
*
|
*
|
||||||
|
|
|
@ -124,7 +124,7 @@ public final class InternalJSONUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将Property的键转化为JSON形式<br>
|
* 将Property的键转化为JSON形式<br>
|
||||||
* 用于识别类似于:com.luxiaolei.package.hutool这类用点隔开的键<br>
|
* 用于识别类似于:getLogFilePath.luxiaolei.package.hutool这类用点隔开的键<br>
|
||||||
* 注意:是否允许重复键,取决于JSONObject配置
|
* 注意:是否允许重复键,取决于JSONObject配置
|
||||||
*
|
*
|
||||||
* @param jsonObject JSONObject
|
* @param jsonObject JSONObject
|
||||||
|
|
|
@ -4,7 +4,7 @@ package aiyh.utils.tool.org.apache.commons.jexl3.parser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token literal values and constants.
|
* Token literal values and constants.
|
||||||
* Generated by com.helger.pgcc.output.java.OtherFilesGenJava#start()
|
* Generated by getLogFilePath.helger.pgcc.output.java.OtherFilesGenJava#start()
|
||||||
*/
|
*/
|
||||||
public interface ParserConstants {
|
public interface ParserConstants {
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package com.api.chaoyang.he.hcy_xintiantongxin.projectorder.controller;//package com.api.hcy_xintiantongxin.projectorder.controller;
|
package com.api.chaoyang.he.hcy_xintiantongxin.projectorder.controller;//package getLogFilePath.api.hcy_xintiantongxin.projectorder.controller;
|
||||||
//
|
//
|
||||||
//import aiyh.utils.ApiResult;
|
//import aiyh.utils.ApiResult;
|
||||||
//import aiyh.utils.Util;
|
//import aiyh.utils.Util;
|
||||||
//import com.api.hcy_xintiantongxin.projectorder.service.ExportExcelAVPNService;
|
//import getLogFilePath.api.hcy_xintiantongxin.projectorder.service.ExportExcelAVPNService;
|
||||||
//import com.api.hcy_xintiantongxin.projectorder.service.ExportExcelL3NSService;
|
//import getLogFilePath.api.hcy_xintiantongxin.projectorder.service.ExportExcelL3NSService;
|
||||||
//import com.api.hcy_xintiantongxin.projectorder.service.ExportExcelOtherService;
|
//import getLogFilePath.api.hcy_xintiantongxin.projectorder.service.ExportExcelOtherService;
|
||||||
//import com.api.hcy_xintiantongxin.projectorder.service.impl.ExportExcelAVPNServiceImpl;
|
//import getLogFilePath.api.hcy_xintiantongxin.projectorder.service.impl.ExportExcelAVPNServiceImpl;
|
||||||
//import com.api.hcy_xintiantongxin.projectorder.service.impl.ExportExcelL3NSServiceImpl;
|
//import getLogFilePath.api.hcy_xintiantongxin.projectorder.service.impl.ExportExcelL3NSServiceImpl;
|
||||||
//import com.api.hcy_xintiantongxin.projectorder.service.impl.ExportExcelOtherServiceImpl;
|
//import getLogFilePath.api.hcy_xintiantongxin.projectorder.service.impl.ExportExcelOtherServiceImpl;
|
||||||
//import org.apache.log4j.Logger;
|
//import org.apache.log4j.Logger;
|
||||||
//import weaver.conn.RecordSet;
|
//import weaver.conn.RecordSet;
|
||||||
//import weaver.wechat.util.Utils;
|
//import weaver.wechat.util.Utils;
|
||||||
|
@ -30,7 +30,7 @@ package com.api.chaoyang.he.hcy_xintiantongxin.projectorder.controller;//package
|
||||||
//import java.util.zip.ZipEntry;
|
//import java.util.zip.ZipEntry;
|
||||||
//import java.util.zip.ZipOutputStream;
|
//import java.util.zip.ZipOutputStream;
|
||||||
//
|
//
|
||||||
//import static com.caucho.server.log.AccessLog.BUFFER_SIZE;
|
//import static getLogFilePath.caucho.server.log.AccessLog.BUFFER_SIZE;
|
||||||
//
|
//
|
||||||
//@Path("/export")
|
//@Path("/export")
|
||||||
//public class ExportExcelApi_copy {
|
//public class ExportExcelApi_copy {
|
||||||
|
|
|
@ -0,0 +1,108 @@
|
||||||
|
package com.api.customization.ey.jiahx.web;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.api.nonstandardext.model_field_async.service.ModelFieldAsyncServiceImpl;
|
||||||
|
import com.weaver.general.TimeUtil;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.setup.ModeRightInfo;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author 贾寒旭
|
||||||
|
* @Date 2023/5/22
|
||||||
|
* @Other
|
||||||
|
* @Version
|
||||||
|
*/
|
||||||
|
@Path("/pushData")
|
||||||
|
public class ButtonTriggeringGenerateData {
|
||||||
|
private static final BaseBean baseBean = new BaseBean();
|
||||||
|
private static weaver.formmode.setup.ModeRightInfo ModeRightInfo = new ModeRightInfo();//模块信息
|
||||||
|
private static String currentdate = TimeUtil.getCurrentDateString();//当前日期
|
||||||
|
private static String currenttime = TimeUtil.getOnlyCurrentTimeString();//当前时间
|
||||||
|
|
||||||
|
private final ModelFieldAsyncServiceImpl service = new ModelFieldAsyncServiceImpl();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("/doPushData")
|
||||||
|
@Produces({MediaType.TEXT_PLAIN})
|
||||||
|
public JSONObject doPushData(@Context HttpServletRequest request, @Context HttpServletResponse response){
|
||||||
|
baseBean.writeLog("点击按钮获得进行流程主表数据传递到明细表开始>>>>>>>>");
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String sql = "select m.invoiceNo invoiceNo,d.mainid mainid,d.totalAmount totalAmount,m.yjthzje yjthzje,m.customerCode customerCode" +
|
||||||
|
",m.customerName customerName,m.groupinvoiceno groupinvoiceno,m.finishedTime finishedTime,m.orifinishedTime orifinishedTime," +
|
||||||
|
"m.hzjtyqz hzjtyqz,m.arState arState,m.yskje yskje,m.qskje qskje,m.wskje wskje,m.kpzt kpzt,m.sckprq sckprq,m.ykpje ykpje,m.wkpje wkpje from uf_zdjmbd_dt2 d left join uf_zdjmbd m on m.id = d.mainid ";
|
||||||
|
baseBean.writeLog("查询明细表2的数据sql为=====" + sql);
|
||||||
|
rs.executeQuery(sql);
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
List<Boolean> list = new ArrayList<>();
|
||||||
|
boolean flag = false;
|
||||||
|
while (rs.next()) {
|
||||||
|
String invoiceNo = Util.null2String(rs.getString("invoiceNo"));
|
||||||
|
if (!invoiceNo.equals("")) {
|
||||||
|
String mainid = Util.null2String(rs.getString("mainid"));//id
|
||||||
|
String zdje = Util.null2String(rs.getString("totalAmount"));//总金额
|
||||||
|
String jyjtje = Util.null2String(rs.getString("yjthzje"));//计划计提金额
|
||||||
|
String customerCode = Util.null2String(rs.getString("customerCode"));//客户编码
|
||||||
|
String customerName = Util.null2String(rs.getString("customerName"));//客户名称
|
||||||
|
String group_invoice_no = Util.null2String(rs.getString("groupinvoiceno"));//组账单ID
|
||||||
|
String finishedTime = Util.null2String(rs.getString("finishedTime"));//账单开具日期
|
||||||
|
String orifinishedTime = Util.null2String(rs.getString("orifinishedTime"));//原账单开具日期
|
||||||
|
String sqjtyqrq = Util.null2String(rs.getString("hzjtyqz"));//坏账计提延期至
|
||||||
|
String skzt = Util.null2String(rs.getString("arState"));//实收状态
|
||||||
|
String yskje = Util.null2String(rs.getString("yskje"));//收款金额
|
||||||
|
String qskje = Util.null2String(rs.getString("qskje"));//其他收款金额
|
||||||
|
String wskje = Util.null2String(rs.getString("wskje"));//未收款金额
|
||||||
|
String kpzt = Util.null2String(rs.getString("kpzt"));//开票状态
|
||||||
|
String sckprq = Util.null2String(rs.getString("sckprq"));//首次开票日期
|
||||||
|
String ykpje = Util.null2String(rs.getString("ykpje"));//已开票金额
|
||||||
|
String wkpje = Util.null2String(rs.getString("wkpje"));//客户编码
|
||||||
|
String fbmxzt = "0";//客户编码
|
||||||
|
String sjjtje = wskje;//实际计提金额
|
||||||
|
RecordSet recordSet = new RecordSet();
|
||||||
|
String insertSql = "insert into uf_zdjmbd_dt4 (mainid,group_invoice_no,invoiceNo,finishedTime," +
|
||||||
|
"orifinishedTime,sqjtyqrq,zdje,skzt,yskje,qskje,wskje,kpzt,sckprq,ykpje,wkpje,jyjtje,sjjtje,customerCode,customerName,fbmxzt) values (?,?,?,?,?,?," +
|
||||||
|
"?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
||||||
|
baseBean.writeLog("插入的明细表的sql为" + insertSql);
|
||||||
|
if (!"".equals(skzt)) {
|
||||||
|
baseBean.writeLog("我进入判断了>>>>>");
|
||||||
|
boolean b = recordSet.executeUpdate(insertSql, mainid, group_invoice_no, invoiceNo, finishedTime, orifinishedTime, sqjtyqrq, zdje, skzt, yskje, qskje, wskje, kpzt, sckprq, ykpje, wkpje, jyjtje, sjjtje, customerCode, customerName, fbmxzt);
|
||||||
|
list.add(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过配置同步字段
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023-06-27
|
||||||
|
*/
|
||||||
|
service.asyncDataByClassName(this.getClass().getSimpleName(), mainid);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
baseBean.writeLog("list===" + list);
|
||||||
|
if(!list.isEmpty()){
|
||||||
|
if (list.contains(false)) {
|
||||||
|
baseBean.writeLog("aaaaaaaaaaaaa");
|
||||||
|
jsonObject.put("result", flag);
|
||||||
|
}else {
|
||||||
|
flag = true;
|
||||||
|
jsonObject.put("result", flag);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
jsonObject.put("result", flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
return jsonObject;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,83 @@
|
||||||
|
package com.api.ebu7dev1.common.getlog.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.api.ebu7dev1.common.getlog.service.GetLogService;
|
||||||
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.hrm.HrmUserVarify;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.POST;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取自定义日志</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/7/1 10:27</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Path("/ebu7-dev1/common/log/")
|
||||||
|
public class GetLogController {
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
private final GetLogService service = new GetLogService();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("ipList")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String getIpList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
User loginUser = HrmUserVarify.getUser(request, response);
|
||||||
|
String path = request.getRealPath("/");
|
||||||
|
return ApiResult.success(service.getIpList(loginUser, path));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取ip节点出错 : " + e.getMessage());
|
||||||
|
log.error(Util.getErrString(e));
|
||||||
|
return ApiResult.error("获取ip节点出错!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("get")
|
||||||
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
public Response getLogger(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||||
|
try {
|
||||||
|
User loginUser = HrmUserVarify.getUser(request, response);
|
||||||
|
return service.get(loginUser);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("下载文件出错:" + Util.getErrString(e));
|
||||||
|
return Response.ok(ApiResult.error("system error!"), MediaType.APPLICATION_JSON).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("collect")
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String collectLogInfo(@Context HttpServletRequest request,
|
||||||
|
@Context HttpServletResponse response,
|
||||||
|
@RequestBody Map<String, Object> params) {
|
||||||
|
try {
|
||||||
|
User loginUser = HrmUserVarify.getUser(request, response);
|
||||||
|
String path = request.getRealPath("/");
|
||||||
|
params.put("ecologyPath", path);
|
||||||
|
return ApiResult.success(service.collectLogInfo(loginUser, params));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("下载文件出错:" + Util.getErrString(e));
|
||||||
|
return ApiResult.error("system error!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,58 @@
|
||||||
|
package com.api.ebu7dev1.common.getlog.enums;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import weaver.xiao.commons.config.enumtype.DataSourceEnum;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>日志类型枚举</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/1 16:24
|
||||||
|
*/
|
||||||
|
public enum LogTypeEnum {
|
||||||
|
THREAD(1, "0", "log" + File.separator + "thread","thread"),
|
||||||
|
ECOLOGY(1, "1", "log","ecology"),
|
||||||
|
RESIN(0, "2", "log","Resin"),
|
||||||
|
SECURITY(1, "3","WEB-INF" + File.separator + "securitylog","security"),
|
||||||
|
INTEGRATION(1,"4", "log" + File.separator + "integration","integration"),
|
||||||
|
SQL(1, "5", "log" + File.separator + "sql","sql"),
|
||||||
|
UTIL_CUS(1,"6", "log" + File.separator + "cus" + File.separator + "util_cus","util_cus"),
|
||||||
|
SQL_LOG(1,"7","log" + File.separator + "cus" + File.separator + "sql_log","sql_log"),
|
||||||
|
HTTP_UTIL(1,"8","log" + File.separator + "cus" + File.separator + "http_util","http_util");
|
||||||
|
private final Integer logBelongType;
|
||||||
|
private final String value;
|
||||||
|
private final String logPath;
|
||||||
|
private final String key;
|
||||||
|
LogTypeEnum(Integer logBelongType, String value, String logPath,String key) {
|
||||||
|
this.logBelongType = logBelongType;
|
||||||
|
this.value = value;
|
||||||
|
this.logPath = logPath;
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
public final static Map<String, LogTypeEnum> ENUMS = new HashMap<>(16);
|
||||||
|
|
||||||
|
static {
|
||||||
|
for (LogTypeEnum typeEnum : EnumSet.allOf(LogTypeEnum.class)){
|
||||||
|
ENUMS.put(typeEnum.value,typeEnum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
public Integer getLogBelongType() {
|
||||||
|
return logBelongType;
|
||||||
|
}
|
||||||
|
public String getLogPath() {
|
||||||
|
return logPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
package com.api.ebu7dev1.common.getlog.service;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.api.ebu7dev1.common.getlog.util.GetLogUtil;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取日志</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/7/1 10:28</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class GetLogService {
|
||||||
|
public Response get(User loginUser) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取所有的ip地址</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/1 14:19
|
||||||
|
* @param ecologyPath ec路径
|
||||||
|
* @return 集群ip 以及 本地ip
|
||||||
|
**/
|
||||||
|
public Set<String> getIpList(User loginUser, String ecologyPath){
|
||||||
|
GetLogUtil.checkUser(loginUser);
|
||||||
|
String weaverPropertiesPath;
|
||||||
|
String resinPath = System.getProperty("user.dir") + File.separator;
|
||||||
|
if (ecologyPath.endsWith(File.separator)) {
|
||||||
|
weaverPropertiesPath = ecologyPath + "WEB-INF" + File.separator + "prop" + File.separator + "weaver.properties";
|
||||||
|
} else {
|
||||||
|
weaverPropertiesPath = ecologyPath + File.separator + "WEB-INF" + File.separator + "prop" + File.separator + "weaver.properties";
|
||||||
|
}
|
||||||
|
String localIp = GetLogUtil.getInnerIp();
|
||||||
|
Set<String> ipList = GetLogUtil.readEcologyProp(weaverPropertiesPath);
|
||||||
|
if(CollectionUtils.isEmpty(ipList)){
|
||||||
|
String resinBinPath = resinPath + "bin" + File.separator + "startresin.sh";
|
||||||
|
ipList.addAll(GetLogUtil.readResinProp(resinBinPath));
|
||||||
|
}
|
||||||
|
if (ipList.size() != 0) {//没有集群的时候
|
||||||
|
boolean status = false;
|
||||||
|
for (String ip : ipList) {
|
||||||
|
if (ip.contains(localIp) || "127.0.0.1".equals(ip) || "127.0.0.1".equals(localIp)) {
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!status) {
|
||||||
|
ipList.add(localIp);
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
ipList.add(localIp);
|
||||||
|
}
|
||||||
|
return ipList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String collectLogInfo(User loginUser, Map<String, Object> params) throws FileNotFoundException {
|
||||||
|
GetLogUtil.checkUser(loginUser);
|
||||||
|
String startDate = Util.null2String(params.get("startDate"));
|
||||||
|
String endDate = Util.null2String(params.get("endDate"));
|
||||||
|
String ecologyPath = Util.null2String(params.get("ecologyPath"));
|
||||||
|
List<String> logTypeList = (List<String>) params.get("selectLogType");
|
||||||
|
String resinPath = System.getProperty("user.dir") + File.separator;
|
||||||
|
List<Map<String, String>> path = GetLogUtil.getLogPathByLogType(ecologyPath, resinPath, logTypeList);
|
||||||
|
Map<String, Map<String, List<String>>> map = GetLogUtil.getLogFilePath(path, startDate, endDate);
|
||||||
|
return GetLogUtil.collectLog(ecologyPath, map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,565 @@
|
||||||
|
package com.api.ebu7dev1.common.getlog.util;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.InetAddress;
|
||||||
|
import java.net.NetworkInterface;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import com.api.ebu7dev1.common.getlog.enums.LogTypeEnum;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/7/1 14:00
|
||||||
|
*/
|
||||||
|
public class GetLogUtil {
|
||||||
|
|
||||||
|
public static void checkUser(User loginUser) {
|
||||||
|
if (loginUser.getUID() != 1) {
|
||||||
|
throw new CustomerException("无权限查看!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>读取ec weaver.properties配置文件 返回集群ip</h1>
|
||||||
|
*
|
||||||
|
* @param weaverPropertiesPath ec weaver.properties配置文件路径
|
||||||
|
* @return 集群ip
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/1 14:08
|
||||||
|
**/
|
||||||
|
public static Set<String> readEcologyProp(String weaverPropertiesPath) {
|
||||||
|
File file = new File(weaverPropertiesPath);
|
||||||
|
Set<String> res = new HashSet<>();
|
||||||
|
try {
|
||||||
|
if (!file.exists()) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
Properties registerProp = new Properties();
|
||||||
|
InputStreamReader reader = new InputStreamReader(Files.newInputStream(file.toPath()));
|
||||||
|
registerProp.load(reader);
|
||||||
|
String initialHost = registerProp.getProperty("initial_hosts");
|
||||||
|
if (initialHost != null && !"".equals(initialHost)) {
|
||||||
|
String[] initialHosts = initialHost.split(",");
|
||||||
|
for (String initial_hostStr : initialHosts) {
|
||||||
|
if (!initial_hostStr.isEmpty()) {
|
||||||
|
res.add(initial_hostStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
IOUtils.closeQuietly(reader);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>读取 resin 启动脚本文件 返回集群信息</h1>
|
||||||
|
*
|
||||||
|
* @param resinStartPath resin启动路径地址
|
||||||
|
* @return 集群ip
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/1 14:10
|
||||||
|
**/
|
||||||
|
public static Set<String> readResinProp(String resinStartPath) {
|
||||||
|
File resinFile = new File(resinStartPath);
|
||||||
|
Set<String> res = new HashSet<>();
|
||||||
|
if (!resinFile.exists()) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
if (resinFile.isFile() && resinFile.length() > 0) {
|
||||||
|
FileInputStream fileInput = null;
|
||||||
|
BufferedReader bufferedReader = null;
|
||||||
|
try {
|
||||||
|
fileInput = new FileInputStream(resinFile);
|
||||||
|
bufferedReader = new BufferedReader(new InputStreamReader(fileInput));
|
||||||
|
String str;
|
||||||
|
while ((str = bufferedReader.readLine()) != null) {
|
||||||
|
if (str.contains("-Dinitial_hosts") || str.contains("-J-Dinitial_hosts")) {
|
||||||
|
if (str.contains("-J-Dinitial_hosts")) {
|
||||||
|
str = str.substring(str.indexOf("-J-Dinitial_hosts") + 17);
|
||||||
|
}
|
||||||
|
if (str.contains("-Dinitial_hosts")) {
|
||||||
|
str = str.substring(str.indexOf("-Dinitial_hosts") + 15);
|
||||||
|
}
|
||||||
|
str = str.contains("=") ? str.substring(str.indexOf("=") + 1) : str;
|
||||||
|
str = str.contains("-") ? str.substring(0, str.indexOf("-")) : str;
|
||||||
|
str = str.contains(" ") ? str.substring(0, str.indexOf(" ")) : str;
|
||||||
|
String[] ips = str.split(",");
|
||||||
|
for (String ip : ips) {
|
||||||
|
try {
|
||||||
|
String tmpIp = ip.replace(".", "").replace(":", "");
|
||||||
|
Long.parseLong(tmpIp.trim());
|
||||||
|
res.add(ip.trim());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Throwable t) {
|
||||||
|
t.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
IOUtils.closeQuietly(fileInput);
|
||||||
|
IOUtils.closeQuietly(bufferedReader);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>获取内网ip</h1>
|
||||||
|
*
|
||||||
|
* @return 内网ip
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/1 14:17
|
||||||
|
**/
|
||||||
|
public static String getInnerIp() {
|
||||||
|
try {
|
||||||
|
Enumeration<NetworkInterface> netInterfaces = NetworkInterface.getNetworkInterfaces();
|
||||||
|
while (netInterfaces.hasMoreElements()) {
|
||||||
|
NetworkInterface ni = netInterfaces.nextElement();
|
||||||
|
Enumeration<InetAddress> nii = ni.getInetAddresses();
|
||||||
|
while (nii.hasMoreElements()) {
|
||||||
|
InetAddress inetAddress = nii.nextElement();
|
||||||
|
if (!inetAddress.getHostAddress().contains(":")) {
|
||||||
|
String ip = inetAddress.getHostAddress();
|
||||||
|
if (ip.startsWith("10.") || ip.startsWith("192.168.")) {// ||
|
||||||
|
return ip;
|
||||||
|
} else {
|
||||||
|
if (ip.startsWith("172.")) {
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将数据进行解析返回每种类型对应的路径</h1>
|
||||||
|
*
|
||||||
|
* @param ecPath ec路径
|
||||||
|
* @param resinPath resin路径
|
||||||
|
* @param logTypeList 前端要获取的日志类型
|
||||||
|
* @return 转换后的数据
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/1 16:56
|
||||||
|
**/
|
||||||
|
public static List<Map<String, String>> getLogPathByLogType(String ecPath, String resinPath, List<String> logTypeList) {
|
||||||
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
|
for (String logType : logTypeList) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
LogTypeEnum typeEnum = LogTypeEnum.ENUMS.get(logType);
|
||||||
|
Integer logBelongType = typeEnum.getLogBelongType();
|
||||||
|
String logPath = typeEnum.getLogPath();
|
||||||
|
String basePath = ecPath;
|
||||||
|
if (logBelongType == 0) {
|
||||||
|
basePath = resinPath;
|
||||||
|
}
|
||||||
|
map.put("logType", logType);
|
||||||
|
map.put("path", basePath + File.separator + logPath);
|
||||||
|
map.put("key", typeEnum.getKey());
|
||||||
|
list.add(map);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @param logPath
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return <p>
|
||||||
|
* {
|
||||||
|
* "2023-07-01":{
|
||||||
|
* "http_util":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/cus/http_util/cus.log"
|
||||||
|
* ],
|
||||||
|
* "ecology":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/ecology"
|
||||||
|
* ],
|
||||||
|
* "security":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/WEB-INF/securitylog/systemRunInfo2023-07-01.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/WEB-INF/securitylog/systemSecurity2023-07-01.log"
|
||||||
|
* ],
|
||||||
|
* "util_cus":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/cus/util_cus/cus.log"
|
||||||
|
* ],
|
||||||
|
* "Resin":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/stdout.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/stderr.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/watchdog-manager.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/jvm-default.log"
|
||||||
|
* ],
|
||||||
|
* "integration":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/integration/integration.log"
|
||||||
|
* ],
|
||||||
|
* "thread":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/thread/2023-07-01"
|
||||||
|
* ],
|
||||||
|
* "sql_log":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/cus/sql_log/cus.log"
|
||||||
|
* ],
|
||||||
|
* "sql":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/sql/sqlcount_2023-07-01.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/sql/sqltime_2023-07-01.log"
|
||||||
|
* ]
|
||||||
|
* },
|
||||||
|
* "2023-07-02":{
|
||||||
|
* "http_util":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/cus/http_util/cus.log_20230702.log"
|
||||||
|
* ],
|
||||||
|
* "ecology":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/ecology_20230702.log"
|
||||||
|
* ],
|
||||||
|
* "security":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/WEB-INF/securitylog/systemRunInfo2023-07-02.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/WEB-INF/securitylog/systemSecurity2023-07-02.log"
|
||||||
|
* ],
|
||||||
|
* "util_cus":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/cus/util_cus/cus.log_20230702.log"
|
||||||
|
* ],
|
||||||
|
* "Resin":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/stdout-20230702.log.gz",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/stderr-20230702.log.gz",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/watchdog-manager.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/jvm-default.log"
|
||||||
|
* ],
|
||||||
|
* "integration":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/integration/integration.log_20230702.log"
|
||||||
|
* ],
|
||||||
|
* "thread":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/thread/2023-07-02"
|
||||||
|
* ],
|
||||||
|
* "sql_log":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/cus/sql_log/cus.log_20230702.log"
|
||||||
|
* ],
|
||||||
|
* "sql":[
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/sql/sqlcount_2023-07-02.log",
|
||||||
|
* "/Users/wangxuanran/company/project/ebu_ecology_dev1/log/sql/sqltime_2023-07-02.log"
|
||||||
|
* ]
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* </p>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/7/1 18:26
|
||||||
|
**/
|
||||||
|
public static Map<String, Map<String, List<String>>> getLogFilePath(List<Map<String, String>> logPath, String startDate, String endDate) {
|
||||||
|
Map<String, Map<String, List<String>>> res = new HashMap<>();
|
||||||
|
List<String> dateList = getDateList(startDate, endDate);
|
||||||
|
for (String date : dateList) {
|
||||||
|
Map<String, List<String>> keyMap = new HashMap<>();
|
||||||
|
for (Map<String, String> map : logPath) {
|
||||||
|
boolean isToDay = isToDay(date);
|
||||||
|
String key = map.get("key");
|
||||||
|
List<String> pathList = parseLogFilePath(key, map.get("path"), date, isToDay);
|
||||||
|
keyMap.put(key, pathList);
|
||||||
|
}
|
||||||
|
res.put(date, keyMap);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String collectLog(String ecologyPath, Map<String, Map<String, List<String>>> pathListKeyMap) throws FileNotFoundException {
|
||||||
|
FileOutputStream fos;
|
||||||
|
String outPath = ecologyPath + File.separator + "getlog" + File.separator + "log" + File.separator + (System.currentTimeMillis() / 1000);
|
||||||
|
File outFile = null;
|
||||||
|
try {
|
||||||
|
outFile = new File(outPath);
|
||||||
|
if (!outFile.exists()) {
|
||||||
|
outFile.mkdirs();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
String outLogPath = outFile + File.separator + getInnerIp() + "_downLog.zip";
|
||||||
|
fos = new FileOutputStream(outLogPath);
|
||||||
|
try {
|
||||||
|
ZipOutputStream zos = new ZipOutputStream(fos);
|
||||||
|
zos.setLevel(1);
|
||||||
|
for (Map.Entry<String, Map<String, List<String>>> entry : pathListKeyMap.entrySet()) {
|
||||||
|
String date = entry.getKey();
|
||||||
|
Map<String, List<String>> value = entry.getValue();
|
||||||
|
for (Map.Entry<String, List<String>> pathKeyList : value.entrySet()) {
|
||||||
|
String key = pathKeyList.getKey();
|
||||||
|
String basePath = date + File.separator;
|
||||||
|
List<String> pathList = pathKeyList.getValue();
|
||||||
|
for (String path : pathList) {
|
||||||
|
if ("sqllog".equals(key)) {
|
||||||
|
basePath += ("sqllog" + File.separator);
|
||||||
|
}
|
||||||
|
if ("monitorevent".equals(key)) {
|
||||||
|
basePath += ("event" + File.separator);
|
||||||
|
}
|
||||||
|
if ("monitorlog".equals(key)) {
|
||||||
|
basePath += ("monitorlog" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("cus")) {
|
||||||
|
basePath += ("cus" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("util_cus")) {
|
||||||
|
basePath += ("util_cus" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("sql_log")) {
|
||||||
|
basePath += ("sql_log" + File.separator);
|
||||||
|
}
|
||||||
|
if (key.equals("http_util")) {
|
||||||
|
basePath += ("http_util" + File.separator);
|
||||||
|
}
|
||||||
|
compressbyType(path, zos, basePath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("日志文件地址 : " + outLogPath);
|
||||||
|
|
||||||
|
try {
|
||||||
|
zos.close();
|
||||||
|
} catch (Exception es) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (fos != null) {
|
||||||
|
fos.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
return outLogPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按照原路径的类型就行压缩。文件路径直接把文件压缩
|
||||||
|
*
|
||||||
|
* @param src
|
||||||
|
* @param zos
|
||||||
|
* @param baseDir
|
||||||
|
*/
|
||||||
|
private static void compressbyType(String src, ZipOutputStream zos, String baseDir) {
|
||||||
|
File srcFile = new File(src);
|
||||||
|
if (!srcFile.exists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//判断文件是否是文件,如果是文件调用compressFile方法,如果是路径,则调用compressDir方法;
|
||||||
|
if (srcFile.isFile()) {
|
||||||
|
//src是文件,调用此方法
|
||||||
|
compressFile(srcFile, zos, baseDir);
|
||||||
|
} else if (srcFile.isDirectory()) {
|
||||||
|
compressDir(srcFile, zos, baseDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压缩文件,取后面的80M内容
|
||||||
|
*/
|
||||||
|
private static void compressFile(File file, ZipOutputStream zos, String baseDir) {
|
||||||
|
if (!file.exists())
|
||||||
|
return;
|
||||||
|
try {
|
||||||
|
RandomAccessFile fileRead = new RandomAccessFile(file, "r"); //用读模式
|
||||||
|
long fileLength = fileRead.length();//获得文件长度
|
||||||
|
if (file.getName().endsWith(".log") && fileLength > 1073741820) {//如果文件超过80M,则只取文件倒数80M内容
|
||||||
|
fileRead.seek(fileLength - 1073741820);
|
||||||
|
} else {
|
||||||
|
fileRead.seek(0);
|
||||||
|
}
|
||||||
|
ZipEntry entry = new ZipEntry(baseDir + file.getName());
|
||||||
|
zos.putNextEntry(entry);
|
||||||
|
int hasRead;
|
||||||
|
byte[] buf = new byte[1024];
|
||||||
|
while ((hasRead = fileRead.read(buf)) != -1) {
|
||||||
|
zos.write(buf, 0, hasRead);
|
||||||
|
}
|
||||||
|
fileRead.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 压缩文件夹
|
||||||
|
*/
|
||||||
|
private static void compressDir(File dir, ZipOutputStream zos, String baseDir) {
|
||||||
|
if (!dir.exists())
|
||||||
|
return;
|
||||||
|
File[] files = dir.listFiles();
|
||||||
|
for (int i = 0; i < files.length; i++) {
|
||||||
|
File file = files[i];
|
||||||
|
compressFile(file, zos, baseDir + dir.getName() + File.separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static List<String> parseLogFilePath(String key, String path, String date, boolean isToDay) {
|
||||||
|
List list = new ArrayList();
|
||||||
|
if ("thread".equals(key)) {
|
||||||
|
list.add(path + File.separator + date);
|
||||||
|
} else if ("mem".equals(key)) {
|
||||||
|
list.add(path + File.separator + "memory_" + date + ".log");
|
||||||
|
} else if ("ecology".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "ecology");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "ecology_" + getDateStr(date) + ".log");
|
||||||
|
}
|
||||||
|
} else if ("sql".equals(key)) {
|
||||||
|
list.add(path + File.separator + "sqlcount_" + date + ".log");
|
||||||
|
list.add(path + File.separator + "sqltime_" + date + ".log");
|
||||||
|
} else if ("integration".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "integration.log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "integration.log_" + getDateStr(date) + ".log");
|
||||||
|
}
|
||||||
|
} else if ("security".equals(key)) {
|
||||||
|
list.add(path + File.separator + "systemRunInfo" + date + ".log");
|
||||||
|
list.add(path + File.separator + "systemSecurity" + date + ".log");
|
||||||
|
} else if ("Resin".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "stdout.log");
|
||||||
|
list.add(path + File.separator + "stderr.log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "stdout-" + getDateStr(date) + ".log.gz");
|
||||||
|
list.add(path + File.separator + "stderr-" + getDateStr(date) + ".log.gz");
|
||||||
|
}
|
||||||
|
list.add(path + File.separator + "watchdog-manager.log");
|
||||||
|
list.add(path + File.separator + "jvm-default.log");
|
||||||
|
} else if ("sqllog".equals(key)) {
|
||||||
|
list.add(path + File.separator + getSqlPathByDate(date));
|
||||||
|
list.add(path + File.separator);
|
||||||
|
} else if ("monitorevent".equals(key)) {
|
||||||
|
list.addAll(eventLog(path, date));
|
||||||
|
} else if ("monitorPool".equals(key)) {
|
||||||
|
list.add(path + File.separator + "pool_" + getDateStr(date) + "_ecology.log");
|
||||||
|
list.add(path + File.separator + "pool_" + getDateStr(date) + "_ecology.zip");
|
||||||
|
} else if ("monitorlog".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "stdout.log");
|
||||||
|
list.add(path + File.separator + "stderr-log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "stdout-" + getDateStr(date) + ".log.gz");
|
||||||
|
list.add(path + File.separator + "stderr-" + getDateStr(date) + ".log.gz");
|
||||||
|
}
|
||||||
|
} else if ("monitorconcurrent".equals(key)) {
|
||||||
|
list.add(path + File.separator + "concurrent_" + getDateStr(date) + ".log");
|
||||||
|
list.add(path + File.separator + "concurrent_" + getDateStr(date) + ".zip");
|
||||||
|
} else if ("monitorcpu".equals(key)) {
|
||||||
|
list.add(path + File.separator + "cpu_" + getDateStr(date) + ".log");
|
||||||
|
list.add(path + File.separator + "cpu_" + getDateStr(date) + ".zip");
|
||||||
|
} else if ("resinconf".equals(key)) {
|
||||||
|
list.add(path);
|
||||||
|
} else if ("ecoloyweaver".equals(key)) {
|
||||||
|
dealWidthWeaverProp(path + "weaver.properties", new File(path + "weaversecurity.properties"));
|
||||||
|
list.add(path + "weaversecurity.properties");
|
||||||
|
} else if ("cus".equals(key) || "util_cus".equals(key) || "sql_log".equals(key) || "http_util".equals(key)) {
|
||||||
|
if (isToDay) {
|
||||||
|
list.add(path + File.separator + "cus.log");
|
||||||
|
} else {
|
||||||
|
list.add(path + File.separator + "cus.log_" + getDateStr(date) + ".log");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List eventLog(String path, String date) {
|
||||||
|
List list = new ArrayList();
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
File[] filelists = new File(path).listFiles();
|
||||||
|
date = getDateStr(date);
|
||||||
|
for (int i = 0; i < filelists.length; i++) {
|
||||||
|
File filelist = filelists[i];
|
||||||
|
if (filelist.getName().indexOf(date) != -1) {
|
||||||
|
list.add(filelist.getAbsolutePath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getSqlPathByDate(String date) {
|
||||||
|
return date.replace("-", File.separator);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getDateStr(String date) {
|
||||||
|
date = date.replaceAll("-", "");
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isToDay(String date) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String toDay = sdf.format(new Date());
|
||||||
|
return date.equals(toDay);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static List<String> getDateList(String startDate, String endDate) {
|
||||||
|
List<String> list = new ArrayList<>();
|
||||||
|
try {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
Date start = sdf.parse(startDate);
|
||||||
|
Date end = sdf.parse(endDate);
|
||||||
|
Calendar tempStart = Calendar.getInstance();
|
||||||
|
tempStart.setTime(start);
|
||||||
|
while (start.getTime() <= end.getTime()) {
|
||||||
|
list.add(sdf.format(tempStart.getTime()));
|
||||||
|
tempStart.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
start = tempStart.getTime();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void dealWidthWeaverProp(String path, File outFile) {//处理weaver.prop密码问题
|
||||||
|
File file = new File(path);
|
||||||
|
if (!file.exists()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
InputStreamReader reader = null;
|
||||||
|
java.io.Writer outWriter = null;
|
||||||
|
try {
|
||||||
|
if (!file.exists()) {
|
||||||
|
file.createNewFile();
|
||||||
|
}
|
||||||
|
Properties registerProp = new Properties();
|
||||||
|
reader = new InputStreamReader(new FileInputStream(file));
|
||||||
|
registerProp.load(reader);
|
||||||
|
reader.close();
|
||||||
|
outWriter = new FileWriter(outFile);
|
||||||
|
registerProp.put("ecology.password", "***********");
|
||||||
|
registerProp.store(outWriter, "");
|
||||||
|
outWriter.close();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
if (reader != null) {
|
||||||
|
reader.close();
|
||||||
|
}
|
||||||
|
if (outWriter != null) {
|
||||||
|
outWriter.close();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
package com.api.nonstandardext.ey.job;
|
||||||
|
|
||||||
|
import com.api.nonstandardext.ey.mode.BadDebtProvisionDt3;
|
||||||
|
import com.api.nonstandardext.ey.utils.EyLogger;
|
||||||
|
import com.api.nonstandardext.model_field_async.service.ModelFieldAsyncServiceImpl;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 管报 开始执行坏账计提将主表参数携带到明细表3中定时任务
|
||||||
|
*
|
||||||
|
* 计划任务-每周执行一次
|
||||||
|
*
|
||||||
|
* 获取账单台账;uf_zdjmbd 中账单状态invoiceStatus 为0(Open)且 当前日期-子账单计提开始计算日期>=180天的,
|
||||||
|
*
|
||||||
|
* 在该条数据的明细表3中插入一条新的数据,如果存在手动的更新为自动
|
||||||
|
*
|
||||||
|
* 账单台账.明细表3中的数据 来源于 账单台账主表,对应关系详见开发点4
|
||||||
|
* @Description
|
||||||
|
* @Author 贾寒旭
|
||||||
|
* @Date 2023/3/21
|
||||||
|
* @Other
|
||||||
|
* @Version
|
||||||
|
*/
|
||||||
|
public class BadDebtProvisionSynJob extends BaseCronJob {
|
||||||
|
|
||||||
|
private static final EyLogger logger = new EyLogger();
|
||||||
|
|
||||||
|
private final static String JobName = " BadDebtProvisionSynJob V2 , ";
|
||||||
|
|
||||||
|
private final ModelFieldAsyncServiceImpl service = new ModelFieldAsyncServiceImpl();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " >>>>>>");
|
||||||
|
|
||||||
|
//首先查询账单台账,在其中进行查询获得到指定的数据
|
||||||
|
//账单请求类型:只取0、1、2、3、5
|
||||||
|
//以及账单号前三个字母,包含MCN、MHK
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
RecordSet innerRs = new RecordSet();
|
||||||
|
RecordSet updateRs = new RecordSet();
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
String dateSql = "select * from uf_gbrqgz";
|
||||||
|
innerRs.executeQuery(dateSql);
|
||||||
|
int gbscts = 0;
|
||||||
|
while (innerRs.next()) {
|
||||||
|
gbscts = Util.getIntValue(innerRs.getString("gbscts"), 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
String sql = "select m.id, d.bu bu,m.customerCode customerCode,m.requestType requestType,m.invoiceNo invoiceNo," +
|
||||||
|
"m.customerName customerName," +
|
||||||
|
"m.finishedTime finishedTime,m.orifinishedTime orifinishedTime,m.hzjtyqz hzjtyqz," +
|
||||||
|
"d.totalAmount totalAmount,d.skzt skzt,d.yskje yskje,d.qskje qskje,d.wskje wskje," +
|
||||||
|
"m.kpzt kpzt,m.sckprq sckprq,m.ykpje ykpje,m.wkpje wkpje,d.jtksjsrq as computeDate " +
|
||||||
|
"from uf_zdjmbd m left join uf_zdjmbd_dt1 d on d.mainid = m.id where m.invoiceStatus = 0";
|
||||||
|
|
||||||
|
rs.executeQuery(sql);
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " gbscts:" + gbscts + ", rs count:" + rs.getCounts() + " , sql=====" + sql);
|
||||||
|
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String format = sf.format(new Date());
|
||||||
|
|
||||||
|
while (rs.next()) {
|
||||||
|
String id = rs.getString("id");
|
||||||
|
String customerName = rs.getString("customerName");//客户名称
|
||||||
|
String computeDate = rs.getString("computeDate");
|
||||||
|
String requestType = rs.getString("requestType");
|
||||||
|
String invoiceNo = rs.getString("invoiceNo");
|
||||||
|
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + "customerName:" + customerName + ", computeDate:" + computeDate + ", requestType:" + requestType + ", invoiceNo:" + invoiceNo);
|
||||||
|
|
||||||
|
long daysBetween = 0;
|
||||||
|
|
||||||
|
if (!"".equals(computeDate)) {
|
||||||
|
LocalDate date1 = LocalDate.parse(format);
|
||||||
|
LocalDate date2 = LocalDate.parse(computeDate);
|
||||||
|
daysBetween = Math.abs(ChronoUnit.DAYS.between(date1, date2));
|
||||||
|
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + ", computeDate:" + computeDate + ", daysBetween:" + daysBetween + ", gbscts:" + gbscts);
|
||||||
|
|
||||||
|
if (daysBetween >= gbscts) {
|
||||||
|
|
||||||
|
String existSql = "select * from uf_zdjmbd_dt3 where (tszt is null or tszt=0) and mainid=" + id;
|
||||||
|
innerRs.execute(existSql);
|
||||||
|
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " innerRs count : " + innerRs.getCounts() + ",existSql:" + existSql);
|
||||||
|
if (innerRs.getCounts() > 0){
|
||||||
|
updateRs.execute("update uf_zdjmbd_dt3 set tszt=1 where (tszt is null or tszt=0) and mainid=" + id);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String customerCode = rs.getString("customerCode");//客户编码
|
||||||
|
String bu = rs.getString("bu");//客户编码
|
||||||
|
|
||||||
|
BadDebtProvisionDt3 dt3 = new BadDebtProvisionDt3();
|
||||||
|
dt3.setMainId(id);
|
||||||
|
dt3.setCustomerCode(customerCode);
|
||||||
|
dt3.setCustomerName(customerName);
|
||||||
|
dt3.setGroup_invoice_no(rs.getString("groupinvoiceno")); //组账单ID
|
||||||
|
dt3.setInvoiceNo(rs.getString("invoiceNo")); //账单ID
|
||||||
|
dt3.setFinishedTime(rs.getString("finishedTime")); //账单开具日期
|
||||||
|
dt3.setOrifinishedTime(rs.getString("orifinishedTime")); //原账单开具日期
|
||||||
|
dt3.setSqjtyqrq(rs.getString("hzjtyqz")); //申请计提延期日期 取 坏账计提延期至
|
||||||
|
dt3.setZdje(rs.getString("totalAmount")); //账单金额
|
||||||
|
dt3.setSkzt(rs.getString("skzt")); //收款状态
|
||||||
|
dt3.setYskje(rs.getString("yskje")); //已收款金额
|
||||||
|
dt3.setQskje(rs.getString("qskje")); //其他收款金额
|
||||||
|
dt3.setWskje(rs.getString("wskje")); //未收款金额
|
||||||
|
dt3.setKpzt(rs.getString("kpzt")); //开票状态
|
||||||
|
dt3.setSckprq(rs.getString("sckprq")); //首次开票日期
|
||||||
|
dt3.setYkpje(rs.getString("ykpje")); //已开票金额
|
||||||
|
dt3.setWkpje(rs.getString("wkpje")); //未开票金额
|
||||||
|
dt3.setJyjtje(dt3.getWskje()); //建议计提金额
|
||||||
|
dt3.setSjjtje(dt3.getWskje()); //实际计提金额
|
||||||
|
dt3.setBu(bu); //bu
|
||||||
|
dt3.setTszt("1"); //状态
|
||||||
|
|
||||||
|
dt3.save(dt3, "uf_zdjmbd_dt3");
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " dt3 : " + dt3.toString());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过配置同步字段
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023-06-27
|
||||||
|
*/
|
||||||
|
service.asyncDataByClassName(this.getClass().getSimpleName(), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " exception : " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,251 @@
|
||||||
|
package com.api.nonstandardext.ey.job;
|
||||||
|
|
||||||
|
import com.api.nonstandardext.ey.utils.EyLogger;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.interfaces.schedule.BaseCronJob;
|
||||||
|
import weaver.workflow.webservices.*;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 法报
|
||||||
|
* 执行频率:
|
||||||
|
* @Description
|
||||||
|
* @Author 贾寒旭
|
||||||
|
* @Date 2023/3/20
|
||||||
|
* @Other
|
||||||
|
* @Version从银行流水到收款单
|
||||||
|
*/
|
||||||
|
public class BankJournalToCollectSynJob extends BaseCronJob {
|
||||||
|
|
||||||
|
private static final EyLogger logger = new EyLogger();
|
||||||
|
|
||||||
|
private final static String JobName = " BankJournalToCollectSynJob V1 ,";
|
||||||
|
|
||||||
|
private String workflowId;
|
||||||
|
|
||||||
|
public String getWorkflowId() {
|
||||||
|
return workflowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkflowId(String workflowId) {
|
||||||
|
this.workflowId = workflowId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始执行从银行流水到收款单定时任务
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void execute() {
|
||||||
|
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " >>>>>> start");
|
||||||
|
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
RecordSet innerRs = new RecordSet();
|
||||||
|
try {
|
||||||
|
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
||||||
|
String format = sf.format(new Date());
|
||||||
|
String sql = "select * from uf_yhjylsjmbd where szfx = '0'";
|
||||||
|
|
||||||
|
rs.executeQuery(sql);
|
||||||
|
while (rs.next()) {
|
||||||
|
String jylsh = rs.getString("jylsh");//交易流水号对应流程表单上的银行流水id
|
||||||
|
|
||||||
|
String qsql = "select * from formtable_main_257 where yhlsid = ?";
|
||||||
|
innerRs.executeQuery(qsql, jylsh);
|
||||||
|
if (innerRs.next()) {
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + " exists receipt workflow can not create >>>>");
|
||||||
|
} else {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
String dfhm = rs.getString("dfhm");//对方账户名fkrmc
|
||||||
|
String dfzh = rs.getString("dfzh");//对方账号fkrzh
|
||||||
|
String dfyhmc = rs.getString("dfyhmc");//对方银行名称fkrkhh
|
||||||
|
String jyhm = rs.getString("jyhm");//交易户名skfmc
|
||||||
|
String jyzh = rs.getString("jyzh");//交易账号skfzh
|
||||||
|
String jyyhmc = rs.getString("jyyhmc");//交易银行名称skrkhh
|
||||||
|
String bb = rs.getString("bb");//币别bb
|
||||||
|
String szlx = rs.getString("szfx");//收支方向szlx
|
||||||
|
String jyfse = rs.getString("jyfse");//交易发生额jyje
|
||||||
|
String zy = rs.getString("zy");//摘要zy
|
||||||
|
String jyrq = rs.getString("jyrq");//交易日期jyrq
|
||||||
|
String jysj = rs.getString("jysj");//交易时间jysj
|
||||||
|
String jylsh1 = rs.getString("jylsh");//交易流水号yhlsid
|
||||||
|
String bz = rs.getString("bz");//备注bz
|
||||||
|
String ywrq = format;
|
||||||
|
map.put("fkrmc", dfhm);
|
||||||
|
map.put("fkrzh", dfzh);
|
||||||
|
map.put("fkrkhh", dfyhmc);
|
||||||
|
map.put("skfmc", jyhm);
|
||||||
|
map.put("skfzh", jyzh);
|
||||||
|
map.put("skrkhh", jyyhmc);
|
||||||
|
map.put("bb", bb);
|
||||||
|
map.put("szlx", szlx);
|
||||||
|
map.put("jyje", jyfse);
|
||||||
|
map.put("jyrq", jyrq);
|
||||||
|
map.put("jysj", jysj);
|
||||||
|
map.put("yhlsid", jylsh1);
|
||||||
|
map.put("bz", bz);
|
||||||
|
map.put("zy", zy);
|
||||||
|
map.put("ywrq", ywrq);
|
||||||
|
map.put("sfyyhls", "0");
|
||||||
|
map.put("sfxyepemqr", "1");
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " main data map=" + map);
|
||||||
|
//将(摘要)zy字段进行拆分
|
||||||
|
List<Map<String, String>> zyMap = cfzy(zy);
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + "zyMap=====" + zyMap);
|
||||||
|
//创建流程
|
||||||
|
//获得主表信息
|
||||||
|
WorkflowMainTableInfo workflowMainTableInfo = getMainInfo(map);
|
||||||
|
//获得明细表信息
|
||||||
|
WorkflowDetailTableInfo[] detail_tableinfo = null;
|
||||||
|
if (!zyMap.isEmpty()) {
|
||||||
|
detail_tableinfo = getDetailInfo(zyMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
//创建流程工作 创建流程时为必输项
|
||||||
|
String requestName = "收款认领流程";
|
||||||
|
WorkflowRequestInfo workflowRequestInfo = new WorkflowRequestInfo();//工作流程请求信息
|
||||||
|
WorkflowBaseInfo workflowBaseInfo = new WorkflowBaseInfo();//工作流信息
|
||||||
|
workflowRequestInfo.setWorkflowMainTableInfo(workflowMainTableInfo);//添加主表字段数据
|
||||||
|
if (detail_tableinfo != null) {
|
||||||
|
workflowRequestInfo.setWorkflowDetailTableInfos(detail_tableinfo);//添加明细数据
|
||||||
|
}
|
||||||
|
workflowRequestInfo.setCreatorId("1");//创建者ID 创建流程时为必输项
|
||||||
|
workflowRequestInfo.setRequestName(requestName);
|
||||||
|
workflowBaseInfo.setWorkflowId(getWorkflowId());//流程ID
|
||||||
|
workflowRequestInfo.setWorkflowBaseInfo(workflowBaseInfo);//工作流信息
|
||||||
|
workflowRequestInfo.setIsnextflow("0");//停留在当前节点,1代表流转下一节点
|
||||||
|
/**提交流程*/
|
||||||
|
WorkflowService service = new WorkflowServiceImpl();
|
||||||
|
String requestid1 = service.doCreateWorkflowRequest(workflowRequestInfo, 1);
|
||||||
|
String statusCode = Util.null2String(service.submitWorkflowRequest(workflowRequestInfo, Integer.parseInt(requestid1), 1, "save", ""));
|
||||||
|
String statusCode1 = Util.null2String(service.submitWorkflowRequest(workflowRequestInfo, Integer.parseInt(requestid1), 1, "submit", ""));
|
||||||
|
logger.writeLogInfo( this.getClass().getName(),JobName + " submit requestid1 : " + requestid1 + " statusCode: " + statusCode + " statusCode1 : " + statusCode1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e){
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + " exception: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组装明细表数据
|
||||||
|
* @return
|
||||||
|
* @param zyMap
|
||||||
|
*/
|
||||||
|
public WorkflowDetailTableInfo[] getDetailInfo(List<Map<String, String>> zyMap) throws Exception{
|
||||||
|
//设置明细表字段
|
||||||
|
int index = Integer.parseInt("1"); //获取子表封装的表
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>create detail data>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
WorkflowDetailTableInfo[] detail_tableinfo = new WorkflowDetailTableInfo[index];//定义一个明细表对象
|
||||||
|
WorkflowRequestTableRecord[] detil_wrtri = new WorkflowRequestTableRecord[zyMap.size()];//创建多少行明细数据
|
||||||
|
List<WorkflowRequestTableField> dwrs = null; //一行
|
||||||
|
WorkflowRequestTableField det_wrti = null; //一个字段
|
||||||
|
int rownum = 0;
|
||||||
|
for (Map<String, String> map : zyMap) {
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + "get map data" + map);
|
||||||
|
dwrs = new ArrayList<>();
|
||||||
|
for (String key : map.keySet()) {
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + "current map key" + key);
|
||||||
|
det_wrti = new WorkflowRequestTableField();
|
||||||
|
String value = Util.null2String(map.get(key));//原字段字段值
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + "value==="+value);
|
||||||
|
det_wrti.setFieldName(key);//目标字段字段
|
||||||
|
det_wrti.setFieldValue(value);
|
||||||
|
det_wrti.setView(true);
|
||||||
|
det_wrti.setEdit(true);
|
||||||
|
dwrs.add(det_wrti);
|
||||||
|
}
|
||||||
|
WorkflowRequestTableField[] workflowRequestTableFields = new WorkflowRequestTableField[dwrs.size()];
|
||||||
|
for (int i = 0; i < dwrs.size(); i++) {
|
||||||
|
workflowRequestTableFields[i] = dwrs.get(i);
|
||||||
|
}
|
||||||
|
detil_wrtri[rownum] = new WorkflowRequestTableRecord();
|
||||||
|
detil_wrtri[rownum].setWorkflowRequestTableFields(workflowRequestTableFields);
|
||||||
|
rownum++;
|
||||||
|
//将明细数据加入明细表index - 1中 从0开始
|
||||||
|
detail_tableinfo[index - 1] = new WorkflowDetailTableInfo();
|
||||||
|
detail_tableinfo[index - 1].setWorkflowRequestTableRecords(detil_wrtri);
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + "create detail data end " + detail_tableinfo);
|
||||||
|
}
|
||||||
|
return detail_tableinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拆分摘要
|
||||||
|
* @param zy
|
||||||
|
*/
|
||||||
|
public List<Map<String, String>> cfzy(String zy) throws Exception{
|
||||||
|
// 账单号:ICSV*******;客户编号:***;客户名称:****;账单号:ICSV*******;客户编号:***;客户名称:****;
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + " zhai yao : " + zy);
|
||||||
|
String[] strings = zy.split(" ");
|
||||||
|
List<Map<String, String>> list = new ArrayList<>();
|
||||||
|
for (int i = 0; i < strings.length; i++) {
|
||||||
|
Map<String, String> map = new HashMap<>();
|
||||||
|
if(strings[i].toLowerCase().length()==14){
|
||||||
|
if (strings[i].toUpperCase().contains("ICN")
|
||||||
|
||strings[i].toUpperCase().contains("XCN")
|
||||||
|
||strings[i].toUpperCase().contains("RCN")
|
||||||
|
||strings[i].toUpperCase().contains("MCN")
|
||||||
|
||strings[i].toUpperCase().contains("WCN")) {
|
||||||
|
String zdh = strings[i].toUpperCase();
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + "zdh===" + zdh);
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String sql = "select id from uf_zdjmbd where invoiceNo = ?";
|
||||||
|
rs.executeQuery(sql, zdh);
|
||||||
|
String id = "";
|
||||||
|
while (rs.next()) {
|
||||||
|
id = rs.getString("id");
|
||||||
|
}
|
||||||
|
//TODO 流程明细表没有对应字段
|
||||||
|
map.put("zdh", id);
|
||||||
|
// map.put("khbh", khbh);
|
||||||
|
// map.put("khmc", khmc);
|
||||||
|
map.put("zdhwb", zdh);
|
||||||
|
list.add(map);
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + ", map size:" + map.size());
|
||||||
|
}
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + ",list size:" + list.size());
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组装主表数据
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WorkflowMainTableInfo getMainInfo(Map<String, String> map) {
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>create main data start>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||||
|
WorkflowMainTableInfo workflowMainTableInfo = new WorkflowMainTableInfo();//定义一个主表对象
|
||||||
|
WorkflowRequestTableRecord[] workflowRequestTableRecord = new WorkflowRequestTableRecord[1];//创建多少行主表数据
|
||||||
|
List<WorkflowRequestTableField> main_dwrs = new ArrayList<WorkflowRequestTableField>();//一行
|
||||||
|
WorkflowRequestTableField main_det_wrti = null;
|
||||||
|
for (String s : map.keySet()) {
|
||||||
|
main_det_wrti = new WorkflowRequestTableField();//一个字段
|
||||||
|
String value = map.get(s);
|
||||||
|
main_det_wrti.setFieldName(s);
|
||||||
|
main_det_wrti.setFieldValue(value);
|
||||||
|
main_det_wrti.setView(true);
|
||||||
|
main_det_wrti.setEdit(true);
|
||||||
|
main_dwrs.add(main_det_wrti);
|
||||||
|
}
|
||||||
|
WorkflowRequestTableField[] workflowRequestTableFields = new WorkflowRequestTableField[main_dwrs.size()];
|
||||||
|
for (int i = 0; i < main_dwrs.size(); i++) {
|
||||||
|
workflowRequestTableFields[i] = main_dwrs.get(i);
|
||||||
|
}
|
||||||
|
workflowRequestTableRecord[0] = new WorkflowRequestTableRecord();
|
||||||
|
workflowRequestTableRecord[0].setWorkflowRequestTableFields(workflowRequestTableFields);
|
||||||
|
workflowMainTableInfo.setRequestRecords(workflowRequestTableRecord);
|
||||||
|
logger.writeLogInfo( this.getClass().getName(), JobName + "create main data end>>>>>>>>>>>>>>>>>>>>>>>>>" + workflowMainTableInfo);
|
||||||
|
return workflowMainTableInfo;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,313 @@
|
||||||
|
package com.api.nonstandardext.ey.mode;
|
||||||
|
|
||||||
|
import com.api.nonstandardext.ey.utils.EyLogger;
|
||||||
|
import com.weaver.general.BaseBean;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
|
public class BadDebtProvisionDt3 extends BaseBean {
|
||||||
|
|
||||||
|
private static final EyLogger logger = new EyLogger();
|
||||||
|
|
||||||
|
private String mainId;
|
||||||
|
|
||||||
|
private String customerCode;
|
||||||
|
|
||||||
|
private String customerName;
|
||||||
|
|
||||||
|
private String group_invoice_no;
|
||||||
|
|
||||||
|
private String invoiceNo;
|
||||||
|
|
||||||
|
private String finishedTime;
|
||||||
|
|
||||||
|
private String orifinishedTime;
|
||||||
|
|
||||||
|
private String sqjtyqrq;
|
||||||
|
|
||||||
|
private String zdje;
|
||||||
|
|
||||||
|
private String skzt;
|
||||||
|
|
||||||
|
private String yskje;
|
||||||
|
|
||||||
|
private String qskje;
|
||||||
|
|
||||||
|
private String wskje;
|
||||||
|
|
||||||
|
private String kpzt;
|
||||||
|
|
||||||
|
private String sckprq;
|
||||||
|
|
||||||
|
private String ykpje;
|
||||||
|
|
||||||
|
private String wkpje;
|
||||||
|
|
||||||
|
private String jyjtje;
|
||||||
|
|
||||||
|
private String sjjtje;
|
||||||
|
|
||||||
|
private String bu;
|
||||||
|
|
||||||
|
private String tszt;
|
||||||
|
|
||||||
|
public Integer save(BadDebtProvisionDt3 ufModel, String tableName) {
|
||||||
|
String modelName = "管报明细";
|
||||||
|
Integer mainId = null;
|
||||||
|
try {
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
String fieldSql = "";
|
||||||
|
String valueSql = "";
|
||||||
|
boolean result = false;
|
||||||
|
|
||||||
|
// 获取实体类的所有属性,返回Field数组
|
||||||
|
Field[] field = ufModel.getClass().getDeclaredFields();
|
||||||
|
// 遍历所有属性
|
||||||
|
for (int i = 0; i < field.length; i++) {
|
||||||
|
// 获取属性的名字,并将属性第一个字符大写
|
||||||
|
String name = field[i].getName();
|
||||||
|
name = name.substring(0, 1).toUpperCase() + name.substring(1);
|
||||||
|
// 得到属性类型
|
||||||
|
String type = field[i].getGenericType().toString();
|
||||||
|
if (type.equals("class java.lang.String")) {
|
||||||
|
Method m = ufModel.getClass().getMethod("get" + name);
|
||||||
|
// 调用getter方法获取属性值
|
||||||
|
String value = (String) m.invoke(ufModel);
|
||||||
|
if (value != null) {
|
||||||
|
if ("".equals(value)){
|
||||||
|
fieldSql += "," + name;
|
||||||
|
valueSql += ",null";
|
||||||
|
} else {
|
||||||
|
fieldSql += "," + name;
|
||||||
|
valueSql += ",'" + value.trim() + "'";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (type.equals("class java.lang.Integer")) {
|
||||||
|
Method m = ufModel.getClass().getMethod("get" + name);
|
||||||
|
// 调用getter方法获取属性值
|
||||||
|
Integer value = (Integer) m.invoke(ufModel);
|
||||||
|
if (value != null) {
|
||||||
|
fieldSql += "," + name;
|
||||||
|
valueSql += "," + value + "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!"".equals(fieldSql)) {
|
||||||
|
fieldSql = fieldSql.substring(1);
|
||||||
|
valueSql = valueSql.substring(1);
|
||||||
|
String insertSql = "insert into " + tableName + " (" + fieldSql + ") values (" + valueSql + ")";
|
||||||
|
|
||||||
|
logger.writeLogInfo( this.getClass().getName()," insertSql : " + insertSql);
|
||||||
|
|
||||||
|
result = rs.execute(insertSql);
|
||||||
|
if (!result) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
writeLog(modelName + ", insertSql ->" + insertSql + ", result:" + result);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
writeLog(modelName + ", 新增报错 ->" + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return mainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainId() {
|
||||||
|
return mainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainId(String mainId) {
|
||||||
|
this.mainId = mainId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomerCode() {
|
||||||
|
return customerCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerCode(String customerCode) {
|
||||||
|
this.customerCode = customerCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCustomerName() {
|
||||||
|
return customerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCustomerName(String customerName) {
|
||||||
|
this.customerName = customerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getGroup_invoice_no() {
|
||||||
|
return group_invoice_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroup_invoice_no(String group_invoice_no) {
|
||||||
|
this.group_invoice_no = group_invoice_no;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getInvoiceNo() {
|
||||||
|
return invoiceNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvoiceNo(String invoiceNo) {
|
||||||
|
this.invoiceNo = invoiceNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFinishedTime() {
|
||||||
|
return finishedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFinishedTime(String finishedTime) {
|
||||||
|
this.finishedTime = finishedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrifinishedTime() {
|
||||||
|
return orifinishedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrifinishedTime(String orifinishedTime) {
|
||||||
|
this.orifinishedTime = orifinishedTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSqjtyqrq() {
|
||||||
|
return sqjtyqrq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSqjtyqrq(String sqjtyqrq) {
|
||||||
|
this.sqjtyqrq = sqjtyqrq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getZdje() {
|
||||||
|
return zdje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZdje(String zdje) {
|
||||||
|
this.zdje = zdje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSkzt() {
|
||||||
|
return skzt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSkzt(String skzt) {
|
||||||
|
this.skzt = skzt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYskje() {
|
||||||
|
return yskje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYskje(String yskje) {
|
||||||
|
this.yskje = yskje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getQskje() {
|
||||||
|
return qskje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setQskje(String qskje) {
|
||||||
|
this.qskje = qskje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWskje() {
|
||||||
|
return wskje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWskje(String wskje) {
|
||||||
|
this.wskje = wskje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKpzt() {
|
||||||
|
return kpzt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKpzt(String kpzt) {
|
||||||
|
this.kpzt = kpzt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSckprq() {
|
||||||
|
return sckprq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSckprq(String sckprq) {
|
||||||
|
this.sckprq = sckprq;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getYkpje() {
|
||||||
|
return ykpje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setYkpje(String ykpje) {
|
||||||
|
this.ykpje = ykpje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWkpje() {
|
||||||
|
return wkpje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWkpje(String wkpje) {
|
||||||
|
this.wkpje = wkpje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJyjtje() {
|
||||||
|
return jyjtje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJyjtje(String jyjtje) {
|
||||||
|
this.jyjtje = jyjtje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSjjtje() {
|
||||||
|
return sjjtje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSjjtje(String sjjtje) {
|
||||||
|
this.sjjtje = sjjtje;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBu() {
|
||||||
|
return bu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBu(String bu) {
|
||||||
|
this.bu = bu;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTszt() {
|
||||||
|
return tszt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTszt(String tszt) {
|
||||||
|
this.tszt = tszt;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "BadDebtProvisionDt3{" +
|
||||||
|
"mainId='" + mainId + '\'' +
|
||||||
|
", customerCode='" + customerCode + '\'' +
|
||||||
|
", customerName='" + customerName + '\'' +
|
||||||
|
", group_invoice_no='" + group_invoice_no + '\'' +
|
||||||
|
", invoiceNo='" + invoiceNo + '\'' +
|
||||||
|
", finishedTime='" + finishedTime + '\'' +
|
||||||
|
", orifinishedTime='" + orifinishedTime + '\'' +
|
||||||
|
", sqjtyqrq='" + sqjtyqrq + '\'' +
|
||||||
|
", zdje='" + zdje + '\'' +
|
||||||
|
", skzt='" + skzt + '\'' +
|
||||||
|
", yskje='" + yskje + '\'' +
|
||||||
|
", qskje='" + qskje + '\'' +
|
||||||
|
", wskje='" + wskje + '\'' +
|
||||||
|
", kpzt='" + kpzt + '\'' +
|
||||||
|
", sckprq='" + sckprq + '\'' +
|
||||||
|
", ykpje='" + ykpje + '\'' +
|
||||||
|
", wkpje='" + wkpje + '\'' +
|
||||||
|
", jyjtje='" + jyjtje + '\'' +
|
||||||
|
", sjjtje='" + sjjtje + '\'' +
|
||||||
|
", bu='" + bu + '\'' +
|
||||||
|
", tszt='" + tszt + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,93 @@
|
||||||
|
package com.api.nonstandardext.ey.utils;
|
||||||
|
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.GCONST;
|
||||||
|
import weaver.general.TimeUtil;
|
||||||
|
import weaver.general.Util;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
|
||||||
|
public class EyLogger extends BaseBean{
|
||||||
|
|
||||||
|
boolean isDebug = false;
|
||||||
|
|
||||||
|
public EyLogger() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 构造方法
|
||||||
|
*/
|
||||||
|
public EyLogger(RecordSet rs) {
|
||||||
|
String logSql = "select value from uf_systemconfig where config_key = 'DebugLogger'";
|
||||||
|
rs.execute(logSql);
|
||||||
|
if (rs.next()){
|
||||||
|
String valule = Util.null2String(rs.getString("value"));
|
||||||
|
if("1".equals(valule)){
|
||||||
|
isDebug = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写入同步的日志文件
|
||||||
|
*/
|
||||||
|
public void writeLogInfo(String o,String s){
|
||||||
|
BufferedWriter out = null;
|
||||||
|
try {
|
||||||
|
String filename = "ey_" + TimeUtil.getCurrentDateString() + "_ecology.log";
|
||||||
|
|
||||||
|
String folder = GCONST.getRootPath() + "log" + File.separatorChar + "ey_dev_log";
|
||||||
|
|
||||||
|
//this.writeDebugLog("folder:[" + folder + "]");
|
||||||
|
|
||||||
|
File f = new File(folder);
|
||||||
|
|
||||||
|
// 创建文件夹
|
||||||
|
if (!f.exists()) {
|
||||||
|
f.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
f = new File(folder + File.separatorChar + filename);
|
||||||
|
|
||||||
|
if(!f.exists()){//文件不存在,则直接创建
|
||||||
|
f.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f, true)));
|
||||||
|
|
||||||
|
out.write("[" + o.getClass() + "][" + TimeUtil.getCurrentTimeString() + "]:"+ s + "\r\n");
|
||||||
|
|
||||||
|
//关闭写入流
|
||||||
|
if (out != null){
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
if (out != null){
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
} catch (IOException ioException) {
|
||||||
|
ioException.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
|
this.writeDebugLog("创建日志文件存在异常:[" + e.getMessage() + "/" + e.toString() + "]");
|
||||||
|
} finally {
|
||||||
|
if (out != null){
|
||||||
|
try {
|
||||||
|
out.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeDebugLog(Object logstr){
|
||||||
|
if(isDebug){
|
||||||
|
this.writeLog(logstr.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>配置主表对象</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/26 14:33
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ModelFieldAsyncConfig {
|
||||||
|
private String modelTable;
|
||||||
|
private String onlyMark;
|
||||||
|
private String cusWhereSql;
|
||||||
|
private String tableName;
|
||||||
|
private List<ModelFieldAsyncConfigDetail> configDetailList;
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>建模字段同步执行类配置</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/27 10:18
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ModelFieldAsyncConfigClass {
|
||||||
|
private String onlyMark;
|
||||||
|
private String className;
|
||||||
|
private String detailIndex;
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>配置明细对象</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/26 14:34
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ModelFieldAsyncConfigDetail {
|
||||||
|
private String detailIndex;
|
||||||
|
private String targetField;
|
||||||
|
private String valueField;
|
||||||
|
private int getValueType;
|
||||||
|
private String valueContext;
|
||||||
|
private String targetFieldName;
|
||||||
|
private String valueFieldName;
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.interfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>三个参数的函数接口</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/28 10:06
|
||||||
|
*/
|
||||||
|
@FunctionalInterface
|
||||||
|
public interface TriFunction<T, U, V, R> {
|
||||||
|
R apply(T t, U u, V v);
|
||||||
|
}
|
|
@ -0,0 +1,105 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfig;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigClass;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigDetail;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/26 14:39
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface ModelFieldAsyncMapper {
|
||||||
|
|
||||||
|
@Select("select * from uf_model_filed_async_class_config where class_name = #{className}")
|
||||||
|
ModelFieldAsyncConfigClass selectModelFieldAsyncConfigClass(@ParamMapper("className") String className);
|
||||||
|
|
||||||
|
@Select("SELECT a.*,b.tablename as table_name, c.id as model_id " +
|
||||||
|
"FROM uf_model_field_async a " +
|
||||||
|
"left join workflow_mode_table_view b " +
|
||||||
|
"on a.model_table = b.id " +
|
||||||
|
"left join modeinfo c " +
|
||||||
|
"on a.model_table = c.formid " +
|
||||||
|
"where only_mark = #{onlyMark}")
|
||||||
|
@CollectionMappings({
|
||||||
|
@CollectionMapping(property = "configDetailList",
|
||||||
|
column = "id",
|
||||||
|
id = @Id(value = Integer.class, methodId = 1))
|
||||||
|
})
|
||||||
|
ModelFieldAsyncConfig selectConfigByOnlyMark(@ParamMapper("onlyMark") String onlyMark);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>查询配置表明细表信息</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/3/1 16:39
|
||||||
|
* @param mainId 主表数据id
|
||||||
|
* @return 配置集合
|
||||||
|
**/
|
||||||
|
@Select("select a.*,b.fieldname target_field_name, c.fieldname value_field_name " +
|
||||||
|
"from uf_model_field_async_dt1 a " +
|
||||||
|
"left join workflow_field_table_view b " +
|
||||||
|
"on a.target_field = b.id " +
|
||||||
|
"left join workflow_field_table_view c " +
|
||||||
|
"on a.value_field = c.id " +
|
||||||
|
"where mainid = #{mainId} " +
|
||||||
|
"and ( enable is null or enable = 0 )")
|
||||||
|
@CollectionMethod(1)
|
||||||
|
List<ModelFieldAsyncConfigDetail> selectConfigDetail(@ParamMapper("mainId") int mainId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>查询数据总条数</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/26 15:15
|
||||||
|
* @param modelTableName 表名
|
||||||
|
* @param where 自定义数据条件
|
||||||
|
* @return 数据总条数
|
||||||
|
**/
|
||||||
|
@Select("select count(*) from $t{modelTableName} $t{where}")
|
||||||
|
Integer selectModelTableCount(@ParamMapper("modelTableName") String modelTableName,
|
||||||
|
@ParamMapper("where") String where);
|
||||||
|
/**
|
||||||
|
* <h1>分页查询建模数据</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/26 15:15
|
||||||
|
* @param modelTableName 表名
|
||||||
|
* @param offset 首页
|
||||||
|
* @param pageSize 分页大小
|
||||||
|
* @return 建模数据
|
||||||
|
**/
|
||||||
|
@Select("SELECT * " +
|
||||||
|
"FROM $t{modelTableName} " +
|
||||||
|
"$t{where} " +
|
||||||
|
"LIMIT $t{offset}, $t{pageSize}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
List<Map<String, Object>> selectModelContent(@ParamMapper("modelTableName") String modelTableName,
|
||||||
|
@ParamMapper("where") String where,
|
||||||
|
@ParamMapper("offset") Integer offset,
|
||||||
|
@ParamMapper("pageSize") Integer pageSize);
|
||||||
|
|
||||||
|
@Select("SELECT * " +
|
||||||
|
"FROM $t{modelTableName} " +
|
||||||
|
"$t{where}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
List<Map<String, Object>> selectModelContent(@ParamMapper("modelTableName")String modelTableName, @ParamMapper("where")String where);
|
||||||
|
|
||||||
|
@Select("SELECT * " +
|
||||||
|
"FROM $t{modelTableName} " +
|
||||||
|
"$t{cusWhere}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
Map<String, Object> selectMainModelContent(@ParamMapper("modelTableName")String modelTableName,
|
||||||
|
@ParamMapper("id") String id,
|
||||||
|
@ParamMapper("cusWhere")String where);
|
||||||
|
|
||||||
|
|
||||||
|
@Select(custom = true)
|
||||||
|
String selectCustomerSql(@SqlString String sql,
|
||||||
|
@ParamMapper("detail") Map<String, Object> detailMap,
|
||||||
|
@ParamMapper("main") Map<String, Object> mainMap);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,247 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.service;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.recordset.MapperBuilderSql;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfig;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigClass;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigDetail;
|
||||||
|
import com.api.nonstandardext.model_field_async.mapper.ModelFieldAsyncMapper;
|
||||||
|
import com.api.nonstandardext.model_field_async.util.EyCusModelFieldValueRuleMethod;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>同步建模字段值</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/26 14:31
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
public class ModelFieldAsyncServiceImpl {
|
||||||
|
|
||||||
|
private final ModelFieldAsyncMapper asyncMapper = Util.getMapper(ModelFieldAsyncMapper.class);
|
||||||
|
|
||||||
|
private final CommonMapper commonMapper = Util.getMapper(CommonMapper.class);
|
||||||
|
|
||||||
|
private Integer pageSize = 1000;
|
||||||
|
|
||||||
|
private final Logger logger = Util.getLogger();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>根据类名查询配置</h1>
|
||||||
|
*
|
||||||
|
* @param className 类名
|
||||||
|
* @return 配置对象
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/7 11:28
|
||||||
|
**/
|
||||||
|
public ModelFieldAsyncConfigClass getConfigClass(String className) {
|
||||||
|
ModelFieldAsyncConfigClass config = asyncMapper.selectModelFieldAsyncConfigClass(className);
|
||||||
|
if(Objects.isNull(config)){
|
||||||
|
throw new CustomerException("该className [ " + className + " ] 在uf_model_filed_async_class_config配置表中未找到对应的配置!");
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>根据模块id查询配置</h1>
|
||||||
|
*
|
||||||
|
* @param onlyMark 唯一标识
|
||||||
|
* @return 配置对象
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/7 11:28
|
||||||
|
**/
|
||||||
|
public ModelFieldAsyncConfig getConfig(String onlyMark) {
|
||||||
|
ModelFieldAsyncConfig config = asyncMapper.selectConfigByOnlyMark(onlyMark);
|
||||||
|
if(Objects.isNull(config) || CollectionUtils.isEmpty(config.getConfigDetailList())){
|
||||||
|
throw new CustomerException("该唯一标识在 [ " + onlyMark+ " +uf_model_field_async配置表中未找到对应的配置!或存在该配置但是明细数据为空!");
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>通过类名同步数据</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/27 11:45
|
||||||
|
* @param className 类名
|
||||||
|
* @param dataIds 数据ids
|
||||||
|
**/
|
||||||
|
public void asyncDataByClassName(String className, String dataIds){
|
||||||
|
if(StringUtils.isBlank(dataIds)){
|
||||||
|
logger.error("dataIds can not be empty!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
ModelFieldAsyncConfigClass configClass = getConfigClass(className);
|
||||||
|
String onlyMark = configClass.getOnlyMark();
|
||||||
|
ModelFieldAsyncConfig asyncConfig = getConfig(onlyMark);
|
||||||
|
for (String dataId : dataIds.split(",")) {
|
||||||
|
asyncModelField(configClass.getDetailIndex(), dataId, asyncConfig);
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
logger.error("============== asyncDataByClassName error : " + e.getMessage() + " ==============");
|
||||||
|
logger.error(Util.getErrString(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>进行建模字段数据同步</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/26 17:18
|
||||||
|
* @param detailIndexList 需要同步的明细下标 -1 代表主表 -1,1,2 : 代表主表, 明细1, 明细2
|
||||||
|
* @param config 同步配置集合
|
||||||
|
**/
|
||||||
|
public void asyncAllModelField(String detailIndexList, ModelFieldAsyncConfig config){
|
||||||
|
asyncModelField(detailIndexList, "", config);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>进行建模字段数据同步</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/26 17:18
|
||||||
|
* @param detailIndexList 需要同步的明细下标 -1 代表主表 -1,1,2 : 代表主表, 明细1, 明细2
|
||||||
|
* @param dataId 数据id
|
||||||
|
* @param config 同步配置集合
|
||||||
|
**/
|
||||||
|
public void asyncModelField(String detailIndexList, String dataId, ModelFieldAsyncConfig config){
|
||||||
|
List<ModelFieldAsyncConfigDetail> configDetailList = config.getConfigDetailList();
|
||||||
|
Map<String, List<ModelFieldAsyncConfigDetail>> groups = configDetailList.stream()
|
||||||
|
.collect(Collectors.groupingBy(ModelFieldAsyncConfigDetail::getDetailIndex));
|
||||||
|
String preSuffix = " id ";
|
||||||
|
boolean limit = StringUtils.isBlank(dataId);
|
||||||
|
for (String index : detailIndexList.split(",")) {
|
||||||
|
if(StringUtils.isBlank(index)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 该明细/主表的配置集合
|
||||||
|
List<ModelFieldAsyncConfigDetail> configDetails = groups.get(index);
|
||||||
|
if(CollectionUtils.isEmpty(configDetailList)){
|
||||||
|
logger.error("index = " + index + " not found config! current configs : " + JSONObject.toJSONString(groups));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String tableName = config.getTableName();
|
||||||
|
String mainTableName = config.getTableName();
|
||||||
|
// 如果是-1则代表同步主表数据
|
||||||
|
if(!"-1".equals(index)){
|
||||||
|
tableName += "_dt" + index;
|
||||||
|
preSuffix = " mainid ";
|
||||||
|
}
|
||||||
|
String cusWhereSql = buildWhereSql(Util.null2DefaultStr(config.getCusWhereSql(),""), dataId, preSuffix);
|
||||||
|
String cusMainWhereSql = buildWhereSql(Util.null2DefaultStr(config.getCusWhereSql(),""), dataId, "id");
|
||||||
|
// 获取主表数据
|
||||||
|
Map<String, Object> mainMap = asyncMapper.selectMainModelContent(mainTableName, dataId, cusMainWhereSql);
|
||||||
|
asyncAllData(tableName, cusWhereSql, configDetails, limit, mainMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>同步所有的数据</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/27 11:44
|
||||||
|
* @param tableName 表名
|
||||||
|
* @param cusWhereSql 自定义where sql
|
||||||
|
* @param configDetails 配置表集合
|
||||||
|
* @param limit 是否需要分页同步
|
||||||
|
* @param mainMap 主表数据
|
||||||
|
**/
|
||||||
|
public void asyncAllData(String tableName,
|
||||||
|
String cusWhereSql,
|
||||||
|
List<ModelFieldAsyncConfigDetail> configDetails,
|
||||||
|
boolean limit,
|
||||||
|
Map<String, Object> mainMap){
|
||||||
|
// 数据总条数
|
||||||
|
int count = limit ? asyncMapper.selectModelTableCount(tableName, cusWhereSql) : 1;
|
||||||
|
// 总页数
|
||||||
|
int pageCount = (int) Math.ceil((double) count / pageSize);
|
||||||
|
int pageNumber = 1;
|
||||||
|
while (pageNumber <= pageCount){
|
||||||
|
int offset = (pageNumber - 1) * pageSize;
|
||||||
|
// 分页查数据
|
||||||
|
List<Map<String, Object>> dataList = asyncMapper.selectModelContent(tableName, cusWhereSql, offset, pageSize);
|
||||||
|
if(CollectionUtils.isEmpty(dataList)){
|
||||||
|
pageNumber++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
convertDataList(tableName, dataList, configDetails, mainMap);
|
||||||
|
pageNumber++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>构建where语句</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/27 11:44
|
||||||
|
* @param modelWhereSql 配置表中的where sql
|
||||||
|
* @param dataId 数据id
|
||||||
|
* @param preSuffix 前缀 mainId or id
|
||||||
|
* @return 构建的where语句
|
||||||
|
**/
|
||||||
|
public String buildWhereSql(String modelWhereSql, String dataId, String preSuffix){
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
if(StringUtils.isNotBlank(modelWhereSql)){
|
||||||
|
modelWhereSql = Util.sbc2dbcCase(modelWhereSql);
|
||||||
|
sb.append(modelWhereSql);
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(dataId)){
|
||||||
|
if(sb.length() > 0){
|
||||||
|
sb.append(" and ");
|
||||||
|
}
|
||||||
|
sb.append(preSuffix).append(" = ").append(dataId);
|
||||||
|
}
|
||||||
|
sb.insert(0, " where ");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将建模集合数据进行自定义转换</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/26 17:20
|
||||||
|
* @param tableName 表名
|
||||||
|
* @param dataList 建模数据集合
|
||||||
|
* @param configDetails 配置集合
|
||||||
|
* @param mainMap 主表数据
|
||||||
|
**/
|
||||||
|
public void convertDataList(String tableName, List<Map<String, Object>> dataList,
|
||||||
|
List<ModelFieldAsyncConfigDetail> configDetails, Map<String, Object> mainMap){
|
||||||
|
List<Map<String, Object>> res = new ArrayList<>();
|
||||||
|
for (Map<String, Object> data : dataList) {
|
||||||
|
res.add(convertData(data, configDetails, mainMap));
|
||||||
|
}
|
||||||
|
// 需要进行更新的字段集合
|
||||||
|
Map<String, Object> fields = configDetails.stream().collect(Collectors.toMap(ModelFieldAsyncConfigDetail::getTargetFieldName, item -> ""));
|
||||||
|
String updateSql = MapperBuilderSql.builderUpdateSql(tableName, fields,"item");
|
||||||
|
updateSql += " where id = #{item.id}";
|
||||||
|
if (!commonMapper.updateModelInfoList(updateSql, res)) {
|
||||||
|
throw new CustomerException("出错了... 更新 " + tableName + " 失败!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>将单条数据进行转换</h1>
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/26 17:20
|
||||||
|
* @param data 明细单条数据
|
||||||
|
* @param configDetails 配置对象
|
||||||
|
* @param mainMap 主表数据
|
||||||
|
* @return 转换后的map
|
||||||
|
**/
|
||||||
|
public Map<String, Object> convertData(Map<String, Object> data, List<ModelFieldAsyncConfigDetail> configDetails, Map<String, Object> mainMap){
|
||||||
|
Map<String, Object> res = new HashMap<>();
|
||||||
|
for (ModelFieldAsyncConfigDetail detail : configDetails) {
|
||||||
|
Object convert = EyCusModelFieldValueRuleMethod.VALUE_RULE_FUNCTION.get(detail.getGetValueType()).apply(detail, data, mainMap);
|
||||||
|
res.put(detail.getTargetFieldName(), convert);
|
||||||
|
}
|
||||||
|
res.put("id", data.get("id"));
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.service.convert;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigDetail;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>自定义转换接口</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/4/11 16:49
|
||||||
|
*/
|
||||||
|
public interface CusModelFieldAsyncConvert {
|
||||||
|
Logger log = Util.getLogger();
|
||||||
|
Object cusConvert(ModelFieldAsyncConfigDetail configDetail, Map<String, Object> detailMap, Map<String, Object> mainMap, Map<String, String> pathParam);
|
||||||
|
}
|
|
@ -0,0 +1,104 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.util;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import com.api.nonstandardext.model_field_async.entity.ModelFieldAsyncConfigDetail;
|
||||||
|
import com.api.nonstandardext.model_field_async.interfaces.TriFunction;
|
||||||
|
import com.api.nonstandardext.model_field_async.mapper.ModelFieldAsyncMapper;
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.xuanran.wang.eny.data_async.service.convert.CusAsyncConvert;
|
||||||
|
import com.api.nonstandardext.model_field_async.service.convert.CusModelFieldAsyncConvert;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>值处理方法</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-02-02 15:15</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class EyCusModelFieldValueRuleMethod {
|
||||||
|
|
||||||
|
|
||||||
|
public static final Map<Integer, TriFunction<ModelFieldAsyncConfigDetail, Map<String, Object>, Map<String, Object>, Object>> VALUE_RULE_FUNCTION = new HashMap<>();
|
||||||
|
|
||||||
|
private final ModelFieldAsyncMapper mapper = Util.getMapper(ModelFieldAsyncMapper.class);
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
static {
|
||||||
|
Class<EyCusModelFieldValueRuleMethod> valueRuleMethodClass = EyCusModelFieldValueRuleMethod.class;
|
||||||
|
Method[] methods = valueRuleMethodClass.getMethods();
|
||||||
|
for (Method method : methods) {
|
||||||
|
if (method.isAnnotationPresent(ValueRuleMethodNo.class)) {
|
||||||
|
ValueRuleMethodNo annotation = method.getAnnotation(ValueRuleMethodNo.class);
|
||||||
|
int value = annotation.value();
|
||||||
|
VALUE_RULE_FUNCTION.put(value, (detail, detailmap, mainMap) -> {
|
||||||
|
try {
|
||||||
|
EyCusModelFieldValueRuleMethod eyCusModelFieldValueRuleMethod = new EyCusModelFieldValueRuleMethod();
|
||||||
|
return method.invoke(eyCusModelFieldValueRuleMethod, detail, detailmap, mainMap);
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ValueRuleMethodNo(value = 0, desc = "明细表数据不转换")
|
||||||
|
public Object getFixValue(ModelFieldAsyncConfigDetail configDetail,Map<String, Object> detailMap, Map<String, Object> mainMap) {
|
||||||
|
return Util.null2DefaultStr(detailMap.get(configDetail.getValueFieldName()),"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ValueRuleMethodNo(value = 1, desc = "默认值")
|
||||||
|
public Object getCusText(ModelFieldAsyncConfigDetail configDetail, Map<String, Object> detailMap, Map<String, Object> mainMap) {
|
||||||
|
return Util.null2DefaultStr(configDetail.getValueContext(),"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ValueRuleMethodNo(value = 2, desc = "自定义sql")
|
||||||
|
public Object getCustomerSqlValue(ModelFieldAsyncConfigDetail configDetail, Map<String, Object> detailMap, Map<String, Object> mainMap) {
|
||||||
|
String cusText = configDetail.getValueContext();
|
||||||
|
cusText = Util.sbc2dbcCase(cusText);
|
||||||
|
if (Strings.isNullOrEmpty(cusText)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (!cusText.startsWith("select")) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return Util.null2DefaultStr(mapper.selectCustomerSql(cusText, detailMap, mainMap),"");
|
||||||
|
}
|
||||||
|
|
||||||
|
@ValueRuleMethodNo(value = 3, desc = "自定义接口")
|
||||||
|
public Object getCusConvertInterface(ModelFieldAsyncConfigDetail configDetail, Map<String, Object> detailMap, Map<String, Object> mainMap) {
|
||||||
|
String cusText = configDetail.getValueContext();
|
||||||
|
if(Strings.isNullOrEmpty(cusText)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
Class<?> clazz = Class.forName(cusText);
|
||||||
|
if(!CusAsyncConvert.class.isAssignableFrom(clazz)){
|
||||||
|
throw new CustomerException(cusText + " not implements getLogFilePath.api.nonstandardext.model_field_async.service.convert");
|
||||||
|
}
|
||||||
|
CusModelFieldAsyncConvert o = (CusModelFieldAsyncConvert) clazz.newInstance();
|
||||||
|
Map<String, String> pathParam = Util.parseCusInterfacePathParam(cusText);
|
||||||
|
return o.cusConvert(configDetail, detailMap, mainMap, pathParam);
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("getCusConvertInterface error! " + e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ValueRuleMethodNo(value = 4, desc = "转主表数据")
|
||||||
|
public Object getMainTableFieldValue(ModelFieldAsyncConfigDetail configDetail, Map<String, Object> detailMap, Map<String, Object> mainMap) {
|
||||||
|
return Util.null2DefaultStr(mainMap.get(configDetail.getValueFieldName()),"");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.api.nonstandardext.model_field_async.util;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>值处理方法编号注解</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023-02-02 15:18</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
@Documented
|
||||||
|
public @interface ValueRuleMethodNo {
|
||||||
|
int value();
|
||||||
|
String desc();
|
||||||
|
}
|
|
@ -69,7 +69,7 @@ public class SAPWebserviceTool extends BaseBean {
|
||||||
|
|
||||||
public String callParams_011(String comCode, String period, String year, String glAccount){
|
public String callParams_011(String comCode, String period, String year, String glAccount){
|
||||||
|
|
||||||
String params = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">\n" +
|
String params = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-getLogFilePath:document:sap:soap:functions:mc-style\">\n" +
|
||||||
" <soapenv:Header/>\n" +
|
" <soapenv:Header/>\n" +
|
||||||
" <soapenv:Body>\n" +
|
" <soapenv:Body>\n" +
|
||||||
" <urn:ZoaGlGetglaccperiodbalances>\n" +
|
" <urn:ZoaGlGetglaccperiodbalances>\n" +
|
||||||
|
@ -92,7 +92,7 @@ public class SAPWebserviceTool extends BaseBean {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {
|
* {
|
||||||
* "@xmlns:n0": "urn:sap-com:document:sap:soap:functions:mc-style",
|
* "@xmlns:n0": "urn:sap-getLogFilePath:document:sap:soap:functions:mc-style",
|
||||||
* "EsReturn": {
|
* "EsReturn": {
|
||||||
* "Type": [],
|
* "Type": [],
|
||||||
* "Code": [],
|
* "Code": [],
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
package com.api.xuanran.wang.immc.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.api.xuanran.wang.immc.dto.ImmcWorkFlowToKafkaDto;
|
||||||
|
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.xuanran.wang.immc.service.WorkFlowToVmsAndMQService;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.ws.rs.*;
|
||||||
|
import javax.ws.rs.core.Context;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>智己流程操作下发kafka</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/21 15:40
|
||||||
|
*/
|
||||||
|
@Path("/wxr/immc/workflow/kafka")
|
||||||
|
public class ApiImmcWorkFlowToKafka {
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
private final WorkFlowToVmsAndMQService service = new WorkFlowToVmsAndMQService();
|
||||||
|
|
||||||
|
@Path("/del")
|
||||||
|
@POST
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
@Consumes(MediaType.APPLICATION_JSON)
|
||||||
|
public String delWorkFlowToKafka(@Context HttpServletRequest request,
|
||||||
|
@Context HttpServletResponse response,
|
||||||
|
@RequestBody ImmcWorkFlowToKafkaDto config){
|
||||||
|
try {
|
||||||
|
log.info("删除流程下发kafka配置对象 : " + JSONObject.toJSONString(config));
|
||||||
|
// ImmcWorkFlowToKafkaDto dto = JSONObject.parseObject(JSONObject.toJSONString(config), ImmcWorkFlowToKafkaDto.class);
|
||||||
|
service.workFlowToKafkaByDto(config);
|
||||||
|
return ApiResult.successNoData();
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("删除流程下发kafka执行失败 : [ " + e.getMessage() + " ]");
|
||||||
|
log.error(Util.getErrString(e));
|
||||||
|
return ApiResult.error("下发kafka失败! " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.api.xuanran.wang.immc.dto;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>vo 智己流程下发kafka</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/21 16:08
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class ImmcWorkFlowToKafkaDto {
|
||||||
|
private String onlyMark;
|
||||||
|
private Integer billTable;
|
||||||
|
private String config;
|
||||||
|
private Integer requestId;
|
||||||
|
private String skip;
|
||||||
|
}
|
|
@ -17,8 +17,13 @@ import weaver.hrm.User;
|
||||||
import weaver.workflow.webservices.WorkflowRequestTableField;
|
import weaver.workflow.webservices.WorkflowRequestTableField;
|
||||||
import weaver.xuanran.wang.common.util.CommonUtil;
|
import weaver.xuanran.wang.common.util.CommonUtil;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.concurrent.*;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.Callable;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
import java.util.concurrent.Future;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,165 +34,170 @@ import java.util.stream.Collectors;
|
||||||
* @date 2023/2/22 13:58
|
* @date 2023/2/22 13:58
|
||||||
*/
|
*/
|
||||||
public class BatchCreateWorkflowService {
|
public class BatchCreateWorkflowService {
|
||||||
|
|
||||||
// 表名 : requestId 本次需要删除的数据
|
// 表名 : requestId 本次需要删除的数据
|
||||||
private final ConcurrentHashMap<String, List<String>> delWorkflowTableRequestId = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, List<String>> delWorkflowTableRequestId = new ConcurrentHashMap<>();
|
||||||
// workflowId : tableName
|
// workflowId : tableName
|
||||||
private static final HashMap<Integer, String> workflowTable = new HashMap<>();
|
private static final HashMap<Integer, String> workflowTable = new HashMap<>();
|
||||||
private final Logger log = Util.getLogger();
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
private static final String CUSTOM_ID = "customId";
|
private static final String CUSTOM_ID = "customId";
|
||||||
// private final MeetingMapper meetingTransMapper = Util.getTransMapper(MeetingMapper.class);
|
// private final MeetingMapper meetingTransMapper = Util.getTransMapper(MeetingMapper.class);
|
||||||
private final MeetingService meetingService = new MeetingService();
|
private final MeetingService meetingService = new MeetingService();
|
||||||
/**
|
|
||||||
* <h1>取消会议 支持多个</h1>
|
/**
|
||||||
* @author xuanran.wang
|
* <h1>取消会议 支持多个</h1>
|
||||||
* @dateTime 2023/2/24 10:21
|
*
|
||||||
* @param ids 会议id
|
* @param ids 会议id
|
||||||
**/
|
* @author xuanran.wang
|
||||||
public void cancelMeeting(String ids){
|
* @dateTime 2023/2/24 10:21
|
||||||
meetingService.cancelMeeting(ids);
|
**/
|
||||||
}
|
public void cancelMeeting(String ids) {
|
||||||
|
meetingService.cancelMeeting(ids);
|
||||||
/**
|
}
|
||||||
* <h1>批量创建流程</h1>
|
|
||||||
* @author xuanran.wang
|
/**
|
||||||
* @dateTime 2023/2/22 17:10
|
* <h1>批量创建流程</h1>
|
||||||
* @param array 流程数据数组
|
*
|
||||||
* @return 创建流程结果
|
* @param array 流程数据数组
|
||||||
**/
|
* @return 创建流程结果
|
||||||
public List<CreateWfVO> batchCreateWorkflow(User user, JSONArray array) {
|
* @author xuanran.wang
|
||||||
List<Future<CusCreateWfInfo>> list = new ArrayList<>();
|
* @dateTime 2023/2/22 17:10
|
||||||
List<CusCreateWfInfo> errors = new ArrayList<>();
|
**/
|
||||||
ArrayList<CreateWfVO> res = new ArrayList<>();
|
public List<CreateWfVO> batchCreateWorkflow(User user, JSONArray array) {
|
||||||
try {
|
List<Future<CusCreateWfInfo>> list = new ArrayList<>();
|
||||||
List<ReqOperateRequestEntity> reqOperateRequestEntities = checkParams(array);
|
List<CusCreateWfInfo> errors = new ArrayList<>();
|
||||||
// 结果集
|
ArrayList<CreateWfVO> res = new ArrayList<>();
|
||||||
for (int i = 0; i < reqOperateRequestEntities.size(); i++) {
|
try {
|
||||||
int temp = i;
|
List<ReqOperateRequestEntity> reqOperateRequestEntities = checkParams(array);
|
||||||
// 创建流程
|
// 结果集
|
||||||
Callable<CusCreateWfInfo> callable = () -> this.createWorkflow(user,reqOperateRequestEntities.get(temp), temp);
|
for (int i = 0; i < reqOperateRequestEntities.size(); i++) {
|
||||||
list.add(Util.threadPool.submit(callable));
|
int temp = i;
|
||||||
}
|
// 创建流程
|
||||||
for (Future<CusCreateWfInfo> future : list) {
|
Callable<CusCreateWfInfo> callable = () -> this.createWorkflow(user, reqOperateRequestEntities.get(temp), temp);
|
||||||
CusCreateWfInfo cusCreateWfInfo = future.get();
|
list.add(Util.threadPool.submit(callable));
|
||||||
PAResponseEntity entity = cusCreateWfInfo.getPaResponseEntity();
|
}
|
||||||
String tableName = workflowTable.get(cusCreateWfInfo.getWorkflowId());
|
for (Future<CusCreateWfInfo> future : list) {
|
||||||
if(PAResponseCode.SUCCESS != entity.getCode()){
|
CusCreateWfInfo cusCreateWfInfo = future.get();
|
||||||
errors.add(cusCreateWfInfo);
|
PAResponseEntity entity = cusCreateWfInfo.getPaResponseEntity();
|
||||||
continue;
|
String tableName = workflowTable.get(cusCreateWfInfo.getWorkflowId());
|
||||||
}
|
if (PAResponseCode.SUCCESS != entity.getCode()) {
|
||||||
// 将生成的requestId存到vo中返回
|
errors.add(cusCreateWfInfo);
|
||||||
Map<String, Object> data = (Map<String, Object>) entity.getData();
|
continue;
|
||||||
String requestId = Util.null2DefaultStr(data.get("requestid"),"");
|
}
|
||||||
CreateWfVO vo = new CreateWfVO();
|
// 将生成的requestId存到vo中返回
|
||||||
vo.setRequestId(requestId);
|
Map<String, Object> data = (Map<String, Object>) entity.getData();
|
||||||
vo.setCustomId(cusCreateWfInfo.getCustomId());
|
String requestId = Util.null2DefaultStr(data.get("requestid"), "");
|
||||||
res.add(vo);
|
CreateWfVO vo = new CreateWfVO();
|
||||||
|
vo.setRequestId(requestId);
|
||||||
// 将表名 requestId 存到成员变量中
|
vo.setCustomId(cusCreateWfInfo.getCustomId());
|
||||||
if (!delWorkflowTableRequestId.containsKey(tableName)) {
|
res.add(vo);
|
||||||
ArrayList<String> requestIds = new ArrayList<>();
|
|
||||||
requestIds.add(requestId);
|
// 将表名 requestId 存到成员变量中
|
||||||
delWorkflowTableRequestId.put(tableName, requestIds);
|
if (!delWorkflowTableRequestId.containsKey(tableName)) {
|
||||||
}else {
|
ArrayList<String> requestIds = new ArrayList<>();
|
||||||
delWorkflowTableRequestId.get(tableName).add(requestId);
|
requestIds.add(requestId);
|
||||||
}
|
delWorkflowTableRequestId.put(tableName, requestIds);
|
||||||
}
|
} else {
|
||||||
if(errors.size() > 0){
|
delWorkflowTableRequestId.get(tableName).add(requestId);
|
||||||
throw new CustomerException(JSONObject.toJSONString(errors));
|
}
|
||||||
}
|
}
|
||||||
return res;
|
if (errors.size() > 0) {
|
||||||
}catch (Exception e){
|
throw new CustomerException(JSONObject.toJSONString(errors));
|
||||||
if(MapUtils.isNotEmpty(delWorkflowTableRequestId)){
|
}
|
||||||
log.info("删除流程数据map : " + JSONObject.toJSONString(delWorkflowTableRequestId));
|
return res;
|
||||||
for (Map.Entry<String, List<String>> entry : delWorkflowTableRequestId.entrySet()) {
|
} catch (Exception e) {
|
||||||
String tableName = entry.getKey();
|
if (MapUtils.isNotEmpty(delWorkflowTableRequestId)) {
|
||||||
List<String> requestIds = entry.getValue();
|
log.info("删除流程数据map : " + JSONObject.toJSONString(delWorkflowTableRequestId));
|
||||||
if (!CommonUtil.deleteWorkflowDataByRequestIds(tableName, requestIds)) {
|
for (Map.Entry<String, List<String>> entry : delWorkflowTableRequestId.entrySet()) {
|
||||||
log.error(Util.logStr("删除流程数据失败!表名:{}, 待删除流程集合: {} ", tableName,JSONObject.toJSONString(requestIds)));
|
String tableName = entry.getKey();
|
||||||
}
|
List<String> requestIds = entry.getValue();
|
||||||
if (!CommonUtil.deleteWorkflowDataByRequestIds("workflow_requestbase", requestIds)) {
|
if (!CommonUtil.deleteWorkflowDataByRequestIds(tableName, requestIds)) {
|
||||||
log.error(Util.logStr("删除流程数据失败!表名:{}, 待删除流程集合: {} ", "workflow_requestbase", JSONObject.toJSONString(requestIds)));
|
log.error(Util.logStr("删除流程数据失败!表名:{}, 待删除流程集合: {} ", tableName, JSONObject.toJSONString(requestIds)));
|
||||||
}
|
}
|
||||||
if (!CommonUtil.deleteWorkflowDataByRequestIds("Bill_Meeting", requestIds)) {
|
if (!CommonUtil.deleteWorkflowDataByRequestIds("workflow_requestbase", requestIds)) {
|
||||||
log.error(Util.logStr("删除流程数据失败!表名:{}, 待删除流程集合: {} ", "Bill_Meeting", JSONObject.toJSONString(requestIds)));
|
log.error(Util.logStr("删除流程数据失败!表名:{}, 待删除流程集合: {} ", "workflow_requestbase", JSONObject.toJSONString(requestIds)));
|
||||||
}
|
}
|
||||||
}
|
if (!CommonUtil.deleteWorkflowDataByRequestIds("Bill_Meeting", requestIds)) {
|
||||||
}
|
log.error(Util.logStr("删除流程数据失败!表名:{}, 待删除流程集合: {} ", "Bill_Meeting", JSONObject.toJSONString(requestIds)));
|
||||||
throw new CustomerException(e.getMessage());
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
throw new CustomerException(e.getMessage());
|
||||||
/**
|
}
|
||||||
* <h1>创建流程</h1>
|
}
|
||||||
* @author xuanran.wang
|
|
||||||
* @dateTime 2023/2/24 14:33
|
/**
|
||||||
* @param user 用户
|
* <h1>创建流程</h1>
|
||||||
* @param requestEntity 流程请求体
|
*
|
||||||
* @param index 流程集合下标
|
* @param user 用户
|
||||||
* @return 流程创建成功相关数据
|
* @param requestEntity 流程请求体
|
||||||
**/
|
* @param index 流程集合下标
|
||||||
public CusCreateWfInfo createWorkflow(User user,
|
* @return 流程创建成功相关数据
|
||||||
ReqOperateRequestEntity requestEntity,
|
* @author xuanran.wang
|
||||||
int index){
|
* @dateTime 2023/2/24 14:33
|
||||||
// 创建流程
|
**/
|
||||||
PAResponseEntity responseEntity = BatchCreateWorkFlowController.WRO.doCreateRequest(user, requestEntity);
|
public CusCreateWfInfo createWorkflow(User user,
|
||||||
CusCreateWfInfo cusCreateWfInfo = new CusCreateWfInfo();
|
ReqOperateRequestEntity requestEntity,
|
||||||
cusCreateWfInfo.setIndex(index);
|
int index) {
|
||||||
cusCreateWfInfo.setPaResponseEntity(responseEntity);
|
// 创建流程
|
||||||
int workflowId = requestEntity.getWorkflowId();
|
PAResponseEntity responseEntity = BatchCreateWorkFlowController.WRO.doCreateRequest(user, requestEntity);
|
||||||
String tableName = workflowTable.get(workflowId);
|
CusCreateWfInfo cusCreateWfInfo = new CusCreateWfInfo();
|
||||||
if(StringUtils.isBlank(tableName)){
|
cusCreateWfInfo.setIndex(index);
|
||||||
tableName = CommonUtil.getTableNameByWorkflowId(workflowId);
|
cusCreateWfInfo.setPaResponseEntity(responseEntity);
|
||||||
workflowTable.put(workflowId, tableName);
|
int workflowId = requestEntity.getWorkflowId();
|
||||||
}
|
String tableName = workflowTable.get(workflowId);
|
||||||
// 获取主表的customId
|
if (StringUtils.isBlank(tableName)) {
|
||||||
List<WorkflowRequestTableField> collect = requestEntity.getMainData()
|
tableName = CommonUtil.getTableNameByWorkflowId(workflowId);
|
||||||
.stream()
|
workflowTable.put(workflowId, tableName);
|
||||||
.filter(item -> CUSTOM_ID.equals(item.getFieldName()))
|
}
|
||||||
.collect(Collectors.toList());
|
// 获取主表的customId
|
||||||
String customIdVal = collect.get(0).getFieldValue();
|
List<WorkflowRequestTableField> collect = requestEntity.getMainData()
|
||||||
cusCreateWfInfo.setCustomId(customIdVal);
|
.stream()
|
||||||
cusCreateWfInfo.setWorkflowId(workflowId);
|
.filter(item -> CUSTOM_ID.equals(item.getFieldName()))
|
||||||
return cusCreateWfInfo;
|
.collect(Collectors.toList());
|
||||||
}
|
String customIdVal = collect.get(0).getFieldValue();
|
||||||
|
cusCreateWfInfo.setCustomId(customIdVal);
|
||||||
/**
|
cusCreateWfInfo.setWorkflowId(workflowId);
|
||||||
* <h1>参数校验并将json转成ReqOperateRequestEntity</h1>
|
return cusCreateWfInfo;
|
||||||
* @author xuanran.wang
|
}
|
||||||
* @dateTime 2023/2/24 13:36
|
|
||||||
* @param array json数组
|
/**
|
||||||
* @return 解析后的集合
|
* <h1>参数校验并将json转成ReqOperateRequestEntity</h1>
|
||||||
**/
|
*
|
||||||
public List<ReqOperateRequestEntity> checkParams(JSONArray array){
|
* @param array json数组
|
||||||
ArrayList<ReqOperateRequestEntity> res = new ArrayList<>();
|
* @return 解析后的集合
|
||||||
try {
|
* @author xuanran.wang
|
||||||
for (Object obj : array) {
|
* @dateTime 2023/2/24 13:36
|
||||||
ReqOperateRequestEntity entity;
|
**/
|
||||||
JSONObject jsonObject;
|
public List<ReqOperateRequestEntity> checkParams(JSONArray array) {
|
||||||
// 将json转成内部流程对象
|
ArrayList<ReqOperateRequestEntity> res = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
jsonObject = JSONObject.parseObject(obj.toString());
|
for (Object obj : array) {
|
||||||
entity = JSONObject.parseObject(jsonObject.toString(), ReqOperateRequestEntity.class);
|
ReqOperateRequestEntity entity;
|
||||||
}catch (Exception e){
|
JSONObject jsonObject;
|
||||||
throw new CustomerException(Util.logStr("json反序列化失败!当前对象:{}, 错误信息: {}" ,obj,e.getMessage()));
|
// 将json转成内部流程对象
|
||||||
}
|
try {
|
||||||
if(Util.getIntValue(String.valueOf(entity.getWorkflowId()),-1) < 0){
|
jsonObject = JSONObject.parseObject(obj.toString());
|
||||||
throw new CustomerException(Util.logStr("该对象workflowId为空!", obj));
|
entity = JSONObject.parseObject(jsonObject.toString(), ReqOperateRequestEntity.class);
|
||||||
}
|
} catch (Exception e) {
|
||||||
List<WorkflowRequestTableField> collect = entity.getMainData()
|
throw new CustomerException(Util.logStr("json反序列化失败!当前对象:{}, 错误信息: {}", obj, e.getMessage()));
|
||||||
.stream()
|
}
|
||||||
.filter(item -> CUSTOM_ID.equals(item.getFieldName()))
|
if (Util.getIntValue(String.valueOf(entity.getWorkflowId()), -1) < 0) {
|
||||||
.collect(Collectors.toList());
|
throw new CustomerException(Util.logStr("该对象workflowId为空!", obj));
|
||||||
if(collect.size() == 0){
|
}
|
||||||
throw new CustomerException(Util.logStr("该对象mainData中未找到customId!:{}", obj));
|
List<WorkflowRequestTableField> collect = entity.getMainData()
|
||||||
}
|
.stream()
|
||||||
res.add(entity);
|
.filter(item -> CUSTOM_ID.equals(item.getFieldName()))
|
||||||
}
|
.collect(Collectors.toList());
|
||||||
}catch (Exception e){
|
if (collect.size() == 0) {
|
||||||
throw new CustomerException(Util.logStr("JSON参数校验失败!请检查json是否正确!错误信息: {}",e.getMessage()));
|
throw new CustomerException(Util.logStr("该对象mainData中未找到customId!:{}", obj));
|
||||||
}
|
}
|
||||||
return res;
|
res.add(entity);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomerException(Util.logStr("JSON参数校验失败!请检查json是否正确!错误信息: {}", e.getMessage()));
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,4 +143,5 @@ public class TaskElementController {
|
||||||
return ApiResult.error("system error!");
|
return ApiResult.error("system error!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -168,4 +168,22 @@ public interface TaskElementMapper {
|
||||||
*/
|
*/
|
||||||
@Update("update uf_rwtzeq_dt1 set zjwczt = 0 where zjr = #{userId} and mainid = #{mainId}")
|
@Update("update uf_rwtzeq_dt1 set zjwczt = 0 where zjr = #{userId} and mainid = #{mainId}")
|
||||||
boolean updateTaskHandoverStatus(@ParamMapper("userId") String userId, @ParamMapper("mainId") String mainId);
|
boolean updateTaskHandoverStatus(@ParamMapper("userId") String userId, @ParamMapper("mainId") String mainId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询相似名称的人员信息</h2>
|
||||||
|
*
|
||||||
|
* @param nameLike 姓名like
|
||||||
|
* @return 姓名like的id
|
||||||
|
*/
|
||||||
|
@Select("select id from hrmresource where lastname like #{nameLike}")
|
||||||
|
List<Integer> selectUserNameLike(String nameLike);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>查询相似名称的人员信息</h2>
|
||||||
|
*
|
||||||
|
* @param value 姓名
|
||||||
|
* @return 姓名的id
|
||||||
|
*/
|
||||||
|
@Select("select id from hrmresource where lastname = #{nameLike}")
|
||||||
|
Integer selectUserName(String value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,10 @@ public class TaskElementService {
|
||||||
for (Map<String, Object> item : authorityList) {
|
for (Map<String, Object> item : authorityList) {
|
||||||
if ("0".equals(dataSource)) {
|
if ("0".equals(dataSource)) {
|
||||||
// 自定义sql
|
// 自定义sql
|
||||||
customerValue += " " + whereStr;
|
// customerValue += " " + whereStr;
|
||||||
|
if (StrUtil.isNotBlank(whereStr)) {
|
||||||
|
customerValue = "select * from (" + customerValue + ") temp where " + whereStr;
|
||||||
|
}
|
||||||
List<Map<String, Object>> list = mapper.selectWorkList(customerValue, item, user, whereMap, currentMap);
|
List<Map<String, Object>> list = mapper.selectWorkList(customerValue, item, user, whereMap, currentMap);
|
||||||
if (CollectionUtil.isNotEmpty(list)) {
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
result.addAll(list);
|
result.addAll(list);
|
||||||
|
@ -179,8 +182,10 @@ public class TaskElementService {
|
||||||
Map<String, Object> map = new HashMap<>(8);
|
Map<String, Object> map = new HashMap<>(8);
|
||||||
map.put("currentDate", Util.getTime("yyyy-MM-dd"));
|
map.put("currentDate", Util.getTime("yyyy-MM-dd"));
|
||||||
map.put("currentTime", Util.getTime("HH:mm:ss"));
|
map.put("currentTime", Util.getTime("HH:mm:ss"));
|
||||||
|
Map<String, Object> searchParam = (Map<String, Object>) params.get("searchParam");
|
||||||
|
Map<String, Object> allSearch = (Map<String, Object>) params.get("allSearch");
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new StringBuilder();
|
||||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
for (Map.Entry<String, Object> entry : searchParam.entrySet()) {
|
||||||
Map<String, Object> valueMap = (Map<String, Object>) entry.getValue();
|
Map<String, Object> valueMap = (Map<String, Object>) entry.getValue();
|
||||||
String key = Util.null2String(valueMap.get("key"));
|
String key = Util.null2String(valueMap.get("key"));
|
||||||
String value = Util.null2String(valueMap.get("value"));
|
String value = Util.null2String(valueMap.get("value"));
|
||||||
|
@ -196,6 +201,49 @@ public class TaskElementService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String whereStr = builder.toString();
|
String whereStr = builder.toString();
|
||||||
|
if (StrUtil.isNotBlank(whereStr)) {
|
||||||
|
String trim = whereStr.trim();
|
||||||
|
if (trim.startsWith("and")) {
|
||||||
|
whereStr = trim.substring(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(allSearch)) {
|
||||||
|
StringBuilder orWhere = new StringBuilder();
|
||||||
|
String value = Util.null2String(allSearch.get("value"));
|
||||||
|
if (StrUtil.isNotBlank(value)) {
|
||||||
|
List<Map<String, Object>> fields = (List<Map<String, Object>>) allSearch.get("fields");
|
||||||
|
for (Map<String, Object> field : fields) {
|
||||||
|
String key = Util.null2String(field.get("key"));
|
||||||
|
String type = Util.null2String(field.get("type"));
|
||||||
|
if ("like".equalsIgnoreCase(type)) {
|
||||||
|
orWhere.append(" or ").append(key).append(" like ").append("concat('%',#{where._allValue},'%')");
|
||||||
|
} else if ("hrm like".equalsIgnoreCase(type)) {
|
||||||
|
List<Integer> hrmList = mapper.selectUserNameLike("%" + value + "%");
|
||||||
|
orWhere.append(" or ").append(key).append(" in ( ").append(Util.intJoin(hrmList, ",")).append(") ");
|
||||||
|
} else if ("hrm".equalsIgnoreCase(type)) {
|
||||||
|
Integer hrmId = mapper.selectUserName(value);
|
||||||
|
orWhere.append(" or ").append(key).append(" = ").append(hrmId);
|
||||||
|
} else {
|
||||||
|
orWhere.append(" or ").append(key).append(" = ").append("#{where._allValue}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
map.put("_allValue", value);
|
||||||
|
String orWhereStr = orWhere.toString();
|
||||||
|
if (StrUtil.isNotBlank(orWhereStr)) {
|
||||||
|
String trim = orWhereStr.trim();
|
||||||
|
if (trim.startsWith("or")) {
|
||||||
|
orWhereStr = trim.substring(2);
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(whereStr)) {
|
||||||
|
whereStr = whereStr + " or ( " + orWhereStr + " )";
|
||||||
|
} else {
|
||||||
|
whereStr = orWhereStr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// 查询可查看权限并进行过滤
|
// 查询可查看权限并进行过滤
|
||||||
String viewAuthoritySql = ihgTaskElementConfItem.getViewAuthority();
|
String viewAuthoritySql = ihgTaskElementConfItem.getViewAuthority();
|
||||||
List<Map<String, Object>> authorityList = mapper.selectAuthority(viewAuthoritySql, user, map);
|
List<Map<String, Object>> authorityList = mapper.selectAuthority(viewAuthoritySql, user, map);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public interface UserInfoMapper {
|
||||||
"or concat(',',fbleader,',') like concat(',',#{uID},',')\n" +
|
"or concat(',',fbleader,',') like concat(',',#{uID},',')\n" +
|
||||||
"or concat(',',hrleader,',') like concat(',',#{uID},',')\n" +
|
"or concat(',',hrleader,',') like concat(',',#{uID},',')\n" +
|
||||||
"or concat(',',generalmanager,',') like concat(',', #{uID},',')")*/
|
"or concat(',',generalmanager,',') like concat(',', #{uID},',')")*/
|
||||||
@Select("select count(id) from uf_hotelinfo where\n" +
|
@Select("select * from uf_hotelinfo where\n" +
|
||||||
"concat(',',olt,',') like concat(',',#{userId},',')\n" +
|
"concat(',',olt,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',vpo,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',vpo,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',opsconsultant,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',opsconsultant,',') like concat(',',#{userId},',')\n" +
|
||||||
|
@ -61,7 +61,7 @@ public interface UserInfoMapper {
|
||||||
"or concat(',',headoffinancebusinesssupport,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',headoffinancebusinesssupport,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',headofrbeoperations,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',headofrbeoperations,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',headofengineering,',') like concat(',',#{userId},',')")
|
"or concat(',',headofengineering,',') like concat(',',#{userId},',')")
|
||||||
Integer selectIsHotel(int uid);
|
List<Map<String, Object>> selectIsHotel(int uid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询酒店信息</h2>
|
* <h2>查询酒店信息</h2>
|
||||||
|
@ -85,12 +85,11 @@ public interface UserInfoMapper {
|
||||||
/**
|
/**
|
||||||
* <h2>查询角色信息</h2>
|
* <h2>查询角色信息</h2>
|
||||||
*
|
*
|
||||||
* @param uid 当前人员
|
* @param uid 当前人员
|
||||||
* @param hotelIndex 酒店编码
|
|
||||||
* @return 角色信息
|
* @return 角色信息
|
||||||
*/
|
*/
|
||||||
@Select("select * from uf_hotelinfo where\n" +
|
@Select("select * from uf_hotelinfo where\n" +
|
||||||
"(concat(',',olt,',') like concat(',',#{userId},',')\n" +
|
"concat(',',olt,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',vpo,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',vpo,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',subregionadmin,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',subregionadmin,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',opsconsultant,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',opsconsultant,',') like concat(',',#{userId},',')\n" +
|
||||||
|
@ -112,9 +111,8 @@ public interface UserInfoMapper {
|
||||||
"or concat(',',revenueleader,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',revenueleader,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',financeleader,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',financeleader,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',fbleader,',') like concat(',',#{userId},',')\n" +
|
"or concat(',',fbleader,',') like concat(',',#{userId},',')\n" +
|
||||||
"or concat(',',hrleader,',') like concat(',',#{userId},',')) " +
|
"or concat(',',hrleader,',') like concat(',',#{userId},',')")
|
||||||
"and holidex = #{hotelIndex}")
|
List<Map<String, Object>> selectRoles(@ParamMapper("userId") int uid);
|
||||||
List<Map<String, Object>> selectRoles(@ParamMapper("userId") int uid, @ParamMapper("hotelIndex") String hotelIndex);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h2>查询部门信息</h2>
|
* <h2>查询部门信息</h2>
|
||||||
|
|
|
@ -43,7 +43,6 @@ public class UserInfoService {
|
||||||
userInfoVo.setTaskAcceptance(true);
|
userInfoVo.setTaskAcceptance(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 查询用户信息
|
// 查询用户信息
|
||||||
Map<String, Object> userInfo = this.mapper.selectHrmInfo(user.getUID());
|
Map<String, Object> userInfo = this.mapper.selectHrmInfo(user.getUID());
|
||||||
if (CollectionUtil.isNotEmpty(userInfo)) {
|
if (CollectionUtil.isNotEmpty(userInfo)) {
|
||||||
|
@ -70,8 +69,32 @@ public class UserInfoService {
|
||||||
// 支持中心,显示部门信息
|
// 支持中心,显示部门信息
|
||||||
userInfoVo.setDepartmentInfo(department);
|
userInfoVo.setDepartmentInfo(department);
|
||||||
}
|
}
|
||||||
|
List<Map<String, Object>> hotelList = mapper.selectRoles(user.getUID());
|
||||||
// 如果存在酒店信息
|
// 如果存在酒店信息
|
||||||
if (StrUtil.isNotBlank(hotelIndex)) {
|
Set<String> roleNames = new HashSet<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(hotelList)) {
|
||||||
|
for (Map<String, Object> hotel : hotelList) {
|
||||||
|
// 循环酒店角色名称
|
||||||
|
for (Map.Entry<String, String> entry : ROLES_MAP.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
if (!hotel.containsKey(key)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String value = Util.null2String(hotel.get(key));
|
||||||
|
// 如果在酒店名称中找到对应的人,则为角色名
|
||||||
|
if (StrUtil.isBlank(value)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] split = value.split(",");
|
||||||
|
List<String> strings = Arrays.asList(split);
|
||||||
|
if (strings.contains(Util.null2String(user.getUID()))) {
|
||||||
|
roleNames.add(entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userInfoVo.setRoleNames(roleNames);
|
||||||
|
/*if (StrUtil.isNotBlank(hotelIndex)) {
|
||||||
List<Map<String, Object>> hotelRoles = this.mapper.selectRoles(user.getUID(), hotelIndex);
|
List<Map<String, Object>> hotelRoles = this.mapper.selectRoles(user.getUID(), hotelIndex);
|
||||||
if (CollectionUtil.isEmpty(hotelRoles)) {
|
if (CollectionUtil.isEmpty(hotelRoles)) {
|
||||||
return userInfoVo;
|
return userInfoVo;
|
||||||
|
@ -98,7 +121,7 @@ public class UserInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
userInfoVo.setRoleNames(roleNames);
|
userInfoVo.setRoleNames(roleNames);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
return userInfoVo;
|
return userInfoVo;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
package com.api.youhong.ai.pcn.download.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.api.youhong.ai.pcn.download.service.DownloadFileService;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>下载文件</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/6/26 23:30</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Path("aiyh/download-file")
|
||||||
|
public class DownloadFileController {
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
private final DownloadFileService service = new DownloadFileService();
|
||||||
|
|
||||||
|
@GET
|
||||||
|
@Path("download")
|
||||||
|
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||||
|
public Response downloadFile(@QueryParam("fieldId") String fieldId) {
|
||||||
|
try {
|
||||||
|
return service.downloadFile(fieldId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("下载文件出错:" + Util.getErrString(e));
|
||||||
|
return Response.ok(ApiResult.error("system error!"), MediaType.APPLICATION_JSON).build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,74 @@
|
||||||
|
package com.api.youhong.ai.pcn.download.service;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
import javax.ws.rs.core.Response;
|
||||||
|
import javax.ws.rs.core.StreamingOutput;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/6/26 23:33</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DownloadFileService {
|
||||||
|
|
||||||
|
|
||||||
|
public static final String SUFFIX = "==";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>下载文件</h2>
|
||||||
|
*
|
||||||
|
* @param encryptionFileId 加密后的文件id docid
|
||||||
|
* @return 文件流
|
||||||
|
*/
|
||||||
|
public Response downloadFile(String encryptionFileId) {
|
||||||
|
if (StrUtil.isBlank(encryptionFileId)) {
|
||||||
|
return Response.ok(ApiResult.error("fileId is blank!"), MediaType.APPLICATION_JSON).build();
|
||||||
|
}
|
||||||
|
String fieldId = null;
|
||||||
|
try {
|
||||||
|
String decode = URLDecoder.decode(encryptionFileId, "UTF-8");
|
||||||
|
if (encryptionFileId.endsWith(SUFFIX)) {
|
||||||
|
decode = encryptionFileId;
|
||||||
|
}
|
||||||
|
fieldId = EncryptionFileIdUtil.decrypt(decode);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new CustomerException("解密附件id失败!", e);
|
||||||
|
}
|
||||||
|
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(fieldId);
|
||||||
|
StreamingOutput stream = outputStream -> {
|
||||||
|
Integer imageFileId = docImageInfo.getImageFileId();
|
||||||
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(imageFileId);
|
||||||
|
byte[] buffer = new byte[4096];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStreamById.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
String imageFileName = docImageInfo.getImageFileName();
|
||||||
|
try {
|
||||||
|
imageFileName = URLEncoder.encode(imageFileName, "UTF-8");
|
||||||
|
} catch (UnsupportedEncodingException ignore) {
|
||||||
|
}
|
||||||
|
|
||||||
|
return Response
|
||||||
|
.ok(stream)
|
||||||
|
.header("Content-Disposition", "attachment; filename=\"" + imageFileName + "\"")
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package com.api.youhong.ai.pcn.download.service;
|
||||||
|
|
||||||
|
import javax.crypto.Cipher;
|
||||||
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Base64;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>加密工具</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/6/26 23:43</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class EncryptionFileIdUtil {
|
||||||
|
private static final String PASSWORD = "H6f9T4x2jL8E3K7Y";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将密码补齐到合法长度
|
||||||
|
*
|
||||||
|
* @param password 密码
|
||||||
|
* @return 合法长度的密码
|
||||||
|
*/
|
||||||
|
public static String padPassword(String password) {
|
||||||
|
byte[] passwordBytes = password.getBytes(StandardCharsets.UTF_8);
|
||||||
|
// AES-128
|
||||||
|
int validKeyLength = 16;
|
||||||
|
if (passwordBytes.length < validKeyLength) {
|
||||||
|
byte[] paddedBytes = Arrays.copyOf(passwordBytes, validKeyLength);
|
||||||
|
return new String(paddedBytes, StandardCharsets.UTF_8);
|
||||||
|
} else if (passwordBytes.length > validKeyLength) {
|
||||||
|
return new String(Arrays.copyOf(passwordBytes, validKeyLength), StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>使用AES对称加密算法和Base64编码进行加密</h2>
|
||||||
|
*
|
||||||
|
* @param plaintext 待加密字符串
|
||||||
|
* @return 加密后的字符串
|
||||||
|
* @throws Exception 产生的异常信息
|
||||||
|
*/
|
||||||
|
public static String encrypt(String plaintext) throws Exception {
|
||||||
|
String password = padPassword(PASSWORD);
|
||||||
|
SecretKeySpec secretKey = new SecretKeySpec(password.getBytes(StandardCharsets.UTF_8), "AES");
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||||
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||||
|
byte[] encryptedData = cipher.doFinal(plaintext.getBytes(StandardCharsets.UTF_8));
|
||||||
|
return Base64.getEncoder().encodeToString(encryptedData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>使用AES对称加密算法和Base64编码进行解密</h2>
|
||||||
|
*
|
||||||
|
* @param encryptedText 加密后的字符串
|
||||||
|
* @return 解密后的字符串
|
||||||
|
* @throws Exception 异常信息
|
||||||
|
*/
|
||||||
|
public static String decrypt(String encryptedText) throws Exception {
|
||||||
|
String password = padPassword(PASSWORD);
|
||||||
|
SecretKeySpec secretKey = new SecretKeySpec(password.getBytes(StandardCharsets.UTF_8), "AES");
|
||||||
|
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, secretKey);
|
||||||
|
byte[] decryptedData = cipher.doFinal(Base64.getDecoder().decode(encryptedText));
|
||||||
|
return new String(decryptedData, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,41 @@
|
||||||
|
package com.api.youhong.ai.taibao.checknumber.controller;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import com.api.youhong.ai.taibao.checknumber.service.CheckNumberService;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
|
||||||
|
import javax.ws.rs.GET;
|
||||||
|
import javax.ws.rs.Path;
|
||||||
|
import javax.ws.rs.Produces;
|
||||||
|
import javax.ws.rs.QueryParam;
|
||||||
|
import javax.ws.rs.core.MediaType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>检查是否存在编号</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/6/26 11:03</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@Path("/aiyh/taibao/bh")
|
||||||
|
public class CheckNumberController {
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
private final CheckNumberService service = new CheckNumberService();
|
||||||
|
|
||||||
|
@Path("check-number")
|
||||||
|
@GET
|
||||||
|
@Produces(MediaType.APPLICATION_JSON)
|
||||||
|
public String checkNumber(@QueryParam("tableName") String tableName,
|
||||||
|
@QueryParam("field") String field,
|
||||||
|
@QueryParam("requestId") String requestId) {
|
||||||
|
try {
|
||||||
|
return ApiResult.success(service.checkNumber(tableName, field, requestId));
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("检查是否存在编号出错:" + Util.getErrString(e));
|
||||||
|
return ApiResult.error("system error!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.api.youhong.ai.taibao.checknumber.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Select;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/6/26 11:08</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface CheckNumberMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h3>查询编号是否存在</h3>
|
||||||
|
*
|
||||||
|
* @param field 编号字段
|
||||||
|
* @param tableName 表名称
|
||||||
|
* @param requestId 流程id
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
@Select("select $t{field} from $t{tableName} where requestid = #{requestId}")
|
||||||
|
String selectNumber(@ParamMapper("field") String field,
|
||||||
|
@ParamMapper("tableName") String tableName,
|
||||||
|
@ParamMapper("requestId") String requestId);
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.api.youhong.ai.taibao.checknumber.service;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import com.api.youhong.ai.taibao.checknumber.mapper.CheckNumberMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/6/26 11:06</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class CheckNumberService {
|
||||||
|
|
||||||
|
private final CheckNumberMapper mapper = Util.getMapper(CheckNumberMapper.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>检查是否存在编号</h2>
|
||||||
|
*
|
||||||
|
* @param tableName 表名称
|
||||||
|
* @param field 字段
|
||||||
|
* @param requestId 流程id
|
||||||
|
* @return 是否存在编号
|
||||||
|
*/
|
||||||
|
public boolean checkNumber(String tableName, String field, String requestId) {
|
||||||
|
String number = mapper.selectNumber(field, tableName, requestId);
|
||||||
|
return StrUtil.isNotBlank(number);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,7 +2,6 @@ package com.customization.youhong.pcn.createrworkflow.impl;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import com.customization.youhong.pcn.createrworkflow.CreateRequestException;
|
import com.customization.youhong.pcn.createrworkflow.CreateRequestException;
|
||||||
import com.customization.youhong.pcn.createrworkflow.mapper.CheckWorkflowRequestParamsMapper;
|
|
||||||
import com.customization.youhong.pcn.createrworkflow.util.CheckWorkflowRequestParamsUtil;
|
import com.customization.youhong.pcn.createrworkflow.util.CheckWorkflowRequestParamsUtil;
|
||||||
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
|
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
|
||||||
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
|
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
|
||||||
|
@ -31,12 +30,11 @@ public class CheckWorkflowRequestParamsImpl extends AbstractServiceProxy impleme
|
||||||
|
|
||||||
private final Logger log = Util.getLogger("workflow");
|
private final Logger log = Util.getLogger("workflow");
|
||||||
|
|
||||||
private final CheckWorkflowRequestParamsMapper mapper = Util.getMapper(CheckWorkflowRequestParamsMapper.class);
|
|
||||||
|
|
||||||
private final CheckWorkflowRequestParamsUtil checkUtil = new CheckWorkflowRequestParamsUtil();
|
private final CheckWorkflowRequestParamsUtil checkUtil = new CheckWorkflowRequestParamsUtil();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ServiceMethodDynamicProxy(desc = "子流程触发时,做流程转数据")
|
@ServiceMethodDynamicProxy(desc = "流程创建校验流程参数")
|
||||||
public PAResponseEntity doCreateRequest(User user, ReqOperateRequestEntity requestParam) {
|
public PAResponseEntity doCreateRequest(User user, ReqOperateRequestEntity requestParam) {
|
||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -2,6 +2,7 @@ package com.customization.youhong.pcn.createrworkflow.util;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.customization.youhong.pcn.createrworkflow.CreateRequestException;
|
import com.customization.youhong.pcn.createrworkflow.CreateRequestException;
|
||||||
import com.customization.youhong.pcn.createrworkflow.mapper.CheckWorkflowRequestParamsMapper;
|
import com.customization.youhong.pcn.createrworkflow.mapper.CheckWorkflowRequestParamsMapper;
|
||||||
import com.customization.youhong.pcn.createrworkflow.pojo.CheckConditionItem;
|
import com.customization.youhong.pcn.createrworkflow.pojo.CheckConditionItem;
|
||||||
|
@ -51,6 +52,8 @@ public class CheckWorkflowRequestParamsUtil {
|
||||||
if (CollectionUtil.isEmpty(detailList)) {
|
if (CollectionUtil.isEmpty(detailList)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
log.info("checkCreateConfig: " + JSON.toJSONString(checkCreateConfig));
|
||||||
|
log.info("detailList: " + JSON.toJSONString(detailList));
|
||||||
Map<String, CheckConditionItem> checkConditionItemMap;
|
Map<String, CheckConditionItem> checkConditionItemMap;
|
||||||
List<CheckConditionItem> conditionGroupItems = checkCreateConfig.getConditionGroupItems();
|
List<CheckConditionItem> conditionGroupItems = checkCreateConfig.getConditionGroupItems();
|
||||||
if (CollectionUtil.isNotEmpty(conditionGroupItems)) {
|
if (CollectionUtil.isNotEmpty(conditionGroupItems)) {
|
||||||
|
@ -133,6 +136,7 @@ public class CheckWorkflowRequestParamsUtil {
|
||||||
if (Objects.isNull(checkCreateConfigDetail)) {
|
if (Objects.isNull(checkCreateConfigDetail)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// TODO 主表明细表字段一致可能出现问题
|
||||||
checkDetailMap.remove(fieldName);
|
checkDetailMap.remove(fieldName);
|
||||||
CheckFunctionParam checkFunctionParam = new CheckFunctionParam();
|
CheckFunctionParam checkFunctionParam = new CheckFunctionParam();
|
||||||
checkFunctionParam.setCheckCreateConfigDetail(checkCreateConfigDetail);
|
checkFunctionParam.setCheckCreateConfigDetail(checkCreateConfigDetail);
|
||||||
|
|
|
@ -0,0 +1,85 @@
|
||||||
|
package com.customization.youhong.taibao.compresspicture.impl;
|
||||||
|
|
||||||
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
|
||||||
|
import com.api.doc.detail.util.DocDownloadCheckUtil;
|
||||||
|
import com.customization.youhong.taibao.compresspicture.mapper.CompressDocPictureMapper;
|
||||||
|
import com.customization.youhong.taibao.compresspicture.util.CompressPictureUtil;
|
||||||
|
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent;
|
||||||
|
import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter;
|
||||||
|
import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam;
|
||||||
|
import org.apache.log4j.Logger;
|
||||||
|
import weaver.file.ImageFileManager;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>压缩图片</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/7/1 16:17</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
|
||||||
|
@WeaIocReplaceComponent("CompressDocPictureService")
|
||||||
|
public class CompressDocPictureImpl {
|
||||||
|
|
||||||
|
private final CompressDocPictureMapper mapper = Util.getMapper(CompressDocPictureMapper.class);
|
||||||
|
|
||||||
|
private final Logger log = Util.getLogger();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 这个是接口后置方法,大概的用法跟前置方法差不多,稍有差别
|
||||||
|
* 注解名称为WeaReplaceAfter
|
||||||
|
* 返回类型必须为String
|
||||||
|
* 参数叫WeaAfterReplaceParam,这个类前四个参数跟前置方法的那个相同,不同的是多了一个叫data的String,这个是那个接口执行完返回的报文
|
||||||
|
* 你可以对那个报文进行操作,然后在这个方法里return回去
|
||||||
|
*/
|
||||||
|
@WeaReplaceAfter(value = "/api/doc/save/save", order = 1)
|
||||||
|
public String after(WeaAfterReplaceParam weaAfterReplaceParam) {
|
||||||
|
String data = weaAfterReplaceParam.getData();
|
||||||
|
try {
|
||||||
|
Map<String, Object> paramMap = weaAfterReplaceParam.getParamMap();
|
||||||
|
String doccontent = Util.null2String(paramMap.get("doccontent"));
|
||||||
|
if (StrUtil.isBlank(doccontent)) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
List<String> imgSrcList = CompressPictureUtil.parseImageSrc(doccontent);
|
||||||
|
if (CollectionUtil.isEmpty(imgSrcList)) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
for (String imgSrc : imgSrcList) {
|
||||||
|
String imageFileIdEncrypt = CompressPictureUtil.extractFileId(imgSrc);
|
||||||
|
String imageFileId = DocDownloadCheckUtil.DncodeFileid(imageFileIdEncrypt);
|
||||||
|
DocImageInfo docImageInfo = Util.selectImageInfoByImageId(imageFileId);
|
||||||
|
if (StrUtil.isNotBlank(docImageInfo.getMiniImgPath())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
InputStream inputStreamById = ImageFileManager.getInputStreamById(Integer.parseInt(imageFileId));
|
||||||
|
InputStream quality = CompressPictureUtil.compressImage(inputStreamById, docImageInfo.getImageFileName(),
|
||||||
|
Float.parseFloat(Util.getCusConfigValueNullOrEmpty("quality", "0.5")));
|
||||||
|
if (Objects.isNull(quality)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
int newImageFileId = Util.createFileByInputSteam(quality, docImageInfo.getImageFileName());
|
||||||
|
if (newImageFileId <= 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DocImageInfo newDocImageInfo = Util.selectImageInfoByImageId(Util.null2String(newImageFileId));
|
||||||
|
boolean flag = mapper.updateImageInfo(docImageInfo, newDocImageInfo);
|
||||||
|
if (flag) {
|
||||||
|
mapper.updateImageInfo(docImageInfo, newDocImageInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("压缩文件出现异常:" + Util.getErrString(e));
|
||||||
|
}
|
||||||
|
// 这个就是接口执行完的报文
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.customization.youhong.taibao.compresspicture.mapper;
|
||||||
|
|
||||||
|
import aiyh.utils.annotation.recordset.ParamMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.SqlMapper;
|
||||||
|
import aiyh.utils.annotation.recordset.Update;
|
||||||
|
import aiyh.utils.entity.DocImageInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1></h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/7/1 16:41</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
@SqlMapper
|
||||||
|
public interface CompressDocPictureMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>更新文件信息</h2>
|
||||||
|
* @param docImageInfo 老文件信息
|
||||||
|
* @param newDocImageInfo 新文件信息
|
||||||
|
* @return 是否更新成功
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Update("update imagefile set FILEREALPATH = #{new.path},AESCODE = #{new.aesCode}," +
|
||||||
|
"TOKENKEY = #{new.tokenKey},FILESIZE = #{new.fileSize}," +
|
||||||
|
"MINIIMGPATH= #{old.imageFileId} where IMAGEFILEID = #{old.imageFileId}")
|
||||||
|
boolean updateImageInfo(@ParamMapper("old") DocImageInfo docImageInfo,
|
||||||
|
@ParamMapper("new") DocImageInfo newDocImageInfo);
|
||||||
|
}
|
|
@ -0,0 +1,214 @@
|
||||||
|
package com.customization.youhong.taibao.compresspicture.util;
|
||||||
|
|
||||||
|
import aiyh.utils.excention.CustomerException;
|
||||||
|
import org.jsoup.Jsoup;
|
||||||
|
import org.jsoup.nodes.Document;
|
||||||
|
import org.jsoup.nodes.Element;
|
||||||
|
import org.jsoup.select.Elements;
|
||||||
|
|
||||||
|
import javax.imageio.IIOImage;
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import javax.imageio.ImageWriteParam;
|
||||||
|
import javax.imageio.ImageWriter;
|
||||||
|
import javax.imageio.stream.ImageOutputStream;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>压缩工具类</h1>
|
||||||
|
*
|
||||||
|
* <p>create: 2023/7/1 16:20</p>
|
||||||
|
*
|
||||||
|
* @author youHong.ai
|
||||||
|
*/
|
||||||
|
public class CompressPictureUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>压缩图片</h2>
|
||||||
|
*
|
||||||
|
* @param inputStream 图片文件流
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @param quality 图片质量
|
||||||
|
* @return 压缩后的文件
|
||||||
|
*/
|
||||||
|
public static InputStream compressImage(InputStream inputStream, String fileName, float quality) {
|
||||||
|
try {
|
||||||
|
// 读取输入图像流
|
||||||
|
BufferedImage image = ImageIO.read(inputStream);
|
||||||
|
|
||||||
|
// 获取图像格式
|
||||||
|
String formatName = getFormatName(fileName);
|
||||||
|
|
||||||
|
// 根据图像格式进行不同的压缩处理
|
||||||
|
if (formatName.equalsIgnoreCase("png")) {
|
||||||
|
return compressPNG(image, quality);
|
||||||
|
} else if (formatName.equalsIgnoreCase("jepg")) {
|
||||||
|
return compressJPEG(image, quality);
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new CustomerException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>压缩png文件</h2>
|
||||||
|
*
|
||||||
|
* @param image 图片
|
||||||
|
* @param quality 图片质量
|
||||||
|
* @return 压缩后文件
|
||||||
|
* @throws IOException io异常
|
||||||
|
*/
|
||||||
|
private static InputStream compressPNG(BufferedImage image, float quality) throws IOException {
|
||||||
|
int originalWidth = image.getWidth();
|
||||||
|
int originalHeight = image.getHeight();
|
||||||
|
|
||||||
|
// 计算压缩后的宽度和高度
|
||||||
|
int compressedWidth = (int) (originalWidth * quality);
|
||||||
|
int compressedHeight = (int) (originalHeight * quality);
|
||||||
|
|
||||||
|
// 创建压缩后的图像
|
||||||
|
BufferedImage compressedImage = new BufferedImage(compressedWidth, compressedHeight, BufferedImage.TYPE_INT_ARGB);
|
||||||
|
Graphics2D g2d = compressedImage.createGraphics();
|
||||||
|
g2d.drawImage(image, 0, 0, compressedWidth, compressedHeight, null);
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
// 将压缩后的图像保存到字节数组输出流
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
ImageIO.write(compressedImage, "png", outputStream);
|
||||||
|
|
||||||
|
return new ByteArrayInputStream(outputStream.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>压缩jpeg图片</h2>
|
||||||
|
*
|
||||||
|
* @param image 图片
|
||||||
|
* @param quality 图片质量
|
||||||
|
* @return 压缩后图片
|
||||||
|
* @throws IOException io异常
|
||||||
|
*/
|
||||||
|
|
||||||
|
private static InputStream compressJPEG(BufferedImage image, float quality) throws IOException {
|
||||||
|
// 创建压缩参数
|
||||||
|
ImageWriter writer = ImageIO.getImageWritersByFormatName("jpeg").next();
|
||||||
|
ImageWriteParam writeParam = writer.getDefaultWriteParam();
|
||||||
|
writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
|
||||||
|
writeParam.setCompressionQuality(quality);
|
||||||
|
|
||||||
|
// 将压缩后的图像保存到字节数组输出流
|
||||||
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(outputStream);
|
||||||
|
writer.setOutput(imageOutputStream);
|
||||||
|
writer.write(null, new IIOImage(image, null, null), writeParam);
|
||||||
|
|
||||||
|
// 关闭资源
|
||||||
|
writer.dispose();
|
||||||
|
imageOutputStream.close();
|
||||||
|
outputStream.close();
|
||||||
|
|
||||||
|
return new ByteArrayInputStream(outputStream.toByteArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>格式化图片后缀</h2>
|
||||||
|
*
|
||||||
|
* @param fileName 文件名称
|
||||||
|
* @return 文件后缀
|
||||||
|
*/
|
||||||
|
private static String getFormatName(String fileName) {
|
||||||
|
String formatName = fileName.substring(fileName.lastIndexOf('.') + 1).toLowerCase();
|
||||||
|
if (formatName.equals("jpg") || formatName.equals("jpeg")) {
|
||||||
|
return "jpeg";
|
||||||
|
}
|
||||||
|
return formatName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>解析html中的img的src</h2>
|
||||||
|
*
|
||||||
|
* @param html html字符串
|
||||||
|
* @return 所有的src
|
||||||
|
*/
|
||||||
|
public static List<String> parseImageSrc(String html) {
|
||||||
|
List<String> srcList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 使用 Jsoup 解析 HTML 字符串
|
||||||
|
Document document = Jsoup.parse(html);
|
||||||
|
|
||||||
|
// 获取所有的 img 标签
|
||||||
|
Elements imgElements = document.select("img");
|
||||||
|
|
||||||
|
// 使用迭代器遍历 img 标签,并获取其 src 属性值
|
||||||
|
Iterator<Element> iterator = imgElements.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
Element imgElement = iterator.next();
|
||||||
|
String src = imgElement.attr("src");
|
||||||
|
srcList.add(src);
|
||||||
|
}
|
||||||
|
|
||||||
|
return srcList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>获取文件id</h2>
|
||||||
|
*
|
||||||
|
* @param input 输入字符串
|
||||||
|
* @return 文件id
|
||||||
|
*/
|
||||||
|
public static String extractFileId(String input) {
|
||||||
|
String fileId = null;
|
||||||
|
|
||||||
|
// 寻找 "fileid=" 的索引位置
|
||||||
|
int index = input.indexOf("fileid=");
|
||||||
|
if (index != -1) {
|
||||||
|
// 截取 "fileid=" 后面的部分
|
||||||
|
String substring = input.substring(index + 7);
|
||||||
|
|
||||||
|
// 查找第一个 "&" 符号的索引位置
|
||||||
|
int endIndex = substring.indexOf("&");
|
||||||
|
if (endIndex != -1) {
|
||||||
|
// 截取从 "fileid=" 后面到第一个 "&" 符号之前的部分
|
||||||
|
fileId = substring.substring(0, endIndex);
|
||||||
|
} else {
|
||||||
|
// 如果没有 "&" 符号,截取从 "fileid=" 后面到字符串末尾的部分
|
||||||
|
fileId = substring;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return fileId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h2>替换fieldId</h2>
|
||||||
|
*
|
||||||
|
* @param input 带替换的字符串
|
||||||
|
* @param newFileId 新文件id
|
||||||
|
* @return 完整字符串
|
||||||
|
*/
|
||||||
|
public static String replaceFileId(String input, String newFileId) {
|
||||||
|
// 寻找 "fileid=" 的索引位置
|
||||||
|
int index = input.indexOf("fileid=");
|
||||||
|
if (index != -1) {
|
||||||
|
// 查找第一个 "&" 符号的索引位置
|
||||||
|
int endIndex = input.indexOf("&", index);
|
||||||
|
if (endIndex != -1) {
|
||||||
|
// 替换 "fileid=" 后面到第一个 "&" 符号之前的部分
|
||||||
|
return input.substring(0, index + 7) + newFileId + input.substring(endIndex);
|
||||||
|
} else {
|
||||||
|
// 替换 "fileid=" 后面到字符串末尾的部分
|
||||||
|
return input.substring(0, index + 7) + newFileId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return input;
|
||||||
|
}
|
||||||
|
}
|
|
@ -36,7 +36,7 @@ public class ReadMail extends ToolUtil {
|
||||||
/**
|
/**
|
||||||
* 定义邮箱host (腾讯邮箱)暂不修改
|
* 定义邮箱host (腾讯邮箱)暂不修改
|
||||||
*/
|
*/
|
||||||
private static final String host = "imap.exmail.qq.com";
|
private static final String host = "imap.exmail.qq.getLogFilePath";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 定义邮箱端口
|
* 定义邮箱端口
|
||||||
|
|
|
@ -0,0 +1,130 @@
|
||||||
|
package weaver.formmode.customjavacode.modeexpand.ey.jiahx;
|
||||||
|
|
||||||
|
import com.api.nonstandardext.model_field_async.service.ModelFieldAsyncServiceImpl;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author 贾寒旭
|
||||||
|
* @Date 2023/4/6
|
||||||
|
* @Other
|
||||||
|
* @Version
|
||||||
|
*/
|
||||||
|
public class TransferSelect extends AbstractModeExpandJavaCodeNew {
|
||||||
|
|
||||||
|
private final ModelFieldAsyncServiceImpl service = new ModelFieldAsyncServiceImpl();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
|
||||||
|
// src/weaver/formmode/customjavacode/modeexpand/getKmmb.java
|
||||||
|
baseBean.writeLog("保存自定义接口开始TransferSelect>>>>>");
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
User user = (User) param.get("user");
|
||||||
|
int billid = -1;//数据id
|
||||||
|
int modeid = -1;//模块id
|
||||||
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
|
if (requestInfo != null) {
|
||||||
|
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||||
|
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||||
|
RecordSet upRs = new RecordSet();
|
||||||
|
if (billid > 0 && modeid > 0) {
|
||||||
|
//------请在下面编写业务逻辑代码------
|
||||||
|
// billingType,requestType,billingIssueType,clientType,multipleBilling,serviceType,LeType
|
||||||
|
String sql = "select * from uf_zdjmbd where id = ?";
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeQuery(sql, billid);
|
||||||
|
while (rs.next()) {
|
||||||
|
String billingTypewb = Util.null2String(rs.getString("billingTypewb"));
|
||||||
|
String requestTypewb = Util.null2String(rs.getString("requestTypewb"));
|
||||||
|
String billingIssueTypewb = Util.null2String(rs.getString("billingIssueTypewb"));
|
||||||
|
String clientTypewb = Util.null2String(rs.getString("clientTypewb"));
|
||||||
|
String multipleBillingwb = Util.null2String(rs.getString("multipleBillingwb"));
|
||||||
|
String serviceTypewb = Util.null2String(rs.getString("serviceTypewb"));
|
||||||
|
String LeTypewb = Util.null2String(rs.getString("LeTypewb"));
|
||||||
|
//2023年6月7日新增engCodewb转换engCode --cds
|
||||||
|
String engCodewb = Util.null2String(rs.getString("engCodewb"));
|
||||||
|
|
||||||
|
if (!engCodewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_xmjbxxjmbd xm set uf.engCode = xm.engagement_code " +
|
||||||
|
"where uf.engCodewb = xm.engagement_code1 and uf.engCodewb=? and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, engCodewb, billid);
|
||||||
|
}
|
||||||
|
if (!billingTypewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.billingType = uv.zdid" +
|
||||||
|
" where uf.billingTypewb = uv.zdnr and uf.billingType is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
if (!requestTypewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.requestType = uv.zdid " +
|
||||||
|
" where uf.requestTypewb = uv.zdnr and uf.requestType is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
if (!billingIssueTypewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.billingIssueType = uv.zdid " +
|
||||||
|
" where uf.billingIssueTypewb = uv.zdnr and uf.billingIssueType is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
if (!clientTypewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.clientType = uv.zdid " +
|
||||||
|
" where uf.clientTypewb = uv.zdnr and uf.clientType is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
if (!multipleBillingwb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.multipleBilling = uv.zdid " +
|
||||||
|
" where uf.multipleBillingwb = uv.zdnr and uf.multipleBilling is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
if (!serviceTypewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.serviceType = uv.zdid " +
|
||||||
|
" where uf.serviceTypewb = uv.zdnr and uf.serviceType is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
if (!LeTypewb.equals("")) {
|
||||||
|
String Upsql = "update uf_zdjmbd uf ,uf_vmschange_dt1 uv set uf.LeType = uv.zdid " +
|
||||||
|
" where uf.LeTypewb = uv.zdnr and uf.LeType is null and uf.id = ?";
|
||||||
|
upRs.executeUpdate(Upsql, billid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rs.executeQuery("select dt1.engCodewb,dt1.id from uf_zdjmbd_dt1 dt1 left join uf_zdjmbd m on dt1.mainid=m.id where m.id = ?", billid);
|
||||||
|
|
||||||
|
//更新uf_zdjmbd_dt1,engCode
|
||||||
|
String Upsql = "update uf_zdjmbd_dt1 uf ,uf_xmjbxxjmbd xm set uf.engCode = xm.engagement_code " +
|
||||||
|
"where uf.engCodewb = xm.engagement_code1 and uf.engCodewb=? and uf.id = ?";
|
||||||
|
while (rs.next()) {
|
||||||
|
String engCodewb = Util.null2String(rs.getString("engCodewb"));
|
||||||
|
String id = Util.null2String(rs.getString("id"));
|
||||||
|
if (!"".equals(engCodewb)) {
|
||||||
|
boolean b = upRs.executeUpdate(Upsql, engCodewb, id);
|
||||||
|
baseBean.writeLog("TransferSelect转换明细engCode-----Flag:" + b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 通过配置同步字段
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023-06-27
|
||||||
|
*/
|
||||||
|
service.asyncDataByClassName(this.getClass().getSimpleName(), String.valueOf(billid));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
baseBean.writeLog("TransferSelect catch exception:" + e);
|
||||||
|
result.put("errmsg", "自定义出错信息");
|
||||||
|
result.put("flag", "false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package weaver.formmode.customjavacode.modeexpand.ey.jiahx;
|
||||||
|
|
||||||
|
import com.api.nonstandardext.model_field_async.service.ModelFieldAsyncServiceImpl;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
|
||||||
|
import weaver.general.BaseBean;
|
||||||
|
import weaver.general.Util;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description
|
||||||
|
* @Author 贾寒旭
|
||||||
|
* @Date 2023/4/6
|
||||||
|
* @Other
|
||||||
|
* @Version
|
||||||
|
*/
|
||||||
|
//更新 uf_fptbjmbd_dt1 ,engCode
|
||||||
|
public class TransferSelect_fp extends AbstractModeExpandJavaCodeNew {
|
||||||
|
|
||||||
|
private final ModelFieldAsyncServiceImpl service = new ModelFieldAsyncServiceImpl();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String> doModeExpand(Map<String, Object> param) {
|
||||||
|
BaseBean baseBean = new BaseBean();
|
||||||
|
|
||||||
|
// src/weaver/formmode/customjavacode/modeexpand/getKmmb.java
|
||||||
|
baseBean.writeLog("保存自定义接口开始TransferSelect_fp>>>>>");
|
||||||
|
Map<String, String> result = new HashMap<String, String>();
|
||||||
|
try {
|
||||||
|
User user = (User) param.get("user");
|
||||||
|
int billid = -1;//数据id
|
||||||
|
int modeid = -1;//模块id
|
||||||
|
RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
|
||||||
|
if (requestInfo != null) {
|
||||||
|
billid = Util.getIntValue(requestInfo.getRequestid());
|
||||||
|
modeid = Util.getIntValue(requestInfo.getWorkflowid());
|
||||||
|
RecordSet upRs = new RecordSet();
|
||||||
|
if (billid > 0 && modeid > 0) {
|
||||||
|
RecordSet rs = new RecordSet();
|
||||||
|
rs.executeQuery("select dt1.engCodewb,dt1.id from uf_fptbjmbd_dt1 dt1 left join uf_fptbjmbd m on dt1.mainid=m.id where m.id = ?", billid);
|
||||||
|
|
||||||
|
//更新uf_fptbjmbd_dt1,engCode
|
||||||
|
String Upsql = "update uf_fptbjmbd_dt1 uf ,uf_fptbjmbd xm set uf.engCode = xm.engagement_code " +
|
||||||
|
"where uf.engCodewb = xm.engagement_code1 and uf.engCodewb=? and uf.id = ?";
|
||||||
|
while (rs.next()) {
|
||||||
|
String engCodewb = Util.null2String(rs.getString("engCodewb"));
|
||||||
|
String id = Util.null2String(rs.getString("id"));
|
||||||
|
if (!"".equals(engCodewb)) {
|
||||||
|
boolean b = upRs.executeUpdate(Upsql, engCodewb, id);
|
||||||
|
baseBean.writeLog("TransferSelect_fp转换明细engCode-----Flag:" + b);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 通过配置同步字段
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023-06-27
|
||||||
|
*/
|
||||||
|
service.asyncDataByClassName(this.getClass().getSimpleName(), String.valueOf(billid));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
baseBean.writeLog("TransferSelect_fp catch exception:" + e);
|
||||||
|
result.put("errmsg", "自定义出错信息");
|
||||||
|
result.put("flag", "false");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
|
@ -10,15 +10,13 @@ import org.apache.axis2.databinding.types.xsd._float;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
|
import org.apache.tools.ant.taskdefs.Pack;
|
||||||
import weaver.formmode.data.ModeDataIdUpdate;
|
import weaver.formmode.data.ModeDataIdUpdate;
|
||||||
import weaver.formmode.setup.ModeRightInfo;
|
import weaver.formmode.setup.ModeRightInfo;
|
||||||
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
import weaver.xuanran.wang.common.mapper.CommonMapper;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
|
||||||
|
@ -102,7 +100,10 @@ public class CusData2OA {
|
||||||
return modelDataList;
|
return modelDataList;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void baseInsertAndUpdate(String modelId, List<Map<String, Object>> params, CountDownLatch latch){
|
public static boolean baseInsertAndUpdate(String modelId, List<Map<String, Object>> params, CountDownLatch latch){
|
||||||
|
if(CollectionUtils.isEmpty(params)){
|
||||||
|
return true;
|
||||||
|
}
|
||||||
int modelIdInt = Util.getIntValue(modelId, -1);
|
int modelIdInt = Util.getIntValue(modelId, -1);
|
||||||
String tableName = CommonUtil.checkModelId(modelIdInt);
|
String tableName = CommonUtil.checkModelId(modelIdInt);
|
||||||
if(modelIdInt < 0 || StringUtils.isBlank(tableName)){
|
if(modelIdInt < 0 || StringUtils.isBlank(tableName)){
|
||||||
|
@ -127,21 +128,23 @@ public class CusData2OA {
|
||||||
updateSql = buildUpdateSql(tableName, param);
|
updateSql = buildUpdateSql(tableName, param);
|
||||||
}
|
}
|
||||||
if(StringUtils.isBlank(insertSql)){
|
if(StringUtils.isBlank(insertSql)){
|
||||||
insertSql = buildInsertSql(tableName, modelId, param);
|
insertSql = buildInsertSql(tableName, param);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if(CollectionUtils.isNotEmpty(updateParams)){
|
if(CollectionUtils.isNotEmpty(updateParams)){
|
||||||
if (!commonMapper.updateModelInfoList(updateSql, params)) {
|
if (!commonMapper.updateModelInfoList(updateSql, updateParams)) {
|
||||||
throw new CustomerException("update model data sql execute error!");
|
throw new CustomerException("update model data sql execute error!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(CollectionUtils.isNotEmpty(insertParams)){
|
if(CollectionUtils.isNotEmpty(insertParams)){
|
||||||
if (!commonMapper.batchInsertModel(insertSql, params)) {
|
if (!commonMapper.batchInsertModel(insertSql, insertParams)) {
|
||||||
throw new CustomerException("insert model data sql execute error!");
|
throw new CustomerException("insert model data sql execute error!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
|
log.error("更新数据失败! : " + e.getMessage());
|
||||||
throw new CustomerException(e);
|
throw new CustomerException(e);
|
||||||
}finally {
|
}finally {
|
||||||
if(latch != null){
|
if(latch != null){
|
||||||
|
@ -153,10 +156,12 @@ public class CusData2OA {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildUpdateSql(String tableName, Map<String, Object> params) {
|
public static String buildUpdateSql(String tableName, Map<String, Object> params) {
|
||||||
|
Map<String, Object> copy = new HashMap<>(params);
|
||||||
|
copy.remove("id");
|
||||||
StringBuilder sqlSb = new StringBuilder("update ")
|
StringBuilder sqlSb = new StringBuilder("update ")
|
||||||
.append(tableName)
|
.append(tableName)
|
||||||
.append(" set ");
|
.append(" set ");
|
||||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
for (Map.Entry<String, Object> entry : copy.entrySet()) {
|
||||||
sqlSb.append(entry.getKey())
|
sqlSb.append(entry.getKey())
|
||||||
.append(" = #{item.")
|
.append(" = #{item.")
|
||||||
.append(entry.getKey())
|
.append(entry.getKey())
|
||||||
|
@ -167,13 +172,15 @@ public class CusData2OA {
|
||||||
return sqlSb.toString();
|
return sqlSb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String buildInsertSql(String tableName, String modelId,Map<String, Object> params) {
|
public static String buildInsertSql(String tableName, Map<String, Object> params) {
|
||||||
|
Map<String, Object> copy = new HashMap<>(params);
|
||||||
|
copy.remove("id");
|
||||||
StringBuilder sqlSb = new StringBuilder("insert into ")
|
StringBuilder sqlSb = new StringBuilder("insert into ")
|
||||||
.append(tableName)
|
.append(tableName)
|
||||||
.append(" (");
|
.append(" (");
|
||||||
StringBuilder fields = new StringBuilder();
|
StringBuilder fields = new StringBuilder();
|
||||||
StringBuilder values = new StringBuilder();
|
StringBuilder values = new StringBuilder();
|
||||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
for (Map.Entry<String, Object> entry : copy.entrySet()) {
|
||||||
fields.append(entry.getKey()).append(",");
|
fields.append(entry.getKey()).append(",");
|
||||||
values.append("#{item.")
|
values.append("#{item.")
|
||||||
.append(entry.getKey())
|
.append(entry.getKey())
|
||||||
|
|
|
@ -6,6 +6,7 @@ import aiyh.utils.annotation.ActionDesc;
|
||||||
import aiyh.utils.annotation.ActionOptionalParam;
|
import aiyh.utils.annotation.ActionOptionalParam;
|
||||||
import aiyh.utils.annotation.PrintParamMark;
|
import aiyh.utils.annotation.PrintParamMark;
|
||||||
import aiyh.utils.annotation.RequiredMark;
|
import aiyh.utils.annotation.RequiredMark;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
import weaver.soa.workflow.request.RequestInfo;
|
import weaver.soa.workflow.request.RequestInfo;
|
||||||
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
||||||
|
@ -59,7 +60,7 @@ public class WorkflowToCms extends SafeCusBaseAction {
|
||||||
.errorMsg(Util.null2DefaultStr(msg, "error"))
|
.errorMsg(Util.null2DefaultStr(msg, "error"))
|
||||||
.dataKey(Util.null2DefaultStr(dataKey, ""))
|
.dataKey(Util.null2DefaultStr(dataKey, ""))
|
||||||
.build();
|
.build();
|
||||||
log.info("");
|
log.info("cmsResponseVoField : " + JSONObject.toJSONString(cmsResponseVoField));
|
||||||
|
|
||||||
CusSuccess tokenSuccess = CusSuccess
|
CusSuccess tokenSuccess = CusSuccess
|
||||||
.builder()
|
.builder()
|
||||||
|
@ -68,6 +69,7 @@ public class WorkflowToCms extends SafeCusBaseAction {
|
||||||
.errorMsg(Util.null2DefaultStr(tokenMsg, "error"))
|
.errorMsg(Util.null2DefaultStr(tokenMsg, "error"))
|
||||||
.dataKey(Util.null2DefaultStr(tokenDataKey,""))
|
.dataKey(Util.null2DefaultStr(tokenDataKey,""))
|
||||||
.build();
|
.build();
|
||||||
|
log.info("tokenSuccess : " + JSONObject.toJSONString(tokenSuccess));
|
||||||
workflowToCmsService.workflowToCms(onlyMark,tokenOnlyMark, billTable, requestId,cmsResponseVoField, tokenSuccess);
|
workflowToCmsService.workflowToCms(onlyMark,tokenOnlyMark, billTable, requestId,cmsResponseVoField, tokenSuccess);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ 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.sh_bigdata.common.service.CusDataDecipher;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -23,5 +22,4 @@ public class CusSuccess {
|
||||||
private String errorMsg;
|
private String errorMsg;
|
||||||
private String dataKey;
|
private String dataKey;
|
||||||
private Object response;
|
private Object response;
|
||||||
private CusDataDecipher cusDataDecipher;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
package weaver.xuanran.wang.cssc.cms.service.impl;
|
package weaver.xuanran.wang.cssc.cms.service.impl;
|
||||||
|
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.conn.RecordSet;
|
import weaver.conn.RecordSet;
|
||||||
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
import weaver.xiao.commons.config.entity.RequestMappingConfig;
|
||||||
|
import weaver.xiao.commons.config.entity.ResponseMapping;
|
||||||
import weaver.xiao.commons.config.service.DealWithMapping;
|
import weaver.xiao.commons.config.service.DealWithMapping;
|
||||||
|
import weaver.xiao.commons.utils.SqlUtil;
|
||||||
import weaver.xuanran.wang.common.util.CommonUtil;
|
import weaver.xuanran.wang.common.util.CommonUtil;
|
||||||
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
import weaver.xuanran.wang.cssc.cms.entity.CusSuccess;
|
||||||
import weaver.xuanran.wang.cssc.cms.service.WorkflowToCmsService;
|
import weaver.xuanran.wang.cssc.cms.service.WorkflowToCmsService;
|
||||||
import weaver.xuanran.wang.cssc.cms.util.RequestMasterPlate;
|
import weaver.xuanran.wang.cssc.cms.util.RequestMasterPlate;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,6 +31,7 @@ public class WorkFlowToCmsServiceImpl implements WorkflowToCmsService {
|
||||||
private final DealWithMapping dealWithMapping = new DealWithMapping();
|
private final DealWithMapping dealWithMapping = new DealWithMapping();
|
||||||
private final Logger log = Util.getLogger(); // 获取日志对象
|
private final Logger log = Util.getLogger(); // 获取日志对象
|
||||||
private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
|
private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
|
||||||
|
private final SqlUtil sqlUtil = new SqlUtil();
|
||||||
@Override
|
@Override
|
||||||
public String getToken(String onlyMark,String billTable,
|
public String getToken(String onlyMark,String billTable,
|
||||||
String requestId, CusSuccess cusSuccess) {
|
String requestId, CusSuccess cusSuccess) {
|
||||||
|
@ -57,7 +65,20 @@ public class WorkFlowToCmsServiceImpl implements WorkflowToCmsService {
|
||||||
String url = requestMappingConfig.getRequestUrl();
|
String url = requestMappingConfig.getRequestUrl();
|
||||||
dealWithMapping.setMainTable(billTable);
|
dealWithMapping.setMainTable(billTable);
|
||||||
Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig);
|
Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig);
|
||||||
requestMasterPlate.apiPost(url, param, headers, cusSuccess);
|
Map<String, Object> result = requestMasterPlate.apiPost(url, param, headers, cusSuccess);
|
||||||
|
List<ResponseMapping> responseMappingList = requestMappingConfig.getResponseMappingList();
|
||||||
|
if(CollectionUtils.isEmpty(responseMappingList) || MapUtils.isEmpty(result)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Map<String, Map<String, Object>> writeBackMessage = dealWithMapping.dealResponse(responseMappingList, result);
|
||||||
|
log.info("回写信息 writeBackMessage ==>"+ JSON.toJSONString(writeBackMessage));
|
||||||
|
Map<String, Object> updateMsg = writeBackMessage.get(billTable);
|
||||||
|
Map<String,Object> whereParam = new HashMap<>();
|
||||||
|
whereParam.put("requestid",requestId);
|
||||||
|
boolean success = sqlUtil.updateMode(billTable, updateMsg, whereParam);
|
||||||
|
if(!success){
|
||||||
|
log.error("数据回写表单失败!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RecordSet initRs( RequestMappingConfig requestMappingConfig, String billTable, String requestId){
|
public RecordSet initRs( RequestMappingConfig requestMappingConfig, String billTable, String requestId){
|
||||||
|
|
|
@ -53,12 +53,7 @@ public class RequestMasterPlate {
|
||||||
responseVo.getEntityString())); // 相应内容
|
responseVo.getEntityString())); // 相应内容
|
||||||
throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
|
||||||
}
|
}
|
||||||
Map<String, Object> response;
|
Map<String, Object> response = responseVo.getResponseMap(); // 根据相应结果转化为map集合
|
||||||
if(cusSuccess.getCusDataDecipher() != null){
|
|
||||||
response = cusSuccess.getCusDataDecipher().decoder(responseVo);
|
|
||||||
}else {
|
|
||||||
response = responseVo.getResponseMap(); // 根据相应结果转化为map集合
|
|
||||||
}
|
|
||||||
cusSuccess.setResponse(response);
|
cusSuccess.setResponse(response);
|
||||||
String responseValue = Util.null2DefaultStr(response.get(cusSuccess.getSuccessField()), "");
|
String responseValue = Util.null2DefaultStr(response.get(cusSuccess.getSuccessField()), "");
|
||||||
if (!cusSuccess.getSuccessValue().equals(responseValue)) {
|
if (!cusSuccess.getSuccessValue().equals(responseValue)) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package weaver.xuanran.wang.eny.data_async.mapper;
|
package weaver.xuanran.wang.eny.data_async.mapper;
|
||||||
|
|
||||||
import aiyh.utils.annotation.recordset.*;
|
import aiyh.utils.annotation.recordset.*;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import weaver.xuanran.wang.eny.data_async.entity.DataAsyncConfigDetail;
|
import weaver.xuanran.wang.eny.data_async.entity.DataAsyncConfigDetail;
|
||||||
import weaver.xuanran.wang.eny.data_async.entity.DataAsyncConfigMain;
|
import weaver.xuanran.wang.eny.data_async.entity.DataAsyncConfigMain;
|
||||||
|
|
||||||
|
@ -53,6 +54,17 @@ public interface DataAsyncMapper {
|
||||||
@ParamMapper("min") Integer min,
|
@ParamMapper("min") Integer min,
|
||||||
@ParamMapper("max") Integer max);
|
@ParamMapper("max") Integer max);
|
||||||
|
|
||||||
|
@Select("select id from $t{tableName} where $t{foreignKey} between #{min} and #{max}")
|
||||||
|
@CaseConversion(value = false)
|
||||||
|
List<Integer> selectDataIdsByForeignKey(@ParamMapper("tableName") String tableName,
|
||||||
|
@ParamMapper("foreignKey") String foreignKey,
|
||||||
|
@ParamMapper("min") Integer min,
|
||||||
|
@ParamMapper("max") Integer max);
|
||||||
|
|
||||||
@Select(custom = true)
|
@Select(custom = true)
|
||||||
String selectCustomerSql(@SqlString String sql, Map<String, Object> map);
|
String selectCustomerSql(@SqlString String sql, Map<String, Object> map);
|
||||||
|
|
||||||
|
@Select("select id from $t{tableName} where modedatacreatedate = #{date}")
|
||||||
|
List<Integer> selectDataIdListByCreateDate(@ParamMapper("tableName") String tableName,
|
||||||
|
@ParamMapper("date") String date);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,17 +4,14 @@ import aiyh.utils.ThreadPoolConfig;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
import aiyh.utils.excention.CustomerException;
|
import aiyh.utils.excention.CustomerException;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.engine.common.util.ServiceUtil;
|
import io.swagger.models.auth.In;
|
||||||
import com.engine.cube.service.ModeAppService;
|
|
||||||
import com.engine.cube.service.impl.ModeAppServiceImpl;
|
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
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 org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import weaver.formmode.setup.ModeRightInfoThread;
|
import weaver.formmode.setup.ModeRightInfo;
|
||||||
import weaver.general.TimeUtil;
|
import weaver.general.TimeUtil;
|
||||||
import weaver.hrm.User;
|
|
||||||
import weaver.xuanran.wang.common.entity.CusSuccess;
|
import weaver.xuanran.wang.common.entity.CusSuccess;
|
||||||
import weaver.xuanran.wang.common.util.CommonUtil;
|
import weaver.xuanran.wang.common.util.CommonUtil;
|
||||||
import weaver.xuanran.wang.common.util.CusData2OA;
|
import weaver.xuanran.wang.common.util.CusData2OA;
|
||||||
|
@ -25,9 +22,6 @@ import weaver.xuanran.wang.eny.data_async.mapper.DataAsyncMapper;
|
||||||
import weaver.xuanran.wang.eny.data_async.util.EyDataAsyncTokenUtil;
|
import weaver.xuanran.wang.eny.data_async.util.EyDataAsyncTokenUtil;
|
||||||
import weaver.xuanran.wang.eny.data_async.util.ValueRuleMethod;
|
import weaver.xuanran.wang.eny.data_async.util.ValueRuleMethod;
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import javax.servlet.http.HttpSessionContext;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
|
@ -56,6 +50,8 @@ public class DataAsyncServiceImpl {
|
||||||
.errorMsg("msg")
|
.errorMsg("msg")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
private static final ModeRightInfo moderightinfo = new ModeRightInfo();
|
||||||
|
|
||||||
private int pageSize = 100;
|
private int pageSize = 100;
|
||||||
|
|
||||||
private int pageNo = 1;
|
private int pageNo = 1;
|
||||||
|
@ -76,7 +72,7 @@ public class DataAsyncServiceImpl {
|
||||||
**/
|
**/
|
||||||
public DataAsyncConfigMain getConfig(String onlyMark) {
|
public DataAsyncConfigMain getConfig(String onlyMark) {
|
||||||
DataAsyncConfigMain config = asyncMapper.selectConfigByOnlyMark(onlyMark);
|
DataAsyncConfigMain config = asyncMapper.selectConfigByOnlyMark(onlyMark);
|
||||||
if(Objects.isNull(config) || CollectionUtils.isEmpty(config.getConfigDetailList())){
|
if (Objects.isNull(config) || CollectionUtils.isEmpty(config.getConfigDetailList())) {
|
||||||
throw new CustomerException("该唯一标识在配置表中未找到对应的配置!或存在该配置但是明细数据为空!");
|
throw new CustomerException("该唯一标识在配置表中未找到对应的配置!或存在该配置但是明细数据为空!");
|
||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
|
@ -84,13 +80,14 @@ public class DataAsyncServiceImpl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>数据同步 有一个点 就是如果接口请求过程中报错了 怎么重新处理</h1>
|
* <h1>数据同步 有一个点 就是如果接口请求过程中报错了 怎么重新处理</h1>
|
||||||
|
*
|
||||||
|
* @param config 配置对象
|
||||||
|
* @param tokenUrl token地址
|
||||||
|
* @param params token 参数
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
* @dateTime 2023/6/9 13:28
|
* @dateTime 2023/6/9 13:28
|
||||||
* @param config 配置对象
|
|
||||||
* @param tokenUrl token地址
|
|
||||||
* @param params token 参数
|
|
||||||
**/
|
**/
|
||||||
public void asyncData(DataAsyncConfigMain config, String tokenUrl, Map<String, Object> params){
|
public void asyncData(DataAsyncConfigMain config, String tokenUrl, Map<String, Object> params) {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
log.info("数据开始同步时间 : " + TimeUtil.getCurrentTimeString());
|
log.info("数据开始同步时间 : " + TimeUtil.getCurrentTimeString());
|
||||||
String asyncUrl = config.getAsync_url();
|
String asyncUrl = config.getAsync_url();
|
||||||
|
@ -106,12 +103,18 @@ public class DataAsyncServiceImpl {
|
||||||
CountDownLatch latch = null;
|
CountDownLatch latch = null;
|
||||||
int preNum = 0;
|
int preNum = 0;
|
||||||
// 如果不是第一页就先定位到指定位置
|
// 如果不是第一页就先定位到指定位置
|
||||||
if(pageNo > 1){
|
if (pageNo > 1) {
|
||||||
count += (pageNo - 1) * pageSize;
|
count += (pageNo - 1) * pageSize;
|
||||||
preNum = count;
|
preNum = count;
|
||||||
}
|
}
|
||||||
|
List<DataAsyncConfigDetail> configDetailList = config.getConfigDetailList();
|
||||||
|
List<DataAsyncConfigDetail> primaryKeyList = configDetailList.stream().filter(item -> item.getPrimary_key() == 0).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isEmpty(primaryKeyList)) {
|
||||||
|
throw new CustomerException("请先配置主键字段!");
|
||||||
|
}
|
||||||
|
DataAsyncConfigDetail primaryKey = primaryKeyList.get(0);
|
||||||
boolean show = true;
|
boolean show = true;
|
||||||
while (count < total){
|
while (count < total) {
|
||||||
// 从缓存中获取token
|
// 从缓存中获取token
|
||||||
String token = EyDataAsyncTokenUtil.getToken(tokenUrl, params);
|
String token = EyDataAsyncTokenUtil.getToken(tokenUrl, params);
|
||||||
header.put("Authorization", "Bearer " + token);
|
header.put("Authorization", "Bearer " + token);
|
||||||
|
@ -123,11 +126,11 @@ public class DataAsyncServiceImpl {
|
||||||
try {
|
try {
|
||||||
// 获取接口数据
|
// 获取接口数据
|
||||||
data = requestMasterPlate.apiPost(url, new HashMap<>(), header, dataSuccess);
|
data = requestMasterPlate.apiPost(url, new HashMap<>(), header, dataSuccess);
|
||||||
total = Util.getIntValue(Util.null2DefaultStr(data.get("total"),""), -1);
|
total = Util.getIntValue(Util.null2DefaultStr(data.get("total"), ""), -1);
|
||||||
if(show){
|
if (show) {
|
||||||
log.info("接口数据条数total : " + total);
|
log.info("接口数据条数total : " + total);
|
||||||
}
|
}
|
||||||
if(latch == null){
|
if (latch == null) {
|
||||||
// 应该传入 total / pageSize
|
// 应该传入 total / pageSize
|
||||||
latch = new CountDownLatch(total);
|
latch = new CountDownLatch(total);
|
||||||
}
|
}
|
||||||
|
@ -135,45 +138,59 @@ public class DataAsyncServiceImpl {
|
||||||
count += pageSize;
|
count += pageSize;
|
||||||
List<Map<String, Object>> list = (List<Map<String, Object>>) data.get("list");
|
List<Map<String, Object>> list = (List<Map<String, Object>>) data.get("list");
|
||||||
// 进行数据处理
|
// 进行数据处理
|
||||||
maps = dealData(config, list);
|
maps = dealData(config, list, primaryKey);
|
||||||
show = false;
|
show = false;
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
for (int i = 0; i < pageSize; i++) {
|
for (int i = 0; i < pageSize; i++) {
|
||||||
if(latch != null){
|
if (latch != null) {
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.error("请求异常 : " + e.getMessage() + " 当前页数 : " + pageNo);
|
log.error("请求异常 : " + e.getMessage() + " 当前页数 : " + pageNo);
|
||||||
if(latch != null){
|
if (latch != null) {
|
||||||
log.info("当前latch信号数量 : " + latch.getCount());
|
log.info("当前latch信号数量 : " + latch.getCount());
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
CountDownLatch finalLatch = latch;
|
CountDownLatch finalLatch = latch;
|
||||||
if(finalLatch.getCount() > 0 && maps.size() > 0){
|
if (finalLatch.getCount() > 0 && maps.size() > 0) {
|
||||||
// 异步提交数据库处理
|
// 异步提交数据库处理
|
||||||
threadPoolInstance.execute(()->{
|
threadPoolInstance.execute(() -> {
|
||||||
log.info("=======================================================================================");
|
log.info("=======================================================================================");
|
||||||
|
// 查询当天同步的数据
|
||||||
|
Map<String, Integer> map = parseMaxAndMin(maps, primaryKey);
|
||||||
|
Integer max = map.get("max");
|
||||||
|
Integer min = map.get("min");
|
||||||
log.info(Thread.currentThread().getName() + " 入库之前信号数量 : " + finalLatch.getCount());
|
log.info(Thread.currentThread().getName() + " 入库之前信号数量 : " + finalLatch.getCount());
|
||||||
CusData2OA.baseInsertAndUpdate(config.getModel_id(), maps, finalLatch);
|
boolean success = CusData2OA.baseInsertAndUpdate(config.getModel_id(), maps, finalLatch);
|
||||||
|
log.info("数据库更新标识 : " + success);
|
||||||
|
if (!success) {
|
||||||
|
throw new CustomerException("更新数据失败!");
|
||||||
|
}
|
||||||
log.info(Thread.currentThread().getName() + " 入库之后信号数量 : " + finalLatch.getCount());
|
log.info(Thread.currentThread().getName() + " 入库之后信号数量 : " + finalLatch.getCount());
|
||||||
|
List<Integer> dataIdList = asyncMapper.selectDataIdsByForeignKey(config.getTable_name(), primaryKey.getModel_field_name(), min, max);
|
||||||
|
if (CollectionUtils.isNotEmpty(dataIdList)) {
|
||||||
|
log.info("需要权限重构的数据条数 : " + dataIdList.size());
|
||||||
|
for (Integer id : dataIdList) {
|
||||||
|
moderightinfo.rebuildModeDataShareByEdit(1, Util.getIntValue(config.getModel_id(), -1), id);
|
||||||
|
}
|
||||||
|
}
|
||||||
log.info("=======================================================================================");
|
log.info("=======================================================================================");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if(latch != null){
|
if (latch != null) {
|
||||||
log.info("preNum : " + preNum);
|
log.info("preNum : " + preNum);
|
||||||
while (preNum-- > 0){
|
while (preNum-- > 0) {
|
||||||
latch.countDown();
|
latch.countDown();
|
||||||
}
|
}
|
||||||
boolean await = latch.await(30, TimeUnit.MINUTES);
|
boolean await = latch.await(30, TimeUnit.MINUTES);
|
||||||
if(!await){
|
if (!await) {
|
||||||
throw new CustomerException("线程等待时间超过最大时间限制!");
|
throw new CustomerException("线程等待时间超过最大时间限制!");
|
||||||
}
|
}
|
||||||
long endTime = System.currentTimeMillis();
|
|
||||||
log.info("数据结束同步时间 : " + TimeUtil.getCurrentTimeString());
|
log.info("数据结束同步时间 : " + TimeUtil.getCurrentTimeString());
|
||||||
rebuildRight(Util.getIntValue(config.getModel_id()));
|
long endTime = System.currentTimeMillis();
|
||||||
log.info("同步耗时时间 " + (endTime - startTime) / 1000 + " s");// 等待所有转换操作完成
|
log.info("同步耗时时间 " + (endTime - startTime) / 1000 + " s");// 等待所有转换操作完成
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -183,70 +200,85 @@ public class DataAsyncServiceImpl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>同步处理数据</h1>
|
* <h1>同步处理数据</h1>
|
||||||
|
*
|
||||||
|
* @param config 配置对象
|
||||||
|
* @param data 接口数据
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
* @dateTime 2023/6/8 16:50
|
* @dateTime 2023/6/8 16:50
|
||||||
* @param config 配置对象
|
|
||||||
* @param data 接口数据
|
|
||||||
**/
|
**/
|
||||||
public List<Map<String, Object>> dealData(DataAsyncConfigMain config, List<Map<String, Object>> data) {
|
public List<Map<String, Object>> dealData(DataAsyncConfigMain config,
|
||||||
|
List<Map<String, Object>> data,
|
||||||
|
DataAsyncConfigDetail primaryKey) {
|
||||||
List<DataAsyncConfigDetail> configDetailList = config.getConfigDetailList();
|
List<DataAsyncConfigDetail> configDetailList = config.getConfigDetailList();
|
||||||
List<DataAsyncConfigDetail> primaryKey = configDetailList.stream().filter(item -> item.getPrimary_key() == 0).collect(Collectors.toList());
|
// List<DataAsyncConfigDetail> primaryKey = configDetailList.stream().filter(item -> item.getPrimary_key() == 0).collect(Collectors.toList());
|
||||||
List<Map<String, Object>> maps = new ArrayList<>();
|
List<Map<String, Object>> maps;
|
||||||
if(CollectionUtils.isNotEmpty(primaryKey)){
|
// 模版-接口外键
|
||||||
// 模版-接口外键
|
String primaryKeyModelFieldName = primaryKey.getModel_field_name();
|
||||||
String modelFieldName = primaryKey.get(0).getModel_field_name();
|
maps = data.stream().map(item -> convert(item, primaryKey.getInterface_field(), configDetailList)).filter(MapUtils::isNotEmpty).collect(Collectors.toList());
|
||||||
maps = data.stream().map(item -> convert(item, primaryKey.get(0).getInterface_field(), configDetailList)).filter(MapUtils::isNotEmpty).collect(Collectors.toList());
|
// 进行排序
|
||||||
// 进行排序
|
Map<String, Integer> map = parseMaxAndMin(maps, primaryKey);
|
||||||
Optional<Integer> minClassId = maps.stream()
|
Integer max = map.get("max");
|
||||||
.map(map -> Util.getIntValue(Util.null2DefaultStr(map.get(modelFieldName),""),-1))
|
Integer min = map.get("min");
|
||||||
.min(Comparator.naturalOrder());
|
// 按照外键排序并且在oa中范围查询出外键与oa数据的对应关系
|
||||||
Optional<Integer> maxClassId = maps.stream()
|
List<Map<String, String>> dataIdList = asyncMapper.selectDataIds(primaryKeyModelFieldName, config.getTable_name(), min, max);
|
||||||
.map(map -> Util.getIntValue(Util.null2DefaultStr(map.get(modelFieldName),""),-1))
|
if ("1".equals(debug)) {
|
||||||
.max(Comparator.naturalOrder());
|
log.info("dataIdList : " + JSONObject.toJSONString(dataIdList));
|
||||||
Integer min = minClassId.orElse(0);
|
}
|
||||||
Integer max = maxClassId.orElse(0);
|
if (CollectionUtils.isNotEmpty(dataIdList)) {
|
||||||
// 按照外键排序并且在oa中范围查询出外键与oa数据的对应关系
|
HashMap<String, String> idMap = parseListMap2Map(primaryKeyModelFieldName, "id", dataIdList);
|
||||||
List<Map<String, String>> dataIdList = asyncMapper.selectDataIds(modelFieldName, config.getTable_name(), min, max);
|
if ("1".equals(debug)) {
|
||||||
if("1".equals(debug)){
|
log.info("idMap : " + JSONObject.toJSONString(idMap));
|
||||||
log.info("dataIdList : " + JSONObject.toJSONString(dataIdList));
|
|
||||||
}
|
}
|
||||||
if(CollectionUtils.isNotEmpty(dataIdList)){
|
maps.forEach(item -> {
|
||||||
HashMap<String, String> idMap = parseListMap2Map(modelFieldName, "id", dataIdList);
|
if ("1".equals(debug)) {
|
||||||
if("1".equals(debug)){
|
log.info("item : " + JSONObject.toJSONString(item));
|
||||||
log.info("idMap : " + JSONObject.toJSONString(idMap));
|
|
||||||
}
|
}
|
||||||
maps.forEach(item->{
|
String id = Util.null2DefaultStr(item.get(primaryKeyModelFieldName), "");
|
||||||
if("1".equals(debug)){
|
if ("1".equals(debug)) {
|
||||||
log.info("item : " + JSONObject.toJSONString(item));
|
log.info("id : " + id);
|
||||||
}
|
}
|
||||||
String id = Util.null2DefaultStr(item.get(modelFieldName),"");
|
if (idMap.containsKey(id)) {
|
||||||
if("1".equals(debug)){
|
String oaId = idMap.get(id);
|
||||||
log.info("id : " + id);
|
item.put("id", oaId);
|
||||||
}
|
}
|
||||||
if(idMap.containsKey(id)){
|
});
|
||||||
String oaId = idMap.get(id);
|
|
||||||
item.put("id",oaId);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, Integer> parseMaxAndMin(List<Map<String, Object>> maps, DataAsyncConfigDetail primaryKey) {
|
||||||
|
String primaryKeyModelFieldName = primaryKey.getModel_field_name();
|
||||||
|
// 进行排序
|
||||||
|
Optional<Integer> minClassId = maps.stream()
|
||||||
|
.map(map -> Util.getIntValue(Util.null2DefaultStr(map.get(primaryKeyModelFieldName), ""), -1))
|
||||||
|
.min(Comparator.naturalOrder());
|
||||||
|
Optional<Integer> maxClassId = maps.stream()
|
||||||
|
.map(map -> Util.getIntValue(Util.null2DefaultStr(map.get(primaryKeyModelFieldName), ""), -1))
|
||||||
|
.max(Comparator.naturalOrder());
|
||||||
|
Integer min = minClassId.orElse(0);
|
||||||
|
Integer max = maxClassId.orElse(0);
|
||||||
|
Map<String, Integer> map = new HashMap<>();
|
||||||
|
map.put("max", max);
|
||||||
|
map.put("min", min);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>将数据进行转换</h1>
|
* <h1>将数据进行转换</h1>
|
||||||
* @author xuanran.wang
|
*
|
||||||
* @dateTime 2023/6/9 13:27
|
* @param data 原始数据
|
||||||
* @param data 原始数据
|
* @param foreignKey 外键
|
||||||
* @param foreignKey 外键
|
|
||||||
* @param configDetailList 配置集合
|
* @param configDetailList 配置集合
|
||||||
* @return 转换后的数据
|
* @return 转换后的数据
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @dateTime 2023/6/9 13:27
|
||||||
**/
|
**/
|
||||||
public Map<String, Object> convert(Map<String, Object> data,
|
public Map<String, Object> convert(Map<String, Object> data,
|
||||||
String foreignKey,
|
String foreignKey,
|
||||||
List<DataAsyncConfigDetail> configDetailList){
|
List<DataAsyncConfigDetail> configDetailList) {
|
||||||
String foreignVal = Util.null2DefaultStr(data.get(foreignKey), "");
|
String foreignVal = Util.null2DefaultStr(data.get(foreignKey), "");
|
||||||
if(StringUtils.isBlank(foreignVal)){
|
if (StringUtils.isBlank(foreignVal)) {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
HashMap<String, Object> map = new HashMap<>();
|
||||||
|
@ -258,128 +290,25 @@ public class DataAsyncServiceImpl {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <h1>将集合数据放到缓存中</h1>
|
* <h1>将集合数据放到缓存中</h1>
|
||||||
|
*
|
||||||
|
* @param listMap 集合数据
|
||||||
* @author xuanran.wang
|
* @author xuanran.wang
|
||||||
* @dateTime 2023/4/10 18:33
|
* @dateTime 2023/4/10 18:33
|
||||||
* @param listMap 集合数据
|
|
||||||
**/
|
**/
|
||||||
public static HashMap<String, String> parseListMap2Map(String key, String value, List<Map<String, String>> listMap){
|
public static HashMap<String, String> parseListMap2Map(String key, String value, List<Map<String, String>> listMap) {
|
||||||
if(CollectionUtils.isEmpty(listMap)){
|
if (CollectionUtils.isEmpty(listMap)) {
|
||||||
return new HashMap<>();
|
return new HashMap<>();
|
||||||
}
|
}
|
||||||
HashMap<String, String> res = new HashMap<>();
|
HashMap<String, String> res = new HashMap<>();
|
||||||
listMap.forEach(map -> {
|
listMap.forEach(map -> {
|
||||||
String outKey = Util.null2DefaultStr(map.get(key),"");
|
String outKey = Util.null2DefaultStr(map.get(key), "");
|
||||||
if(StringUtils.isNotBlank(outKey)){
|
if (StringUtils.isNotBlank(outKey)) {
|
||||||
String id = Util.null2DefaultStr(map.get(value),"");
|
String id = Util.null2DefaultStr(map.get(value), "");
|
||||||
res.put(outKey, id);
|
res.put(outKey, id);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ModeAppService modeAppService = ServiceUtil.getService(ModeAppServiceImpl.class, new User(1));
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <h1>模块数据全量权限重构</h1>
|
|
||||||
* @author xuanran.wang
|
|
||||||
* @dateTime 2023/6/9 13:28
|
|
||||||
* @param modeId 模块id
|
|
||||||
**/
|
|
||||||
public static void rebuildRight(int modeId){
|
|
||||||
ModeRightInfoThread var5 = new ModeRightInfoThread();
|
|
||||||
var5.setModeId(modeId);
|
|
||||||
var5.setRebulidFlag("1");
|
|
||||||
var5.setSession(new HttpSession() {
|
|
||||||
@Override
|
|
||||||
public String getId() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isNew() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getCreationTime() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLastAccessedTime() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setMaxInactiveInterval(int i) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int getMaxInactiveInterval() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getAttribute(String s) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Enumeration getAttributeNames() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setAttribute(String s, Object o) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeAttribute(String s) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void invalidate() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public HttpSessionContext getSessionContext() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ServletContext getServletContext() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Object getValue(String s) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getValueNames() {
|
|
||||||
return new String[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putValue(String s, Object o) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeValue(String s) {
|
|
||||||
|
|
||||||
}
|
|
||||||
});
|
|
||||||
var5.setUser(new User(1));
|
|
||||||
var5.resetModeRight();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,12 @@ public class ValueRuleMethod {
|
||||||
|
|
||||||
@ValueRuleMethodNo(value = 0, desc = "不转换")
|
@ValueRuleMethodNo(value = 0, desc = "不转换")
|
||||||
public Object getFixValue(DataAsyncConfigDetail configDetail,Map<String, Object> map) {
|
public Object getFixValue(DataAsyncConfigDetail configDetail,Map<String, Object> map) {
|
||||||
return Util.null2DefaultStr(map.get(configDetail.getInterface_field()),"");
|
String interfaceField = configDetail.getInterface_field();
|
||||||
|
String value = Util.null2DefaultStr(map.get(interfaceField),"");
|
||||||
|
if(StringUtils.isBlank(value)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return map.get(interfaceField);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -90,7 +95,7 @@ public class ValueRuleMethod {
|
||||||
try {
|
try {
|
||||||
Class<?> clazz = Class.forName(cusText);
|
Class<?> clazz = Class.forName(cusText);
|
||||||
if(!CusAsyncConvert.class.isAssignableFrom(clazz)){
|
if(!CusAsyncConvert.class.isAssignableFrom(clazz)){
|
||||||
throw new CustomerException(cusText + " not implements weaver.xuanran.wang.sh_bigdata.org_hrm_async.annotations.CusOrgHrmAsyncConvert");
|
throw new CustomerException(cusText + " not implements weaver.xuanran.wang.eny.data_async.service.convert.CusAsyncConvert!");
|
||||||
}
|
}
|
||||||
CusAsyncConvert o = (CusAsyncConvert) clazz.newInstance();
|
CusAsyncConvert o = (CusAsyncConvert) clazz.newInstance();
|
||||||
Map<String, String> pathParam = Util.parseCusInterfacePathParam(cusText);
|
Map<String, String> pathParam = Util.parseCusInterfacePathParam(cusText);
|
||||||
|
|
|
@ -49,6 +49,10 @@ public class WorkFlowToVmsAndMQ extends SafeCusBaseAction {
|
||||||
@PrintParamMark
|
@PrintParamMark
|
||||||
@ActionOptionalParam(value = "message", desc = "报错返回信息字段")
|
@ActionOptionalParam(value = "message", desc = "报错返回信息字段")
|
||||||
private String msg;
|
private String msg;
|
||||||
|
@PrintParamMark
|
||||||
|
@ActionOptionalParam(value = "0", desc = "发送mq跳过校验")
|
||||||
|
private String mqSkip;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
|
||||||
|
@ -59,6 +63,6 @@ public class WorkFlowToVmsAndMQ extends SafeCusBaseAction {
|
||||||
.successVal(Util.null2DefaultStr(successVal, "200"))
|
.successVal(Util.null2DefaultStr(successVal, "200"))
|
||||||
.message(Util.null2DefaultStr(msg, "message"))
|
.message(Util.null2DefaultStr(msg, "message"))
|
||||||
.build();
|
.build();
|
||||||
workFlowToVmsAndMQService.workFlowToVmsAndMQ(onlyMark, billTable, requestId, vmsResponseVoField, kafkaConfig);
|
workFlowToVmsAndMQService.workFlowToVmsAndMQ(onlyMark, billTable, requestId, vmsResponseVoField, kafkaConfig, mqSkip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,19 +32,20 @@ public class CusListValue implements CusInterfaceGetValue {
|
||||||
// 如果fileName不为空则对集合中每个map添加"fileName":value value则是附件字段名称
|
// 如果fileName不为空则对集合中每个map添加"fileName":value value则是附件字段名称
|
||||||
String fileName = Util.null2DefaultStr(pathParam.get("fileName"), "");
|
String fileName = Util.null2DefaultStr(pathParam.get("fileName"), "");
|
||||||
if(StringUtils.isNotBlank(cusSql)){
|
if(StringUtils.isNotBlank(cusSql)){
|
||||||
|
cusSql = cusSql.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
|
||||||
if (StringUtils.isNotBlank(attachmentField)) {
|
if (StringUtils.isNotBlank(attachmentField)) {
|
||||||
for (String item : attachmentField.split(",")) {
|
String[] fields = attachmentField.split(",");
|
||||||
|
for (String item : fields) {
|
||||||
String filedValue = Util.null2DefaultStr(mainMap.get(item),"");
|
String filedValue = Util.null2DefaultStr(mainMap.get(item),"");
|
||||||
if(StringUtils.isNotBlank(Util.null2DefaultStr(mainMap.get(filedValue),""))){
|
String fileSql = cusSql;
|
||||||
cusSql = cusSql
|
if(StringUtils.isNotBlank(filedValue)){
|
||||||
.replace("{?docIds}", "( " + filedValue + " )")
|
fileSql = fileSql.replace("{?docIds}", "( " + filedValue + " )");
|
||||||
.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
|
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(fileSql);
|
||||||
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
|
|
||||||
if(CollectionUtils.isEmpty(attachmentInfo)){
|
if(CollectionUtils.isEmpty(attachmentInfo)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 往map中put附件字段名
|
// 往map中put附件字段名
|
||||||
if(StringUtils.isBlank(fileName)){
|
if(StringUtils.isNotBlank(fileName)){
|
||||||
attachmentInfo.forEach(file ->{
|
attachmentInfo.forEach(file ->{
|
||||||
file.put(fileName, item);
|
file.put(fileName, item);
|
||||||
});
|
});
|
||||||
|
@ -52,6 +53,11 @@ public class CusListValue implements CusInterfaceGetValue {
|
||||||
list.addAll(attachmentInfo);
|
list.addAll(attachmentInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
|
||||||
|
if(CollectionUtils.isNotEmpty(attachmentInfo)){
|
||||||
|
list.addAll(attachmentInfo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
package weaver.xuanran.wang.immc.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import weaver.conn.RecordSet;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <h1>请求url, 请求参数</h1>
|
||||||
|
*
|
||||||
|
* @author xuanran.wang
|
||||||
|
* @date 2023/6/21 15:50
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public class CusRequestParam {
|
||||||
|
private String url;
|
||||||
|
private RecordSet rs;
|
||||||
|
private Map<String, Object> param;
|
||||||
|
private String requestId;
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue