添加请求工具方法第2天

dev
IT-xiaoXiong 2022-01-26 16:14:41 +08:00
parent bd56639b06
commit 3e4971c2d4
61 changed files with 3279 additions and 121 deletions

View File

@ -31,6 +31,18 @@
<orderEntry type="library" name="Maven: com.adobe.xmp:xmpcore:6.1.11" level="project" /> <orderEntry type="library" name="Maven: com.adobe.xmp:xmpcore:6.1.11" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" /> <orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> <orderEntry type="library" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-excelant:3.12" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi:3.12" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant:1.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.ant:ant-launcher:1.8.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-scratchpad:3.12" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml:3.8" level="project" />
<orderEntry type="library" name="Maven: dom4j:dom4j:1.6.1" level="project" />
<orderEntry type="library" name="Maven: xml-apis:xml-apis:1.0.b2" level="project" />
<orderEntry type="library" name="Maven: org.apache.poi:poi-ooxml-schemas:3.8" level="project" />
<orderEntry type="library" name="Maven: org.apache.xmlbeans:xmlbeans:2.3.0" level="project" />
<orderEntry type="library" name="Maven: stax:stax-api:1.0.1" level="project" />
<orderEntry type="library" name="classbean" level="project" /> <orderEntry type="library" name="classbean" level="project" />
</component> </component>
</module> </module>

View File

@ -7,7 +7,7 @@ class Utils {
data, isAsync = true, data, isAsync = true,
success = () => { success = () => {
}, error = (err) => { }, error = (err) => {
console.log(err) console.log(err)
}, complete = () => { }, complete = () => {
}, },
contentType = 'application/json', contentType = 'application/json',
@ -74,73 +74,93 @@ class CopyMultipleFile {
* @param listenerField 浏览框字段 * @param listenerField 浏览框字段
*/ */
bindBrowseBoxChangeEvent() { bindBrowseBoxChangeEvent() {
WfForm.bindFieldChangeEvent(this.convertField2Id(this.configuration.browseBox), async (elem, id, value) => { WfForm.bindFieldChangeEvent(this.convertField2Id(this.configuration.browseBox),async (elem, id, value) => {
//为空,清除其他模板字段数据,TODO 删除文件 await this.copyFile(value)
if ((value ?? '') === '') { })
let deleteArr = [] }
this.configuration.detailList.forEach(item => {
let fieldId = this.convertField2Id(item.workflowFile) /**
deleteArr = [...wfform.getFieldValue(fieldId).split(","), ...deleteArr] * 复制文件逻辑
WfForm.changeFieldValue(fieldId, { * @param value 浏览框的值
value: '', * @returns {Promise<void>}
*/
async copyFile(value){
//为空,清除其他模板字段数据,TODO 删除文件
if ((value ?? '') === '') {
let deleteArr = []
this.configuration.detailList.forEach(item => {
let fieldId = this.convertField2Id(item.workflowFile)
deleteArr = [...wfform.getFieldValue(fieldId).split(","), ...deleteArr]
WfForm.changeFieldValue(fieldId, {
value: '',
specialobj: {
filedatas: []
}
})
})
Utils.request(`/api/browseBox/copyMultipleFile/delete/${deleteArr.join(",")}`).then((res) => {
// console.log(res)
})
return
}
//判断是否和原来的数据不同,不同则进行文件复制带出
if (value !== this.oldBrowseBoxValue) {
let copyFileParam = {
workflowType: this.baseInfo.workflowid,
requestId: this.baseInfo.requestid,
browseValue: value,
modeTable: this.configuration.modeTable,
fileMapperList: this.configuration.detailList,
queryFileInfoMap: {
listType: "list",
requestid: this.baseInfo.requestid,
desrequestid: -1,
isprint: 0,
f_weaver_belongto_userid: this.baseInfo.f_weaver_belongto_userid,
f_weaver_belongto_usertype: this.baseInfo.f_weaver_belongto_usertype,
authStr: '',
authSignatureStr: ''
},
}
ecCom.WeaLoadingGlobal.start({
tip: "文件模板复制中"
})
let result = await Utils.request("/api/browseBox/copyMultipleFile/copy", "POST", copyFileParam)
ecCom.WeaLoadingGlobal.destroy()
// console.log(result)
if (result && result.code == 200) {
let copyResult = result.data
copyResult.forEach(item => {
// 设置模板字段值
WfForm.changeFieldValue(this.convertField2Id(item.workflowFile), {
value: item.fileId,
specialobj: { specialobj: {
filedatas: [] filedatas: item.fileInfo ? item.fileInfo.filedatas : []
} }
}) })
}) })
Utils.request(`/api/browseBox/multipleCopy/delete/${deleteArr.join(",")}`).then((res)=>{ } else {
// console.log(res) antd.message.error("复制模板文件失败!")
})
return
} }
//判断是否和原来的数据不同,不同则进行文件复制带出 }
if (value !== this.oldBrowseBoxValue) {
let copyFileParam = {
workflowType: this.baseInfo.workflowid,
requestId: this.baseInfo.requestid,
browseValue: value,
modeTable: this.configuration.modeTable,
fileMapperList: this.configuration.detailList,
queryFileInfoMap: {
listType: "list",
requestid: this.baseInfo.requestid,
desrequestid: -1,
isprint: 0,
f_weaver_belongto_userid: this.baseInfo.f_weaver_belongto_userid,
f_weaver_belongto_usertype: this.baseInfo.f_weaver_belongto_usertype,
authStr: '',
authSignatureStr: ''
},
}
ecCom.WeaLoadingGlobal.start({
tip:"文件模板复制中"
})
let result = await Utils.request("/api/browseBox/multipleCopy/copy", "POST", copyFileParam)
ecCom.WeaLoadingGlobal.destroy()
// console.log(result)
if (result && result.code == 200) {
let copyResult = result.data
copyResult.forEach(item => {
// 设置模板字段值
WfForm.changeFieldValue(this.convertField2Id(item.workflowFile), {
value: item.fileId,
specialobj: {
filedatas: item.fileInfo ? item.fileInfo.filedatas : []
}
})
})
} else {
antd.message.error("复制模板文件失败!")
}
}
})
} }
/**
* 强制触发一次复制
*/
mandatoryCopy() {
let browseBoxValue = WfForm.getFieldValue(this.convertField2Id(this.configuration.browseBox))
this.copyFile(browseBoxValue)
}
} }
class CopyMultipleFileBuilder { class CopyMultipleFileBuilder {
configuration = [] configuration = []
copyMultipleFileArr = []
constructor() { constructor() {
this.workflowId = WfForm.getBaseInfo().workflowid this.workflowId = WfForm.getBaseInfo().workflowid
@ -149,12 +169,13 @@ class CopyMultipleFileBuilder {
async init() { async init() {
// 获取配置信息 // 获取配置信息
let result = await Utils.request(`/api/browseBox/multipleCopy/getConfig/${this.workflowId}`, "GET"); let result = await Utils.request(`/api/browseBox/copyMultipleFile/getConfig/${this.workflowId}`, "GET");
if (result && result.code == 200) { if (result && result.code == 200) {
this.configuration = result.data this.configuration = result.data
this.configuration.forEach(item => { this.configuration.forEach(item => {
let copyMultipleFile = new CopyMultipleFile(item); let copyMultipleFile = new CopyMultipleFile(item);
copyMultipleFile.bindBrowseBoxChangeEvent() copyMultipleFile.bindBrowseBoxChangeEvent()
this.copyMultipleFileArr.push(copyMultipleFile)
}) })
} else { } else {
antd.message.error("请求模板复制信息失败!") antd.message.error("请求模板复制信息失败!")
@ -164,5 +185,11 @@ class CopyMultipleFileBuilder {
} }
$(() => { $(() => {
new CopyMultipleFileBuilder() let copyMultipleFileBuilder = new CopyMultipleFileBuilder()
//绑定强制触发
window.mandatoryCopy = function () {
copyMultipleFileBuilder.copyMultipleFileArr.forEach(item => {
item.mandatoryCopy()
})
}
}) })

View File

@ -30,15 +30,19 @@ function statisticalDetailTableData() {
let groupFieldId = groupFieldMark + "_" + rowIndex let groupFieldId = groupFieldMark + "_" + rowIndex
// 获取值 // 获取值
let groupFieldValue = WfForm.getFieldValue(groupFieldId) let groupFieldValue = WfForm.getFieldValue(groupFieldId)
let groupFieldValueObj = WfForm.getFieldValueObj(groupFieldId)
let sumFieldMark = convertField2Id(config.sumField, config.detailTableSimple) let sumFieldMark = convertField2Id(config.sumField, config.detailTableSimple)
let sumFieldId = sumFieldMark + "_" + rowIndex let sumFieldId = sumFieldMark + "_" + rowIndex
// 获取值 // 获取值
let sumFieldValue = parseInt(WfForm.getFieldValue(sumFieldId)) let sumFieldValue = parseInt(WfForm.getFieldValue(sumFieldId) === "" ? 0 : WfForm.getFieldValue(sumFieldId))
if (sumMap.has(groupFieldValue)) { if (sumMap.has(groupFieldValue)) {
let sumValue = sumMap.get(groupFieldValue) + sumFieldValue sumMap.get(groupFieldValue).sum += sumFieldValue
sumMap.set(groupFieldValue, sumValue)
} else { } else {
sumMap.set(groupFieldValue, sumFieldValue) let obj = {
value: groupFieldValueObj,
sum: sumFieldValue
}
sumMap.set(groupFieldValue, obj)
} }
} }
return sumMap return sumMap
@ -64,17 +68,20 @@ function assignmentDetailTable2(sumMap) {
// 赋值 // 赋值
sumMap.forEach((value, key) => { sumMap.forEach((value, key) => {
let valueObj = { let valueObj = {
[convertField2Id(config.groupField, config.detailTableSimple)]: { [convertField2Id(config.groupField, config.detailTableSimple)]: value.value,
value: key
},
[convertField2Id(config.sumField, config.detailTableSimple)]: { [convertField2Id(config.sumField, config.detailTableSimple)]: {
value: value value: value.sum
}, },
} }
WfForm.addDetailRow(config.detailTableSimple, valueObj); WfForm.addDetailRow(config.detailTableSimple, valueObj);
}) })
} }
$(() => {
//页面加载时执行一次
let sumMap = statisticalDetailTableData()
assignmentDetailTable2(sumMap)
})
/** /**
* 注册监听提交和保存事件 * 注册监听提交和保存事件
*/ */
@ -85,18 +92,115 @@ WfForm.registerCheckEvent(WfForm.OPER_SAVE + "," + WfForm.OPER_SUBMIT, function
}); });
//#endregion
// </editor-fold>(╰_╯)#(╰_╯)#
// ================================================================================
//<editor-fold desc="法务预算审核流程 法务VP节点VP审核节点计算 明细表数据计算(╰_╯)#o(≧口≦)o">
//#region
/**
* 转换字段名为字段id
* @param fieldName 字段名
* @param detail
* @returns {*} 字段id
*/
function convertField2Id(fieldName, detail = "main") {
return WfForm.convertFieldNameToId(fieldName, detail)
}
/**
* 绑定明细表发生变化时触发并执行计算逻辑
*/
function bindDetailFieldChange() {
let config = {
changeField: 'fyygrmb',
detailTable: 'formtable_main_173_dt1',
detailTableSimple: 'detail_1'
}
WfForm.bindDetailFieldChangeEvent(convertField2Id(config.changeField, config.detailTableSimple), () => {
let sumMap = statisticalDetailTableData()
assignmentDetailTable2(sumMap)
})
}
/**
* 统计第一个明细表数据
* @returns {Map} 整理后的明细数据
*/
function statisticalDetailTableData() {
let config = {
groupField: "sqrbm",
sumField: 'fyygrmb',
detailTable: 'formtable_main_173_dt1',
detailTableSimple: 'detail_1'
}
let sumMap = new Map()
let rowArr = (WfForm.getDetailAllRowIndexStr(config.detailTableSimple) ?? '').split(",");
for (let i = 0; i < rowArr.length; i++) {
let rowIndex = rowArr[i];
let groupFieldMark = convertField2Id(config.groupField, config.detailTableSimple)
let groupFieldId = groupFieldMark + "_" + rowIndex
// 获取值
let groupFieldValue = WfForm.getFieldValue(groupFieldId)
let sumFieldMark = convertField2Id(config.sumField, config.detailTableSimple)
let sumFieldId = sumFieldMark + "_" + rowIndex
// 获取值
let sumFieldValue = parseInt(WfForm.getFieldValue(sumFieldId) === "" ? 0 : WfForm.getFieldValue(sumFieldId))
if (sumMap.has(groupFieldValue)) {
let sumValue = sumMap.get(groupFieldValue) + sumFieldValue
sumMap.set(groupFieldValue, sumValue)
} else {
sumMap.set(groupFieldValue, sumFieldValue)
}
}
return sumMap
}
/**
* 第二个明细表赋值
* @param sumMap 整理后的明细数据
*/
function assignmentDetailTable2(sumMap) {
let config = {
groupField: "sqrbm",
sumField: 'fyygrmbxj',
detailTable: 'formtable_main_173_dt2',
detailTableSimple: 'detail_2'
}
// 赋值
let valueObj = {}
let rowArr = (WfForm.getDetailAllRowIndexStr(config.detailTableSimple) ?? '').split(",");
for (let i = 0; i < rowArr.length; i++) {
let rowIndex = rowArr[i];
let groupFieldMark = convertField2Id(config.groupField, config.detailTableSimple)
let groupFieldId = groupFieldMark + "_" + rowIndex
// 获取值
let groupFieldValue = WfForm.getFieldValue(groupFieldId)
sumMap.forEach((value, key) => {
if (groupFieldValue == key) {
valueObj[convertField2Id(config.sumField, config.detailTableSimple) + "_" + rowIndex] = {value: value}
}
})
}
WfForm.changeMoreField(valueObj);
}
$(() => {
//页面加载时执行一次
bindDetailFieldChange()
})
//#endregion //#endregion
// </editor-fold>(╰_╯)#(╰_╯)# // </editor-fold>(╰_╯)#(╰_╯)#
// ================================================================================ // ================================================================================
//<editor-fold desc="法务预算审核流程 明细表数据计算, <( ̄ ﹌  ̄)@m 折算"> //<editor-fold desc="法务预算审核流程 明细表数据计算, <( ̄ ﹌  ̄)@m 折算">
//
/** /**
* 转换字段名为字段id * 转换字段名为字段id
* @param fieldName 字段名 * @param fieldName 字段名
@ -129,7 +233,7 @@ function calculateDiscountDetail1(discountMap) {
let discountFieldId = discountFieldMark + "_" + rowArr[i] let discountFieldId = discountFieldMark + "_" + rowArr[i]
let costCountFieldId = costCountFieldMark + "_" + rowArr[i] let costCountFieldId = costCountFieldMark + "_" + rowArr[i]
let groupFieldValue = WfForm.getFieldValue(groupFieldId) let groupFieldValue = WfForm.getFieldValue(groupFieldId)
let costCountFieldValue = parseInt(WfForm.getFieldValue(costCountFieldId)) let costCountFieldValue = parseInt(WfForm.getFieldValue(costCountFieldId) === "" ? 0 : WfForm.getFieldValue(costCountFieldId))
// console.log(discountMap.get(groupFieldValue) * costCountFieldValue) // console.log(discountMap.get(groupFieldValue) * costCountFieldValue)
//修改值 //修改值
WfForm.changeFieldValue(discountFieldId, { WfForm.changeFieldValue(discountFieldId, {
@ -158,7 +262,7 @@ function getDiscountByDetail2() {
let groupFieldId = groupFieldMark + "_" + rowArr[i] let groupFieldId = groupFieldMark + "_" + rowArr[i]
let discountFieldId = discountFieldMark + "_" + rowArr[i] let discountFieldId = discountFieldMark + "_" + rowArr[i]
let groupFieldValue = WfForm.getFieldValue(groupFieldId) let groupFieldValue = WfForm.getFieldValue(groupFieldId)
discountMap[groupFieldValue] = parseFloat(WfForm.getFieldValue(discountFieldId)) / 100 discountMap[groupFieldValue] = parseFloat(WfForm.getFieldValue(discountFieldId) === "" ? 0 : WfForm.getFieldValue(discountFieldId)) / 100
} }
return discountMap return discountMap
} }
@ -178,7 +282,7 @@ function bindEvent() {
}) })
} }
$(()=>{ $(() => {
//页面加载时执行一次 //页面加载时执行一次
let discountMap = getDiscountByDetail2(); let discountMap = getDiscountByDetail2();
calculateDiscountDetail1(discountMap) calculateDiscountDetail1(discountMap)
@ -186,4 +290,173 @@ $(()=>{
}) })
// </editor-fold> // </editor-fold>
// ================================================================================
// <editor-fold desc="捐赠/赞助合作伙伴合规评估 红绿灯变颜色">
//#region 捐赠/赞助合作伙伴合规评估 红绿灯变颜色
/**
* 转换字段名为字段id
* @param fieldName 字段名
* @param detail
* @returns {*} 字段id
*/
function convertField2Id(fieldName, detail = "main", showPrefix = true) {
return WfForm.convertFieldNameToId(fieldName, detail, showPrefix)
}
/**
* 改变颜色逻辑处理
* @param colorMapper 颜色和值的映射关系
* @returns {(function(*=, *=): void)|*} 值改变回调函数
*/
function changeColor(colorMapper) {
return (info, compFn) => {
let value = info.fieldValue
if (value === "") {
return compFn()
}
let options = {style: {}}
colorMapper.forEach(item => {
if (item.value == value) {
options.style.background = item.color
}
})
return React.createElement("div", options, [compFn()]);
}
}
/**
* 绑定自定义渲染事件
* @param configObj 配置对象
*/
function bindEvent(configObj) {
configObj.forEach(item => {
let colorMapper = item.colorMapper
for (let v in colorMapper) {
WfForm.proxyFieldContentComp(convertField2Id(v, item.simpleTableName, false), changeColor(colorMapper[v]));
WfForm.forceRenderField(convertField2Id(v, item.simpleTableName));
}
})
}
$(() => {
let configObj = [{
tableName: "formtable_main_106_dt1",
simpleTableName: "detail_1",
colorMapper: {
jg: [{
value: 0,
color: 'rgb(213,0,28)'
}, {
value: 1,
color: 'rgb(255,255,0)'
}, {
value: 2,
color: 'rgb(146,208,80)'
}]
}
}, {
tableName: "formtable_main_106_dt2",
simpleTableName: "detail_2",
colorMapper: {
zzjg2: [{
value: 0,
color: 'rgb(213,0,28)'
}, {
value: 1,
color: 'rgb(255,255,0)'
}, {
value: 2,
color: 'rgb(146,208,80)'
}]
}
}]
bindEvent(configObj)
})
//#endregion
// </editor-fold>
// ================================================================================
// <editor-fold desc="发达大合同用印计算">
//#region 发达大合同用印计算
/**
* 转换字段名为字段id
* @param fieldName 字段名
* @param detail
* @returns {*} 字段id
*/
function convertField2Id(fieldName, detail = "main") {
return WfForm.convertFieldNameToId(fieldName, detail)
}
/**
* 修改用印类型的值
* @param config 配置信息
* @param value 需要修改的值
*/
function changeContractSelectBox(config, value) {
WfForm.changeFieldValue(convertField2Id(config.changeField), {value: value});
}
/**
* 检查是否存在法大大认证编号
* @param config 配置信息
* @returns {boolean} 是否存在
*/
function checkContractFadadaechapter(config) {
let rowArr = (WfForm.getDetailAllRowIndexStr(config.simpleTableName) ?? '').split(",");
for (let i = 0; i < rowArr.length; i++) {
let rowIndex = rowArr[i]
let fieldValue = WfForm.getFieldValue(convertField2Id(config.changeField,config.simpleTableName) + "_" + rowIndex);
if((fieldValue ?? "" ) === ""){
return false
}
}
return true
}
/**
* 绑定提交和保存事件拦截触发修改电子用印字段
* @param config
*/
function bindSubmitEvent(config){
WfForm.registerCheckEvent(WfForm.OPER_SAVE+","+WfForm.OPER_SUBMIT, function(callback){
let electronicSeals = checkContractFadadaechapter(config.detailConfig)
if(electronicSeals){
// 电子用印
changeContractSelectBox(config.mainConfig,0)
}else{
// 物理用印
changeContractSelectBox(config.mainConfig,1)
}
callback();
});
}
$(() => {
let config = {
mainConfig: {
tableName: "formtable_main_56",
changeField: "yylx",
simpleTableName: "main"
},
detailConfig: {
tableName: "formtable_main_56_dt1",
changeField: "fadadaechapter",
simpleTableName: "detail_1"
}
}
bindSubmitEvent(config)
})
//#endregion
// </editor-fold>

View File

View File

60
pom.xml
View File

@ -36,31 +36,53 @@
<dependencies> <dependencies>
<!-- lombok--> <!-- lombok-->
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>${lombok.version}</version> <version>${lombok.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<!-- 糊涂工具包,法大大验签指定版本--> <!-- 糊涂工具包,法大大验签指定版本-->
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>${hutool.version}</version> <version>${hutool.version}</version>
</dependency> </dependency>
<!-- 图片efi信息识别ps贵酒--> <!-- 图片efi信息识别ps贵酒-->
<dependency> <dependency>
<groupId>com.drewnoakes</groupId> <groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId> <artifactId>metadata-extractor</artifactId>
<version>${metadata-extractor.version}</version> <version>${metadata-extractor.version}</version>
</dependency> </dependency>
<!-- 单元测试--> <!-- 单元测试-->
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<version>4.12</version> <version>4.12</version>
</dependency> </dependency>
<!-- 操作word相关-->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-excelant</artifactId>
<version>3.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>3.12</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.8</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>3.8</version>
</dependency>
<!-- 操作word结束-->
</dependencies> </dependencies>
@ -73,13 +95,27 @@
<configuration> <configuration>
<source>8</source> <source>8</source>
<target>8</target> <target>8</target>
<!-- <annotationProcessors>--> <annotationProcessors>
<!-- <annotationProcessor>--> <annotationProcessor>
<!-- <groupId>org.projectors</groupId>--> <groupId>org.projectors</groupId>
<!-- <artifactId>lombok</artifactId>--> <artifactId>lombok</artifactId>
<!-- <version>${lombok.version}</version>--> <version>${lombok.version}</version>
<!-- </annotationProcessor>--> </annotationProcessor>
<!-- </annotationProcessors>--> </annotationProcessors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
<configuration>
<artifactItems>
<artifactItem>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</artifactItem>
</artifactItems>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -106,4 +142,4 @@
</project> </project>
<!--mvn dependency:copy-dependencies--> <!--mvn dependency:copy-dependencies-->

11
sql/index.sql Normal file
View File

@ -0,0 +1,11 @@
select kqdt.signindate,kqdt.signoutdate,kqdt.signintime ,kqdt.signouttime,
FLOOR(
datediff(minute,signindate + ' ' + signintime,signoutdate + ' ' + signouttime)/60.0 - 8.0
) overtime,
kqdt.changeType
from kq_format_detail kqdt
join kq_holidayset kqst on kqdt.signindate = kqst.holidayDate
where signindate is not null
and signoutdate is not null
and signindate <> '' and signoutdate <> ''
and FLOOR(datediff(minute,signindate + ' ' + signintime,signoutdate + ' ' + signouttime)/60.0 - 8.0) > 0

View File

@ -3,6 +3,7 @@ package aiyh.utils;
import aiyh.utils.annotation.DateFormatAn; import aiyh.utils.annotation.DateFormatAn;
import aiyh.utils.entity.*; import aiyh.utils.entity.*;
import aiyh.utils.fileUtil.ProperUtil; import aiyh.utils.fileUtil.ProperUtil;
import aiyh.utils.logger.LoggerUtil;
import aiyh.utils.mapUtil.UtilHashMap; import aiyh.utils.mapUtil.UtilHashMap;
import aiyh.utils.mapUtil.UtilLinkedHashMap; import aiyh.utils.mapUtil.UtilLinkedHashMap;
import aiyh.utils.recordset.RecordsetUtil; import aiyh.utils.recordset.RecordsetUtil;
@ -15,6 +16,7 @@ import aiyh.utils.zwl.common.ToolUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.ibm.icu.text.SimpleDateFormat; import com.ibm.icu.text.SimpleDateFormat;
import org.apache.dubbo.common.utils.CollectionUtils; import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.log4j.Logger;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
import weaver.common.util.string.StringUtil; import weaver.common.util.string.StringUtil;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
@ -27,10 +29,12 @@ import weaver.workflow.workflow.WorkflowVersion;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.beans.BeanInfo; import java.beans.BeanInfo;
import java.beans.IntrospectionException;
import java.beans.Introspector; import java.beans.Introspector;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.io.*; import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -38,6 +42,7 @@ import java.net.URLDecoder;
import java.text.ParseException; import java.text.ParseException;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.function.BiConsumer;
import java.util.function.Function; import java.util.function.Function;
import java.util.function.Predicate; import java.util.function.Predicate;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -54,10 +59,13 @@ import java.util.zip.ZipEntry;
public class Util extends weaver.general.Util { public class Util extends weaver.general.Util {
static ToolUtil toolUtil = new ToolUtil();
private static final UtilService utilService = new UtilService(); private static final UtilService utilService = new UtilService();
private static final RecordSet rs = new RecordSet(); private static final RecordSet rs = new RecordSet();
private static RecordsetUtil recordsetUtil = new RecordsetUtil();; private static final String LOGGER_NAME = "cusAYH";
static ToolUtil toolUtil = new ToolUtil();
private static RecordsetUtil recordsetUtil = new RecordsetUtil();
private static LoggerUtil loggerUtil = new LoggerUtil();
private static volatile Logger log = null;
/** /**
@ -149,7 +157,8 @@ public class Util extends weaver.general.Util {
/** /**
* *
* @param sqlBuilder StringBuilder *
* @param sqlBuilder StringBuilder
* @param removeSeparator * @param removeSeparator
* @return * @return
*/ */
@ -167,7 +176,8 @@ public class Util extends weaver.general.Util {
/** /**
* *
* @param string *
* @param string
* @param removeSeparator * @param removeSeparator
* @return * @return
*/ */
@ -642,7 +652,7 @@ public class Util extends weaver.general.Util {
//处理字符串 //处理字符串
for (int i = 0, l = charArray.length; i < l; i++) { for (int i = 0, l = charArray.length; i < l; i++) {
if (charArray[i] >= 65 && charArray[i] <= 90) { if (charArray[i] >= 65 && charArray[i] <= 90) {
if(i==0){ if (i == 0) {
buffer.append(charArray[i] += 32); buffer.append(charArray[i] += 32);
continue; continue;
} }
@ -1620,7 +1630,7 @@ public class Util extends weaver.general.Util {
} }
public static String getDocCategorys(int workflowId, String docField) { public static String getDocCategorys(int workflowId, String docField) {
return getDocCategorys(String.valueOf(workflowId),docField); return getDocCategorys(String.valueOf(workflowId), docField);
} }
/** /**
@ -1788,18 +1798,19 @@ public class Util extends weaver.general.Util {
/** /**
* *
*
* @param throwable * @param throwable
* @return * @return
*/ */
public static String getErrString(Throwable throwable){ public static String getErrString(Throwable throwable) {
StringWriter stringWriter = new StringWriter(); StringWriter stringWriter = new StringWriter();
throwable.printStackTrace(new PrintWriter(stringWriter,true)); throwable.printStackTrace(new PrintWriter(stringWriter, true));
new Thread(() -> { new Thread(() -> {
try { try {
Thread.sleep(1000); Thread.sleep(1000);
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
}finally { } finally {
try { try {
stringWriter.close(); stringWriter.close();
} catch (IOException e) { } catch (IOException e) {
@ -1812,6 +1823,7 @@ public class Util extends weaver.general.Util {
/** /**
* RecordSetUtilSQL * RecordSetUtilSQL
*
* @param t * @param t
* @param <T> * @param <T>
* @return * @return
@ -1823,6 +1835,7 @@ public class Util extends weaver.general.Util {
/** /**
* join * join
*
* @param coll * @param coll
* @param split * @param split
* @return * @return
@ -1835,8 +1848,8 @@ public class Util extends weaver.general.Util {
boolean isFirst = true; boolean isFirst = true;
String s; String s;
for(Iterator item = coll.iterator(); item.hasNext(); sb.append(s)) { for (Iterator item = coll.iterator(); item.hasNext(); sb.append(s)) {
s = (String)item.next(); s = (String) item.next();
if (isFirst) { if (isFirst) {
isFirst = false; isFirst = false;
} else { } else {
@ -1857,7 +1870,7 @@ public class Util extends weaver.general.Util {
boolean isFirst = true; boolean isFirst = true;
String s; String s;
for(Iterator item = coll.iterator(); item.hasNext(); sb.append(s)) { for (Iterator item = coll.iterator(); item.hasNext(); sb.append(s)) {
Object next = item.next(); Object next = item.next();
s = next == null ? "" : String.valueOf(next); s = next == null ? "" : String.valueOf(next);
if (isFirst) { if (isFirst) {
@ -1870,4 +1883,250 @@ public class Util extends weaver.general.Util {
return sb.toString(); return sb.toString();
} }
} }
public static void errorException(Object message, Throwable exception) {
loggerUtil.error(message, exception);
}
public static Logger getLogger() {
if (log == null) {
synchronized (Util.class) {
if (log == null) {
log = org.apache.log4j.Logger.getLogger(LOGGER_NAME);
}
}
}
return log;
}
/**
* listlist
*
* @param dataList
* @param getIdFn id
* @param getParentId id
* @param setChildFn
* @param predicate
* @param <T> list
* @param <K> id
* @return list
*/
public static <T, K> List<T> listToTree(List<T> dataList, Function<T, K> getIdFn,
Function<T, K> getParentId, BiConsumer<T, T> setChildFn, Predicate<K> predicate) {
if (dataList == null || dataList.isEmpty() || dataList.size() == 1) {
return dataList;
}
return buildTree(dataList, new HashMap<>(dataList.size()), new HashMap<>(dataList.size()), 0,
getIdFn, getParentId, setChildFn, predicate);
}
/**
* listlist
*
* @param dataList
* @param getIdFn id
* @param getParentId id
* @param setChildFn
* @param getChildFn
* @param predicate
* @param <T> list
* @param <K> id
* @return list
*/
public static <T,K> List<T> listToTree(List<T> dataList, Function<T, K> getIdFn,
Function<T, K> getParentId, Function<T, List<T>> getChildFn,
BiConsumer<T, List<T>> setChildFn, Predicate<K> predicate){
if (dataList == null || dataList.isEmpty() || dataList.size() == 1) {
return dataList;
}
return buildTree(dataList,new HashMap<>(dataList.size()),new HashMap<>(dataList.size()),
0,getIdFn,getParentId,getChildFn,setChildFn,predicate);
}
/**
* listlist
*
* @param dataList list
* @param dataMap map
* @param childMap
* @param index
* @param getIdFn id
* @param getParentId id
* @param setChildFn
* @param predicate
* @param <T> list
* @param <K> id
* @return
*/
private static <T, K> List<T> buildTree(List<T> dataList, Map<K, T> dataMap, Map<K, T> childMap, int index, Function<T, K> getIdFn,
Function<T, K> getParentId, BiConsumer<T, T> setChildFn,
Predicate<K> predicate) {
List<T> treeList = new ArrayList<>(dataList.size());
while (index < dataList.size()) {
T item = dataList.get(index);
index++;
K id = getIdFn.apply(item);
K parentId = getParentId.apply(item);
dataMap.put(id, item);
// 判断是否属于根节点,如果是根节点,则将数据添加到树中
if (predicate.test(parentId)) {
if (childMap.containsKey(id)) {
continue;
}
treeList.add(item);
childMap.put(id, item);
} else {
// 如果不是根节点则通过id查找到父级
T parent = dataMap.get(parentId);
if (Objects.isNull(parent)) {
// 如果父级为空,则说明他的父级还没有遍历到,需要从之后的数据进行遍历,直到找到父级为止
List<T> list = buildTree(dataList, dataMap, childMap, index, getIdFn, getParentId, setChildFn, predicate);
parent = dataMap.get(parentId);
if (Objects.isNull(parent)) {
// 如果还是没有查询到父节点,则表明是顶层节点,将他添加到顶层节点中
treeList.add(item);
} else {
// 如果找到了父节点,则将自己挂到父节点上
if (childMap.containsKey(id)) {
continue;
}
setChildFn.accept(parent, item);
childMap.put(id, item);
}
// 如果查找的list不为空并且有值那就说明属于根节点
if (list != null && list.size() > 0) {
treeList.addAll(list);
}
} else {
// 如果找到了父节点,则将自己挂到父节点上
if (childMap.containsKey(id)) {
continue;
}
setChildFn.accept(parent, item);
childMap.put(id, item);
}
}
}
return treeList;
}
/**
* listlist
*
* @param dataList list
* @param dataMap map
* @param childMap
* @param index
* @param getIdFn id
* @param getParentId id
* @param getChildFn
* @param setChildFn
* @param predicate
* @param <T> list
* @param <K> id
* @return
*/
private static <T, K> List<T> buildTree(List<T> dataList, Map<K, T> dataMap, Map<K, T> childMap, int index, Function<T, K> getIdFn,
Function<T, K> getParentId, Function<T, List<T>> getChildFn,
BiConsumer<T, List<T>> setChildFn, Predicate<K> predicate) {
List<T> treeList = new ArrayList<>(dataList.size());
while (index < dataList.size()) {
T item = dataList.get(index);
index++;
K id = getIdFn.apply(item);
K parentId = getParentId.apply(item);
dataMap.put(id, item);
// 判断是否属于根节点,如果是根节点,则将数据添加到树中
if (predicate.test(parentId)) {
if (childMap.containsKey(id)) {
continue;
}
treeList.add(item);
childMap.put(id, item);
} else {
// 如果不是根节点则通过id查找到父级
T parent = dataMap.get(parentId);
if (Objects.isNull(parent)) {
// 如果父级为空,则说明他的父级还没有遍历到,需要从之后的数据进行遍历,直到找到父级为止
List<T> list = buildTree(dataList, dataMap, childMap, index, getIdFn, getParentId, getChildFn, setChildFn, predicate);
parent = dataMap.get(parentId);
if (Objects.isNull(parent)) {
// 如果还是没有查询到父节点,则表明是顶层节点,将他添加到顶层节点中
treeList.add(item);
} else {
// 如果找到了父节点,则将自己挂到父节点上
if (childMap.containsKey(id)) {
continue;
}
List<T> childList = Optional.ofNullable(getChildFn.apply(parent)).orElse(new ArrayList<>());
childList.add(item);
setChildFn.accept(parent, childList);
childMap.put(id, item);
}
// 如果查找的list不为空并且有值那就说明属于根节点
if (list != null && list.size() > 0) {
treeList.addAll(list);
}
} else {
// 如果找到了父节点,则将自己挂到父节点上
if (childMap.containsKey(id)) {
continue;
}
List<T> childList = Optional.ofNullable(getChildFn.apply(parent)).orElse(new ArrayList<>());
childList.add(item);
setChildFn.accept(parent, childList);
childMap.put(id, item);
}
}
}
return treeList;
}
/**
* java bean
* @param source
* @param target
* @param <T>
* @param <K>
* @return
*/
public static <T,K> K copyBeanBaseField(T source, K target){
if(Objects.isNull(source)){
return target;
}
if(Objects.isNull(target)){
throw new RuntimeException("target is null, You cannot pass a null bean");
}
BeanInfo beanInfo = null;
try {
beanInfo = Introspector.getBeanInfo(target.getClass());
} catch (IntrospectionException e) {
e.printStackTrace();
}
if(Objects.isNull(beanInfo)){
throw new RuntimeException("无法获取对象信息can not get bean info");
}
Class<?> sourceClass = source.getClass();
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
Method writeMethod = propertyDescriptor.getWriteMethod();
String name = propertyDescriptor.getName();
try {
Field sourceClassField = sourceClass.getDeclaredField(name);
Class<?> propertyType = propertyDescriptor.getPropertyType();
Class<?> classFieldType = sourceClassField.getType();
if(propertyType.equals(classFieldType)){
Method getMethod = sourceClass.getMethod("get" + name.substring(0, 1).toUpperCase() + name.substring(1));
Object invoke = getMethod.invoke(source);
writeMethod.invoke(target,invoke);
}
} catch (NoSuchFieldException | IllegalAccessException | InvocationTargetException ignored) {
} catch (NoSuchMethodException e) {
throw new RuntimeException("invoke method err, cant not invoke method set" + name.substring(0,1).toUpperCase() + name.substring(1));
}
}
// TODO 复制bean
return target;
}
} }

View File

@ -5,6 +5,7 @@ import java.lang.annotation.*;
/** /**
* @author @author EBU7-dev1-ay * @author @author EBU7-dev1-ay
* create 2021/12/21 0021 15:25 * create 2021/12/21 0021 15:25
*
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD) @Target(ElementType.METHOD)

View File

@ -0,0 +1,12 @@
package aiyh.utils.apirequest;
/**
* <p></p>
* <p>create 2022/1/22 0022 20:15</p>
*
* @author EBU7-dev1-ayh
*/
public class ApiRequestUtil {
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.factory;
/**
* <p></p>
* <p>create 2022/1/26 0026 12:03</p>
*
* @author EBU7-dev1-ayh
*/
public interface AbstractFactory {
/**
*
* @param type
* @return
*/
<T> T createParamHandlerFactory(Class<T> type);
}

View File

@ -0,0 +1,26 @@
package aiyh.utils.apirequest.core.factory;
/**
* <p></p>
* <p>create 2022/1/26 0026 12:55</p>
*
* @author EBU7-dev1-ayh
*/
public class AbstractFactoryImpl implements AbstractFactory {
@Override
public <T> T createParamHandlerFactory(Class<T> type) {
if (ParamTypeHandlerFactory.class.equals(type)) {
return (T) new ParamTypeHandlerFactory();
}
if (ParamValueRuleHandlerFactory.class.equals(type)) {
return (T) new ParamValueRuleHandlerFactory();
}
if (DataSourceHandlerFactory.class.equals(type)) {
return (T) new DataSourceHandlerFactory();
}
return null;
}
}

View File

@ -0,0 +1,31 @@
package aiyh.utils.apirequest.core.factory;
import aiyh.utils.apirequest.core.typehandler.IDataSourceHandler;
import aiyh.utils.apirequest.core.typehandler.datasource.ModelDataHandler;
import aiyh.utils.apirequest.core.typehandler.datasource.WorkflowDataHandler;
import aiyh.utils.apirequest.enumtype.DataSourceRuleEnum;
import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum;
/**
* <p></p>
* <p>create 2022/1/25 0025 13:52</p>
*
* @author EBU7-dev1-ayh
*/
public class DataSourceHandlerFactory implements ParamHandlerFactory<IDataSourceHandler, DataSourceRuleEnum> {
@Override
public IDataSourceHandler createParamHandler(DataSourceRuleEnum factoryEnum) {
switch (factoryEnum){
case WORKFLOW_DATA:
return new WorkflowDataHandler();
case MODEL_DATA:
return new ModelDataHandler();
default:
break;
}
return null;
}
}

View File

@ -0,0 +1,19 @@
package aiyh.utils.apirequest.core.factory;
/**
* <p></p>
* <p>create 2022/1/24 0024 10:59</p>
*
* @author EBU7-dev1-ayh
*/
public interface ParamHandlerFactory<R,V> {
/**
*
* @param factoryEnum
* @return
*/
public R createParamHandler(V factoryEnum);
}

View File

@ -0,0 +1,21 @@
package aiyh.utils.apirequest.core.factory;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
import aiyh.utils.apirequest.enumtype.ParamTypeEnum;
/**
* <p></p>
* <p>create 2022/1/23 0023 21:24</p>
*
* @author EBU7-dev1-ayh
*/
public class ParamTypeHandlerFactory implements ParamHandlerFactory<IParamTypeHandler, ParamTypeEnum> {
@Override
public IParamTypeHandler createParamHandler(ParamTypeEnum factoryEnum) {
return null;
}
}

View File

@ -0,0 +1,21 @@
package aiyh.utils.apirequest.core.factory;
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum;
/**
* <p></p>
* <p>create 2022/1/23 0023 21:25</p>
*
* @author EBU7-dev1-ayh
*/
public class ParamValueRuleHandlerFactory implements ParamHandlerFactory<IParamValueRuleHandler, ParamValueRuleEnum> {
@Override
public IParamValueRuleHandler createParamHandler(ParamValueRuleEnum factoryEnum) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package aiyh.utils.apirequest.core.typehandler;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
/**
* <p></p>
* <p>create 2022/1/26 0026 10:39</p>
*
* @author EBU7-dev1-ayh
*/
public interface IDataSourceHandler {
/**
*
* @param apiRequestMain
* @return
*/
public ParamConfigInfo parseDataSource(ApiRequestMain apiRequestMain);
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler;
/**
* <p></p>
* <p>create 2022/1/22 0022 20:21</p>
*
* @author EBU7-dev1-ayh
*/
public interface IParamTypeHandler {
/**
*
* @param value
* @return
*/
public Object getValue(Object value);
}

View File

@ -0,0 +1,23 @@
package aiyh.utils.apirequest.core.typehandler;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/22 0022 20:22</p>
*
* @author EBU7-dev1-ayh
*/
public interface IParamValueRuleHandler {
/**
*
* @param paramInfo
* @param dataMap
* @return
*/
public Object getValue(ApiRequestParamDetail paramInfo, Map<String,Object> dataMap);
}

View File

@ -0,0 +1,20 @@
package aiyh.utils.apirequest.core.typehandler.datasource;
import aiyh.utils.apirequest.core.typehandler.IDataSourceHandler;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
/**
* <p></p>
* <p>create 2022/1/26 0026 11:00</p>
*
* @author EBU7-dev1-ayh
*/
public class ModelDataHandler implements IDataSourceHandler {
@Override
public ParamConfigInfo parseDataSource(ApiRequestMain apiRequestMain) {
return null;
}
}

View File

@ -0,0 +1,75 @@
package aiyh.utils.apirequest.core.typehandler.datasource;
import aiyh.utils.Util;
import aiyh.utils.apirequest.core.factory.AbstractFactory;
import aiyh.utils.apirequest.core.factory.AbstractFactoryImpl;
import aiyh.utils.apirequest.core.factory.ParamValueRuleHandlerFactory;
import aiyh.utils.apirequest.core.typehandler.IDataSourceHandler;
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.entity.ParamInfo;
import aiyh.utils.apirequest.enumtype.ParamValueRuleEnum;
import aiyh.utils.apirequest.mapper.DataSourceMapper;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import weaver.workflow.workflow.WorkflowVersion;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/26 0026 11:00</p>
*
* @author EBU7-dev1-ayh
*/
public class WorkflowDataHandler implements IDataSourceHandler {
private final DataSourceMapper mapper = Util.getMapper(DataSourceMapper.class);
private final AbstractFactory factory = new AbstractFactoryImpl();
@Override
public ParamConfigInfo parseDataSource(ApiRequestMain apiRequestMain) {
String workflowId = apiRequestMain.getWorkflowType();
String workflowVersionIds = WorkflowVersion.getVersionStringByWfid(workflowId);
String workflowTable = mapper.selectWorkflowTableById(workflowVersionIds.split(","));
Map<String, Object> mainData = mapper.selectMainData(workflowTable, apiRequestMain.getRequestId());
ParamConfigInfo paramConfigInfo = Util.copyBeanBaseField(apiRequestMain, new ParamConfigInfo());
List<ApiRequestParamDetail> paramDetailList = apiRequestMain.getParamDetailList();
// 明细请求模式,单挑明细 当做请求参数进行一次请求
if (apiRequestMain.getParamRequestType() == 1) {
} else {
// 默认模式
}
return paramConfigInfo;
}
public List<List<ParamInfo>> parseValueForDetail(ApiRequestMain apiRequestMain, Map<String, Object> mainData) {
String requestDetailTableName = apiRequestMain.getRequestDetailTableName();
List<Map<String, Object>> detailList = mapper.selectDetailData(requestDetailTableName, String.valueOf(mainData.get("id")));
List<ApiRequestParamDetail> paramDetailList = apiRequestMain.getParamDetailList();
ParamValueRuleHandlerFactory paramHandlerFactory = factory.createParamHandlerFactory(ParamValueRuleHandlerFactory.class);
for (Map<String, Object> detail : detailList) {
Map<String, Object> dataMap = new HashMap<>(8);
dataMap.put("main", mainData);
dataMap.put("detail", detail);
for (ApiRequestParamDetail paramDetail : paramDetailList) {
ParamValueRuleEnum paramValueRuleEnum = ParamValueRuleEnum.get(paramDetail.getValueRule());
IParamValueRuleHandler paramHandler = paramHandlerFactory.createParamHandler(paramValueRuleEnum);
Object value = paramHandler.getValue(paramDetail, dataMap);
}
}
return null;
}
public List<ParamInfo> parseValueForDefault() {
return null;
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler.paramtype;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
/**
* <p>boolean</p>
* <p>create 2022/1/24 0024 11:35</p>
*
* @author EBU7-dev1-ayh
*/
public class BooleanTypeHandler implements IParamTypeHandler {
@Override
public Boolean getValue(Object value) {
return Boolean.valueOf(String.valueOf(value));
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler.paramtype;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
/**
* <p></p>
* <p>create 2022/1/24 0024 11:35</p>
*
* @author EBU7-dev1-ayh
*/
public class DoubleTypeHandler implements IParamTypeHandler {
@Override
public Double getValue(Object value) {
return Double.valueOf(String.valueOf(value));
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler.paramtype;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
/**
* <p></p>
* <p>create 2022/1/24 0024 11:36</p>
*
* @author EBU7-dev1-ayh
*/
public class ListTypeHandler implements IParamTypeHandler {
@Override
public Object getValue(Object value) {
return null;
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler.paramtype;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
/**
* <p></p>
* <p>create 2022/1/24 0024 11:34</p>
*
* @author EBU7-dev1-ayh
*/
public class LongTypeHandler implements IParamTypeHandler {
@Override
public Long getValue(Object value) {
return Long.valueOf(String.valueOf(value));
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler.paramtype;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
/**
* <p>Object</p>
* <p>create 2022/1/24 0024 11:34</p>
*
* @author EBU7-dev1-ayh
*/
public class ObjectTypeHandler implements IParamTypeHandler {
@Override
public Object getValue(Object value) {
return null;
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.apirequest.core.typehandler.paramtype;
import aiyh.utils.apirequest.core.typehandler.IParamTypeHandler;
/**
* <p></p>
* <p>create 2022/1/24 0024 11:09</p>
*
* @author EBU7-dev1-ayh
*/
public class StringTypeHandler implements IParamTypeHandler {
@Override
public String getValue(Object value) {
return String.valueOf(value);
}
}

View File

@ -0,0 +1,22 @@
package aiyh.utils.apirequest.core.typehandler.paramvalue;
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/23 0023 19:51</p>
*
* @author EBU7-dev1-ayh
*/
public class FixedValueRuleHandle implements IParamValueRuleHandler {
@Override
public Object getValue(ApiRequestParamDetail paramInfo, Map<String, Object> dataMap) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package aiyh.utils.apirequest.core.typehandler.paramvalue;
import aiyh.utils.apirequest.core.typehandler.IParamValueRuleHandler;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/23 0023 19:52</p>
*
* @author EBU7-dev1-ayh
*/
public class NullValueRuleHandler implements IParamValueRuleHandler {
@Override
public Object getValue(ApiRequestParamDetail paramInfo, Map<String, Object> dataMap) {
return null;
}
}

View File

@ -0,0 +1,24 @@
package aiyh.utils.apirequest.entity;
import lombok.Data;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/23 0023 21:09</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class HeardInfo {
/**
*
*/
private String heardName;
/**
*
*/
private String heardValue;
}

View File

@ -0,0 +1,72 @@
package aiyh.utils.apirequest.entity;
import lombok.Data;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/23 0023 21:08</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class ParamConfigInfo {
private String requestId;
private Integer id;
/**
* api
*/
private String apiUrl;
/**
* api
*/
private String testApiUrl;
/**
*
*/
private Integer requestType;
/**
* api
*/
private Integer apiType;
/**
*
*/
private Integer dataSource;
/**
* api
*/
private String apiDesc;
/**
*
*/
private String workflowType;
/**
*
*/
private String modelTableName;
/**
*
*/
private Integer paramRequestType;
/**
*
*/
private String requestDetailTableName;
/**
*
*/
private String onlyMark;
/**
*
*/
private List<ParamInfo> paramInfoList;
/**
*
*/
private List<HeardInfo> heardInfoList;
}

View File

@ -0,0 +1,37 @@
package aiyh.utils.apirequest.entity;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import lombok.Data;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/23 0023 21:04</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class ParamInfo {
/**
*
*/
private Integer lineNum;
/**
*
*/
private String paramName;
/**
*
*/
private Object paramValue;
/**
*
*/
private Integer parentLine;
/**
*
*/
private List<ParamInfo> childList;
}

View File

@ -0,0 +1,26 @@
package aiyh.utils.apirequest.entity;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/23 0023 20:33</p>
*
* @author EBU7-dev1-ayh
*/
public class ParseAfterData {
/**
*
*/
private boolean autoRequest;
/**
*
*/
private Map<String,Object> requestData;
/**
*
*/
private Map<String,Object> requestHeard;
}

View File

@ -0,0 +1,48 @@
package aiyh.utils.apirequest.enumtype;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/26 0026 10:43</p>
*
* @author EBU7-dev1-ayh
*/
public enum DataSourceRuleEnum {
/**
*
*/
WORKFLOW_DATA(0),
/**
*
*/
MODEL_DATA(1);
private static final Map<Integer, DataSourceRuleEnum> LOOKUP;
static {
LOOKUP = new HashMap<>();
for (DataSourceRuleEnum enumType : EnumSet.allOf(DataSourceRuleEnum.class)) {
LOOKUP.put(enumType.getValue(), enumType);
}
}
private final int value;
DataSourceRuleEnum(int value) {
this.value = value;
}
public static DataSourceRuleEnum get(int value) {
return LOOKUP.get(value);
}
public int getValue() {
return this.value;
}
}

View File

@ -0,0 +1,12 @@
package aiyh.utils.apirequest.enumtype;
/**
* <p></p>
* <p>create 2022/1/25 0025 10:36</p>
*
* @author EBU7-dev1-ayh
*/
public enum ParamTypeEnum {
}

View File

@ -0,0 +1,83 @@
package aiyh.utils.apirequest.enumtype;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/25 0025 10:16</p>
*
* @author EBU7-dev1-ayh
*/
public enum ParamValueRuleEnum {
/**
*
*/
NULL_VALUE(0),
/**
*
*/
FIXED_VALUE(1),
/**
*
*/
SYSTEM_FIELD(2),
/**
* SQL
*/
CUSTOMER_SQL(3),
/**
*
*/
CURRENT_TIME(4),
/**
* id
*/
REQUEST_ID(5),
/**
* id
*/
WORKFLOW_ID(6),
/**
*
*/
RANDOM_VALUE(7),
/**
*
*/
ATTACHMENT_FILE(8),
/**
*
*/
TIME_STAMP(9),
/**
* SQL
*/
SQL_FIELD(10);
private static final Map<Integer, ParamValueRuleEnum> LOOKUP;
static {
LOOKUP = new HashMap<>();
for (ParamValueRuleEnum enumType : EnumSet.allOf(ParamValueRuleEnum.class)) {
LOOKUP.put(enumType.getValue(), enumType);
}
}
private final int value;
ParamValueRuleEnum(int value) {
this.value = value;
}
public static ParamValueRuleEnum get(int value) {
return LOOKUP.get(value);
}
public int getValue() {
return this.value;
}
}

View File

@ -0,0 +1,51 @@
package aiyh.utils.apirequest.interceptor;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.entity.ParseAfterData;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
import aiyh.utils.httpUtil.ResponeVo;
/**
* <p>api </p>
* <p>create 2022/1/22 0022 20:19</p>
*
* @author EBU7-dev1-ayh
*/
public interface ApiRequestInterceptor {
/**
* '
* @param apiRequestMain
* @return
*/
public ApiRequestMain parseBefore(ApiRequestMain apiRequestMain);
/**
*
* @param paramConfigInfo
* @return
*/
public ParamConfigInfo parseAfter(ParamConfigInfo paramConfigInfo);
/**
*
* @param paramConfigTreeInfo
* @return
*/
public ParamConfigInfo parseTreeAfter(ParamConfigInfo paramConfigTreeInfo);
/**
*
* @param parseAfterData
* @return
*/
public ParseAfterData requestBefore(ParseAfterData parseAfterData);
/**
*
* @param isSuccess
* @param responeVo
*/
public void requestAfter(ResponeVo responeVo,boolean isSuccess);
}

View File

@ -0,0 +1,53 @@
package aiyh.utils.apirequest.mapper;
import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.apirequest.pojo.ApiRequestHeardDetail;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/23 0023 17:52</p>
*
* @author EBU7-dev1-ayh
*/
@SqlMapper
public interface ApiRequestMapper {
/**
*
* @param onlyMark
* @return
*/
@Select("")
public ApiRequestMain selectApiConfigByOnlyMark(@ParamMapper("onlyMark") String onlyMark);
/**
*
* @param id id
* @return
*/
@Select("")
public ApiRequestMain selectApiConfigById(@ParamMapper("id") int id);
/**
* id
* @param mainId id
* @return
*/
@Select("")
public List<ApiRequestParamDetail> selectApiParamListByMainId(@ParamMapper("mainId") int mainId);
/**
* id
* @param mainId id
* @return
*/
@Select("")
public List<ApiRequestHeardDetail> selectApiHeardListByMainId(@ParamMapper("mainId") int mainId);
}

View File

@ -0,0 +1,40 @@
package aiyh.utils.apirequest.mapper;
import aiyh.utils.annotation.recordset.CaseConversion;
import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import java.util.List;
import java.util.Map;
/**
* <p></p>
* <p>create 2022/1/26 0026 14:10</p>
*
* @author EBU7-dev1-ayh
*/
@SqlMapper
public interface DataSourceMapper {
/**
* id
* @param versionIds id
* @return
*/
@Select("select distinct tablename from workflow_base wb " +
"left join workflow_bill wbi on wbi.id = wb.formid " +
"where wb.id in (${versionIds})")
public String selectWorkflowTableById(@ParamMapper("versionIds") String[] versionIds);
@Select("select * from $t{workflowTable} where requestid = #{requestid}")
@CaseConversion(false)
Map<String,Object> selectMainData(@ParamMapper("workflowTable") String workflowTable,
@ParamMapper("requestId") String requestId);
@Select("select * from $t{detailTable} where mainid = #{mainId}")
@CaseConversion(false)
List<Map<String, Object>> selectDetailData(@ParamMapper("detailTable") String requestDetailTableName,
@ParamMapper("mainId") String mainId);
}

View File

@ -0,0 +1,31 @@
package aiyh.utils.apirequest.pojo;
import lombok.Data;
/**
* <p>api</p>
* <p>create 2022/1/23 0023 18:10</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class ApiRequestHeardDetail {
private Integer mainId;
/**
*
*/
private String heardName;
/**
*
*/
private Integer valueRule;
/**
*
*/
private String customerValue;
/**
*
*/
private Integer enableParam;
}

View File

@ -0,0 +1,78 @@
package aiyh.utils.apirequest.pojo;
import lombok.Data;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/23 0023 17:55</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class ApiRequestMain {
/**
* id
*/
private String requestId;
/**
* id
*/
private Integer id;
/**
* api
*/
private String apiUrl;
/**
* api
*/
private String testApiUrl;
/**
*
*/
private Integer requestType;
/**
* api
*/
private Integer apiType;
/**
*
*/
private Integer dataSource;
/**
* api
*/
private String apiDesc;
/**
*
*/
private String workflowType;
/**
*
*/
private String modelTableName;
/**
*
*/
private Integer paramRequestType;
/**
*
*/
private String requestDetailTableName;
/**
*
*/
private String onlyMark;
/**
*
*/
private List<ApiRequestParamDetail> paramDetailList;
/**
*
*/
private List<ApiRequestHeardDetail> heardDetailList;
}

View File

@ -0,0 +1,62 @@
package aiyh.utils.apirequest.pojo;
import lombok.Data;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/23 0023 18:04</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class ApiRequestParamDetail {
/**
* id
*/
private Integer mainId;
/**
*
*/
private Integer lineNum;
/**
*
*/
private String paramName;
/**
*
*/
private Integer paramType;
/**
*
*/
private Integer dataSource;
/**
*
*/
private String detailTableName;
/**
*
*/
private Integer parentLine;
/**
*
*/
private Integer valueRule;
/**
*
*/
private String systemFieldName;
/**
*
*/
private String customerValue;
/**
*
*/
private Integer enableParam;
}

View File

@ -0,0 +1,137 @@
package aiyh.utils.apirequest.service;
import aiyh.utils.Util;
import aiyh.utils.apirequest.core.factory.AbstractFactory;
import aiyh.utils.apirequest.core.factory.AbstractFactoryImpl;
import aiyh.utils.apirequest.core.factory.DataSourceHandlerFactory;
import aiyh.utils.apirequest.core.typehandler.IDataSourceHandler;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.entity.ParamInfo;
import aiyh.utils.apirequest.entity.ParseAfterData;
import aiyh.utils.apirequest.enumtype.DataSourceRuleEnum;
import aiyh.utils.apirequest.interceptor.ApiRequestInterceptor;
import aiyh.utils.apirequest.mapper.ApiRequestMapper;
import aiyh.utils.apirequest.pojo.ApiRequestHeardDetail;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
import aiyh.utils.apirequest.pojo.ApiRequestParamDetail;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.atomic.AtomicReference;
/**
* <p>api </p>
* <p>create 2022/1/22 0022 20:26</p>
*
* @author EBU7-dev1-ayh
*/
public class ApiRequestService {
/**
*
*/
private final ApiRequestInterceptor interceptor;
private final AbstractFactory abstractFactory = new AbstractFactoryImpl();
/**
*
*/
private final ApiRequestMapper mapper;
private String requestId;
/**
* @param interceptor
*/
public ApiRequestService(ApiRequestInterceptor interceptor) {
this.mapper = Util.getMapper(ApiRequestMapper.class);
this.interceptor = interceptor;
}
/**
*
*
* @param id id
* @return
*/
public ApiRequestMain getApiRequestMain(int id) {
AtomicReference<ApiRequestMain> apiRequestMain = new AtomicReference<>(mapper.selectApiConfigById(id));
if (Objects.isNull(apiRequestMain.get())) {
return null;
}
List<ApiRequestParamDetail> paramDetailList = mapper.selectApiParamListByMainId(apiRequestMain.get().getId());
apiRequestMain.get().setParamDetailList(paramDetailList);
List<ApiRequestHeardDetail> heardDetailList = mapper.selectApiHeardListByMainId(apiRequestMain.get().getId());
apiRequestMain.get().setHeardDetailList(heardDetailList);
Optional.ofNullable(interceptor).map(interceptor -> {
Optional.ofNullable(interceptor.parseBefore(apiRequestMain.get())).map(v -> {
apiRequestMain.set(v);
return v;
});
return interceptor;
});
return apiRequestMain.get();
}
/**
*
*
* @param apiRequestMain
* @return
*/
public ParamConfigInfo parseParam(ApiRequestMain apiRequestMain) {
DataSourceHandlerFactory dataSourceHandlerFactory = abstractFactory.createParamHandlerFactory(DataSourceHandlerFactory.class);
DataSourceRuleEnum dataSourceRuleEnum = DataSourceRuleEnum.get(apiRequestMain.getDataSource());
IDataSourceHandler paramHandler = dataSourceHandlerFactory.createParamHandler(dataSourceRuleEnum);
apiRequestMain.setRequestId(this.requestId);
AtomicReference<ParamConfigInfo> paramConfigInfo = new AtomicReference<>(paramHandler.parseDataSource(apiRequestMain));
// TODO 解析配置表中的参数
Optional.ofNullable(interceptor).map(interceptor -> {
Optional.ofNullable(interceptor.parseAfter(paramConfigInfo.get())).map(v -> {
paramConfigInfo.set(v);
return v;
});
return interceptor;
});
return paramConfigInfo.get();
}
/**
*
*
* @param paramConfigInfo
* @return
*/
public ParseAfterData parseTree(ParamConfigInfo paramConfigInfo) {
AtomicReference<ParamConfigInfo> parseParamConfig = new AtomicReference<>(new ParamConfigInfo());
Util.copyBeanBaseField(paramConfigInfo, parseParamConfig.get());
List<ParamInfo> paramInfoList = paramConfigInfo.getParamInfoList();
List<ParamInfo> treeParamList = Util.listToTree(paramInfoList,
ParamInfo::getLineNum, ParamInfo::getParentLine,
ParamInfo::getChildList, ParamInfo::setChildList,
parentId -> Objects.isNull(parentId) || parentId == -1 || parentId == 0);
parseParamConfig.get().setParamInfoList(treeParamList);
// TODO 将树形结构组合为最终的请求参数结构
Optional.ofNullable(interceptor).map(interceptor->{
Optional.ofNullable(interceptor.parseTreeAfter(parseParamConfig.get())).map(v->{
parseParamConfig.set(v);
return v;
});
return interceptor;
});
return null;
}
public String getRequestId() {
return requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
}

View File

@ -0,0 +1,29 @@
package aiyh.utils.apirequest.service;
import aiyh.utils.apirequest.core.factory.AbstractFactory;
import aiyh.utils.apirequest.core.factory.AbstractFactoryImpl;
import aiyh.utils.apirequest.core.factory.DataSourceHandlerFactory;
import aiyh.utils.apirequest.core.typehandler.IDataSourceHandler;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.enumtype.DataSourceRuleEnum;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
/**
* <p></p>
* <p>create 2022/1/25 0025 10:02</p>
*
* @author EBU7-dev1-ayh
*/
public class ParseParamValue {
private final AbstractFactory abstractFactory = new AbstractFactoryImpl();
public ParamConfigInfo parseValue(ApiRequestMain apiRequestMain) {
DataSourceHandlerFactory dataSourceHandlerFactory = abstractFactory.createParamHandlerFactory(DataSourceHandlerFactory.class);
DataSourceRuleEnum dataSourceRuleEnum = DataSourceRuleEnum.get(apiRequestMain.getDataSource());
IDataSourceHandler paramHandler = dataSourceHandlerFactory.createParamHandler(dataSourceRuleEnum);
return paramHandler.parseDataSource(apiRequestMain);
}
}

View File

@ -0,0 +1,18 @@
package aiyh.utils.function;
/**
* <p>function</p>
* <p>create 2022/1/22 0022 18:26</p>
*
* @author EBU7-dev1-ayh
*/
@FunctionalInterface
public interface ListToTreeSetChildFunction<T> {
/**
*
* @param parent
* @param child
*/
void setChildItem(T parent, T child);
}

View File

@ -0,0 +1,64 @@
package aiyh.utils.logger;
/**
* create 2022/1/17 0017 9:58
*
*
* @author EBU7-dev1-ayh
*/
public interface Logger {
/**
* debug
* @param message
*/
public void debug(Object message);
/**
* debug
* @param message
* @param exception
*/
public void debug(Object message, Throwable exception);
/**
* info
* @param message
*/
public void info(Object message);
/**
* info
* @param message
* @param exception
*/
public void info(Object message, Throwable exception);
/**
* warn
* @param message
*/
public void warn(Object message);
/**
* warn
* @param message
* @param exception
*/
public void warn(Object message, Throwable exception);
/**
* error
* @param message
*/
public void error(Object message);
/**
* error
* @param message
* @param exception
*/
public void error(Object message, Throwable exception);
}

View File

@ -0,0 +1,69 @@
package aiyh.utils.logger;
import aiyh.utils.Util;
/**
* create 2022/1/17 0017 9:57
*
*
* @author EBU7-dev1-ayh
*/
public class LoggerUtil implements Logger{
private final String LOGGER_NAME = "cusAYH";
private final org.apache.log4j.Logger log;
public LoggerUtil() {
log = org.apache.log4j.Logger.getLogger(LOGGER_NAME);
}
public LoggerUtil(String loggerName) {
this.log = org.apache.log4j.Logger.getLogger(loggerName);
}
@Override
public void debug(Object message) {
this.log.debug(message);
}
@Override
public void debug(Object message, Throwable exception) {
this.log.debug(message,exception);
}
@Override
public void info(Object message) {
this.log.info(message);
}
@Override
public void info(Object message, Throwable exception) {
this.log.info(message,exception);
}
@Override
public void warn(Object message) {
this.log.warn(message);
}
@Override
public void warn(Object message, Throwable exception) {
this.log.warn(message,exception);
}
@Override
public void error(Object message) {
this.log.error(message);
}
@Override
public void error(Object message, Throwable exception) {
this.log.error(message,exception);
}
public void errorException(Object message, Throwable exception) {
this.log.error(message + " ==> :\n " + Util.getErrString(exception));
}
}

View File

@ -22,6 +22,7 @@ import com.drew.metadata.Tag;
import com.engine.workflow.biz.requestForm.FileBiz; import com.engine.workflow.biz.requestForm.FileBiz;
import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.log4j.Logger;
import org.h2.util.StringUtils; import org.h2.util.StringUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.docs.docs.DocManager; import weaver.docs.docs.DocManager;
@ -47,7 +48,7 @@ public class WorkflowQueueService {
ToolUtil toolUtil = new ToolUtil(); ToolUtil toolUtil = new ToolUtil();
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
ConflictWorkflowDao conflictWorkflowDao = new ConflictWorkflowDao(); ConflictWorkflowDao conflictWorkflowDao = new ConflictWorkflowDao();
private Logger log = Util.getLogger();
/** /**
* ps * ps
@ -105,7 +106,7 @@ public class WorkflowQueueService {
// 遍历Directory对象每个对象里面包含标签 // 遍历Directory对象每个对象里面包含标签
for (Directory directory : metadata.getDirectories()) { for (Directory directory : metadata.getDirectories()) {
String directoryName = directory.getName(); String directoryName = directory.getName();
System.out.println(directory); log.info(directory);
if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName) if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName)
|| directoryName.contains("Adobe")) { || directoryName.contains("Adobe")) {
if (picPsVO.getScore() > 90) { if (picPsVO.getScore() > 90) {
@ -116,7 +117,7 @@ public class WorkflowQueueService {
} }
String model = ""; String model = "";
for (Tag tag : directory.getTags()) { for (Tag tag : directory.getTags()) {
System.out.println(tag); log.info(tag);
if (tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())) { if (tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())) {
picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核"); picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核");
picPsVO.setScore(70); picPsVO.setScore(70);
@ -170,10 +171,14 @@ public class WorkflowQueueService {
} }
} catch (ImageProcessingException | IOException e) { } catch (ImageProcessingException | IOException e) {
e.printStackTrace(); e.printStackTrace();
toolUtil.writeErrorLog("图片识别异常!");
} }
list.add(picPsVO); if (picPsVO.getScore() > 0){
list.add(picPsVO);
}
} }
List<PicPsVO> collect = list.stream().filter(item -> item.getScore() > 0).collect(Collectors.toList()); List<PicPsVO> collect = list.stream().filter(item -> item.getScore() > 0).collect(Collectors.toList());
// log.info("最终识别后的数组:" + collect);
return ApiResult.success(collect); return ApiResult.success(collect);
} }

View File

@ -954,15 +954,11 @@ public class FaDDContractService {
} }
public void pushAPush(String requestId) { public void pushAPush(String requestId) {
toolUtil.writeDebuggerLog("进入催一催方法===================");
UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId);
toolUtil.writeDebuggerLog("获取到合同数据:" + JSON.toJSONString(ufContractInfoDTO));
String signedUrls = Util.null2String(ufContractInfoDTO.getContractSignedUrl()); String signedUrls = Util.null2String(ufContractInfoDTO.getContractSignedUrl());
PushAPushEmailEntity pushAPushEmailEntity = queryEmailInfo(ufContractInfoDTO.getWorkflowType(), PushAPushEmailEntity pushAPushEmailEntity = queryEmailInfo(ufContractInfoDTO.getWorkflowType(),
ufContractInfoDTO.getWorkflowRequestId()); ufContractInfoDTO.getWorkflowRequestId());
toolUtil.writeDebuggerLog("获取到邮件信息数据:" + JSON.toJSONString(pushAPushEmailEntity));
String content = pushAPushEmailEntity.getEmailContent().replaceAll("#\\{info.signedUrls}", signedUrls); String content = pushAPushEmailEntity.getEmailContent().replaceAll("#\\{info.signedUrls}", signedUrls);
toolUtil.writeDebuggerLog("contnet:" + content);
try { try {
EmailWorkRunnable.threadModeReminder(pushAPushEmailEntity.getEmailAddress(), "", "", EmailWorkRunnable.threadModeReminder(pushAPushEmailEntity.getEmailAddress(), "", "",
pushAPushEmailEntity.getEmailTitle(), pushAPushEmailEntity.getEmailTitle(),
@ -970,7 +966,6 @@ public class FaDDContractService {
} catch (Exception e) { } catch (Exception e) {
toolUtil.writeDebuggerLog(e.toString()); toolUtil.writeDebuggerLog(e.toString());
} }
toolUtil.writeDebuggerLog("结束催一催方法===================");
} }
private PushAPushEmailEntity queryEmailInfo(int workflowType, String requestId) { private PushAPushEmailEntity queryEmailInfo(int workflowType, String requestId) {

View File

@ -34,7 +34,7 @@ import weaver.workflow.workflow.WorkflowVersion;
/** /**
* @author EBU7-dev1-ayh * @author EBU7-dev1-ayh
* @create 2021/9/30 0030 11:12 service * @create 2021/9/30 0030 11:12 core
*/ */
public class FaDDServiceImpl implements IFaDDService { public class FaDDServiceImpl implements IFaDDService {
private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping();

View File

@ -293,7 +293,7 @@ public class SyncOrganizationUtils extends ToolUtil {
String today = TimeUtil.getCurrentDateString(); String today = TimeUtil.getCurrentDateString();
// 根据outkey,询是否存在该人员 // 根据outkey,询是否存在该人员
String query = "select id from hrmresource where outkey = ?"; String query = "select id from hrmresource where outkey = ?";
try { try {
rs.executeQuery(query, Util.null2String(String.valueOf(employee.getUserID()))); rs.executeQuery(query, Util.null2String(String.valueOf(employee.getUserID())));
} catch (Exception e) { } catch (Exception e) {
writeErrorLog("select hrmresource error: " + query + Util.null2String(String.valueOf(employee.getUserID()))); writeErrorLog("select hrmresource error: " + query + Util.null2String(String.valueOf(employee.getUserID())));

View File

@ -0,0 +1,39 @@
<ehcache maxBytesLocalHeap="1G" maxBytesLocalDisk="5G">
<diskStore path="java.io.tempdir" />
<sizeOfPolicy maxDepth="150000"/>
<defaultCache
maxElementsInMemory = "100000"
maxElementsOnDisk = "0"
eternal="false"
timeToLiveSeconds="180"
timeToIdleSeconds="180"
overflowToDisk = "false"
diskPersistent = "false"
diskSpoolBufferSizeMB = "2000"
diskExpiryThreadIntervalSeconds = "360"
memoryStoreEvictionPolicy = "LFU"
/>
<cache name="com.cloudstore"
eternal="false"
overflowToDisk="false"
diskPersistent="false"
timeToLiveSeconds="1800"
diskSpoolBufferSizeMB="2000"
memoryStoreEvictionPolicy="LRU" />
<cache name="formmodecache"
eternal="false"
timeToLiveSeconds="180"
timeToIdleSeconds="180"
overflowToDisk="false"
diskPersistent="false"
diskSpoolBufferSizeMB="2000"
memoryStoreEvictionPolicy="LFU" />
<cache name="workflowcache"
eternal="false"
overflowToDisk="true"
diskPersistent="true"
timeToLiveSeconds="300"
timeToIdleSeconds="300"
diskSpoolBufferSizeMB="2048"
memoryStoreEvictionPolicy="LRU" />
</ehcache>

View File

@ -3,7 +3,7 @@
<!--Console appender --> <!--Console appender -->
<appender name="stdout" class="org.apache.log4j.ConsoleAppender"> <appender name="stdout" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout"> <layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss} %p %m%n"/> <param name="ConversionPattern" value="[%-5p] [%d{yyyy-MM-dd HH:mm:ss,SSS}] [%r] [Thread:%t][%F.%M:%L] ==> : %m %x %n"/>
</layout> </layout>
</appender> </appender>
<logger name="java.sql"> <logger name="java.sql">

View File

@ -172,3 +172,16 @@ log4j.appender.cus.layout=org.apache.log4j.PatternLayout
log4j.appender.cus.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %m%n log4j.appender.cus.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p %m%n
#log4j.appender.cuslog.Threshold = INFO #log4j.appender.cuslog.Threshold = INFO
log4j.additivity.cus=false log4j.additivity.cus=false
#cusAYH log \u81EA\u5B9A\u4E49\u65E5\u5FD7\u6587\u4EF6\u914D\u7F6EINFO,ERROR,WARN,DEBUG,cusAYH
log4j.logger.cusAYH=INFO,ERROR,WARN,DEBUG,cusAYH
log4j.additivity.cusAYH=false
log4j.appender.cusAYH=org.apache.log4j.DailyRollingFileAppender
log4j.appender.cusAYH.Encoding=UTF-8
log4j.appender.cusAYH.DatePattern='_'yyyyMMdd'.log'
log4j.appender.cusAYH.File=@ayh/ayh_cus.log
log4j.appender.cusAYH.Threshold=DEBUG
log4j.appender.cusAYH.layout=org.apache.log4j.PatternLayout
log4j.appender.cusAYH.layout.ConversionPattern=[%-5p] [%d{yyyy-MM-dd HH:mm:ss,SSS}] [%r] [Thread:%t][%F.%M:%L] ==> : %m %x %n

View File

@ -0,0 +1,767 @@
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<!--<filter><filter-name>CompressingFilter</filter-name><filter-class>com.planetj.servlet.filter.compression.CompressingFilter</filter-class><init-param><param-name>includeContentTypes</param-name><param-value>text/html,text/xml,text/css,text/javascript</param-value></init-param></filter><filter-mapping><filter-name>CompressingFilter</filter-name><url-pattern>/*</url-pattern></filter-mapping>-->
<!-- if you need web core support ,uncomment the following -->
<!--<servlet><servlet-name>AxisServlet</servlet-name><servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class><init-param><param-name>consumer</param-name><param-value>*</param-value></init-param></servlet>-->
<!-- if you need web core support ,uncomment the following -->
<!--<servlet-mapping><servlet-name>AxisServlet</servlet-name><url-pattern>/ws/WSServlet</url-pattern></servlet-mapping><servlet-mapping><servlet-name>AxisServlet</servlet-name><url-pattern>*.jws</url-pattern></servlet-mapping><servlet-mapping><servlet-name>AxisServlet</servlet-name><url-pattern>/ws/*</url-pattern></servlet-mapping>-->
<filter>
<filter-name>WSessionClusterFilter</filter-name>
<filter-class>weaver.session.WSessionClusterFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>WSessionClusterFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>EncodingFilterWeaver</filter-name>
<filter-class>weaver.security.filter.EncodingFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>EncodingFilterWeaver</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>SecurityTransFilter</filter-name>
<filter-class>weaver.security.encryptedtrans.SecurityTransFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecurityTransFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>CheckSensitiveFilter</filter-name>
<filter-class>com.engine.sensitive.biz.CheckSensitiveFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CheckSensitiveFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>WeaSsoIocComponentFilter</filter-name>
<filter-class>com.weaverboot.frame.ioc.filter.WeaSsoIocComponentFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>WeaSsoIocComponentFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WeaSsoIocComponentFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WeaSsoIocComponentFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter>
<filter-name>EMFilter</filter-name>
<filter-class>com.cloudstore.dev.api.service.EMFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>EMFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>SessionCloudFilter</filter-name>
<filter-class>com.cloudstore.dev.api.service.SessionFilter</filter-class>
<init-param>
<param-name>checkurl</param-name>
<param-value>/api/hrm/emmanager;</param-value>
</init-param>
<init-param>
<param-name>uncheckurl</param-name>
<param-value>/api/ec/dev/app/getCheckSystemInfo;/api/ec/dev/app/emjoin;</param-value>
</init-param>
<init-param>
<param-name>unchecksessionurl</param-name>
<param-value/>
</init-param>
</filter>
<filter-mapping>
<filter-name>SessionCloudFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SessionCloudFilter</filter-name>
<url-pattern>/page/interfaces/*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>SessionCloudFilter</filter-name>
<url-pattern>/workflow/core/ControlServlet.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>weaver.filter.SecurityFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>Compress</filter-name>
<filter-class>weaver.filter.WGzipFilter</filter-class>
<init-param>
<param-name>exclude</param-name>
<param-value>/wui/theme/ecology8/page/login.jsp;/login/login.jsp;/keygenerator/KeyGenerator.jsp;/keygenerator/getNoCheckFiles.jsp;/keygenerator/packNoCheckFiles.jsp;/workflow/request/WorkflowPDFStream.jsp;/keygenerator/packKeyCompareFiles.jsp;/mobile/plugin/Download.jsp</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>/weaver/weaver.common.util.taglib.SplitPageXmlServlet</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>/weaver/weaver.common.util.taglib.SplitPageXmlServletNew</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Compress</filter-name>
<url-pattern>/Messager/MessagerServlet</url-pattern>
</filter-mapping>
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<jsp-config>
<taglib>
<taglib-uri>/browserTag</taglib-uri>
<taglib-location>/WEB-INF/tld/browser.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/browser</taglib-uri>
<taglib-location>/WEB-INF/tld/browser.tld</taglib-location>
</taglib>
</jsp-config>
<filter>
<filter-name>IECompatibleFilter</filter-name>
<filter-class>weaver.filter.IECompatibleFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>IECompatibleFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>IECompatibleFilter</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>IECompatibleFilter</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>IECompatibleFilter</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter>
<filter-name>ConnFastFilter</filter-name>
<filter-class>weaver.filter.ConnFastFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ConnFastFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ConnFastFilter</filter-name>
<url-pattern>/weaver/weaver.common.util.taglib.SplitPageXmlServlet</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ConnFastFilter</filter-name>
<url-pattern>/weaver/weaver.common.util.taglib.SplitPageXmlServletNew</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>ConnFastFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>MultiLangFilter</filter-name>
<filter-class>weaver.filter.MultiLangFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>MultiLangFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MultiLangFilter</filter-name>
<url-pattern>/weaver/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MultiLangFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>MultiLangFilter</filter-name>
<url-pattern>/ReportServer</url-pattern>
</filter-mapping>
<filter>
<filter-name>DialogHandleFilter</filter-name>
<filter-class>weaver.filter.DialogHandleFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>DialogHandleFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>WStatic</filter-name>
<filter-class>weaver.filter.WStaticFilter</filter-class>
<init-param>
<param-name>max-age</param-name>
<param-value>86400000</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.gif</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.jpg</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.png</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.css</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.js</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.htm</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>WStatic</filter-name>
<url-pattern>*.html</url-pattern>
</filter-mapping>
<filter>
<filter-name>resin-ln</filter-name>
<filter-class>ln.LNFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>resin-ln</filter-name>
<url-pattern>*.*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>InitServer</servlet-name>
<servlet-class>weaver.general.InitServer</servlet-class>
<init-param>
<param-name>serverName</param-name>
<param-value>ecology</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>dwr-invoker</servlet-name>
<servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>
<init-param>
<param-name>crossDomainSessionSecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>allowScriptTagRemoting</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>XFireServlet</servlet-name>
<display-name>XFire Servlet</display-name>
<servlet-class>org.codehaus.xfire.transport.http.XFireConfigurableServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>XFireServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CreateQRCodeServlet</servlet-name>
<servlet-class>weaver.workflow.exceldesign.CreateQRCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CreateQRCodeServlet</servlet-name>
<url-pattern>/workflow/createQRCode</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CreateQRCodeServlet</servlet-name>
<url-pattern>/createQRCode</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ReplyFileDownload</servlet-name>
<servlet-class>weaver.docs.docs.reply.FileDownload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ReplyFileDownload</servlet-name>
<url-pattern>/weaver/weaver.docs.docs.reply.FileDownload</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CreateWfBarCodeServlet</servlet-name>
<servlet-class>weaver.workflow.exceldesign.CreateBarCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CreateWfBarCodeServlet</servlet-name>
<url-pattern>/workflow/createWfBarCode</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>CreateWfBarCodeServlet</servlet-name>
<url-pattern>/createWfBarCode</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SplitPageXmlServlet</servlet-name>
<servlet-class>weaver.common.util.taglib.SplitPageXmlServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>SplitPageXmlServletNew</servlet-name>
<servlet-class>weaver.common.util.taglib.SplitPageXmlServletNew</servlet-class>
</servlet>
<servlet>
<servlet-name>FileDownload</servlet-name>
<servlet-class>weaver.file.FileDownload</servlet-class>
</servlet>
<servlet>
<servlet-name>DownloadDeptLayoutServlet</servlet-name>
<servlet-class>weaver.org.layout.DownloadDeptLayoutServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>DownloadWFLayoutServlet</servlet-name>
<servlet-class>weaver.workflow.layout.DownloadWFLayoutServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>ShowDepLayoutToPicServlet</servlet-name>
<servlet-class>weaver.org.layout.ShowDepLayoutToPicServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>ShowDocsImageServlet</servlet-name>
<servlet-class>weaver.docs.docs.ShowDocsImageServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>ShowImgServlet</servlet-name>
<servlet-class>weaver.album.ShowImgServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>HomePageServlet</servlet-name>
<servlet-class>weaver.homepage.HomepageCreateImage</servlet-class>
</servlet>
<servlet>
<servlet-name>Admin</servlet-name>
<servlet-class>org.logicalcobwebs.proxool.admin.servlet.AdminServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Admin</servlet-name>
<url-pattern>/admin</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>dwr-invoker</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SplitPageXmlServlet</servlet-name>
<url-pattern>/weaver/weaver.common.util.taglib.SplitPageXmlServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SplitPageXmlServletNew</servlet-name>
<url-pattern>/weaver/weaver.common.util.taglib.SplitPageXmlServletNew</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>FileDownload</servlet-name>
<url-pattern>/weaver/weaver.file.FileDownload</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DownloadDeptLayoutServlet</servlet-name>
<url-pattern>/weaver/weaver.org.layout.DownloadDeptLayoutServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>DownloadWFLayoutServlet</servlet-name>
<url-pattern>/weaver/weaver.workflow.layout.DownloadWFLayoutServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ShowDepLayoutToPicServlet</servlet-name>
<url-pattern>/weaver/weaver.org.layout.ShowDepLayoutToPicServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ShowDocsImageServlet</servlet-name>
<url-pattern>/weaver/weaver.docs.docs.ShowDocsImageServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>ShowImgServlet</servlet-name>
<url-pattern>/weaver/weaver.album.ShowImgServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>HomePageServlet</servlet-name>
<url-pattern>/weaver/weaver.homepage.HomepageCreateImage</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>WorkflowXmlParser</servlet-name>
<servlet-class>weaver.workflow.layout.WorkflowXmlParser</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WorkflowXmlParser</servlet-name>
<url-pattern>/weaver/weaver.workflow.layout.WorkflowXmlParser</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>WorkflowDesignOperatoinServlet</servlet-name>
<servlet-class>weaver.workflow.layout.WorkflowDesignOperatoinServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>WorkflowDesignOperatoinServlet</servlet-name>
<url-pattern>/weaver/weaver.workflow.layout.WorkflowDesignOperatoinServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ShowWorkFlow</servlet-name>
<servlet-class>weaver.workflow.workflow.ShowWorkFlow</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowWorkFlow</servlet-name>
<url-pattern>/weaver/weaver.workflow.workflow.ShowWorkFlow</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ExcelOut</servlet-name>
<servlet-class>weaver.file.ExcelOut</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ExcelOut</servlet-name>
<url-pattern>/weaver/weaver.file.ExcelOut</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>MakeValidateCode</servlet-name>
<servlet-class>weaver.file.MakeValidateCode</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MakeValidateCode</servlet-name>
<url-pattern>/weaver/weaver.file.MakeValidateCode</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CreateExcelServer</servlet-name>
<servlet-class>weaver.common.util.taglib.CreateExcelServer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CreateExcelServer</servlet-name>
<url-pattern>/weaver/weaver.common.util.taglib.CreateExcelServer</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SignatureDownLoad</servlet-name>
<servlet-class>weaver.file.SignatureDownLoad</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SignatureDownLoad</servlet-name>
<url-pattern>/weaver/weaver.file.SignatureDownLoad</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ImgFileDownload</servlet-name>
<servlet-class>weaver.file.ImgFileDownload</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ImgFileDownload</servlet-name>
<url-pattern>/weaver/weaver.file.ImgFileDownload</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>xsd</extension>
<mime-type>text/xml</mime-type>
</mime-mapping>
<servlet>
<servlet-name>CloudStoreInit</servlet-name>
<servlet-class>com.cloudstore.api.util.Util_InitSys</servlet-class>
<load-on-startup>3</load-on-startup>
</servlet>
<servlet>
<servlet-name>restservlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.cloudstore;com.api</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>restservlet</servlet-name>
<url-pattern>/api/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>InitFilter</filter-name>
<filter-class>weaver.filter.InitFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>InitFilter</filter-name>
<url-pattern>/wui/index.html</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>RsaInfo</servlet-name>
<servlet-class>weaver.rsa.GetRsaInfo</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RsaInfo</servlet-name>
<url-pattern>/rsa/weaver.rsa.GetRsaInfo</url-pattern>
</servlet-mapping>
<filter>
<filter-name>FileNamingCheckFilter</filter-name>
<filter-class>weaver.file.FileNamingCheckFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>FileNamingCheckFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FileNamingCheckFilter</filter-name>
<url-pattern>/weaver/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>FileNamingCheckFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>AddressAccessFilter</filter-name>
<filter-class>com.engine.edc.web.AddressAccessFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AddressAccessFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>DateFormatFilter</filter-name>
<filter-class>weaver.dateformat.DateFormatFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>DateFormatFilter</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>DateFormatFilter</filter-name>
<url-pattern>/weaver/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>DateFormatFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>WeaComponentFilter</filter-name>
<filter-class>com.weaverboot.frame.ioc.filter.WeaComponentFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>WeaComponentFilter</filter-name>
<url-pattern>/api/*</url-pattern>
</filter-mapping>
<servlet>
<servlet-name>WeaIocInitServlet</servlet-name>
<servlet-class>com.weaverboot.frame.ioc.prop.init.WeaIocInitServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>WeaIocInitServlet</servlet-name>
<url-pattern>/weaIoc/init</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>EcodeInit</servlet-name>
<servlet-class>com.cloudstore.api.util.Util_InitEcode</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>HeartBeat</servlet-name>
<servlet-class>weaver.ofs.heartbeat.HeartBeat</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HeartBeat</servlet-name>
<url-pattern>/HeartBeat</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>RestDispatcherServlet</servlet-name>
<servlet-class>weaver.rest.servlet.RestDispatcherServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RestDispatcherServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FileDownloadForNews</servlet-name>
<servlet-class>weaver.file.FileDownloadForNews</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FileDownloadForNews</servlet-name>
<url-pattern>/weaver/weaver.file.FileDownloadForNews</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>QYSPrivateCallbackServlet</servlet-name>
<display-name>QYSPrivateCallbackServlet</display-name>
<servlet-class>weaver.workflow.qiyuesuo.servlet.QYSPrivateCallbackServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>QYSPrivateCallbackServlet</servlet-name>
<url-pattern>/QYSPrivateCallbackServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>QYSDownloadFileServlet</servlet-name>
<display-name>QYSDownloadFileServlet</display-name>
<servlet-class>weaver.workflow.qiyuesuo.servlet.QYSDownloadFileServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>QYSDownloadFileServlet</servlet-name>
<url-pattern>/weaver/weaver.workflow.qiyuesuo.servlet.QYSDownloadFileServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>QYSInitializeServlet</servlet-name>
<display-name>QYSInitializeServlet</display-name>
<servlet-class>weaver.workflow.qiyuesuo.servlet.QYSInitializeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>QYSInitializeServlet</servlet-name>
<url-pattern>/QYSInitializeServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>VerifyLoginServlet</servlet-name>
<servlet-class>weaver.login.VerifyLoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>VerifyLoginServlet</servlet-name>
<url-pattern>/weaver/weaver.login.VerifyLoginServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ShowColServlet</servlet-name>
<servlet-class>weaver.common.util.taglib.ShowColServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowColServlet</servlet-name>
<url-pattern>/weaver/weaver.common.util.taglib.ShowColServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>InterfaceServlet</servlet-name>
<servlet-class>weaver.admincenter.servlet.InterfaceServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>InterfaceServlet</servlet-name>
<url-pattern>/weaver/weaver.admincenter.servlet.InterfaceServlet</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CreateBarCodeServlet</servlet-name>
<servlet-class>weaver.workflow.exceldesign.CreateBarCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CreateBarCodeServlet</servlet-name>
<url-pattern>/createBarCode</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>CreateCptBarCode</servlet-name>
<servlet-class>weaver.cpt.barcode.BarCodeServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>CreateCptBarCode</servlet-name>
<url-pattern>/CreateCptBarCode</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>MobilemodeApiServlet</servlet-name>
<servlet-class>com.weaver.formmodel.gateway.servlet.MobilemodeApiServlet</servlet-class>
<init-param>
<param-name>apiBasicPath</param-name>
<param-value>/mobilemode/api</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>MobilemodeApiServlet</servlet-name>
<url-pattern>/mobilemode/api/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FileDownloadForEM</servlet-name>
<servlet-class>weaver.file.FileDownloadForEM</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FileDownloadForEM</servlet-name>
<url-pattern>/weaver/weaver.file.FileDownloadForEM</url-pattern>
</servlet-mapping>
<error-page>
<error-code>404</error-code>
<location>/errorpage/404.htm</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/errorpage/500.htm</location>
</error-page>
<error-page>
<error-code>403</error-code>
<location>/errorpage/403.htm</location>
</error-page>
<error-page>
<error-code>503</error-code>
<location>/errorpage/503.htm</location>
</error-page>
<error-page>
<error-code>502</error-code>
<location>/errorpage/502.htm</location>
</error-page>
<servlet>
<servlet-name>FileDownloadForWps</servlet-name>
<servlet-class>weaver.file.other.DownloadForTokenServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FileDownloadForWps</servlet-name>
<url-pattern>/weaver/weaver.file.FileDownloadForWps</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>ExpCardServer</servlet-name>
<servlet-class>weaver.formmode.expcard.servlet.ExpCardServer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ExpCardServer</servlet-name>
<url-pattern>/weaver/weaver.formmode.expcard.servlet.ExpCardServer</url-pattern>
</servlet-mapping>
<mime-mapping>
<extension>xls</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xlsx</extension>
<mime-type>application/octet-stream</mime-type>
</mime-mapping>
<servlet>
<servlet-name>EdcFormViewServlet</servlet-name>
<servlet-class>com.engine.edc.web.EdcFormViewServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>EdcFormViewServlet</servlet-name>
<url-pattern>/edc/formview/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>OfficeServer</servlet-name>
<servlet-class>DBstep.OfficeServer</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>OfficeServer</servlet-name>
<url-pattern>/OfficeServer</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FileDownloadForOutDoc</servlet-name>
<servlet-class>weaver.file.FileDownloadForOutDoc</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FileDownloadForOutDoc</servlet-name>
<url-pattern>/weaver/weaver.file.FileDownloadForOutDoc</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>FileDownloadLocation</servlet-name>
<servlet-class>weaver.email.FileDownloadLocation</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>FileDownloadLocation</servlet-name>
<url-pattern>/weaver/weaver.email.FileDownloadLocation</url-pattern>
</servlet-mapping>
</web-app>

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean class="weaver.schedule.aiyh_calculate_overtime.entity.WorkdayInfo" id="workdayInfo">
<property name="relateWeekday" value="10"/>
<property name="workday" value="false"/>
</bean>
</beans>

View File

@ -2,14 +2,16 @@ package pcn.copy;
import aiyh.utils.Util; import aiyh.utils.Util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.api.aiyh_pcn.multipleCopy.mapper.MultipleCopyMapper; import com.api.aiyh_logincheck.service.DynamicCodeService;
import com.api.aiyh_pcn.multipleCopy.pojo.CopyMultipleMain; import com.api.aiyh_pcn.copy_multiple_file.mapper.MultipleCopyMapper;
import com.api.aiyh_pcn.multipleCopy.services.MultipleCopyService; import com.api.aiyh_pcn.copy_multiple_file.services.MultipleCopyService;
import com.api.aiyh_pcn.multipleCopy.vo.MultipleCopyConfigVO; import com.api.aiyh_pcn.copy_multiple_file.vo.MultipleCopyConfigVO;
import com.cloudstore.dev.api.util.Util_DataCache;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import java.io.IOException;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -51,5 +53,36 @@ public class TestCopy {
System.out.println(join); System.out.println(join);
} }
@Test
public void testLog() throws InterruptedException, IOException {
System.out.println(Util_DataCache.getObjValWithRedis("name"));
Util_DataCache.setObjValWithRedis("loginId","aiyh",2);
Object loginId = Util_DataCache.getObjValWithRedis("loginId");
System.out.println(loginId);
Util_DataCache.setObjVal("name","zhangshan",2);
Object name = Util_DataCache.getObjVal("name");
System.out.println(name);
Thread.sleep(1000*5);
name = Util_DataCache.getObjVal("aiyh");
System.out.println("获取名字" + name);
}
@Test
public void test2(){
String code = "aldfiu${code}".replaceAll("\\$\\{\\s*code\\s*}", "code");
System.out.println(code);
}
@Test
public void test3(){
DynamicCodeService dynamicCodeService = new DynamicCodeService();
boolean aiyh = dynamicCodeService.getCode("aiyh");
System.out.println(aiyh);
}
} }

View File

@ -0,0 +1,39 @@
package unknow;
import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import weaver.schedule.aiyh_calculate_overtime.entity.WorkdayInfo;
import weaver.schedule.aiyh_calculate_overtime.service.CalculateOvertimeService;
/**
* create 2022/1/18 0018 23:59
*
* @author EBU7-dev1-ayh
*/
public class CalculateOvertimeTest {
@Before
public void before() {
weaver.general.GCONST.setServerName("ecology");
weaver.general.GCONST.setRootPath("H:\\ecology-9-dev\\src\\main\\resources\\");
}
@Test
public void test(){
CalculateOvertimeService calculateOvertimeService = new CalculateOvertimeService();
WorkdayInfo workdayInfo = calculateOvertimeService.checkWorkday();
System.out.println(workdayInfo);
}
@Test
public void test1(){
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("application.xml");
WorkdayInfo workdayInfo = (WorkdayInfo) applicationContext.getBean("workdayInfo");
System.out.println(workdayInfo);
}
}

View File

@ -1,20 +1,32 @@
package utilTest; package utilTest;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.apirequest.entity.ParamConfigInfo;
import aiyh.utils.apirequest.pojo.ApiRequestMain;
import aiyh.utils.entity.ApiConfigMainDTO; import aiyh.utils.entity.ApiConfigMainDTO;
import aiyh.utils.httpUtil.ResponeVo; import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils; import aiyh.utils.httpUtil.util.HttpUtils;
import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.api.aiyh_guijiu.vo.PicPsVO;
import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService; import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService;
import com.drew.imaging.ImageMetadataReader;
import com.drew.imaging.ImageProcessingException;
import com.drew.metadata.Directory;
import com.drew.metadata.Metadata;
import com.drew.metadata.Tag;
import com.engine.doc.cmd.secCategoryList.DocSecCategoryAddCmd;
import entity.ImageInfo; import entity.ImageInfo;
import mybatisTest.mapper.IMapperTest; import mybatisTest.mapper.IMapperTest;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import utilTest.entity.TestTreeEntity;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.hrm.User;
import weaver.hrm.moduledetach.ManageDetachComInfo;
import java.io.IOException; import java.io.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -48,6 +60,31 @@ public class UtilTest {
} }
} }
// @Test
public static void main(String[] args) {
final int[] n = {5};
Object o = new Object();
Thread thread = new Thread(() -> {
System.out.println("啊法法大大方");
synchronized (o) {
while (n[0] >= 0) {
System.out.println("妈的");
n[0]--;
try {
o.wait(1000*2);
System.out.println("测试!");
// Thread.sleep(1000 * 2);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
});
thread.start();
System.out.println("main线程结束");
}
@Before @Before
public void before() { public void before() {
weaver.general.GCONST.setServerName("ecology"); weaver.general.GCONST.setServerName("ecology");
@ -177,7 +214,6 @@ public class UtilTest {
} }
} }
@Test @Test
public void builderSelect() { public void builderSelect() {
// 将以下数据插入到数据库中,比如 inset into name ,email values('update_name','update_email') // 将以下数据插入到数据库中,比如 inset into name ,email values('update_name','update_email')
@ -216,7 +252,6 @@ public class UtilTest {
System.out.println(imageInfos); System.out.println(imageInfos);
} }
@Test @Test
public void testSqlUtil() { public void testSqlUtil() {
// 获取代理对象 // 获取代理对象
@ -226,7 +261,6 @@ public class UtilTest {
System.out.println(result); System.out.println(result);
} }
@Test @Test
public void testRequest() { public void testRequest() {
// 构建工具实体 // 构建工具实体
@ -258,7 +292,6 @@ public class UtilTest {
} }
@Test @Test
public void testTerr() { public void testTerr() {
FaDDContractService faDDContractService = new FaDDContractService(); FaDDContractService faDDContractService = new FaDDContractService();
@ -272,12 +305,196 @@ public class UtilTest {
System.out.println(JSON.toJSONString(maps)); System.out.println(JSON.toJSONString(maps));
} }
@Test @Test
public void te(){ public void te() {
String test = ",7629,7632,"; String test = ",7629,7632,";
System.out.println(test.contains(",7632,")); System.out.println(test.contains(",7632,"));
} }
@Test
public void testPs() throws FileNotFoundException {
PicPsVO picPsVO = PicPsVO.PicPsVOBuilder.aPicPsVO()
.docId(1)
.fileId(1)
.fileName("name")
.build();
// 通过物理文件的id进行获取对应的输入流信息。
// ImageFileManager imageFileManager = new ImageFileManager();
// 通过文件id获取输入流
InputStream inputStreamById = new FileInputStream("C:\\Users\\77449\\Desktop\\test.jpg");
try {
// 获取媒体数据
Metadata metadata = ImageMetadataReader.readMetadata(inputStreamById);
// 遍历Directory对象每个对象里面包含标签
for (Directory directory : metadata.getDirectories()) {
String directoryName = directory.getName();
System.out.println(directory);
if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName)
|| directoryName.contains("Adobe")) {
if (picPsVO.getScore() > 90) {
continue;
}
picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核");
picPsVO.setScore(90);
}
String model = "";
for (Tag tag : directory.getTags()) {
System.out.println(tag);
if (tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())) {
picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核");
picPsVO.setScore(70);
if (picPsVO.getScore() > 70) {
continue;
}
}
if ("Software".equalsIgnoreCase(tag.getTagName())) {
if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())
|| tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) {
picPsVO.setDescribe("图片经过Adobe Photoshop软件注意审核");
picPsVO.setScore(100);
} else {
if (picPsVO.getScore() > 70) {
continue;
}
picPsVO.setDescribe("图片经过" + tag.getDescription() + "软件,注意审核!");
picPsVO.setScore(70);
}
if (!org.h2.util.StringUtils.isNullOrEmpty(model) && picPsVO.getDescribe().contains(model)) {
picPsVO.setDescribe("");
picPsVO.setScore(-1);
}
}
if ("Model".equalsIgnoreCase(tag.getTagName())) {
model = tag.getDescription();
if (!org.h2.util.StringUtils.isNullOrEmpty(picPsVO.getDescribe())) {
if (picPsVO.getDescribe().contains(tag.getDescription())) {
picPsVO.setDescribe("");
picPsVO.setScore(-1);
}
}
}
if ("User Comment".equalsIgnoreCase(tag.getTagName())) {
try {
if (picPsVO.getScore() > 80) {
continue;
}
com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription());
picPsVO.setDescribe("图片经过手机端图片处理软件,软件未知!请注意审核!");
picPsVO.setScore(80);
} catch (Exception e) {
if (picPsVO.getScore() > 40) {
continue;
}
picPsVO.setDescribe("图片可能经过未知软件!请注意审核!");
picPsVO.setScore(40);
}
}
}
}
} catch (ImageProcessingException | IOException e) {
e.printStackTrace();
}
System.out.println(picPsVO);
}
@Test
public void testList2Tree() {
List<TestTreeEntity> list = new ArrayList<>();
list.add(new TestTreeEntity("0", "根节点1", null));
list.add(new TestTreeEntity("1", "根节点2", null));
list.add(new TestTreeEntity("2", "根节点3", null));
list.add(new TestTreeEntity("3", "子结点1.1", "0"));
list.add(new TestTreeEntity("4", "子结点5.1", "9"));
list.add(new TestTreeEntity("5", "子结点1.3", "0"));
list.add(new TestTreeEntity("6", "子结点1.2", "0"));
list.add(new TestTreeEntity("7", "子结点1.2.1", "6"));
list.add(new TestTreeEntity("8", "子结点2.1", "1"));
list.add(new TestTreeEntity("9", "根节点5", null));
list.add(new TestTreeEntity("10", "子结点3.1", "2"));
// List<TestTreeEntity> treeList = Util.listToTree(list, TestTreeEntity::getParamName, TestTreeEntity::getParentName, (parent, child) -> {
// Optional.ofNullable(parent.getChildList()).map(v -> {
// v.add(child);
// return list;
// }).orElseGet(()->{
// List<TestTreeEntity> childList = new ArrayList<>();
// childList.add(child);
// parent.setChildList(childList);
// return null;
// });
// }, parentName -> parentName == null || "".equals(parentName));
// System.out.println(JSON.toJSONString(treeList));
System.out.println("===================================");
List<TestTreeEntity> list1 = Util.listToTree(list, TestTreeEntity::getParamName,
TestTreeEntity::getParentName,
TestTreeEntity::getChildList, TestTreeEntity::setChildList,
parentName -> parentName == null || "".equals(parentName));
System.out.println(JSON.toJSONString(list1));
}
@Test
public void test3() {
User user = new User(1);
System.out.println(user.getUserSubCompany1());
System.out.println(user.getUsername());
Map<String, Object> createMap = new HashMap<>(4);
createMap.put("parentid", "89");
createMap.put("categoryname", "使用代码测试创建测试缓存123");
createMap.put("subcompanyid", String.valueOf(user.getUserSubCompany1()));
createMap.put("extendParentAttr", "1");
DocSecCategoryAddCmd docSecCategoryAddcCmd = new DocSecCategoryAddCmd(createMap, user);
Map execute = docSecCategoryAddcCmd.execute(null);
ManageDetachComInfo manageDetachComInfo = new ManageDetachComInfo();
manageDetachComInfo.removeManageDetachCache();
System.out.println(execute);
}
@Test
public void scanFiles() {
ArrayList<String> objects = scanFilesWithRecursion("F:\\fanwei");
System.out.println(JSON.toJSONString(objects));
}
public ArrayList<String> scanFilesWithRecursion(String folderPath) {
ArrayList<String> scanFiles = new ArrayList<>();
File directory = new File(folderPath);
if (!directory.isDirectory()) {
throw new RuntimeException("输入的路径不是一个文件夹! input path is not a folder!");
}
if (directory.isDirectory()) {
File[] filelist = directory.listFiles();
Optional.ofNullable(filelist).map(v -> {
for (File file : filelist) {
/*如果当前是文件夹,进入递归扫描文件夹*/
if (file.isDirectory()) {
continue;
}
/*非文件夹*/
else {
System.out.println(file.getName());
scanFiles.add(file.getAbsolutePath());
}
}
return v;
});
}
return scanFiles;
}
@Test
public void testCopy(){
ApiRequestMain apiRequestMain = new ApiRequestMain();
apiRequestMain.setApiDesc("api描述");
apiRequestMain.setApiType(2);
apiRequestMain.setApiUrl("http://www.baidu.com");
apiRequestMain.setDataSource(2);
apiRequestMain.setModelTableName("modelTable");
apiRequestMain.setId(20);
apiRequestMain.setParamRequestType(2);
apiRequestMain.setOnlyMark("onlyMark");
ParamConfigInfo paramConfigInfo = new ParamConfigInfo();
paramConfigInfo = Util.copyBeanBaseField(apiRequestMain, paramConfigInfo);
System.out.println(paramConfigInfo);
}
} }

View File

@ -0,0 +1,30 @@
package utilTest.entity;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* <p></p>
* <p>create 2022/1/22 0022 18:49</p>
*
* @author EBU7-dev1-ayh
*/
@Data
public class TestTreeEntity {
private String paramName;
private String desc;
private String parentName;
private List<TestTreeEntity> childList;
public TestTreeEntity(String paramName, String desc, String parentName) {
this.paramName = paramName;
this.desc = desc;
this.parentName = parentName;
}
}