ic_excellent 2023-04-20 14:18:43 +08:00
commit 0e77a487d8
145 changed files with 8577 additions and 699 deletions

5
.gitignore vendored
View File

@ -36,6 +36,7 @@ DirectoryV2.xml
/lib/classbeanLib/ecology-dev-lib.jar /lib/classbeanLib/ecology-dev-lib.jar
/lib/classbeanLib/web-inf-class-lib.jar /lib/classbeanLib/web-inf-class-lib.jar
/lib/weaverLib/ /lib/weaverLib/
/lib/jitulib/
*.groovy *.groovy
*.log *.log
*.iml *.iml
@ -46,5 +47,5 @@ src/test/resources/font
src/main/resources/WEB-INF/vm/outFile src/main/resources/WEB-INF/vm/outFile
target/ target/
*.back *.back
src/main/old_src/ src/main/aiyh_old_src/
src/main/jitu_src/

View File

@ -22,6 +22,7 @@ const detail2TempDateField = WfForm.convertFieldNameToId("dyrq", detailTable);
// 需要计算的款项类型集合 // 需要计算的款项类型集合
const computeDatePayType = ['0']; const computeDatePayType = ['0'];
const DETAIL_MAX_SIZE = 5; const DETAIL_MAX_SIZE = 5;
const readOnlyArr = ['0'];
// 款项类型预计对应日期取值 // 款项类型预计对应日期取值
const paymentTypeGetValue = { const paymentTypeGetValue = {
0: (index)=>{ 0: (index)=>{
@ -36,7 +37,8 @@ jQuery().ready(function(){
'detailComPayDateId': detail2ComPayDateId, 'detailComPayDateId': detail2ComPayDateId,
'dayId': detail2DayId, 'dayId': detail2DayId,
'computeDatePayType': computeDatePayType, 'computeDatePayType': computeDatePayType,
'paymentTypeGetValue': paymentTypeGetValue 'paymentTypeGetValue': paymentTypeGetValue,
'readOnlyArr': readOnlyArr
} }
let rowArr = WfForm.getDetailAllRowIndexStr(detailTable).split(","); let rowArr = WfForm.getDetailAllRowIndexStr(detailTable).split(",");
@ -49,7 +51,7 @@ jQuery().ready(function(){
addRowBack(2, configObj); addRowBack(2, configObj);
changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, computeDatePayType) changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, readOnlyArr)
// 主表字段发生变化 // 主表字段发生变化
mainFieldChangeDetailCom(contractSignDateId, detailTable, configObj); mainFieldChangeDetailCom(contractSignDateId, detailTable, configObj);

View File

@ -60,6 +60,7 @@ function submitCallback(detailTable, detail2PayProportionId){
sum += parseFloat(WfForm.getFieldValue(field));//遍历明细行字段 sum += parseFloat(WfForm.getFieldValue(field));//遍历明细行字段
} }
} }
console.log('sum => ', sum)
sum === 100.00 ? callback() : WfForm.showMessage("明细付款比例总和不等于100,请修改后提交!"); sum === 100.00 ? callback() : WfForm.showMessage("明细付款比例总和不等于100,请修改后提交!");
}); });
} }
@ -118,11 +119,18 @@ function changeDetailPayDate(obj){
let computeDatePayType = obj['computeDatePayType']; let computeDatePayType = obj['computeDatePayType'];
// 获取主表的字符值转换函数 // 获取主表的字符值转换函数
let paymentTypeGetValue = obj['paymentTypeGetValue']; let paymentTypeGetValue = obj['paymentTypeGetValue'];
// 只读
let readOnlyArr = obj['readOnlyArr'];
// 款项类型 // 款项类型
let paymentType = WfForm.getFieldValue(`${detailPaymentTypeId}_${index}`); let paymentType = WfForm.getFieldValue(`${detailPaymentTypeId}_${index}`);
if(readOnlyArr.includes(paymentType)){
WfForm.changeFieldAttr(`${detailComPayDateId}_${index}`, READ_ONLY);
}else{
// 如果款项类型不需要计算就把预计付款日期属性改成可编辑
WfForm.changeFieldAttr(`${detailComPayDateId}_${index}`, EDIT);
}
// 先进行赋值 // 先进行赋值
if(computeDatePayType.includes(paymentType)){ if(computeDatePayType.includes(paymentType)){
WfForm.changeFieldAttr(`${detailComPayDateId}_${index}`, READ_ONLY);
// 存在字段联动延时处理 // 存在字段联动延时处理
setTimeout(()=>{ setTimeout(()=>{
if(paymentTypeGetValue){ if(paymentTypeGetValue){
@ -142,16 +150,14 @@ function changeDetailPayDate(obj){
value: comDate value: comDate
}); });
} }
}else {
// 如果对应日期为空就给预计付款赋空值
WfForm.changeFieldValue(`${detailComPayDateId}_${index}`,{
value: ''
});
} }
// else {
// // 如果对应日期为空就给预计付款赋空值
// WfForm.changeFieldValue(`${detailComPayDateId}_${index}`,{
// value: ''
// });
// }
},100); },100);
}else{
// 如果款项类型不需要计算就把预计付款日期属性改成可编辑
WfForm.changeFieldAttr(`${detailComPayDateId}_${index}`, EDIT);
} }
} }

View File

@ -0,0 +1,26 @@
const zrckField = WfForm.convertFieldNameToId('zrck');
const zcckField = WfForm.convertFieldNameToId('zcck');
// 主表存货编码
const mainStockSetField = WfForm.convertFieldNameToId('chbmjh');
// 明细1存货编码字段
const deail1StockSetField = WfForm.convertFieldNameToId('chbm','detail_1');
jQuery(document).ready(function(){
WfForm.triggerFieldAllLinkage(zrckField);
WfForm.triggerFieldAllLinkage(zcckField);
initStockNo();
});
function initStockNo(){
var rowArr = WfForm.getDetailAllRowIndexStr("detail_1").split(",");
let arr = [];
for(var i=0; i<rowArr.length; i++){
var rowIndex = rowArr[i];
if(rowIndex !== ""){
let val = WfForm.getFieldValue(`${deail1StockSetField}_${rowIndex}`);
arr.push(val);
}
}
WfForm.changeFieldValue(mainStockSetField, {value:arr.join(',')});
setTimeout(()=>{
WfForm.triggerFieldAllLinkage(mainStockSetField);
},500);
}

View File

@ -6,21 +6,87 @@ const bl = WfForm.convertFieldNameToId('bcfkbl');
const detail3Yqfkrq = WfForm.convertFieldNameToId('yqfkrq', "detail_3"); const detail3Yqfkrq = WfForm.convertFieldNameToId('yqfkrq', "detail_3");
// 明细本次付款比例 // 明细本次付款比例
const detailBl = WfForm.convertFieldNameToId('bcfkbl', "detail_3"); const detailBl = WfForm.convertFieldNameToId('bcfkbl', "detail_3");
// 关联订单
const relationOrder = WfForm.convertFieldNameToId("gldd");
// 明细4施工合同字段
const detail4SgField = WfForm.convertFieldNameToId("sght", "detail_4");
// 明细4采购合同字段
const detail4CgField = WfForm.convertFieldNameToId("cght", "detail_4");
// 明细4发票字段
const detail4FpField = WfForm.convertFieldNameToId("fpje", "detail_4");
// 明细4合同发票金额和
let detail4Map = new Map();
// 明细3施工合同字段
const detail3SgField = WfForm.convertFieldNameToId("sght", "detail_3");
// 明细3采购合同字段
const detail3CgField = WfForm.convertFieldNameToId("cght", "detail_3");
// 明细3 含税金额
const detail3TaxField = WfForm.convertFieldNameToId("ddhsje", "detail_3");
// 明细3以收票金额
const detail3YspField = WfForm.convertFieldNameToId("yspje", "detail_3");
WfForm.registerCheckEvent(WfForm.OPER_ADDROW + "3", function (callback) { WfForm.registerCheckEvent(WfForm.OPER_ADDROW + "3", function (callback) {
callback(); callback();
setTimeout(() => {
initDeatail3Date(); initDeatail3Date();
}, 5)
}); });
// 关联订单变化时将明细四的合同-金额map进行初始化
WfForm.bindFieldChangeEvent(relationOrder, function (obj, id, value) {
setTimeout(() => {
initDetail4Map();
changeDetail3SpMoney();
}, 2000);
});
WfForm.bindFieldChangeEvent(`${yjfksj},${bl}`, function (obj, id, value) { WfForm.bindFieldChangeEvent(`${yjfksj},${bl}`, function (obj, id, value) {
initDeatail3Date(); initDeatail3Date();
}); });
// 计算明细三开票金额
function changeDetail3SpMoney() {
let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(",");
for (let i = 0; i < detail3RowArr.length; i++) {
let rowIndex = detail3RowArr[i];
if (rowIndex !== "") {
let detail3SgFieldVal = WfForm.getFieldValue(`${detail3SgField}_${rowIndex}`);
let detail3CgFieldVal = WfForm.getFieldValue(`${detail3CgField}_${rowIndex}`);
let fpje = detail4Map.get(detail3SgFieldVal) ?? detail4Map.get(detail3CgFieldVal);
let mapVal = detail4Map.get(detail3SgFieldVal);
let key = detail3SgFieldVal;
if (!mapVal) {
key = detail3CgFieldVal;
}
console.log('key ', key);
if (fpje) {
console.log('fpje => ', fpje);
// 0.1 0.3
let detail3TaxVal = WfForm.getFieldValue(`${detail3TaxField}_${rowIndex}`);
console.log('detail3TaxVal => ', detail3TaxVal);
let tempJe = fpje - detail3TaxVal;
console.log('tempJe => ', tempJe);
if (fpje > detail3TaxVal) {
WfForm.changeFieldValue(`${detail3YspField}_${rowIndex}`, {value: detail3TaxVal});
} else if (tempJe <= 0 && fpje == 0) {
WfForm.changeFieldValue(`${detail3YspField}_${rowIndex}`, {value: 0});
} else if (tempJe < 0) {
WfForm.changeFieldValue(`${detail3YspField}_${rowIndex}`, {value: fpje});
tempJe = 0;
}
detail4Map.set(key, tempJe);
console.log('detail4Map ', detail4Map)
} else {
WfForm.changeFieldValue(`${detail3YspField}_${rowIndex}`, {value: 0});
}
}
}
}
function initDeatail3Date() { function initDeatail3Date() {
let dateVal = WfForm.getFieldValue(yjfksj); let dateVal = WfForm.getFieldValue(yjfksj);
let blVal = WfForm.getFieldValue(bl); let blVal = WfForm.getFieldValue(bl);
console.log('dateVal ', dateVal);
console.log('blVal ', blVal);
let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(","); let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(",");
for (let i = 0; i < detail3RowArr.length; i++) { for (let i = 0; i < detail3RowArr.length; i++) {
let rowIndex = detail3RowArr[i]; let rowIndex = detail3RowArr[i];
@ -30,3 +96,64 @@ function initDeatail3Date(){
} }
} }
} }
function initDetail4Map() {
let detail4RowArr = WfForm.getDetailAllRowIndexStr('detail_4').split(",");
console.log('detail4RowArr ', detail4RowArr);
for (let i = 0; i < detail4RowArr.length; i++) {
let rowIndex = detail4RowArr[i];
if (rowIndex !== "") {
let detail4SgFieldVal = WfForm.getFieldValue(`${detail4SgField}_${rowIndex}`);
let detail4CgFieldVal = WfForm.getFieldValue(`${detail4CgField}_${rowIndex}`);
let detail4FpFieldVal = WfForm.getFieldValue(`${detail4FpField}_${rowIndex}`);
let key = -1;
console.log('detail4SgFieldVal ', detail4SgFieldVal);
console.log('detail4CgFieldVal ', detail4CgFieldVal);
console.log('detail4FpFieldVal ', detail4FpFieldVal);
if (!detail4FpFieldVal) {
continue;
}
key = detail4CgFieldVal ?? detail4SgFieldVal;
console.log('key ', key);
let tempVal = parseFloat(detail4Map.get(key) ?? 0);
tempVal += parseFloat(detail4FpFieldVal);
detail4Map.set(key, tempVal);
}
}
console.log('detail4Map ', detail4Map)
}
const detail3ApplyMoneyField = WfForm.convertFieldNameToId("bcfkje", "detail_3");
const detail3CgId = WfForm.convertFieldNameToId("cgddzbid", "detail_3");
const detail3Bl = WfForm.convertFieldNameToId('bcfkbl', "detail_3");
let detailBlMap = new Map();
const detail1Bl = WfForm.convertFieldNameToId('fkbl', "detail_1");
const detail1CgId = WfForm.convertFieldNameToId("cgddzbid", "detail_1");
WfForm.bindDetailFieldChangeEvent(detail3ApplyMoneyField, (id, rowIndex, value) => {
let detail3RowArr = WfForm.getDetailAllRowIndexStr('detail_3').split(",");
detailBlMap = new Map();
for (let i = 0; i < detail3RowArr.length; i++) {
let rowIndex = detail3RowArr[i];
if (rowIndex !== "") {
let bl = parseFloat(WfForm.getFieldValue(`${detail3Bl}_${rowIndex}`));
let cg = WfForm.getFieldValue(`${detail3CgId}_${rowIndex}`);
let mapVal = parseFloat(detailBlMap.get(cg) ?? 0) + bl;
detailBlMap.set(cg, mapVal);
}
}
console.log('detailBlMap ', detailBlMap)
let detail1RowArr = WfForm.getDetailAllRowIndexStr('detail_1').split(",");
for (let i = 0; i < detail1RowArr.length; i++) {
let rowIndex = detail1RowArr[i];
if (rowIndex !== "") {
let cg = WfForm.getFieldValue(`${detail1CgId}_${rowIndex}`);
let val = detailBlMap.get(cg) === '' ? 0 : detailBlMap.get(cg);
WfForm.changeFieldValue(`${detail1Bl}_${rowIndex}`, {value: val})
}
}
});

View File

@ -23,6 +23,7 @@ const detailComPayDateId = WfForm.convertFieldNameToId("yjfkrq",detailTable);
// 对应日期 // 对应日期
const detailTempDateField = WfForm.convertFieldNameToId("dyrq", detailTable); const detailTempDateField = WfForm.convertFieldNameToId("dyrq", detailTable);
// 需要计算的款项类型集合 // 需要计算的款项类型集合
const readOnlyArr = ['0'];
const computeDatePayType = ['0','2','4']; const computeDatePayType = ['0','2','4'];
// 款项类型预计对应日期取值 // 款项类型预计对应日期取值
const paymentTypeGetValue = { const paymentTypeGetValue = {
@ -49,12 +50,13 @@ function init(){
'detailComPayDateId': detailComPayDateId, 'detailComPayDateId': detailComPayDateId,
'dayId': detailDayId, 'dayId': detailDayId,
'computeDatePayType': computeDatePayType, 'computeDatePayType': computeDatePayType,
'paymentTypeGetValue': paymentTypeGetValue 'paymentTypeGetValue': paymentTypeGetValue,
'readOnlyArr': readOnlyArr
} }
addRowBack(3, obj); addRowBack(3, obj);
changeDetailFieldReadOnly(detailTable, detailComPayDateId, detailPaymentTypeId, computeDatePayType) changeDetailFieldReadOnly(detailTable, detailComPayDateId, detailPaymentTypeId, readOnlyArr)
// 主表字段发生变化 // 主表字段发生变化
mainFieldChangeDetailCom(`${mainProjectId},${contractSignDateId}`, detailTable, obj); mainFieldChangeDetailCom(`${mainProjectId},${contractSignDateId}`, detailTable, obj);
// 明细的款项类型字段变化绑定 // 明细的款项类型字段变化绑定

View File

@ -11,7 +11,7 @@ const mainWorkFlowEndId = WfForm.convertFieldNameToId("fhdgdrq");
// 主表实际验收 // 主表实际验收
const mainActualCheckId = WfForm.convertFieldNameToId("sjysrq"); const mainActualCheckId = WfForm.convertFieldNameToId("sjysrq");
// 明细2付款比例字段 // 明细2付款比例字段
const detail2PayProportionId = WfForm.convertFieldNameToId("fkbl",detailTable); const detail2PayProportionId = WfForm.convertFieldNameToId("skbl",detailTable);
// 明细2款项类型 // 明细2款项类型
const detail2PaymentTypeId = WfForm.convertFieldNameToId("kxlx",detailTable); const detail2PaymentTypeId = WfForm.convertFieldNameToId("kxlx",detailTable);
// 明细2前后字段 // 明细2前后字段
@ -24,6 +24,8 @@ const detail2ComPayDateId = WfForm.convertFieldNameToId("yjfkrq",detailTable);
const detail2TempDateField = WfForm.convertFieldNameToId("dyrq", detailTable); const detail2TempDateField = WfForm.convertFieldNameToId("dyrq", detailTable);
// 需要计算的款项类型集合 // 需要计算的款项类型集合
const computeDatePayType = ['2', '4', '5']; const computeDatePayType = ['2', '4', '5'];
// 只读 明细款项类型
const readOnlyArr = [];
// 款项类型预计对应日期取值 // 款项类型预计对应日期取值
const paymentTypeGetValue = { const paymentTypeGetValue = {
2: (index)=>{ 2: (index)=>{
@ -50,10 +52,11 @@ function init(){
'detailComPayDateId': detail2ComPayDateId, 'detailComPayDateId': detail2ComPayDateId,
'dayId': detail2DayId, 'dayId': detail2DayId,
'computeDatePayType': computeDatePayType, 'computeDatePayType': computeDatePayType,
'paymentTypeGetValue': paymentTypeGetValue 'paymentTypeGetValue': paymentTypeGetValue,
'readOnlyArr': readOnlyArr
} }
addRowBack(2, obj); addRowBack(2, obj);
changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, computeDatePayType) changeDetailFieldReadOnly(detailTable, detail2ComPayDateId, detail2PaymentTypeId, readOnlyArr);
// 主表字段发生变化 // 主表字段发生变化
mainFieldChangeDetailCom(mainProjectId, detailTable, obj); mainFieldChangeDetailCom(mainProjectId, detailTable, obj);
// 明细的款项类型字段变化绑定 // 明细的款项类型字段变化绑定

View File

@ -0,0 +1,45 @@
const enable = 0;
// 班级浏览按钮表单字段id
const classFieldId = WfForm.convertFieldNameToId("bjmc");
// 明细1学员id
const detail1StuId = WfForm.convertFieldNameToId("studentId","detail_1");;
// 明细1学员编号
const detail1StuNo = WfForm.convertFieldNameToId("studentNo","detail_1");;
// 明细1学员姓名
const detail1StuName = WfForm.convertFieldNameToId("studentName","detail_1");;
// 明细1班级id
const detail1ClassId = WfForm.convertFieldNameToId("classId","detail_1");
// 主表学员汇总字段
const stuAllField = WfForm.convertFieldNameToId("mxxybhhzfz");
WfForm.bindFieldChangeEvent(classFieldId, function(obj,id,value){
let classId = WfForm.getBrowserShowName(classFieldId);
WfForm.delDetailRow("detail_1", "all");
$.get('/api/wxr/students/getStudentsByClassId',{id:classId},(res)=>{
let obj = JSON.parse(res);
if(obj.code != 200){
WfForm.showMessage(obj.msg);
return;
}
console.log('obj ', obj);
let objData = obj.data;
let responseObj = JSON.parse(objData);
if(!responseObj || !responseObj.data){
WfForm.showMessage(responseObj.msg);
return;
}
objData = responseObj.data;
WfForm.changeFieldValue(stuAllField, {value: ''});
let stuArr = [];
objData.forEach((item)=>{
let detailObj = {};
detailObj[detail1StuId] = { value: item.id };
detailObj[detail1StuNo] = { value: item.studentNo };
detailObj[detail1StuName] = { value: item.studentName };
detailObj[detail1ClassId] = { value: item.classId };
// console.log('detailObj ', detailObj)
WfForm.addDetailRow("detail_1",detailObj);
stuArr.push(item.studentNo);
})
WfForm.changeFieldValue(stuAllField, {value: stuArr.join(',')});
})
});

View File

@ -0,0 +1,114 @@
/* ******************* 德尔格 明细物料历史数据折扣带出提示 by youhong.ai ******************* */
$(() => {
let type = {
// 等于
equalTo: (value, target) => value == target,
// 不等于
notEqual: (value, target) => value != target,
// 大于
greaterThan: (value, target) => +value > +target,
// 小于
lessThan: (value, target) => +value < +target
}
// 值类型
let valueType = {
// 固定值
fixValue: 0,
// 流程字段
field: 1
}
let config = {
// 主表填main
table: 'main',
// 明细表明细1为detail_1,明细2为detail_2
detail: 'detail_1',
redField: 'zk',
// 条件集合
conditions: [{
// 所属表
table: 'detail_1',
// 字段
field: 'wllx',
// 对比值
value: 0,
// 值的类型
valueType: valueType.fixValue,
// 值字段所在表
valueTable: '',
// 条件类型
type: type.equalTo
}, {
// 所属表
table: 'detail_1',
// 字段
field: 'zkdc',
// 对比值
value: 'zk',
// 值的类型
valueType: valueType.field,
// 值字段所在表
valueTable: 'detail_1',
// 条件类型
type: type.notEqual
}]
}
runJs()
function runJs() {
let detailAllRowIndexStr = WfForm.getDetailAllRowIndexStr(config.detail);
let rowIndexArr = detailAllRowIndexStr.split(",");
let flag = true
rowIndexArr.forEach(rowIndex => {
if (flag) {
flag = isTrue(rowIndex)
} else {
isTrue(rowIndex)
}
})
if (!flag) {
WfForm.showConfirm("当前订单折扣不等于默认折扣");
}
}
function isTrue(rowIndex) {
let flag = true
for (let i = 0; i < config.conditions.length; i++) {
let item = config.conditions[i]
let fieldId = WfForm.convertFieldNameToId(config, item.table)
let fieldMark = `${fieldId}_${rowIndex}`
let fieldValue = WfForm.getFieldValue(fieldMark)
if (item.valueType == valueType.fixValue) {
if (item.type(fieldValue, item.value)) {
continue
}
renderRed(`${WfForm.convertFieldNameToId(config.redField, config.detail)}_${rowIndex}`)
flag = false
}
if (item.valueType == valueType.field) {
if (item.type(fieldValue, WfForm.getFieldValue(item.value, item.valueTable))) {
continue
}
renderRed(`${WfForm.convertFieldNameToId(config.redField, config.detail)}_${rowIndex}`)
flag = false
}
}
return flag
}
function renderRed(fieldMark) {
$(`#oTable0 .detail_odd_row.detail_data_row div[data-fieldmark='${fieldMark}'] .wf-form-input`).css({
color: '#FFF',
background: 'red',
})
$(`#oTable0 .detail_odd_row.detail_data_row div[data-fieldmark='${fieldMark}'] .wf-form-input input`).css({
'border-color': 'red',
background: 'red',
color: '#FFF'
})
}
})
/* ******************* 德尔格 明细物料历史数据折扣带出提示 end ******************* */

View File

@ -0,0 +1,75 @@
/* ******************* 按钮变灰 ******************* */
$(() => {
const disabledRightButton = function (...indexIds) {
indexIds.forEach(index => {
let buttons = $(".ant-menu-item.text-elli[ecid='_Route@9uoqid_Com@knmejd_WeaRightMenu@spqptt_Item@eu37n0_li@zyccqn']")
let nodeArr = []
for (let i = 0; i < buttons.length; i++) {
let item = buttons[i]
nodeArr.push(findReact(item))
}
let disableArr = []
for (let i = 0; i < nodeArr.length; i++) {
let node = nodeArr[i]
if (index === i) {
node.props.disabled = true
node.setState({})
disableArr.push(node)
}
}
for (let i = 0; i < nodeArr.length; i++) {
let node = nodeArr[i]
let onMouseOver = node.onMouseOver
let onMouseLeave = node.onMouseLeave
node.onMouseOver = (...args) => {
disableArr.forEach(item => {
item.props.disabled = true
item.setState({})
})
onMouseOver(...args)
}
node.onMouseLeave = (...args) => {
disableArr.forEach(item => {
item.props.disabled = true
item.setState({})
})
onMouseLeave(...args)
}
}
})
}
const findReact = function (dom, traverseUp = 0) {
const key = Object.keys(dom).find(key => {
return key.startsWith("__reactFiber$") // react 17+
|| key.startsWith("__reactInternalInstance$")
|| key.startsWith("__reactEventHandlers$"); // react <17
});
const domFiber = dom[key];
if (domFiber == null) return null;
// react <16
if (domFiber._currentElement) {
let compFiber = domFiber._currentElement._owner;
for (let i = 0; i < traverseUp; i++) {
compFiber = compFiber._currentElement._owner;
}
return compFiber._instance;
}
// react 16+
const GetCompFiber = fiber => {
let parentFiber = fiber.return;
while (typeof parentFiber.type == "string") {
parentFiber = parentFiber.return;
}
return parentFiber;
};
let compFiber = GetCompFiber(domFiber);
for (let i = 0; i < traverseUp; i++) {
compFiber = GetCompFiber(compFiber);
}
return compFiber.stateNode;
}
window.disabledRightButton = disabledRightButton
})
/* ******************* 按钮变灰 ******************* */

View File

@ -103,6 +103,12 @@
<version>4.4.0</version> <version>4.4.0</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<version>2.3.1</version>
</dependency>
<dependency> <dependency>
<groupId>cn.afterturn</groupId> <groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId> <artifactId>easypoi-base</artifactId>

View File

@ -0,0 +1,178 @@
package aiyh.utils;
/**
* @Author DYS
* @Date 2023/3/25 18:08
* @description create at weaver
*/
import java.io.Serializable;
import java.math.BigDecimal;
/**
* . this.
*/
public class AmountHandler implements Serializable {
private BigDecimal value;
/**
* 10
*/
private int scale = 10;
public AmountHandler() {
}
/**
* double
*
* @param value
*/
public AmountHandler(double value) {
this.value = new BigDecimal(Double.toString(value));
}
/**
* String
*
* @param value
*/
public AmountHandler(String value) {
this.value = new BigDecimal(value);
}
/**
* BigDecimal
*
* @return
*/
public BigDecimal getValue() {
return this.value;
}
/**
* double
*
* @param v1
* @param v2
* @return
*/
public double add(double v1, double v2) {
AmountHandler a1 = new AmountHandler(v1);
AmountHandler a2 = new AmountHandler(v2);
return add(a1, a2);
}
/**
*
*
* @param v1
* @param v2
* @return
*/
public double div(double v1, double v2) {
AmountHandler a1 = new AmountHandler(v1);
AmountHandler a2 = new AmountHandler(v2);
return this.divide(a1, a2);
}
/**
*
*
* @param v1
* @param v2
* @return
*/
public double sub(double v1, double v2) {
AmountHandler a1 = new AmountHandler(v1);
AmountHandler a2 = new AmountHandler(v2);
return this.subtract(a1, a2);
}
/**
*
*
* @param v1
* @param v2
* @return
*/
public double mul(double v1, double v2) {
AmountHandler a1 = new AmountHandler(v1);
AmountHandler a2 = new AmountHandler(v2);
return this.multiply(a1, a2);
}
/**
* Amount
*
* @param v1
* @param v2
* @return
*/
public double add(AmountHandler v1, AmountHandler v2) {
return v1.getValue().add(v2.getValue()).doubleValue();
}
/**
* Amount
*
* @param v1
* @param v2
* @return
*/
public double divide(AmountHandler v1, AmountHandler v2) {
if (scale < 0) {
throw new IllegalArgumentException("精度指定错误,请指定一个>=0的精度");
}
return v1.getValue().divide(v2.getValue(), scale,
BigDecimal.ROUND_HALF_UP).doubleValue();
}
/**
*
*
* @param v1
* @param v2
* @return
*/
public double multiply(AmountHandler v1, AmountHandler v2) {
return v1.getValue().multiply(v2.getValue()).doubleValue();
}
/**
*
*
* @param v1
* @param v2
* @return
*/
public double subtract(AmountHandler v1, AmountHandler v2) {
return v1.getValue().subtract(v2.getValue()).doubleValue();
}
/**
* value
*
* @return
*/
public double doubleValue() {
return this.getValue().doubleValue();
}
/**
*
*
* @param scale
*/
public void setScale(int scale) {
this.scale = scale;
}
public static void main(String[] args) {
AmountHandler AmountHandler = new AmountHandler(5000.23);
AmountHandler AmountHandler1 = new AmountHandler(2033.37);
System.out.println(new AmountHandler().add(AmountHandler, AmountHandler1));
}
}

View File

@ -3870,4 +3870,86 @@ public class Util extends weaver.general.Util {
} }
return ip; return ip;
} }
public static String parseLanguageString(String multiLanguageString, String languageId) {
// 将多语言字符串按 `~`~` 分隔成语言id和对应的文本
String[] languageTextPairs = multiLanguageString.split("`~`");
for (String pair : languageTextPairs) {
// 按 ` 分隔语言id和文本
String[] parts = pair.split(" ");
if (parts[0].equals(languageId)) {
// 如果语言id匹配返回对应文本
return Util.joinEach(parts, " ").substring(languageId.length() + 1);
}
}
// 如果没有匹配的语言id返回空字符串
return "";
}
/**
*
*
* @param oldName
* @param newName
* @param lanuage 7 8 9
*/
public static String moreLanugageHandler(String oldName, String newName, String lanuage) {
List languageIds = getActiveLanguageIds();// 获取系统支持的多语言
String newMoreLanuage = "";
// 要按照当前系统支持的多语言id进行拼接处理
if (oldName.startsWith("~`~`") && oldName.endsWith("`~`~")) {
// 获取当前系统存在的多语言id
// 思路先按照系统存在的语言进行拼接之后判断oldname包含那些语言进行过滤将除了lanuage的其他语言都替换成之前的
// 多语言的中间处理
String tempLanuage = joinLanuage(newName, languageIds);
// 中间处理转成map
Map splitMultilangData = splitMultilangData(tempLanuage);
Map<String, String> lanuageMap = new HashMap<>();
for (Object id : languageIds) {
String labelLanuage = "`~`" + id;
if (oldName.contains(labelLanuage)) {
// 获取过滤的语言name
String formatLanuageName = formatMultiLang(oldName, String.valueOf(id));
if (!weaver.general.StringUtil.isEmpty(formatLanuageName)) {
lanuageMap.put(String.valueOf(id), formatLanuageName);
}
}
}
String s = lanuageMap.get(lanuage);
if (weaver.general.StringUtil.isEmpty(s)) {
for (Map.Entry<String, String> entry : lanuageMap.entrySet()) {
splitMultilangData.put(entry.getKey(), entry.getValue());
}
} else {
lanuageMap.remove(lanuage);
for (Map.Entry<String, String> entry : lanuageMap.entrySet()) {
splitMultilangData.put(entry.getKey(), entry.getValue());
}
}
newMoreLanuage = stitchMultilangData(splitMultilangData);
} else {
// 要根据系统支持的语言进行拼接
newMoreLanuage = joinLanuage(newName, languageIds);
}
return newMoreLanuage;
}
/**
*
*
* @param newName
* @param languageIds
* @return
*/
public static String joinLanuage(String newName, List languageIds) {
StringBuilder supportLanuage = new StringBuilder();
supportLanuage.append("~`~`");
languageIds.forEach(id -> {
supportLanuage.append(id).append(" ").append(newName).append("`~`");
});
supportLanuage.delete(supportLanuage.lastIndexOf("`~`"), supportLanuage.length());
supportLanuage.append("`~`~");
return supportLanuage.toString();
}
} }

View File

@ -1,6 +1,7 @@
package aiyh.utils.action; package aiyh.utils.action;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.action.mapper.SafeActionMapper;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -29,6 +30,8 @@ public abstract class SafeCusBaseAction implements Action {
protected final Logger log = Util.getLogger(); protected final Logger log = Util.getLogger();
private final Map<String, SafeCusBaseActionHandleFunction> actionHandleMethod = new HashMap<>(); private final Map<String, SafeCusBaseActionHandleFunction> actionHandleMethod = new HashMap<>();
private final SafeActionMapper mapper = Util.getMapper(SafeActionMapper.class);
/** /**
* <h2></h2> * <h2></h2>
*/ */
@ -191,7 +194,12 @@ public abstract class SafeCusBaseAction implements Action {
protected Map<String, String> getMainTableValue(RequestInfo requestInfo) { protected Map<String, String> getMainTableValue(RequestInfo requestInfo) {
// 获取主表数据 // 获取主表数据
Property[] propertyArr = requestInfo.getMainTableInfo().getProperty(); Property[] propertyArr = requestInfo.getMainTableInfo().getProperty();
return getStringMap(propertyArr); Map<String, String> result = getStringMap(propertyArr);
RequestManager requestManager = requestInfo.getRequestManager();
String billTable = requestManager.getBillTableName();
String id = mapper.selectIdByRequest(billTable, requestInfo.getRequestid());
result.put("id", id);
return result;
} }
@NotNull @NotNull

View File

@ -0,0 +1,20 @@
package aiyh.utils.action.mapper;
import aiyh.utils.annotation.recordset.ParamMapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
/**
* <h1></h1>
*
* <p>create: 2023/4/17 17:47</p>
*
* @author youHong.ai
*/
@SqlMapper
public interface SafeActionMapper {
@Select("select id from $t{billTable} where requestid = #{requestId}")
String selectIdByRequest(@ParamMapper("billTable") String billTable,
@ParamMapper("requestId") String requestId);
}

View File

@ -6,8 +6,6 @@ import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.api.xuanran.wang.shyl.service.BatchCreateWorkflowService; import com.api.xuanran.wang.shyl.service.BatchCreateWorkflowService;
import com.api.xuanran.wang.shyl.service.MeetingService;
import com.api.xuanran.wang.shyl.vo.CreateWfVO;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.workflow.publicApi.WorkflowRequestOperatePA; import com.engine.workflow.publicApi.WorkflowRequestOperatePA;
import com.engine.workflow.publicApi.impl.WorkflowRequestOperatePAImpl; import com.engine.workflow.publicApi.impl.WorkflowRequestOperatePAImpl;
@ -16,7 +14,6 @@ import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.xuanran.wang.common.mapper.CommonMapper;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
@ -26,7 +23,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.core.Context; import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import java.util.List;
/** /**
* <h1>-</h1> * <h1>-</h1>

View File

@ -0,0 +1,54 @@
package com.api.xuanran.wang.shyl.controller;
import aiyh.utils.ApiResult;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.api.xuanran.wang.shyl.service.UserUpdateToMQService;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/20 17:15
*/
@Path("/wxr/user_mq")
public class UserUpdateToMQController {
private final Logger log = Util.getLogger();
private final UserUpdateToMQService userUpdateToMQService = new UserUpdateToMQService();
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/3/1 15:24
**/
@Path("/update")
@POST
@Produces(MediaType.TEXT_PLAIN)
public String updateUserInfoToMQ(@Context HttpServletRequest request,
@Context HttpServletResponse response){
try {
String id = Util.null2DefaultStr(request.getParameter("id"),"");
String onlyMark = Util.null2DefaultStr(request.getParameter("onlyMark"),"");
String configName = Util.null2DefaultStr(request.getParameter("configName"),"");
String debug = Util.null2DefaultStr(request.getParameter("debug"),"");
if(StringUtils.isBlank(id) || StringUtils.isBlank(onlyMark) || StringUtils.isBlank(configName)){
throw new CustomerException("update user to mq id or onlyMark or configName can not null!");
}
userUpdateToMQService.toMQ(id, onlyMark, configName, debug);
return ApiResult.success(null);
}catch (Exception e){
log.error(Util.logStr("MeetingController error ! {}", e.getMessage()));
return ApiResult.error(500,"会议取消接口发生异常! 异常信息 :[ " + e.getMessage() + " ]");
}
}
}

View File

@ -5,7 +5,7 @@ import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper; import aiyh.utils.annotation.recordset.SqlMapper;
import com.api.xuanran.wang.shyl.entity.ProducerCarInfo; import com.api.xuanran.wang.shyl.entity.ProducerCarInfo;
import java.util.HashMap; import java.util.Map;
/** /**
* <h1>mapper</h1> * <h1>mapper</h1>
@ -15,6 +15,13 @@ import java.util.HashMap;
*/ */
@SqlMapper @SqlMapper
public interface ProducerMapper { public interface ProducerMapper {
/**
* <h1>ID</h1>
* @author xuanran.wang
* @dateTime 2023/3/20 17:26
* @param id id
* @return
**/
@Select("select a.id carCode, Deposit status,b.outkey driver, b.lastname userName, " + @Select("select a.id carCode, Deposit status,b.outkey driver, b.lastname userName, " +
"b.telephone userPhone, carNo plateList, remark " + "b.telephone userPhone, carNo plateList, remark " +
"from carinfo a " + "from carinfo a " +
@ -23,6 +30,13 @@ public interface ProducerMapper {
"where a.id = #{id}") "where a.id = #{id}")
ProducerCarInfo queryCarInfo(@ParamMapper("id") String id); ProducerCarInfo queryCarInfo(@ParamMapper("id") String id);
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/3/20 17:27
* @param carNo
* @return
**/
@Select("select a.id carCode, Deposit status,b.outkey driver, b.lastname userName, " + @Select("select a.id carCode, Deposit status,b.outkey driver, b.lastname userName, " +
"b.telephone userPhone, carNo plateList, remark " + "b.telephone userPhone, carNo plateList, remark " +
"from carinfo a " + "from carinfo a " +
@ -30,4 +44,14 @@ public interface ProducerMapper {
"on a.driver = b.id " + "on a.driver = b.id " +
"where a.carNo = #{carNo}") "where a.carNo = #{carNo}")
ProducerCarInfo queryCarNo(@ParamMapper("carNo") String carNo); ProducerCarInfo queryCarNo(@ParamMapper("carNo") String carNo);
/**
* <h1>ID</h1>
* @author xuanran.wang
* @dateTime 2023/3/20 17:27
* @param id ID
* @return
**/
@Select("select * from hrmresource where id = #{id}")
Map<String, Object> queryUserInfo(@ParamMapper("id") String id);
} }

View File

@ -81,6 +81,10 @@ public class CarService {
carNo = Util.null2DefaultStr(request.getParameter("carNo"),""); carNo = Util.null2DefaultStr(request.getParameter("carNo"),"");
info = producerMapper.queryCarNo(carNo); info = producerMapper.queryCarNo(carNo);
} }
//add by taojw
// String plateList = info.getPlateList();
// 如果能找到就说明是更新或者新增 // 如果能找到就说明是更新或者新增
if("del".equals(operation)){ //删除状态下 if("del".equals(operation)){ //删除状态下
info = new ProducerCarInfo(); info = new ProducerCarInfo();
@ -88,6 +92,7 @@ public class CarService {
info.setStatus("1"); info.setStatus("1");
info.setRemark(""); info.setRemark("");
info.setDriver(""); info.setDriver("");
//edit by taojw
info.setPlateList(""); info.setPlateList("");
info.setUserName(""); info.setUserName("");
info.setUserPhone(""); info.setUserPhone("");

View File

@ -0,0 +1,57 @@
package com.api.xuanran.wang.shyl.service;
import aiyh.utils.Util;
import com.alibaba.fastjson.JSONObject;
import com.api.xuanran.wang.shyl.mapper.ProducerMapper;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.xiao.commons.config.entity.RequestMappingConfig;
import weaver.xiao.commons.config.service.DealWithMapping;
import weaver.xuanran.wang.shyl_mq.util.RocketConsumerUtil;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/20 17:18
*/
public class UserUpdateToMQService {
private final Logger logger = Util.getLogger();
private final DealWithMapping dealWithMapping = new DealWithMapping();
private final ProducerMapper producerMapper = Util.getMapper(ProducerMapper.class);
private static final String HRM_TABLE = "hrmresource";
public void toMQ(String id,
String onlyMark,
String configName,
String debug){
Map<String, Object> userMap = producerMapper.queryUserInfo(id);
if(MapUtils.isEmpty(userMap)){
logger.error(Util.logStr("userId: {}, userInfo is empty!"));
return;
}
RequestMappingConfig config = dealWithMapping.treeDealWithUniqueCode(onlyMark);
dealWithMapping.setMainTable(HRM_TABLE);
Map<String, Object> param = dealWithMapping.getRequestParam(userMap, config);
if(MapUtils.isEmpty(param)){
logger.error(Util.logStr("userId:{}, 生成json为空!",id));
return;
}
if(StringUtils.isNotBlank(debug)){
logger.info("update user json : \n" + JSONObject.toJSONString(param));
return;
}
RocketConsumerUtil.producerSendMsg(configName, JSONObject.toJSONString(param), id);
}
}

View File

@ -37,10 +37,12 @@ public class RequestLogAuthorityController {
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)
public String getPrivacyAuthority(@Context HttpServletRequest request, @Context HttpServletResponse response, public String getPrivacyAuthority(@Context HttpServletRequest request, @Context HttpServletResponse response,
@QueryParam("workflowId") String workflowId) { @QueryParam("workflowId") String workflowId,
@QueryParam("requestId") String requestId,
@QueryParam("nodeId") String nodeId) {
try { try {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return ApiResult.success(service.getPrivacyAuthority(user, workflowId)); return ApiResult.success(service.getPrivacyAuthority(user, workflowId, requestId, nodeId));
} catch (Exception e) { } catch (Exception e) {
log.info("get privacy authority error!" + Util.getErrString(e)); log.info("get privacy authority error!" + Util.getErrString(e));
return ApiResult.error(e.getMessage()); return ApiResult.error(e.getMessage());

View File

@ -30,4 +30,11 @@ public interface RequestLogAuthorityMapper {
"and (',' || authority_members || ',') like #{userLike} and enable_status = 1") "and (',' || authority_members || ',') like #{userLike} and enable_status = 1")
RequestLogAuthority selectLogPrivacyConfig(@ParamMapper("userLike") String userLike, RequestLogAuthority selectLogPrivacyConfig(@ParamMapper("userLike") String userLike,
@ParamMapper("workflowId") String workflowId); @ParamMapper("workflowId") String workflowId);
@Select("select id from uf_privacy_log_info where request_id = #{requestId} and " +
"node_id = #{nodeId} and user_id = #{userId} and enable_privacy = '1'")
Integer selectRequestLogId(@ParamMapper("requestId") String requestId,
@ParamMapper("nodeId") String nodeId,
@ParamMapper("userId") String userId);
} }

View File

@ -1,10 +1,13 @@
package com.api.youhong.ai.geerde.requestlog.service; package com.api.youhong.ai.geerde.requestlog.service;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
import com.api.youhong.ai.geerde.requestlog.mapper.RequestLogAuthorityMapper; import com.api.youhong.ai.geerde.requestlog.mapper.RequestLogAuthorityMapper;
import com.api.youhong.ai.geerde.requestlog.pojo.RequestLogAuthority; import com.api.youhong.ai.geerde.requestlog.pojo.RequestLogAuthority;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects; import java.util.Objects;
/** /**
@ -18,8 +21,25 @@ public class RequestLogAuthorityService {
private final RequestLogAuthorityMapper mapper = Util.getMapper(RequestLogAuthorityMapper.class); private final RequestLogAuthorityMapper mapper = Util.getMapper(RequestLogAuthorityMapper.class);
public boolean getPrivacyAuthority(User user, String workflowId) { public Map<String, Boolean> getPrivacyAuthority(User user, String workflowId, String requestId, String nodeId) {
Map<String, Boolean> result = new HashMap<>();
result.put("show", true);
RequestLogAuthority requestLogAuthority = mapper.selectLogPrivacyConfig("%," + user.getUID() + ",%", workflowId); RequestLogAuthority requestLogAuthority = mapper.selectLogPrivacyConfig("%," + user.getUID() + ",%", workflowId);
return !Objects.isNull(requestLogAuthority); if (Objects.isNull(requestLogAuthority)) {
// 不存在签字意见组中
result.put("show", false);
return result;
}
if (StrUtil.isBlank(requestId) || "-1".equals(requestId)) {
result.put("enable", false);
return result;
}
Integer id = mapper.selectRequestLogId(requestId, nodeId, String.valueOf(user.getUID()));
if (id <= 0) {
result.put("enable", false);
} else {
result.put("enable", true);
}
return result;
} }
} }

View File

@ -27,8 +27,8 @@ public interface FunctionListMapper {
column = "button_icon", column = "button_icon",
id = @Id(value = String.class, methodId = 1)) id = @Id(value = String.class, methodId = 1))
) )
@Select("select * from uf_fun_list_config where CONCAT(',' , subcompany_id , ',') like #{userSubCompanyLike}") @Select("select * from uf_fun_list_config where CONCAT(',' , subcompany_id , ',') like #{userSubCompanyLike} order by sort_num")
@SelectOracle("select * from uf_fun_list_config where (',' || subcompany_id || ',') like #{userSubCompanyLike}") @SelectOracle("select * from uf_fun_list_config where (',' || subcompany_id || ',') like #{userSubCompanyLike} order by sort_num")
List<FunctionListConfigItem> selectFunctionList(@ParamMapper("userSubCompanyLike") String userSubCompanyLike); List<FunctionListConfigItem> selectFunctionList(@ParamMapper("userSubCompanyLike") String userSubCompanyLike);
@ -42,7 +42,7 @@ public interface FunctionListMapper {
column = "button_icon", column = "button_icon",
id = @Id(value = String.class, methodId = 1)) id = @Id(value = String.class, methodId = 1))
) )
@Select("select * from uf_fun_list_config") @Select("select * from uf_fun_list_config order by sort_num")
List<FunctionListConfigItem> selectFunctionListAll(); List<FunctionListConfigItem> selectFunctionListAll();
/** /**

View File

@ -35,4 +35,8 @@ public class FunctionListConfigItem {
/** 图标数量接口地址 */ /** 图标数量接口地址 */
@SqlOracleDbFieldAnn("NUMBER_URL") @SqlOracleDbFieldAnn("NUMBER_URL")
private String numberUrl; private String numberUrl;
/** 排序字段 */
@SqlOracleDbFieldAnn("SORT_NUM")
private String sortNum;
} }

View File

@ -1,8 +1,7 @@
package com.customization.youhong.deerge.requestlog.impl; package com.customization.youhong.deerge.requestlog.impl;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil; import com.customization.youhong.deerge.requestlog.util.PrivacyRequestLogUtil;
import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper;
import com.engine.core.cfg.annotation.ServiceDynamicProxy; import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy; import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy; import com.engine.core.impl.aop.AbstractServiceProxy;
@ -11,11 +10,13 @@ import com.engine.workflow.entity.requestForm.RequestOperationResultBean;
import com.engine.workflow.service.RequestFormService; import com.engine.workflow.service.RequestFormService;
import com.engine.workflow.service.impl.RequestFormServiceImpl; import com.engine.workflow.service.impl.RequestFormServiceImpl;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import weaver.workflow.request.RequestManager; import weaver.workflow.request.RequestManager;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
@ -33,7 +34,7 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
public static final String SUCCESS = "SUCCESS"; public static final String SUCCESS = "SUCCESS";
private final Logger log = Util.getLogger(); private final Logger log = Util.getLogger();
private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class); private final PrivacyRequestLogUtil privacyRequestLogUtil = new PrivacyRequestLogUtil();
@Override @Override
public Map<String, Object> judgeCreateRight(HttpServletRequest request) { public Map<String, Object> judgeCreateRight(HttpServletRequest request) {
@ -118,37 +119,40 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
@Override @Override
@ServiceMethodDynamicProxy(desc = "保存和提交流程时,判断是否开启隐私") @ServiceMethodDynamicProxy(desc = "保存和提交流程时,判断是否开启隐私")
public Map<String, Object> requestSubmit(HttpServletRequest request) { public Map<String, Object> requestSubmit(HttpServletRequest request) {
log.info("requestSubmit:=>");
return handlerRequestLogPrivacy(request);
}
@Override
@ServiceMethodDynamicProxy(desc = "转发流程、意见征询时,判断是否开启隐私")
public Map<String, Object> forwardSubmit(HttpServletRequest request) {
log.info("forwardSubmit:=>");
return handlerRequestLogPrivacy(request);
}
@Override
@ServiceMethodDynamicProxy(desc = "转发流程、意见征询时,判断是否开启隐私")
public Map<String, Object> remarkSubmit(HttpServletRequest request) {
log.info("remarkSubmit:=>");
return handlerRequestLogPrivacy(request);
}
@Nullable
private Map<String, Object> handlerRequestLogPrivacy(HttpServletRequest request) {
Map<String, Object> result = (Map<String, Object>) executeMethod(request); Map<String, Object> result = (Map<String, Object>) executeMethod(request);
try { try {
log.info("调用提交流程和保存流程后的返回参数: " + result);
RequestOperationResultBean data = (RequestOperationResultBean) result.get("data"); RequestOperationResultBean data = (RequestOperationResultBean) result.get("data");
if (Objects.isNull(data)) {
String success = Util.null2DefaultStr(result.get("success"), "false");
if (Boolean.parseBoolean(success)) {
privacyRequestLogUtil.privacyRequestLogHandle(request);
}
return result;
}
String type = Util.null2String(data.getType()); String type = Util.null2String(data.getType());
if (SUCCESS.equals(type)) { if (SUCCESS.equals(type)) {
// 保存成功,这里对隐私的签字意见做处理 // 保存成功,这里对隐私的签字意见做处理
String userId = request.getParameter("userId"); privacyRequestLogUtil.privacyRequestLogHandle(request);
String enablePrivacy = request.getParameter("enablePrivacy");
String nodeId = request.getParameter("nodeid");
String requestId = request.getParameter("requestid");
String remark = request.getParameter("remark");
if (StrUtil.isBlank(enablePrivacy)) {
return result;
}
if (!Boolean.parseBoolean(enablePrivacy)) {
return result;
}
if ("-1".equals(requestId)) {
Map<String, Object> submitParams = data.getSubmitParams();
requestId = Util.null2String(submitParams.get("requestid"));
}
// 查询logId
Integer logId = mapper.selectRequestLogId(requestId, remark, nodeId, userId);
// 插入logId隐私信息
int dataId = Util.getModeDataId("uf_privacy_log_info", 1);
Boolean flag = mapper.insertPrivacyLog(dataId, logId, userId, nodeId, requestId);
if (!flag) {
Util.deleteModeId("uf_privacy_log_info", dataId);
}
} }
} catch (Exception e) { } catch (Exception e) {
log.error("add privacy request log error! " + Util.getErrString(e)); log.error("add privacy request log error! " + Util.getErrString(e));
@ -156,20 +160,11 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
return result; return result;
} }
@Override
public Map<String, Object> forwardSubmit(HttpServletRequest request) {
return null;
}
@Override @Override
public Map<String, Object> requestWithdraw(HttpServletRequest httpServletRequest) { public Map<String, Object> requestWithdraw(HttpServletRequest httpServletRequest) {
return null; return null;
} }
@Override
public Map<String, Object> remarkSubmit(HttpServletRequest request) {
return null;
}
@Override @Override
public Map<String, Object> functionManage(HttpServletRequest request, HttpServletResponse response) { public Map<String, Object> functionManage(HttpServletRequest request, HttpServletResponse response) {

View File

@ -1,23 +1,17 @@
package com.customization.youhong.deerge.requestlog.impl; package com.customization.youhong.deerge.requestlog.impl;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil; import com.alibaba.fastjson.JSON;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil; import com.customization.youhong.deerge.requestlog.util.PrivacyRequestLogUtil;
import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper;
import com.engine.core.cfg.annotation.ServiceDynamicProxy; import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy; import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy; import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.workflow.service.RequestLogService; import com.engine.workflow.service.RequestLogService;
import com.engine.workflow.service.impl.RequestLogServiceImpl; import com.engine.workflow.service.impl.RequestLogServiceImpl;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
* <h1></h1> * <h1></h1>
@ -29,9 +23,8 @@ import java.util.stream.Collectors;
@ServiceDynamicProxy(target = RequestLogServiceImpl.class, desc = "拦截签字意见信息,是否需要隐私控制") @ServiceDynamicProxy(target = RequestLogServiceImpl.class, desc = "拦截签字意见信息,是否需要隐私控制")
public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements RequestLogService { public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements RequestLogService {
private final Logger log = Util.getLogger(); private final PrivacyRequestLogUtil privacyRequestLogUtil = new PrivacyRequestLogUtil();
private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class);
@Override @Override
public Map<String, Object> getRequestLogBaseInfo(Map<String, Object> params) { public Map<String, Object> getRequestLogBaseInfo(Map<String, Object> params) {
@ -42,52 +35,13 @@ public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements
@ServiceMethodDynamicProxy(desc = "控制是否显示隐私签字意见") @ServiceMethodDynamicProxy(desc = "控制是否显示隐私签字意见")
public Map<String, Object> getRequestLogList(HttpServletRequest request, Map<String, Object> params) { public Map<String, Object> getRequestLogList(HttpServletRequest request, Map<String, Object> params) {
Map<String, Object> result = (Map<String, Object>) executeMethod(request, params); Map<String, Object> result = (Map<String, Object>) executeMethod(request, params);
Logger log = Util.getLogger();
try { try {
String isMonitor = request.getParameter("ismonitor"); privacyRequestLogUtil.requestLogList(result, params, request);
boolean isPrint = "1".equals(Util.null2String(request.getParameter("isprint")));
// 如果是流程监控,全部返回
if (!StrUtil.isBlank(isMonitor) && !isPrint) {
return result;
}
User user = HrmUserVarify.getUser(request, null);
List<Map<String, Object>> logList = (List<Map<String, Object>>) result.get("loglist");
List<String> logIds = new ArrayList<>();
for (Map<String, Object> logInfo : logList) {
String logId = Util.null2String(logInfo.get("logid"));
logIds.add(logId);
}
String workflowId = Util.null2String(params.get("workflowid"));
if (StrUtil.isBlank(workflowId)) {
log.error("can not get value from params by wworkflowid!");
return result;
}
List<String> privacyLogIds;
// 如果是打印,所有隐私都不显示
if (isPrint) {
privacyLogIds = mapper.selectPrivacyLogIdAll(Util.join(logIds, ","), "-1", Util.null2String(params.get("requestid")));
} else {
// 如果不是,不显示除自己和隐私组之外的其他人的信息
List<String> userGroup = mapper.selectPrivacyGroup(workflowId, "%," + user.getUID() + ",%");
if (CollectionUtil.isEmpty(userGroup)) {
// 不在权限组,不能查看隐私的签字意见
privacyLogIds = mapper.selectPrivacyLogIdAll(Util.join(logIds, ","), String.valueOf(user.getUID()), Util.null2String(params.get("requestid")));
} else {
privacyLogIds = mapper.selectPrivacyLogId(Util.join(logIds, ","),
Util.join(userGroup, ","), Util.null2String(params.get("requestid")));
}
}
if (CollectionUtil.isEmpty(privacyLogIds)) {
return result;
}
List<String> finalPrivacyLogIds = privacyLogIds;
List<Map<String, Object>> newLogList = logList.stream()
.filter(item -> !finalPrivacyLogIds.contains(Util.null2String(item.get("logid"))))
.collect(Collectors.toList());
result.put("loglist", newLogList);
} catch (Exception e) { } catch (Exception e) {
log.error("filter request log list error!" + Util.getErrString(e)); log.error("filter request log list error!" + Util.getErrString(e));
} }
return result; return result;
} }

View File

@ -1,8 +1,10 @@
package com.customization.youhong.deerge.requestlog.mapper; package com.customization.youhong.deerge.requestlog.mapper;
import aiyh.utils.annotation.recordset.*; import aiyh.utils.annotation.recordset.*;
import com.customization.youhong.deerge.requestlog.pojo.RequestLogPrivacyEntity;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* <h1></h1> * <h1></h1>
@ -14,19 +16,18 @@ import java.util.List;
@SqlMapper @SqlMapper
public interface InterceptRequestLogMapper { public interface InterceptRequestLogMapper {
/** /**
* <h2>id</h2> * <h2>id</h2>
* *
* @param requestId requestid * @param requestId requestid
* @param remark
* @param nodeId id * @param nodeId id
* @param operator * @param operator
* @return id * @return id
*/ */
@Select("select logid from workflow_requestlog where REQUESTID = #{requestId} and REMARK = #{remark} " + @Select("select logid,operatetime from workflow_requestlog where REQUESTID = #{requestId} " +
"and NODEID = #{nodeId} and OPERATOR = #{operator}") "and NODEID = #{nodeId} and OPERATOR = #{operator} order by LOGID desc ")
Integer selectRequestLogId(@ParamMapper("requestId") String requestId, List<Map<String, Object>> selectRequestLogId(@ParamMapper("requestId") String requestId,
@ParamMapper("remark") String remark,
@ParamMapper("nodeId") String nodeId, @ParamMapper("nodeId") String nodeId,
@ParamMapper("operator") String operator); @ParamMapper("operator") String operator);
@ -42,40 +43,53 @@ public interface InterceptRequestLogMapper {
*/ */
@Update("update uf_privacy_log_info set request_id = #{requestId}," + @Update("update uf_privacy_log_info set request_id = #{requestId}," +
"node_id = #{nodeId}, user_id = #{userId},log_id = #{logId} " + "node_id = #{nodeId}, user_id = #{userId},log_id = #{logId}," +
"target_hrm = case when target_hrm is null then #{targetHrm} else concat(concat(target_hrm,',') ,#{targetHrm}) end," +
"enable_privacy = #{enablePrivacy} " +
"where id = #{dataId}") "where id = #{dataId}")
Boolean insertPrivacyLog( Boolean insertPrivacyLog(
@ParamMapper("dataId") int dataId, @ParamMapper("dataId") int dataId,
@ParamMapper("logId") Integer logId, @ParamMapper("logId") Integer logId,
@ParamMapper("userId") String userId, @ParamMapper("userId") String userId,
@ParamMapper("nodeId") String nodeId, @ParamMapper("nodeId") String nodeId,
@ParamMapper("requestId") String requestId); @ParamMapper("requestId") String requestId,
@ParamMapper("targetHrm") String field5,
@ParamMapper("enablePrivacy") String enablePrivacy);
/** /**
* <h2></h2> * <h2></h2>
* *
* @param logIds ids * @param logId id
* @param uid ID * @param userId id
* @param nodeId id
* @param requestId id * @param requestId id
* @return * @param enablePrivacy
* @return
*/ */
@Select("select log_id from uf_privacy_log_info where request_id = #{requestId} and user_id not in ($t{userId}) and log_id in ($t{logIds})") @Update("update uf_privacy_log_info set enable_privacy = #{enablePrivacy} where request_id = #{requestId} " +
List<String> selectPrivacyLogId( "and node_id = #{nodeId} and user_id = #{userId} and log_id = #{logId},")
@ParamMapper("logIds") String logIds, boolean updateRequestLogStatus(@ParamMapper("logId") Integer logId,
@ParamMapper("userId") String uid, @ParamMapper("userId") String userId,
@ParamMapper("requestId") String requestId); @ParamMapper("nodeId") String nodeId,
@ParamMapper("requestId") String requestId,
@ParamMapper("enablePrivacy") String enablePrivacy);
/** /**
* <h2></h2> * <h2>id</h2>
* *
* @param logIds ids * @param requestId id
* @param requestId id * @param nodeId id
* @return * @param userId id
* @param logId id
* @return
*/ */
@Select("select log_id from uf_privacy_log_info where request_id = #{requestId} and user_id <> #{userId} and log_id in ($t{logIds})") @Select("select id from uf_privacy_log_info where request_id = #{requestId} and " +
List<String> selectPrivacyLogIdAll(@ParamMapper("logIds") String logIds, "node_id = #{nodeId} and user_id = #{userId} and log_id = #{logId}")
@ParamMapper("userId") String uid, Integer selectRequestLogDataId(@ParamMapper("requestId") String requestId,
@ParamMapper("requestId") String requestId); @ParamMapper("nodeId") String nodeId,
@ParamMapper("userId") String userId,
@ParamMapper("logId") String logId);
/** /**
@ -91,4 +105,35 @@ public interface InterceptRequestLogMapper {
"and workflow_type = #{workflowId} and (',' || authority_members || ',') like #{userLike}") "and workflow_type = #{workflowId} and (',' || authority_members || ',') like #{userLike}")
List<String> selectPrivacyGroup(@ParamMapper("workflowId") String workflowId, List<String> selectPrivacyGroup(@ParamMapper("workflowId") String workflowId,
@ParamMapper("userLike") String userLike); @ParamMapper("userLike") String userLike);
/**
* <h2></h2>
*
* @param nodeId id
* @param requestId id
* @return
*/
@Select("select * from uf_privacy_log_info where request_id = #{requestId} and node_id = #{nodeId}")
RequestLogPrivacyEntity selectRequestLogUsers(@ParamMapper("nodeId") String nodeId,
@ParamMapper("requestId") String requestId);
/**
* <h2>id</h2>
*
* @param requestId id
* @return id
*/
@Select("select log_id from uf_privacy_log_info where request_id = #{requestId} and enable_privacy = 1")
List<String> selectAllLogId(String requestId);
/**
* <h2></h2>
*
* @param userId id
* @param requestId id
* @return
*/
@Select("select log_id from uf_privacy_log_info where request_id = #{requestId} and user_id not in ($t{userId})")
List<String> selectOtherGroupPrivacyLog(@ParamMapper("userId") String userId,
@ParamMapper("requestId") String requestId);
} }

View File

@ -0,0 +1,40 @@
package com.customization.youhong.deerge.requestlog.pojo;
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
/**
* <h1></h1>
*
* <p>create: 2023/3/28 15:08</p>
*
* @author youHong.ai
*/
@Getter
@Setter
@ToString
public class RequestLogPrivacyEntity {
/** id */
@SqlOracleDbFieldAnn("ID")
private Integer id;
/** requestId */
@SqlOracleDbFieldAnn("REQUEST_ID")
private String requestId;
/** 节点id */
@SqlOracleDbFieldAnn("NODE_ID")
private String nodeId;
/** 用户id */
@SqlOracleDbFieldAnn("USER_ID")
private String userId;
/** 签字意见id */
@SqlOracleDbFieldAnn("LOG_ID")
private String logId;
/** 是否开启隐私 */
@SqlOracleDbFieldAnn("ENABLE_PRIVACY")
private String enablePrivacy;
/** 转发签字意见等目标人员 */
@SqlOracleDbFieldAnn("TARGET_HRM")
private String targetHrm;
}

View File

@ -0,0 +1,245 @@
package com.customization.youhong.deerge.requestlog.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
import aiyh.utils.tool.cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper;
import com.customization.youhong.deerge.requestlog.pojo.RequestLogPrivacyEntity;
import org.apache.log4j.Logger;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
import java.util.stream.Collectors;
/**
* <h1></h1>
*
* <p>create: 2023/3/28 14:44</p>
*
* @author youHong.ai
*/
public class PrivacyRequestLogUtil {
private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class);
/**
* <h2></h2>
*
* @param request
*/
public void privacyRequestLogHandle(HttpServletRequest request) {
Logger logger = Util.getLogger();
User user = HrmUserVarify.getUser(request, null);
String userId = Util.null2String(user.getUID());
String enablePrivacy = request.getParameter("enablePrivacy");
String nodeId = request.getParameter("nodeid");
String requestId = request.getParameter("requestid");
String field5 = request.getParameter("field5");
if (StrUtil.isBlank(enablePrivacy)) {
// 没有添加隐私按钮
logger.info("没有添加隐私按钮!" + enablePrivacy);
hasNotEnablePrivacy(nodeId, requestId, userId, field5);
return;
}
if (Boolean.parseBoolean(enablePrivacy)) {
// 开启了隐私权限
// 查询 当前人员在当前节点的的签字意见id
logger.info("添加隐私按钮!开启隐私" + enablePrivacy);
insertRequestPrivacyLog(userId, nodeId, requestId, field5, "1");
return;
}
logger.info("添加隐私按钮!未开启隐私");
// 未开启隐私,更新签字意见隐私信息为不隐私
List<Map<String, Object>> nodeIdMapList = mapper.selectRequestLogId(requestId, nodeId, userId);
logger.info("查询的log日志列表" + nodeIdMapList);
if (CollectionUtil.isEmpty(nodeIdMapList)) {
return;
}
Map<String, Object> firstLog = nodeIdMapList.get(0);
String operateTime = Util.null2String(firstLog.get("operatetime"));
List<Integer> logList = new ArrayList<>();
for (Map<String, Object> item : nodeIdMapList) {
String itemOperateTime = Util.null2String(item.get("operatetime"));
int logId = Integer.parseInt(Util.null2String(item.get("logid")));
if (operateTime.equals(itemOperateTime)) {
logList.add(logId);
} else {
break;
}
}
for (Integer logId : logList) {
if (logId > 0) {
mapper.updateRequestLogStatus(logId, userId, nodeId, requestId, "0");
}
}
}
/**
* <h2></h2>
*
* @param userId ID
* @param nodeId id
* @param requestId id
* @param field5
* @param enablePrivacy
*/
private void insertRequestPrivacyLog(String userId, String nodeId, String requestId, String field5, String enablePrivacy) {
Logger logger = Util.getLogger();
List<Map<String, Object>> nodeIdMapList = mapper.selectRequestLogId(requestId, nodeId, userId);
logger.info("查询的log日志列表" + nodeIdMapList);
if (CollectionUtil.isEmpty(nodeIdMapList)) {
return;
}
Map<String, Object> firstLog = nodeIdMapList.get(0);
String operateTime = Util.null2String(firstLog.get("operatetime"));
List<Integer> logList = new ArrayList<>();
for (Map<String, Object> item : nodeIdMapList) {
String itemOperateTime = Util.null2String(item.get("operatetime"));
int logId = Integer.parseInt(Util.null2String(item.get("logid")));
if (operateTime.equals(itemOperateTime)) {
logList.add(logId);
} else {
break;
}
}
for (Integer logId : logList) {
logger.info("查询到的logId是:" + logId);
if (logId <= 0) {
throw new CustomerException("request log id query error!\n");
}
Integer dataId = mapper.selectRequestLogDataId(requestId, nodeId, userId, String.valueOf(logId));
logger.info("查询到的数据id是:" + logId);
if (dataId <= 0) {
// 插入logId隐私信息
dataId = Util.getModeDataId("uf_privacy_log_info", 1);
}
Boolean flag = mapper.insertPrivacyLog(dataId, logId, userId, nodeId, requestId, field5, enablePrivacy);
if (!flag) {
logger.info("更新失败签字意见隐私信息失败!");
Util.deleteModeId("uf_privacy_log_info", dataId);
} else {
Util.rebuildModeDataShare(1,
Integer.parseInt(Util.getModeIdByTableName("uf_privacy_log_info")),
dataId);
}
}
}
/**
* <h2></h2>
*
* @param nodeId id
* @param requestId id
* @param userId id
* @param field5
*/
private void hasNotEnablePrivacy(String nodeId, String requestId, String userId, String field5) {
// 通过节点idrequestId和userId,查询当前用户是否在签字意见记录表中存在,存在则可能是转发等意见征询啥的
RequestLogPrivacyEntity logPrivacyEntity = mapper.selectRequestLogUsers(nodeId, requestId);
if (Objects.isNull(logPrivacyEntity)) {
// 没有查询到相关数据,检查是否开启隐私
return;
}
Logger logger = Util.getLogger();
logger.info("查询到数据:" + JSON.toJSONString(logPrivacyEntity));
String targetHrm = logPrivacyEntity.getTargetHrm();
if (StrUtil.isBlank(targetHrm)) {
return;
}
String[] split = targetHrm.split(",");
List<String> hrmIds = Arrays.asList(split);
if (hrmIds.contains(userId)) {
// 默认签字意见隐私
insertRequestPrivacyLog(userId, nodeId, requestId, field5, "1");
}
// 不是转发等情况回复,默认处理方式处理
}
/**
* <h2></h2>
*
* @param result
* @param params
* @param request
*/
public void requestLogList(Map<String, Object> result, Map<String, Object> params, HttpServletRequest request) {
String isMonitor = request.getParameter("ismonitor");
boolean isPrint = "1".equals(Util.null2String(request.getParameter("isprint")));
String requestId = Util.null2String(params.get("requestid"));
User user = HrmUserVarify.getUser(request, null);
if (isPrint) {
// 打印
hiddenAll(result, requestId);
return;
}
// 是流程监控
if (!StrUtil.isBlank(isMonitor)) {
return;
}
// 查询隐私组
String workflowId = Util.null2String(params.get("workflowid"));
List<String> privacyUserList = mapper.selectPrivacyGroup(workflowId, "%," + user.getUID() + ",%");
if (CollectionUtil.isEmpty(privacyUserList)) {
// 不存在签字意见组中,所有隐私信息不可查看
hiddenAll(result, requestId);
return;
}
// 查询非本组隐私的隐私信息
List<Map<String, Object>> logList = (List<Map<String, Object>>) result.get("loglist");
List<String> privacyLogList = mapper.selectOtherGroupPrivacyLog(Util.join(privacyUserList, ","), requestId);
hiddenContentOrHiddenLog(result, logList, privacyLogList);
}
/**
* <h2></h2>
*
* @param result
* @param requestId id
*/
private void hiddenAll(Map<String, Object> result, String requestId) {
List<Map<String, Object>> logList = (List<Map<String, Object>>) result.get("loglist");
List<String> privacyLogIdList = mapper.selectAllLogId(requestId);
if (CollectionUtil.isEmpty(privacyLogIdList)) {
return;
}
hiddenContentOrHiddenLog(result, logList, privacyLogIdList);
}
/**
* <h2></h2>
*
* @param result
* @param logList list
* @param privacyLogIdList
*/
private static void hiddenContentOrHiddenLog(Map<String, Object> result, List<Map<String, Object>> logList, List<String> privacyLogIdList) {
String showContent = Util.getCusConfigValueNullOrEmpty("REQUEST_LOG_SHOW_CONTENT", "false");
String requestLogShowContentDefault = Util.getCusConfigValueNullOrEmpty("requestLogShowContentDefault", "");
if (!Boolean.parseBoolean(showContent)) {
List<Map<String, Object>> newLogList = logList.stream()
.filter(item -> !privacyLogIdList.contains(Util.null2String(item.get("logid"))))
.collect(Collectors.toList());
result.put("loglist", newLogList);
return;
}
List<Map<String, Object>> newLogList = logList.stream()
.peek(item -> {
if (privacyLogIdList.contains(Util.null2String(item.get("logid")))) {
item.put("log_remarkHtml", requestLogShowContentDefault);
}
})
.collect(Collectors.toList());
result.put("loglist", newLogList);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,21 @@
package com.engine.youhong.ai.taibao.email;
import java.util.Set;
/**
* <h1></h1>
*
* <p>create: 2023/4/14 17:07</p>
*
* @author youHong.ai
*/
public interface BlackListExpansion {
/**
* <h2></h2>
*
* @param mailAddress
* @return
*/
Set<String> sendEmailHandler(Set<String> mailAddress);
}

View File

@ -0,0 +1,38 @@
package com.engine.youhong.ai.taibao.email;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* <h1></h1>
*
* <p>create: 2023/4/14 17:09</p>
*
* @author youHong.ai
*/
public class BlackListRegister {
private static final List<BlackListExpansion> EXPANSION_LIST = new ArrayList<>();
private static final List<BlackListExpansion> EXPANSION_APPROVE_LIST = new ArrayList<>();
public static void registerExpansion(BlackListExpansion blackListExpansion) {
if (Objects.nonNull(blackListExpansion)) {
EXPANSION_LIST.add(blackListExpansion);
}
}
public static void registerAPPROVEExpansion(BlackListExpansion blackListExpansion) {
if (Objects.nonNull(blackListExpansion)) {
EXPANSION_APPROVE_LIST.add(blackListExpansion);
}
}
public static List<BlackListExpansion> getExpansionList() {
return EXPANSION_LIST;
}
public static List<BlackListExpansion> getExpansionApproveList() {
return EXPANSION_APPROVE_LIST;
}
}

View File

@ -0,0 +1,64 @@
package com.engine.youhong.ai.taibao.email.impl;
import aiyh.utils.Util;
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
import com.engine.youhong.ai.taibao.email.BlackListRegister;
import com.engine.youhong.ai.taibao.email.mapper.InitBlackEmailListMapper;
import com.weaverboot.frame.ioc.anno.classAnno.WeaSysInitComponent;
import com.weaverboot.frame.ioc.anno.methodAnno.WeaSysInit;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* <h1></h1>
*
* <p>create: 2023/4/14 17:15</p>
*
* @author youHong.ai
*/
@WeaSysInitComponent("注册email黑名单拦截器")
public class InitBlackListServiceImpl {
private final InitBlackEmailListMapper mapper = Util.getMapper(InitBlackEmailListMapper.class);
@WeaSysInit(order = 1, description = "注册拦截邮箱黑名单")
public void init() {
Util.getLogger().info("注册拦截邮箱黑名单,init");
BlackListRegister.registerExpansion(set -> {
if (Objects.isNull(set)) {
return null;
}
List<String> hrmList = mapper.selectWorkflowBlackEmailList();
String ids = Util.join(hrmList, ",");
List<String> blackEmailList = mapper.selectEmailListByHrmIds(ids);
if (CollectionUtil.isEmpty(blackEmailList)) {
return set;
}
return set.stream()
.filter(item -> !blackEmailList.contains(item))
.collect(Collectors.toSet());
});
}
@WeaSysInit(order = 2, description = "注册拦截邮箱黑名单")
public void initApprove() {
Util.getLogger().info("注册拦截邮箱黑名单,initApprove");
BlackListRegister.registerAPPROVEExpansion(set -> {
if (Objects.isNull(set)) {
return null;
}
String ids = mapper.selectWorkflowApproveBlackEmailList();
List<String> blackEmailList = mapper.selectEmailListByHrmIds(ids);
if (CollectionUtil.isEmpty(blackEmailList)) {
return set;
}
return set.stream()
.filter(item -> !blackEmailList.contains(item))
.collect(Collectors.toSet());
});
}
}

View File

@ -0,0 +1,44 @@
package com.engine.youhong.ai.taibao.email.mapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import java.util.List;
/**
* <h1></h1>
*
* <p>create: 2023/4/14 17:20</p>
*
* @author youHong.ai
*/
@SqlMapper
public interface InitBlackEmailListMapper {
/**
* <h2></h2>
*
* @return email
*/
@Select("select black_hrm from uf_black_email_conf where type = 0")
List<String> selectWorkflowBlackEmailList();
/**
* <h2></h2>
*
* @return email
*/
@Select("select email from uf_black_email_conf where type = 1")
String selectWorkflowApproveBlackEmailList();
/**
* <h2>idid</h2>
*
* @param ids ids
* @return
*/
@Select("select email from hrmresource where id in ($t{ids})")
List<String> selectEmailListByHrmIds(String ids);
}

View File

@ -0,0 +1,70 @@
package weaver.shyl.workflow.action;
import aiyh.utils.Util;
import aiyh.utils.entity.DocImageInfo;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.file.ImageFileManager;
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.Base64;
import java.util.Map;
/**
* <h1>-base64</h1>
*
* @author xuanran.wang
* @date 2023/3/27 22:41
*/
public class FileTypeFieldConvert implements CusInterfaceGetValue {
private final Logger log = Util.getLogger();
/**
*
*
* @param mainMap
* @param detailMap
* @param currentValue
* @param pathParam
* @return
*/
@Override
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
try {
log.info("原文件图片ID:[" + currentValue + "]");
log.info("pathParam : " + JSONObject.toJSONString(pathParam));
int tempId = Util.getIntValue(currentValue, -1);
if(!"".equals(currentValue) && tempId > 0 && !currentValue.contains(",")) {
String imageFileId = Util.null2DefaultStr(pathParam.get("imageFileId"),"");
InputStream inputStream;
if (StringUtils.isBlank(imageFileId)) {
DocImageInfo docImageInfo = Util.selectImageInfoByDocId(currentValue);
inputStream = ImageFileManager.getInputStreamById(docImageInfo.getImageFileId());
}else {
int fileId = Util.getIntValue(currentValue, -1);
if(fileId < 0){
throw new CustomerException("image file id < 0");
}
inputStream = ImageFileManager.getInputStreamById(fileId);
}
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) != -1) {
outputStream.write(buffer, 0, bytesRead);
}
byte[] bytes = outputStream.toByteArray();
return Base64.getEncoder().encodeToString(bytes);
}
} catch (Exception e) {
log.error("convert file to base64 fail!" + e.getMessage() + "\n" + Util.getErrString(e));
throw new CustomerException("convert file to base64 fail!");
}
return null;
}
}

View File

@ -10,19 +10,31 @@ import java.util.Map;
*/ */
public enum GetValueTypeEnum { public enum GetValueTypeEnum {
/** 流程字段 */
WORKFLOW_FIELD("0"), WORKFLOW_FIELD("0"),
/** 默认值 */
DEFAULT_VALUE("1"), DEFAULT_VALUE("1"),
/** 当前时间 */
CURRENT_TIME("3"), CURRENT_TIME("3"),
/** 自定义sql */
CUS_SQL("4"), CUS_SQL("4"),
/** 流程请求id */
REQUEST_ID("5"), REQUEST_ID("5"),
/** 主表数据id */
MAIN_DATA_ID("6"), MAIN_DATA_ID("6"),
/** 随机值 */
RANDOM("7"), RANDOM("7"),
/** 附件 */
ATTACHMENT("8"), ATTACHMENT("8"),
/** 自定义接口 */
CUS_INTERFACE("9"), CUS_INTERFACE("9"),
CUS_FIELD("10"); /** 自定义字段 */
CUS_FIELD("10"),
/** 自定义mapper sql */
CUS_MAPPER_SQL("11");
private static final Map<String, GetValueTypeEnum> LOOK_UP = new HashMap<>(8); private static final Map<String, GetValueTypeEnum> LOOK_UP = new HashMap<>(8);

View File

@ -0,0 +1,21 @@
package weaver.xiao.commons.config.mapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.annotation.recordset.SqlString;
import java.util.Map;
/**
* <h1></h1>
*
* <p>create: 2023/4/17 22:21</p>
*
* @author youHong.ai
*/
@SqlMapper
public interface DealWithMapper {
@Select(custom = true)
String selectCustomSql(@SqlString String sql, Map<String, Object> params);
}

View File

@ -15,12 +15,14 @@ import weaver.xiao.commons.config.enumtype.GetValueTypeEnum;
import weaver.xiao.commons.config.enumtype.ParamTypeEnum; import weaver.xiao.commons.config.enumtype.ParamTypeEnum;
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue; import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
import weaver.xiao.commons.config.interfacies.CusInterfaceListValue; import weaver.xiao.commons.config.interfacies.CusInterfaceListValue;
import weaver.xiao.commons.config.mapper.DealWithMapper;
import weaver.xiao.commons.exception.ValueDealException; import weaver.xiao.commons.exception.ValueDealException;
import weaver.zwl.common.ToolUtil; import weaver.zwl.common.ToolUtil;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -56,6 +58,16 @@ public class DealWithMapping extends ToolUtil {
private RecordSet tempRs; private RecordSet tempRs;
private DealWithMapper mapper = null;
{
try {
mapper = aiyh.utils.Util.getMapper(DealWithMapper.class);
} catch (Exception e) {
this.writeErrorLog("缺少 aiyh_utils.jar依赖初始化失败");
}
}
/** /**
* <h1>Date</h1> * <h1>Date</h1>
* *
@ -115,7 +127,20 @@ public class DealWithMapping extends ToolUtil {
continue; continue;
} }
if ("DECIMAL".equalsIgnoreCase(type) || "NUMERIC".equalsIgnoreCase(type)) { if ("DECIMAL".equalsIgnoreCase(type) || "NUMERIC".equalsIgnoreCase(type)) {
map.put(key, rs.getDouble(i)); /**
* @author xuanran.wang
* @data 2023-04-04
* @desc double
*/
String val = Util.null2String(rs.getString(i));
BigDecimal decimal;
if (StringUtils.isBlank(val)) {
decimal = new BigDecimal("0");
} else {
decimal = new BigDecimal(val);
}
map.put(key, decimal);
// map.put(key, rs.getDouble(i));
continue; continue;
} }
map.put(key, rs.getString(i)); map.put(key, rs.getString(i));
@ -740,6 +765,16 @@ public class DealWithMapping extends ToolUtil {
value = detailMap.get(valueContext.trim()); value = detailMap.get(valueContext.trim());
} }
break; break;
case CUS_MAPPER_SQL: {
Map<String, Object> param = new HashMap<>();
param.put("main", mainMap);
param.put("dt", detailMap);
if (mapper == null) {
throw new RuntimeException("缺少 aiyh_utils.jar依赖无法使用mapper");
}
value = mapper.selectCustomSql(valueContext, param);
}
break;
default: default:
throw new ValueDealException("不支持的取值方式"); throw new ValueDealException("不支持的取值方式");
} }
@ -1080,6 +1115,16 @@ public class DealWithMapping extends ToolUtil {
} }
} }
break; break;
case CUS_MAPPER_SQL: {
Map<String, Object> param = new HashMap<>();
param.put("main", mainMap);
param.put("dt", detailMap);
if (mapper == null) {
throw new RuntimeException("缺少 aiyh_utils.jar依赖无法使用mapper");
}
value = mapper.selectCustomSql(valueContext, param);
}
break;
default: default:
throw new ValueDealException("不支持的取值方式"); throw new ValueDealException("不支持的取值方式");
} }

View File

@ -0,0 +1,49 @@
package weaver.xuanran.wang.bme.action;
import aiyh.utils.Util;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.interfaces.workflow.action.Action;
import weaver.soa.workflow.request.RequestInfo;
import weaver.workflow.request.RequestManager;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 09:51
*/
public class CheckConsumerNameAction implements Action {
private final Logger log = Util.getLogger();
private String wfConsumerField;
private String modelConsumerField;
private String modelName;
@Override
public String execute(RequestInfo request) {
String requestId = request.getRequestid();
String tableName = request.getRequestManager().getBillTableName();
RecordSet rs = new RecordSet();
wfConsumerField = Util.null2DefaultStr(wfConsumerField, "khmc");
modelConsumerField = Util.null2DefaultStr(modelConsumerField, "khmc");
modelName = Util.null2DefaultStr(modelName, "uf_kh");
RequestManager requestManager = request.getRequestManager();
rs.executeQuery("select * from " + tableName + " where requestid = ?", requestId);
rs.next();
String wfConsumer = rs.getString(wfConsumerField);
log.info("wfConsumer : [ " + wfConsumer + " ]");
if(StringUtils.isNotBlank(wfConsumer)){
String sql = "select id from " + modelName + " where " + modelConsumerField + " = ?";
log.info("sql : " + sql + " ,参数: " + wfConsumer);
if (rs.executeQuery(sql, wfConsumer) && rs.next()) {
requestManager.setMessageid(System.currentTimeMillis() + "");
requestManager.setMessagecontent("当前客户名称: " + wfConsumer + " ,在客户表中已经存在请修改后提交!");
return Action.FAILURE_AND_CONTINUE;
}
}
return Action.SUCCESS;
}
}

View File

@ -68,6 +68,7 @@ public class ContractApplyComDateAction implements Action {
* <h2></h2> * <h2></h2>
**/ **/
@RequiredMark @RequiredMark
@PrintParamMark
private String beforeBackField; private String beforeBackField;
/** /**
@ -124,6 +125,7 @@ public class ContractApplyComDateAction implements Action {
log.error(Util.logStr("checkDate:{}, project:{}", checkDate, project)); log.error(Util.logStr("checkDate:{}, project:{}", checkDate, project));
throw new CustomerException("实际验收日期或项目字段字段为空!"); throw new CustomerException("实际验收日期或项目字段字段为空!");
} }
// select a.id,a.requestid from formtable_main_58 a right join uf_cgdd b on a.htbh = b.lcbh where b.id =
String selectSql = "select id,requestid from " + buildContractTable + " where " + buildContractProjectField + " = ?"; String selectSql = "select id,requestid from " + buildContractTable + " where " + buildContractProjectField + " = ?";
if(StringUtils.isNotBlank(relationSql)){ if(StringUtils.isNotBlank(relationSql)){
selectSql = relationSql; selectSql = relationSql;
@ -159,7 +161,6 @@ public class ContractApplyComDateAction implements Action {
params.add(param); params.add(param);
log.info(Util.logStr("关联流程requestId: {}, 流程明细前后字段: {}, 天数: {}, 计算后的日期: {}",tempRequestId, beforeBack, day, computeDate)); log.info(Util.logStr("关联流程requestId: {}, 流程明细前后字段: {}, 天数: {}, 计算后的日期: {}",tempRequestId, beforeBack, day, computeDate));
} }
}
if(CollectionUtils.isNotEmpty(params)){ if(CollectionUtils.isNotEmpty(params)){
if(!rs.executeBatchSql(updateSql,params)){ if(!rs.executeBatchSql(updateSql,params)){
log.error(Util.logStr("更新sql : {}, 参数 : {}", updateSql, params)); log.error(Util.logStr("更新sql : {}, 参数 : {}", updateSql, params));
@ -168,7 +169,7 @@ public class ContractApplyComDateAction implements Action {
}else { }else {
log.error(Util.logStr("明细表: {}不存在数据!", detailContractTable)); log.error(Util.logStr("明细表: {}不存在数据!", detailContractTable));
} }
}
}else{ }else{
log.error(Util.logStr("查询关联项目sql暂未查到数据! sql {} ,{}", selectSql, requestId)); log.error(Util.logStr("查询关联项目sql暂未查到数据! sql {} ,{}", selectSql, requestId));
} }

View File

@ -150,13 +150,15 @@ public class CusInfoToOAUtil {
* @dateTime 2023/2/9 11:51 * @dateTime 2023/2/9 11:51
* @param modelId id * @param modelId id
* @param list * @param list
* @param whereSql * @param whereSql sql
* @return id * @return id
**/ **/
public static List<String> executeBatchByEntity(int modelId, List<?> list, String whereSql){ public static List<String> executeBatchByEntity(int modelId, List<?> list, String whereSql){
String tableName = checkModelId(modelId); String tableName = checkModelId(modelId);
List<LinkedHashMap<String, Object>> params = new ArrayList<>(); List<LinkedHashMap<String, Object>> params = new ArrayList<>();
List<List<String>> whereParams = new ArrayList<>(); List<List<String>> whereParams = new ArrayList<>();
StringBuilder whereSqlSb;
LinkedHashSet<String> whereFields = new LinkedHashSet<>();
for (Object o : list) { for (Object o : list) {
if(Objects.isNull(o)){ if(Objects.isNull(o)){
continue; continue;
@ -165,7 +167,14 @@ public class CusInfoToOAUtil {
Field[] fields = clazz.getDeclaredFields(); Field[] fields = clazz.getDeclaredFields();
LinkedHashMap<String, Object> linkedHashMap = new LinkedHashMap<>(); LinkedHashMap<String, Object> linkedHashMap = new LinkedHashMap<>();
ArrayList<String> whereParam = new ArrayList<>(); ArrayList<String> whereParam = new ArrayList<>();
for (Field field : fields) { List<Field> fieldArr = Arrays.stream(fields).collect(Collectors.toList());
Class<?> superclass = clazz.getSuperclass();
// 找出父类所有的字段
while (superclass != null){
fieldArr.addAll(Arrays.stream(superclass.getDeclaredFields()).collect(Collectors.toList()));
superclass = superclass.getSuperclass();
}
for (Field field : fieldArr) {
field.setAccessible(true); field.setAccessible(true);
String fieldName = field.getName(); String fieldName = field.getName();
Object fieldValue; Object fieldValue;
@ -194,14 +203,25 @@ public class CusInfoToOAUtil {
if(null == sqlUpdateWhereField || !sqlUpdateWhereField.value()){ if(null == sqlUpdateWhereField || !sqlUpdateWhereField.value()){
continue; continue;
} }
if(StringUtils.isBlank(whereSql)){
whereFields.add(fieldName + " = ?");
}
whereParam.add(fieldValue.toString()); whereParam.add(fieldValue.toString());
} }
params.add(linkedHashMap); params.add(linkedHashMap);
whereParams.add(whereParam); whereParams.add(whereParam);
} }
if(!whereFields.isEmpty()){
whereSqlSb = new StringBuilder("select id from #{tableName} where ");
for (String field : whereFields) {
whereSqlSb.append(field).append(" and ");
}
whereSql = whereSqlSb.substring(0, whereSqlSb.length() - 4);
}
return executeBatch(modelId, tableName, params, whereSql, whereParams, true, new ArrayList<>()); return executeBatch(modelId, tableName, params, whereSql, whereParams, true, new ArrayList<>());
} }
/** /**
* <h1></h1> * <h1></h1>
* @author xuanran.wang * @author xuanran.wang

View File

@ -0,0 +1,64 @@
package weaver.xuanran.wang.immc;
import aiyh.utils.Util;
import aiyh.utils.action.SafeCusBaseAction;
import aiyh.utils.annotation.ActionDesc;
import aiyh.utils.annotation.ActionOptionalParam;
import aiyh.utils.annotation.PrintParamMark;
import aiyh.utils.annotation.RequiredMark;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import weaver.xuanran.wang.immc.entity.VmsResponseVoField;
import weaver.xuanran.wang.immc.service.WorkFlowToVmsAndMQService;
/**
* <h1> /kafka</h1>
*
* @author xuanran.wang
* @date 2023/3/30 11:21
*/
@ActionDesc(value = "智己 将流程数据推送到接口/kafka队列中", author = "xuanran.wang")
public class WorkFlowToVmsAndMQ extends SafeCusBaseAction {
private final WorkFlowToVmsAndMQService workFlowToVmsAndMQService = new WorkFlowToVmsAndMQService();
/**
* <h2>
* OA-uat
*
* oa_uat_user/los0cp6aiV1iO1e2
* Topic
* oa_service_immc_topic_uat
*
* 10.184.42.41:9094,10.184.42.42:9094,10.184.42.40:9094
* </h2>
**/
@PrintParamMark
@ActionOptionalParam(value = "", desc = "kafka配置文件名称")
private String kafkaConfig;
@PrintParamMark
@RequiredMark("建模配置文件唯一标识")
private String onlyMark;
@PrintParamMark
@ActionOptionalParam(value = "code", desc = "接口成功标识字段")
private String successField;
@PrintParamMark
@ActionOptionalParam(value = "200", desc = "接口成功标识默认200")
private String successVal;
@PrintParamMark
@ActionOptionalParam(value = "message", desc = "报错返回信息字段")
private String msg;
@Override
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
log.info("-------------- " + requestId + " begin --------------");
VmsResponseVoField vmsResponseVoField = VmsResponseVoField
.builder()
.successField(Util.null2DefaultStr(successField, "code"))
.successVal(Util.null2DefaultStr(successVal, "200"))
.message(Util.null2DefaultStr(msg, "message"))
.build();
workFlowToVmsAndMQService.workFlowToVmsAndMQ(onlyMark, billTable, requestId, vmsResponseVoField, kafkaConfig);
}
}

View File

@ -0,0 +1,50 @@
package weaver.xuanran.wang.immc.cusfieldvalue;
import aiyh.utils.Util;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.xiao.commons.config.interfacies.CusInterfaceGetValue;
import weaver.xiao.commons.config.interfacies.CusInterfaceListValue;
import weaver.xuanran.wang.immc.mapper.ImMcMapper;
import java.util.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/30 15:11
*/
public class CusListValue implements CusInterfaceGetValue {
private final Logger log = Util.getLogger();
private final ImMcMapper mapper = Util.getMapper(ImMcMapper.class);
@Override
public Object execute(Map<String, Object> mainMap, Map<String, Object> detailMap, String currentValue, Map<String, String> pathParam) {
List<Object> list = new ArrayList<>();
log.info("pathParam : \n" + JSONObject.toJSONString(pathParam));
String attachmentField = Util.null2DefaultStr(pathParam.get("attachmentField"), "");
String cusSql = Util.null2DefaultStr(pathParam.get("cusSql"), "");
if(StringUtils.isNotBlank(cusSql)){
String docIds = "";
if (StringUtils.isNotBlank(attachmentField)) {
List<String> attachment = new ArrayList<>();
for (String item : attachmentField.split(",")) {
String filedValue = Util.null2DefaultStr(mainMap.get(item),"");
if(StringUtils.isNotBlank(Util.null2DefaultStr(mainMap.get(item),""))){
attachment.add(filedValue);
}
}
docIds = StringUtils.join(attachment, ",");
}
cusSql = cusSql
.replace("{?docIds}", "( " + docIds + " )")
.replace("{?requestid}",Util.null2DefaultStr(mainMap.get("requestid"),""));
List<Map<String, String>> attachmentInfo = mapper.getAttachmentInfo(cusSql);
list.addAll(attachmentInfo);
}
return list;
}
}

View File

@ -0,0 +1,23 @@
package weaver.xuanran.wang.immc.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.kie.api.definition.rule.All;
/**
* <h1>vms</h1>
*
* @author xuanran.wang
* @date 2023/3/30 14:23
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class VmsResponseVoField {
private String successField;
private String successVal;
private String message;
}

View File

@ -0,0 +1,20 @@
package weaver.xuanran.wang.immc.mapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.annotation.recordset.SqlString;
import java.util.List;
import java.util.Map;
/**
* <h1>dao</h1>
*
* @author xuanran.wang
* @date 2023/3/30 15:27
*/
@SqlMapper
public interface ImMcMapper {
@Select(custom = true)
List<Map<String, String>> getAttachmentInfo(@SqlString String sql);
}

View File

@ -0,0 +1,165 @@
package weaver.xuanran.wang.immc.service;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.ProducerRecord;
import org.apache.kafka.clients.producer.RecordMetadata;
import org.apache.log4j.Logger;
import weaver.conn.RecordSet;
import weaver.xiao.commons.config.entity.RequestMappingConfig;
import weaver.xiao.commons.config.service.DealWithMapping;
import weaver.xuanran.wang.common.util.CommonUtil;
import weaver.xuanran.wang.immc.entity.VmsResponseVoField;
import javax.ws.rs.core.MediaType;
import java.io.IOException;
import java.util.Map;
/**
* <h1>vms</h1>
*
* @Author xuanran.wang
* @Date 2022/12/1 10:58
*/
public class WorkFlowToVmsAndMQService {
private static final int SUCCESS_CODE = 200;
private final DealWithMapping dealWithMapping = new DealWithMapping();
private final Logger log = Util.getLogger(); // 获取日志对象
private final HttpUtils httpUtils = new HttpUtils();
// 表单字段
private static final String MQ_SUCCESS = "mq_success";
// 表单字段
private static final String VMS_SUCCESS = "vms_success";
private static final String SUCCESS = "0";
{
httpUtils.getGlobalCache().header.put("Content-Type", MediaType.APPLICATION_JSON); // 全局请求头
}
/**
* <h1></h1>
*
* @param onlyMark
* @param billTable
* @param requestId id
* @param vmsResponseVoField vms
* @param config kafka
* @author xuanran.wang
* @dateTime 2022/12/5 17:05
**/
public void workFlowToVmsAndMQ(String onlyMark, String billTable, String requestId, VmsResponseVoField vmsResponseVoField, String config) {
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); // 将配置参数通过唯一标识查询处理成树形结构
String selectMainSql = CommonUtil.getSelectSql(requestMappingConfig, billTable);
log.info(Util.logStr("查询主表数据sql : {}, requestId : {}", selectMainSql, requestId));
RecordSet recordSet = new RecordSet();
recordSet.executeQuery(selectMainSql, requestId);
recordSet.next();
String url = requestMappingConfig.getRequestUrl();
dealWithMapping.setMainTable(billTable);
Map<String, Object> param = dealWithMapping.getRequestParam(recordSet, requestMappingConfig);
String vmsSuccess = Util.null2DefaultStr(recordSet.getString(VMS_SUCCESS),"");
String mqSuccess = Util.null2DefaultStr(recordSet.getString(MQ_SUCCESS),"");
if(!SUCCESS.equals(vmsSuccess)){
ResponeVo responeVo;
try {
responeVo = httpUtils.apiPost(url, param);
} catch (IOException e) {
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
parseResponseVo(responeVo, url, param, vmsResponseVoField);
updateWorkFlow(VMS_SUCCESS, billTable, requestId);
}
if(!SUCCESS.equals(mqSuccess) && StringUtils.isNotBlank(config)){
sendToMQ(config, param);
updateWorkFlow(MQ_SUCCESS, billTable, requestId);
}
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2022/12/23 11:25
* @param responseVo
* @param url
* @param requestParam
**/
private void parseResponseVo(ResponeVo responseVo, String url, Map<String, Object> requestParam, VmsResponseVoField vmsResponseVoField){
if (responseVo.getCode() != SUCCESS_CODE) { // 相应状态码
log.error(Util.logStr("can not fetch [{}]this request params is [{}]" + // 构建日志字符串
"this request heard is [{}]but response status code is [{}]" +
"this response is [{}]", url, JSON.toJSON(requestParam), JSON.toJSONString(httpUtils.getGlobalCache().header), responseVo.getCode(), // 相应状态码
responseVo.getEntityString())); // 相应内容
throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
log.info(Util.logStr("vmsResponseVoField: {}", JSONObject.toJSONString(vmsResponseVoField)));
Map<String, Object> response = responseVo.getResponseMap(); // 根据相应结果转化为map集合
String successCode = Util.null2DefaultStr(response.get(vmsResponseVoField.getSuccessField()), "");
if (!vmsResponseVoField.getSuccessVal().equals(successCode)) {
throw new CustomerException(Util.logStr("接口响应码不为 : [{}],接口响应信息: {}", successCode, Util.null2DefaultStr(response.get(vmsResponseVoField.getMessage()), ""))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
}
/**
* <h1>kafka</h1>
* @author xuanran.wang
* @dateTime 2023/3/30 14:56
* @param kafkaConfig kafka
* @param message
**/
public void sendToMQ(String kafkaConfig, Map<String, Object> message){
KafkaProducer<String, String> producer = null;
try {
Map<String, Object> configMap = Util.getProperties2Map(kafkaConfig);
if(MapUtils.isEmpty(configMap)){
throw new CustomerException("please check /web-inf/prop2map has " + kafkaConfig + ".properties");
}
log.info("kafkaConfig : " + JSONObject.toJSONString(configMap));
String topic = Util.null2DefaultStr(configMap.get("topic"),"");
if(StringUtils.isBlank(topic)){
throw new CustomerException("kafka properties topic can not null!");
}
producer = new KafkaProducer<>(configMap);
// 发送消息到指定主题
ProducerRecord<String, String> record = new ProducerRecord<>(topic, JSONObject.toJSONString(message));
try {
RecordMetadata recordMetadata = producer.send(record).get();
log.info(Util.logStr("send mq recordMetadata: {}", JSONObject.toJSONString(recordMetadata)));
}catch (Exception e){
throw new CustomerException(Util.logStr("producer send error: {}!", e.getMessage()));
}
}catch (Exception e){
throw new CustomerException(Util.logStr("send to kafka error!: {}", e.getMessage()));
}finally {
// 关闭Kafka生产者实例
if(producer != null){
producer.close();
}
}
}
/**
* <h1>sql</h1>
* @author xuanran.wang
* @dateTime 2023/3/30 19:18
* @param field
* @param tableName
* @param requestId id
**/
public void updateWorkFlow(String field, String tableName, String requestId){
String updateSQL = "update " + tableName + " set " + field + " = " + SUCCESS + " where requestid = ?";
RecordSet recordSet = new RecordSet();
if(!recordSet.executeUpdate(updateSQL, requestId)){
log.error(Util.logStr("update field error! sql: {}, requestId: {}", updateSQL, requestId));
throw new CustomerException("更新表单字段失败!");
}
}
}

View File

@ -0,0 +1,26 @@
package weaver.xuanran.wang.sh_bigdata.common.entity;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.function.Consumer;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 19:34
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CusSuccess {
private String successField;
private int successValue;
private String errorMsg;
private String dataKey;
private Object response;
}

View File

@ -0,0 +1,25 @@
package weaver.xuanran.wang.sh_bigdata.common.entity;
import lombok.Data;
/**
* <h1>token</h1>
*
* @author xuanran.wang
* @date 2023/4/7 23:29
*/
@Data
public class CusToken {
/**
* <h2>token</h2>
**/
private String access_token;
/**
* <h2>(s)</h2>
**/
private long expires_in;
/**
* <h2></h2>
**/
private long expiryTime;
}

View File

@ -0,0 +1,74 @@
package weaver.xuanran.wang.sh_bigdata.common.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.httpUtil.ResponeVo;
import aiyh.utils.httpUtil.util.HttpUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
import java.io.IOException;
import java.util.Map;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/4 11:51
*/
public class RequestMasterPlate{
private final Logger log = Util.getLogger();
private final HttpUtils httpUtils = new HttpUtils();
private static final int HTTP_SUCCESS_CODE = 200;
public <T> T apiGet(String url, Map<String, Object> params, Map<String, String> headers, CusSuccess cusSuccess){
ResponeVo responeVo;
try {
responeVo = httpUtils.apiGet(url, params, headers);
} catch (IOException e) {
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
return parseResponse(url, responeVo, params, cusSuccess);
}
public <T> T apiPost(String url, Object o, Map<String, String> headers, CusSuccess cusSuccess){
ResponeVo responeVo;
try {
responeVo = httpUtils.apiPostObject(url, o, headers);
} catch (IOException e) {
throw new CustomerException(Util.logStr("发送请求发生异常! : {}", e.getMessage())); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
return parseResponse(url, responeVo, o, cusSuccess);
}
public <T> T parseResponse(String url, ResponeVo responseVo, Object o, CusSuccess cusSuccess){
if (responseVo.getCode() != HTTP_SUCCESS_CODE) { // 相应状态码
log.error(Util.logStr("can not fetch [{}]this request params is [{}]" + // 构建日志字符串
"this request heard is [{}]but response status code is [{}]" +
"this response is [{}]", url, JSON.toJSON(o), JSON.toJSONString(httpUtils.getGlobalCache().header), responseVo.getCode(), // 相应状态码
responseVo.getEntityString())); // 相应内容
throw new CustomerException(Util.logStr("can not fetch [{}]", url)); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
Map<String, Object> response = responseVo.getResponseMap(); // 根据相应结果转化为map集合
cusSuccess.setResponse(response);
int responseValue = Util.getIntValue(Util.null2DefaultStr(response.get(cusSuccess.getSuccessField()), ""),-1);
if (cusSuccess.getSuccessValue() != responseValue) {
throw new CustomerException(Util.logStr("接口响应码不为: [{}], 接口响应信息: {}", cusSuccess.getSuccessValue(), Util.null2DefaultStr(response.get(cusSuccess.getErrorMsg()), ""))); // 自定义异常类 create 2022/3/9 2:20 PM 构建日志字符串
}
String[] split = Util.null2DefaultStr(cusSuccess.getDataKey(),"").split("\\.");
int len = split.length;
if(len == 0 || StringUtils.isBlank(cusSuccess.getDataKey())){
return (T)response;
}
for (int i = 0; i < len - 1; i++) {
response = (Map) response.get(split[i]);
}
return (T) response.get(split[len - 1]);
}
}

View File

@ -0,0 +1,167 @@
package weaver.xuanran.wang.sh_bigdata.common.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.workflow.request.todo.RequestStatusObj;
import weaver.xuanran.wang.common.mapper.CommonMapper;
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTask;
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
import weaver.xuanran.wang.sh_bigdata.task_async.mapper.SendTodoTaskMapper;
import java.util.*;
import java.util.stream.Collectors;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 16:47
*/
@Data
public class SendTodoTaskUtil {
private final SendTodoTaskMapper mapper = Util.getMapper(SendTodoTaskMapper.class);
private final CommonMapper commonMapper = Util.getMapper(CommonMapper.class);
private String appId;
private String oaAddress;
private Logger log = Util.getLogger();
{
oaAddress = getOAAddress();
}
/**
* <h1>/</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 17:01
* @param list /
* @return
**/
public List<RequestStatusObj> distantList(List<RequestStatusObj> list){
if(CollectionUtils.isEmpty(list)){
return new ArrayList<>();
}
HashMap<String, RequestStatusObj> obj = new HashMap<>();
for (RequestStatusObj statusObj : list) {
String str = statusObj.getRequestid() + "" + statusObj.getUser().getUID();
if(obj.containsKey(str)){
continue;
}
obj.put(str, statusObj);
}
return new ArrayList<>(obj.values());
}
/**
* <h1>oa</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 17:29
* @param objs
* @return
**/
public List<CusTodoTask> getTodoTaskInfo(List<RequestStatusObj> objs){
ArrayList<CusTodoTask> res = new ArrayList<>();
for (RequestStatusObj obj : objs) {
String taskId = getTaskId(0, obj);
CusTodoTask todoTask = new CusTodoTask();
int requestId = obj.getRequestid();
int userId = obj.getUser().getUID();
todoTask.setTaskNum(taskId);
todoTask.setAppId(appId);
todoTask.setTaskName(obj.getRequestnamenew());
todoTask.setTaskDesc(obj.getRequestnamenew());
todoTask.setLinkUrl(oaAddress + "/spa/workflow/static4form/index.html?#/main/workflow/req?requestid="+requestId);
todoTask.setMobileLinkUrl(oaAddress + "/spa/workflow/static4mobileform/index.html?#/req?requestid="+requestId);
todoTask.setSender(getConvertHrm(0, obj, obj.getCreator().getUID() + ""));
todoTask.setReceiver(getConvertHrm(1, obj,userId + ""));
res.add(todoTask);
}
return res;
}
/**
* <h1>oa</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 17:29
* @param objs
* @return
**/
public List<CusDoneTask> getDoneTaskInfo(List<RequestStatusObj> objs){
ArrayList<CusDoneTask> res = new ArrayList<>();
for (RequestStatusObj obj : objs) {
String taskId = getTaskId(1, obj);
List<String> list = mapper.queryUnSendTodoTaskList(taskId);
for (String num : list) {
CusDoneTask doneTask = new CusDoneTask();
doneTask.setTaskNum(num);
doneTask.setStatus(1);
doneTask.setAppId(appId);
res.add(doneTask);
}
}
return res;
}
/**
* <h1>id</h1>
* @author xuanran.wang
* @dateTime 2023/4/9 17:25
* @param type 0 1
* @param obj
* @return ID
**/
public String getTaskId(int type, RequestStatusObj obj){
String taskId = obj.getRequestid() + "" + obj.getUser().getUID();
if(type == 0){
taskId += (System.currentTimeMillis() / 1000);
}
return taskId;
}
/**
* <h1>id</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 16:55
* @param type 0: 1
* @param obj
* @param hrmId ID
* @return id
**/
public String getConvertHrm(int type, RequestStatusObj obj, String hrmId){
String convertSql;
if(type == 0){
convertSql = Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("hrmSenderConvertRuleSql"),"");
}else {
convertSql = Util.null2DefaultStr(ShBigDataUtil.getPropertiesValByKey("hrmReceiveConvertRuleSql"),"");
}
if(StringUtils.isNotBlank(convertSql) && StringUtils.isNotBlank(hrmId)){
List<String> ids = Arrays.stream(hrmId.split(",")).collect(Collectors.toList());
int requestId = obj.getRequestid();
convertSql = convertSql
.replace("{?.requestId}", requestId + "")
.replace("{?.nodeId}",obj.getNodeid() + "");
return Util.null2DefaultStr(StringUtils.join(mapper.selectHrmConvertId(convertSql, ids), ","),hrmId + "");
}
return hrmId + "";
}
/**
* <h1>oa</h1>
* @author xuanran.wang
* @dateTime 2022/12/22 13:51
* @return OA
**/
public String getOAAddress(){
String address = mapper.queryOAAddress();
if(StringUtils.isBlank(address)){
throw new CustomerException("OAAddress can not null!");
}
return address;
}
}

View File

@ -0,0 +1,120 @@
package weaver.xuanran.wang.sh_bigdata.common.util;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusToken;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.annotations.CusDbEntityMapping;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/4 11:34
*/
public class ShBigDataUtil {
private static final String CONFIG_NAME = "ShBigdataConf";
private static final List<String> WHILTE_LIST = new ArrayList<>();
static {
WHILTE_LIST.add("hrmSenderConvertRuleSql");
WHILTE_LIST.add("hrmReceiveConvertRuleSql");
}
/**
* <h1>token</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 19:59
* @return token
**/
public static String getToken(){
return TokenUtil.getToken();
}
/**
* <h1>posturltoken</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 20:11
* @param url
* @return tokenurl
**/
public static String addToken2Url(String url){
return url + "?access_token=" + getToken();
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/4 11:47
* @return map
**/
public static Map<String, Object> getConfFromProperties(){
Map<String, Object> configMap = Util.getProperties2Map(CONFIG_NAME);
if(MapUtils.isEmpty(configMap)){
throw new CustomerException(Util.logStr("/web-inf/prop/prop2map/{}.properties can not empty!", CONFIG_NAME));
}
return configMap;
}
/**
* <h1>keyvalue</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 10:45
* @param key key
* @return value
**/
public static String getPropertiesValByKey(String key){
Map<String, Object> conf = getConfFromProperties();
String value = Util.null2DefaultStr(conf.get(key), "");
if(StringUtils.isBlank(value) && !WHILTE_LIST.contains(key)){
throw new CustomerException(Util.logStr("/web-inf/prop/prop2map/{}.properties the key = {} can not empty!",CONFIG_NAME, key));
}
return value;
}
/**
* <h1>map</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 12:27
* @param type 0: , 1:
* @param o
* @return
**/
public static LinkedHashMap<String, Object> parseCusDbEntityMapping(int type, Object o) throws IllegalAccessException {
Class<?> clazz = o.getClass();
LinkedHashMap<String, Object> params = new LinkedHashMap<>();
Field[] fields = clazz.getDeclaredFields();
Field[] superFields = clazz.getSuperclass().getDeclaredFields();
List<Field> collect = Arrays.stream(fields).collect(Collectors.toList());
if(superFields.length > 0){
collect.addAll(Arrays.stream(superFields).collect(Collectors.toList()));
}
for (Field field : collect) {
CusDbEntityMapping cusDbEntityMapping = field.getDeclaredAnnotation(CusDbEntityMapping.class);
if(cusDbEntityMapping != null){
String[] dbFields = cusDbEntityMapping.dbFiled();
String dbField;
if(dbFields.length == 0 || type == -1){
dbField = field.getName();
}else {
int index = Math.min(dbFields.length, type);
dbField = dbFields[index - 1];
}
field.setAccessible(true);
params.put(dbField, field.get(o));
}
}
return params;
}
}

View File

@ -0,0 +1,78 @@
package weaver.xuanran.wang.sh_bigdata.common.util;
import aiyh.utils.Util;
import com.alibaba.fastjson.JSONObject;
import org.apache.dubbo.common.serialize.fastjson.FastJsonObjectOutput;
import org.apache.log4j.Logger;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusToken;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <h1>token </h1>
*
* @author xuanran.wang
* @date 2023/4/7 23:27
*/
public class TokenUtil {
private static final Logger log = Util.getLogger();
private static volatile CusToken cusToken = null;
private static final CusSuccess tokenCusSuccess = CusSuccess.builder()
.successField("errcode")
.successValue(0)
.errorMsg("msg")
.dataKey("")
.build();
private static final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
/**
* <h1>token</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 19:59
* @return token
**/
public static String getToken() {
if(cusToken == null){
synchronized (TokenUtil.class){
if(cusToken == null){
return getTokenByHTTP();
}
}
}
long expiryTime = cusToken.getExpiryTime();
if(new Date().getTime() >= expiryTime){
synchronized (TokenUtil.class){
expiryTime = cusToken.getExpiryTime();
if(new Date().getTime() >= expiryTime){
return getTokenByHTTP();
}
}
}
return cusToken.getAccess_token();
}
/**
* <h1>token</h1>
* @author xuanran.wang
* @dateTime 2023/4/7 23:49
* @return token
**/
private static String getTokenByHTTP(){
HashMap<String, Object> params = new HashMap<>();
// 接口调用地址
String tokenUrl = ShBigDataUtil.getPropertiesValByKey("tokenUrl");
// 密钥
String corpSecret = ShBigDataUtil.getPropertiesValByKey("corpSecret");
params.put("corpsecret", corpSecret);
Map<String, Object> tokenMap = requestMasterPlate.apiGet(tokenUrl, params, new HashMap<>(), tokenCusSuccess);
cusToken = JSONObject.parseObject(JSONObject.toJSONString(tokenMap), CusToken.class);
long expiryBeforeTime = Util.getIntValue(ShBigDataUtil.getPropertiesValByKey("expiryBeforeTime"), 5);
// 默认少5分钟过期
cusToken.setExpiryTime(new Date().getTime() + (cusToken.getExpires_in() * 1000) - (60 * expiryBeforeTime * 1000));
log.info("http token => " + JSONObject.toJSONString(cusToken));
return cusToken.getAccess_token();
}
}

View File

@ -0,0 +1,106 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async;
import weaver.hrm.resource.HrmSynDAO;
import weaver.interfaces.hrm.*;
import java.util.HashMap;
import java.util.Map;
/**
* <h1>/</h1>
*
* @author xuanran.wang
* @date 2023/4/4 10:21
*/
public class OrganizationHrmSyncFromOtherSys implements HrmSynService {
private HashMap<String, Object> synResult;
public OrganizationHrmSyncFromOtherSys(){
this.removeSynResult();
}
@Override
public String SynTimingToOASubCompany() {
return null;
}
@Override
public String SynTimingToOADepartment() {
return null;
}
@Override
public String SynTimingToOAJobtitle() {
return null;
}
@Override
public String SynTimingToOAHrmResource() {
return null;
}
@Override
public void SynTimingFromOASubCompany(SubCompanyBean[] subCompanyBeans) {
}
@Override
public void SynTimingFromOADepartment(DepartmentBean[] departmentBeans) {
}
@Override
public void SynTimingFromOAJobtitle(JobTitleBean[] jobTitleBeans) {
}
@Override
public void SynTimingFromOAHrmResource(UserBean[] userBeans) {
}
@Override
public void SynInstantSubCompany(SubCompanyBean subCompanyBean) {
}
@Override
public void SynInstantDepartment(DepartmentBean departmentBean) {
}
@Override
public void SynInstantJobtitle(JobTitleBean jobTitleBean) {
}
@Override
public void SynInstantHrmResource(UserBean userBean) {
}
@Override
public boolean SynSendMessage(String s, String s1, String s2, String s3, String s4) {
return false;
}
@Override
public HashMap getSynResult() {
return this.synResult;
}
@Override
public void removeSynResult() {
this.synResult = new HashMap<>();
}
private Map<String, Object> buildItemMap(String pkCode, String pk, String memo, String success, String error) {
//保存结果
Map<String, Object> res = new HashMap<>();
res.put(weaver.hrm.resource.HrmSynDAO.OUTPK, pkCode);
res.put(weaver.hrm.resource.HrmSynDAO.PK, pk);
res.put(weaver.hrm.resource.HrmSynDAO.Memo, memo);
res.put(weaver.hrm.resource.HrmSynDAO.Success, success);
res.put(HrmSynDAO.ErrorMessage, error);
return res;
}
}

View File

@ -0,0 +1,16 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.annotations;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 11:55
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD})
@Documented
public @interface CusDbEntityMapping {
String[] dbFiled() default {};
}

View File

@ -0,0 +1,53 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity;
import aiyh.utils.annotation.recordset.SqlDbFieldAnn;
import lombok.Data;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.annotations.CusDbEntityMapping;
import java.util.List;
/**
* <h1>/ </h1>
*
* @author xuanran.wang
* @date 2023/4/4 11:03
*/
@Data
public class OtherSysDepartment {
/**
* <h2>id</h2>
**/
@CusDbEntityMapping(dbFiled ={"outkey"})
private int id;
/**
* <h2></h2>
**/
@CusDbEntityMapping(dbFiled = {"subcompanyname", "departmentname"})
private String name;
/**
* <h2>id1</h2>
**/
@CusDbEntityMapping(dbFiled = {"supsubcomid", "supdepid"})
private int parentid;
/**
* <h2>
* orderorderidid[0, 2^32)
* </h2>
**/
@CusDbEntityMapping(dbFiled = {"showorder"})
private int order;
/**
* <h2>id</h2>
**/
@CusDbEntityMapping(dbFiled = {"supsubcomid","supsubcomid1"})
private int subCompanyId;
/**
* <h2>
* ,0:,1:
* </h2>
**/
private int hasChild;
private List<OtherSysDepartment> childList;
}

View File

@ -0,0 +1,25 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.mapper;
import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.annotation.recordset.SqlString;
import aiyh.utils.annotation.recordset.Update;
import io.swagger.models.auth.In;
import java.util.Map;
/**
* <h1> mapper</h1>
*
* @author xuanran.wang
* @date 2023/4/6 11:05
*/
@SqlMapper
public interface OrgHrmAsyncMapper {
@Select("select outkey, id from HrmSubCompany where outkey != '' and outkey is not null")
Map<Integer, Integer> selectSubCompany();
@Update(custom = true)
boolean updateSubInfo(@SqlString String sql, Map<String, Object> params);
}

View File

@ -0,0 +1,32 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.service;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OtherSysDepartment;
import java.util.List;
/**
* <h1>/ </h1>
*
* @author xuanran.wang
* @date 2023/4/4 11:09
*/
public interface OrgHrmAsyncApiService {
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/4 11:13
* @return
**/
List<Object> getUserInfo();
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/4 11:13
* @return
**/
List<OtherSysDepartment> getDepartmentInfo();
}

View File

@ -0,0 +1,31 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.service;
import io.swagger.models.auth.In;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OtherSysDepartment;
import java.util.List;
import java.util.Map;
/**
* <h1></ /h1>
*
* @author xuanran.wang
* @date 2023/4/4 11:07
*/
public interface OrgHrmAsyncService {
/**
* <h1> outKey idmap</h1>
* @author xuanran.wang
* @dateTime 2023/4/6 13:44
* @return outKey idmap
**/
Map<Integer, Integer> initSubCompany();
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/6 13:44
**/
List<OtherSysDepartment> asyncDepartment();
}

View File

@ -0,0 +1,49 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.impl;
import com.alibaba.fastjson.JSONObject;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OtherSysDepartment;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.OrgHrmAsyncApiService;
import weaver.xuanran.wang.sh_bigdata.common.util.RequestMasterPlate;
import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* <h1>
* /
* </h1>
*
* @author xuanran.wang
* @date 2023/4/4 11:24
*/
public class OrgHrmAsyncApiServiceImpl implements OrgHrmAsyncApiService {
private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
@Override
public List<Object> getUserInfo() {
return null;
}
@Override
public List<OtherSysDepartment> getDepartmentInfo() {
String departmentInfoUrl = ShBigDataUtil.getPropertiesValByKey("departmentInfoUrl");
HashMap<String, Object> params = new HashMap<>();
params.put("access_token", ShBigDataUtil.getToken());
CusSuccess cusSuccess = CusSuccess.builder()
.successField("code")
.successValue(0)
.errorMsg("msg")
.dataKey("data.department")
.build();
List<Map<String, Object>> list = requestMasterPlate.apiGet(departmentInfoUrl, params, new HashMap<>(), cusSuccess);
List<OtherSysDepartment> res = new ArrayList<>();
for (Object o : list) {
res.add(JSONObject.parseObject(JSONObject.toJSONString(o), OtherSysDepartment.class));
}
return res;
}
}

View File

@ -0,0 +1,163 @@
package weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.impl;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import org.apache.commons.collections.CollectionUtils;
import weaver.conn.RecordSet;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.matrix.MatrixUtil;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.entity.OtherSysDepartment;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.mapper.OrgHrmAsyncMapper;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.OrgHrmAsyncApiService;
import weaver.xuanran.wang.sh_bigdata.org_hrm_async.service.OrgHrmAsyncService;
import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 10:10
*/
public class OrgHrmAsyncServiceImpl implements OrgHrmAsyncService {
private final OrgHrmAsyncApiService orgHrmAsyncApiService = new OrgHrmAsyncApiServiceImpl();
private final OrgHrmAsyncMapper orgHrmAsyncMapper = Util.getMapper(OrgHrmAsyncMapper.class);
private final SubCompanyComInfo sci = new SubCompanyComInfo();
@Override
public Map<Integer, Integer> initSubCompany() {
return orgHrmAsyncMapper.selectSubCompany();
}
@Override
public List<OtherSysDepartment> asyncDepartment() {
List<OtherSysDepartment> departmentInfo = orgHrmAsyncApiService.getDepartmentInfo();
//TODO 分部(条件待确认)
List<OtherSysDepartment> subList = departmentInfo
.stream()
.filter(item -> -1 == item.getParentid())
.sorted(Comparator.comparing(OtherSysDepartment::getId))
.collect(Collectors.toList());
addHrmSubCompany(subList);
// 过滤出父节点并根据id进行升序排序
List<OtherSysDepartment> rootDepList = departmentInfo
.stream()
.filter(item -> 0 == item.getHasChild() && -1 != item.getParentid())
.sorted(Comparator.comparing(OtherSysDepartment::getId))
.collect(Collectors.toList());
return null;
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/6 13:37
* @param departmentList
**/
public void addHrmSubCompany(List<OtherSysDepartment> departmentList){
//新增的分部id
int subId;
char separator = weaver.general.Util.getSeparator();
RecordSet rsSch = new RecordSet();
// 分部数据
Map<Integer, Integer> subCompany = initSubCompany();
for (OtherSysDepartment department : departmentList) {
subId = Util.getIntValue(Util.null2DefaultStr(subCompany.get(department.getId()),""),-1);
if(subId < 0){
String para = department.getName() + separator + department.getName() + separator + "1" + separator
+ department.getId()+ separator + "" + separator +department.getOrder();
rsSch.executeProc("HrmSubCompany_Insert", para);
if (rsSch.next()) {
subId = rsSch.getInt(1);
}
}
updateTable("HrmSubCompany", subId, 0, department);
}
//清除全部分部缓存
sci.removeCompanyCache();
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/6 13:37
* @param departmentList
**/
public void addHrmDepartment(List<OtherSysDepartment> departmentList){
//新增的分部id
int id = 0;
char separator = weaver.general.Util.getSeparator();
RecordSet rsSch = new RecordSet();
for (OtherSysDepartment department : departmentList) {
String para = department.getName() + separator + department.getName() + separator + "1" + separator
+ department.getParentid() + separator + "" + separator +department.getOrder();
rsSch.executeProc("HrmSubCompany_Insert", para);
if (rsSch.next()) {
id = rsSch.getInt(1);
updateTable("HrmSubCompany", id, 0, department);
}
}
//清除全部分部缓存
sci.removeCompanyCache();
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/4/6 13:35
* @param tableName
* @param id id
* @param type
* @param o
**/
public void updateTable(String tableName, int id, int type, Object o){
StringBuilder sb = new StringBuilder("update ");
sb.append(tableName).append(" set ");
Map<String, Object> params;
try {
params = ShBigDataUtil.parseCusDbEntityMapping(type, o);
}catch (Exception e){
throw new CustomerException("parseCusDbEntityMapping error!");
}
for (Map.Entry<String, Object> entry : params.entrySet()) {
sb.append(entry.getKey())
.append(" = #{")
.append(entry.getKey())
.append("},");
}
sb.deleteCharAt(sb.length() - 1);
sb.append(" where id = ").append(id);
boolean success = orgHrmAsyncMapper.updateSubInfo(sb.toString(), params);
if(!success){
throw new CustomerException(Util.logStr("update {} sql error!", tableName));
}
//同步分部数据到矩阵
MatrixUtil.updateSubcompayData(String.valueOf(id));
}
public void setChildList(List<OtherSysDepartment> departmentList){
if(departmentList.size() == 0){
return;
}
for (OtherSysDepartment department : departmentList) {
List<OtherSysDepartment> childList = departmentList
.stream()
.filter(item -> department.getId() == item.getParentid())
.collect(Collectors.toList());
department.setChildList(childList);
if(CollectionUtils.isNotEmpty(childList)){
setChildList(childList);
}
}
}
}

View File

@ -0,0 +1,162 @@
package weaver.xuanran.wang.sh_bigdata.task_async;
import aiyh.utils.ThreadPoolConfig;
import aiyh.utils.Util;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.ofs.interfaces.SendRequestStatusDataInterfaces;
import weaver.workflow.request.todo.DataObj;
import weaver.workflow.request.todo.RequestStatusObj;
import weaver.xuanran.wang.sh_bigdata.common.util.SendTodoTaskUtil;
import weaver.xuanran.wang.sh_bigdata.task_async.service.impl.SendTodoTaskServiceImpl;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 15:43
*/
public class SendTodoTaskImpl implements SendRequestStatusDataInterfaces {
/**
* id
*/
public String id;
/**
*
*/
public String syscode;
/**
* URL
*/
public String serverurl;
/**
*
*/
public ArrayList<String> workflowwhitelist;
/**
*
*/
public ArrayList<String> userwhitelist;
public String getId() {
return id;
}
public String getSyscode() {
return syscode;
}
public String getServerurl() {
return serverurl;
}
public ArrayList<String> getWorkflowwhitelist() {
return workflowwhitelist;
}
public ArrayList<String> getUserwhitelist() {
return userwhitelist;
}
private final SendTodoTaskServiceImpl sendTodoTaskService = new SendTodoTaskServiceImpl();
private final ExecutorService pool = ThreadPoolConfig.createThreadPoolInstance();
private final SendTodoTaskUtil sendTodoTaskUtil = new SendTodoTaskUtil();
private final Logger log = Util.getLogger();
@Override
public void SendRequestStatusData(ArrayList<DataObj> dataList) {
for (DataObj dataObj : dataList) {
List<RequestStatusObj> todoList = sendTodoTaskUtil.distantList(dataObj.getTododatas());
List<RequestStatusObj> doneList = sendTodoTaskUtil.distantList(dataObj.getDonedatas());
try {
pool.execute(() -> {
log.info("todoList => \n" + JSONObject.toJSONString(todoList));
log.info("doneList => \n" + JSONObject.toJSONString(doneList));
if (CollectionUtils.isNotEmpty(todoList)) {
sendTodoTaskService.sendTodo(todoList);
}
if (CollectionUtils.isNotEmpty(doneList)) {
sendTodoTaskService.sendDone(doneList);
}
});
} catch (Exception e) {
log.error("SendTodoTaskImpl error! " + e.getMessage());
}
}
}
/**
* JSON
*
* @param jsonStr
* @return
*/
public static String formatJson(String jsonStr) {
if (null == jsonStr || "".equals(jsonStr))
return "";
StringBuilder sb = new StringBuilder();
char last = '\0';
char current = '\0';
int indent = 0;
boolean isInQuotationMarks = false;
for (int i = 0; i < jsonStr.length(); i++) {
last = current;
current = jsonStr.charAt(i);
switch (current) {
case '"':
if (last != '\\') {
isInQuotationMarks = !isInQuotationMarks;
}
sb.append(current);
break;
case '{':
case '[':
sb.append(current);
if (!isInQuotationMarks) {
sb.append('\n');
indent++;
addIndentBlank(sb, indent);
}
break;
case '}':
case ']':
if (!isInQuotationMarks) {
sb.append('\n');
indent--;
addIndentBlank(sb, indent);
}
sb.append(current);
break;
case ',':
sb.append(current);
break;
default:
sb.append(current);
}
}
return sb.toString();
}
/**
* space()
*
* @param sb
* @param indent
*/
private static void addIndentBlank(StringBuilder sb, int indent) {
for (int i = 0; i < indent; i++) {
sb.append('\t');
}
}
}

View File

@ -0,0 +1,23 @@
package weaver.xuanran.wang.sh_bigdata.task_async.entity;
import aiyh.utils.annotation.recordset.SqlOracleDbFieldAnn;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import weaver.xuanran.wang.common.annocation.SqlFieldMapping;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 22:21
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CusDoneTask {
@SqlFieldMapping
private String taskNum;
private int status;
private String appId;
}

View File

@ -0,0 +1,39 @@
package weaver.xuanran.wang.sh_bigdata.task_async.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import weaver.xuanran.wang.common.annocation.SqlFieldMapping;
/**
* <h1>oa</h1>
*
* @author xuanran.wang
* @date 2023/4/7 13:19
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CusDoneTaskOA extends CusDoneTask{
@SqlFieldMapping
private String sourceTaskId;
@SqlFieldMapping
private String response;
@SqlFieldMapping
private String requestJson;
@SqlFieldMapping
private int success;
@SqlFieldMapping
private String requestUrl;
@SqlFieldMapping
private int taskType;
@SqlFieldMapping
private String sendTime;
/**
* <h2></h2>
**/
@SqlFieldMapping
private String error;
}

View File

@ -0,0 +1,29 @@
package weaver.xuanran.wang.sh_bigdata.task_async.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import weaver.xuanran.wang.common.annocation.SqlFieldMapping;
import weaver.xuanran.wang.common.annocation.SqlUpdateWhereField;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 16:27
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class CusTodoTask {
@SqlFieldMapping
protected String taskNum;
protected String appId;
@SqlFieldMapping
protected String taskName;
protected String taskDesc;
protected String linkUrl;
protected String mobileLinkUrl;
protected String receiver;
protected String sender;
}

View File

@ -0,0 +1,68 @@
package weaver.xuanran.wang.sh_bigdata.task_async.entity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import weaver.xuanran.wang.common.annocation.SqlFieldMapping;
import weaver.xuanran.wang.common.annocation.SqlUpdateWhereField;
/**
* <h1>oa</h1>
*
* @author xuanran.wang
* @date 2023/4/6 20:18
*/
@EqualsAndHashCode(callSuper = true)
@Data
@AllArgsConstructor
public class CusTodoTaskToOADetail extends CusTodoTask{
/**
* <h2></h2>
**/
@SqlFieldMapping
private int taskType;
/**
* <h2></h2>
**/
@SqlFieldMapping
private String requestUrl;
/**
* <h2></h2>
**/
@SqlFieldMapping
private String response;
/**
* <h2>id</h2>
**/
@SqlFieldMapping
@SqlUpdateWhereField
private String sourceTaskId;
/**
* <h2>/</h2>
**/
@SqlFieldMapping
private int success;
/**
* <h2></h2>
**/
@SqlFieldMapping
private int status;
/**
* <h2>json</h2>
**/
@SqlFieldMapping
private String requestJson;
/**
* <h2></h2>
**/
@SqlFieldMapping
private String sendTime;
/**
* <h2></h2>
**/
@SqlFieldMapping
private String error;
public CusTodoTaskToOADetail() {
super();
}
}

View File

@ -0,0 +1,30 @@
package weaver.xuanran.wang.sh_bigdata.task_async.mapper;
import aiyh.utils.annotation.recordset.*;
import java.util.List;
import java.util.Map;
/**
* <h1>mapper</h1>
*
* @author xuanran.wang
* @date 2023/4/6 16:49
*/
@SqlMapper
public interface SendTodoTaskMapper {
@Select("select hrmtransrule from ofs_sendinfo where syscode = #{sysCode}")
String querySendTodoUserConvert(@ParamMapper("sysCode") String sysCode);
@Select("select oaaddress from systemset")
String queryOAAddress();
@Select("select taskNum from uf_todo_task_log " +
"where sourceTaskId = #{sourceTaskId} and taskType = 0 and status = 0 and success = 0")
List<String> queryUnSendTodoTaskList(@ParamMapper("sourceTaskId") String sourceTaskId);
@Update("update uf_todo_task_log set status = 1 where taskNum in (${taskNums})")
boolean updateStatusByTaskNum(@ParamMapper("taskNums") List<String> taskNums);
@Select(custom = true)
List<String> selectHrmConvertId(@SqlString String sql, @ParamMapper("ids") List<String> ids);
}

View File

@ -0,0 +1,16 @@
package weaver.xuanran.wang.sh_bigdata.task_async.service;
import weaver.workflow.request.todo.RequestStatusObj;
import java.util.List;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 16:31
*/
public interface SendTodoTaskService {
void sendTodo(List<RequestStatusObj> todoList);
void sendDone(List<RequestStatusObj> doneList);
}

View File

@ -0,0 +1,152 @@
package weaver.xuanran.wang.sh_bigdata.task_async.service.impl;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import lombok.Data;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import weaver.general.TimeUtil;
import weaver.workflow.request.todo.RequestStatusObj;
import weaver.xuanran.wang.common.util.CusInfoToOAUtil;
import weaver.xuanran.wang.sh_bigdata.common.entity.CusSuccess;
import weaver.xuanran.wang.sh_bigdata.common.util.RequestMasterPlate;
import weaver.xuanran.wang.sh_bigdata.common.util.ShBigDataUtil;
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTask;
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusDoneTaskOA;
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTask;
import weaver.xuanran.wang.sh_bigdata.task_async.entity.CusTodoTaskToOADetail;
import weaver.xuanran.wang.sh_bigdata.task_async.mapper.SendTodoTaskMapper;
import weaver.xuanran.wang.sh_bigdata.task_async.service.SendTodoTaskService;
import weaver.xuanran.wang.sh_bigdata.common.util.SendTodoTaskUtil;
import javax.ws.rs.core.MediaType;
import java.util.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/4/6 16:46
*/
@Data
public class SendTodoTaskServiceImpl implements SendTodoTaskService {
private final Logger log = Util.getLogger();
private String appId;
private final SendTodoTaskUtil sendTodoTaskUtil = new SendTodoTaskUtil();
private String addTodoTaskUrl;
private String updateTodoTaskUrl;
private static final String MODEL_NAME = "uf_todo_task_log";
private final HashMap<String,String> header = new HashMap<>();
private int modelId;
private final RequestMasterPlate requestMasterPlate = new RequestMasterPlate();
private final SendTodoTaskMapper mapper = Util.getMapper(SendTodoTaskMapper.class);
{
sendTodoTaskUtil.setAppId(ShBigDataUtil.getPropertiesValByKey("appId"));
modelId = Util.getIntValue(ShBigDataUtil.getPropertiesValByKey("modelId"),-1);
addTodoTaskUrl = ShBigDataUtil.getPropertiesValByKey("addTodoTaskUrl");
updateTodoTaskUrl = ShBigDataUtil.getPropertiesValByKey("updateTodoTaskUrl");
header.put("Content-Type", MediaType.APPLICATION_JSON);
}
@Override
public void sendTodo(List<RequestStatusObj> todoList) {
try {
CusSuccess cusSuccess = CusSuccess.builder()
.successField("code")
.successValue(200)
.errorMsg("msg")
.dataKey("")
.build();
List<CusTodoTask> taskInfo = sendTodoTaskUtil.getTodoTaskInfo(todoList);
log.info("---------------- todoTaskInfo ---------------- \n" + JSONObject.toJSONString(taskInfo));
Map<String, Object> response = null;
int success = 0;
String error = null;
try {
response = requestMasterPlate.apiPost(ShBigDataUtil.addToken2Url(addTodoTaskUrl), taskInfo, header, cusSuccess);
}catch (Exception e){
log.error("Send Todo API Post Error! " + Util.getErrString(e));
error = "Send Todo API Post Error! " + e.getMessage();
success = 1;
}
ArrayList<CusTodoTaskToOADetail> details = new ArrayList<>();
for (CusTodoTask cusTodoTask : taskInfo) {
CusTodoTaskToOADetail detail = new CusTodoTaskToOADetail();
detail.setTaskNum(cusTodoTask.getTaskNum());
detail.setRequestUrl(addTodoTaskUrl);
detail.setTaskName(cusTodoTask.getTaskName());
detail.setTaskType(0);
detail.setStatus(0);
detail.setSuccess(success);
detail.setResponse(JSONObject.toJSONString(cusSuccess.getResponse() == null ? response : cusSuccess.getResponse()));
detail.setRequestJson(JSONObject.toJSONString(cusTodoTask));
String sourceTaskId = detail.getTaskNum().substring(0, detail.getTaskNum().length() - 10);
detail.setSourceTaskId(sourceTaskId);
detail.setSendTime(TimeUtil.getCurrentTimeString());
detail.setError(error);
details.add(detail);
}
CusInfoToOAUtil.executeBatchByEntity(modelId, details,"");
}catch (Exception e){
log.error("send todo error! " + Util.getErrString(e));
}
}
@Override
public void sendDone(List<RequestStatusObj> doneList) {
try {
CusSuccess cusSuccess = CusSuccess.builder()
.successField("code")
.successValue(200)
.errorMsg("msg")
.dataKey("")
.build();
List<CusDoneTask> doneTaskInfo = sendTodoTaskUtil.getDoneTaskInfo(doneList);
log.info("---------------- doneTaskInfo ---------------- \n" + JSONObject.toJSONString(doneTaskInfo));
Map<String, Object> response = null;
ArrayList<CusDoneTaskOA> list = new ArrayList<>();
ArrayList<String> successTaskIds = new ArrayList<>();
String error = "";
for (CusDoneTask doneTask : doneTaskInfo) {
int success = 0;
try {
response = requestMasterPlate.apiPost(ShBigDataUtil.addToken2Url(updateTodoTaskUrl), doneTask, header, cusSuccess);
successTaskIds.add(doneTask.getTaskNum());
}catch (Exception e){
log.error("Send Todo API Post Error! " + Util.getErrString(e));
error = "Send Todo API Post Error! " + Util.getErrString(e);
success = 1;
}
CusDoneTaskOA taskOA = new CusDoneTaskOA();
taskOA.setTaskNum(doneTask.getTaskNum());
taskOA.setTaskType(1);
String sourceTaskId = doneTask.getTaskNum().substring(0, doneTask.getTaskNum().length() - 10);
taskOA.setSourceTaskId(sourceTaskId);
taskOA.setResponse(JSONObject.toJSONString(cusSuccess.getResponse() == null ? response : cusSuccess.getResponse()));
taskOA.setRequestUrl(updateTodoTaskUrl);
taskOA.setRequestJson(JSONObject.toJSONString(doneTask));
taskOA.setSuccess(success);
taskOA.setSendTime(TimeUtil.getCurrentTimeString());
taskOA.setError(error);
list.add(taskOA);
}
CusInfoToOAUtil.executeBatchByEntity(modelId, list,"");
if(CollectionUtils.isNotEmpty(successTaskIds)){
mapper.updateStatusByTaskNum(successTaskIds);
}
}catch (Exception e){
log.error("send done error! " + Util.getErrString(e));
}
}
}

View File

@ -24,7 +24,7 @@ public class MQMessage {
* AUTH_CONSOLE_USERINFO_PASSWORD_TOPIC: * AUTH_CONSOLE_USERINFO_PASSWORD_TOPIC:
* </p> * </p>
**/ **/
@SqlFieldMapping() @SqlFieldMapping
private String topic; private String topic;
/** /**
* <h2></h2> * <h2></h2>
@ -35,19 +35,19 @@ public class MQMessage {
* PASSWORD_ACTION: * PASSWORD_ACTION:
* </p> * </p>
**/ **/
@SqlFieldMapping() @SqlFieldMapping
private String actionType; private String actionType;
/** /**
* <h2></h2> * <h2></h2>
**/ **/
@SqlFieldMapping() @SqlFieldMapping
private String sendTime; private String sendTime;
/** /**
* <h2>,json ,()</h2> * <h2>,json ,()</h2>
**/ **/
@SqlFieldMapping() @SqlFieldMapping
private String content; private String content;
@SqlFieldMapping() @SqlFieldMapping
private String error; private String error;
} }

View File

@ -100,7 +100,7 @@ public interface ConsumerMapper {
* @param id id * @param id id
* @return true/false * @return true/false
**/ **/
@Delete("delete from hrmresource where id = #{id}") @Delete("update hrmresource set status = 7 where id = #{id}")
boolean deleteHrmById(@ParamMapper("id") String id); boolean deleteHrmById(@ParamMapper("id") String id);
/** /**
@ -115,4 +115,8 @@ public interface ConsumerMapper {
@Select("select count(1) from uf_mqLog where messageId = #{messageId}") @Select("select count(1) from uf_mqLog where messageId = #{messageId}")
int getMainIdFromMQLogByMessageId(@ParamMapper("messageId") String messageId); int getMainIdFromMQLogByMessageId(@ParamMapper("messageId") String messageId);
@Update("update hrmresource set loginId = #{loginId} where id = #{id}")
boolean updateHrmLoginIdById(@ParamMapper("id") String id,
@ParamMapper("loginId") String loginId);
} }

View File

@ -29,7 +29,7 @@ public class ProducerService {
private final Logger logger = Util.getLogger(); private final Logger logger = Util.getLogger();
private final DealWithMapping dealWithMapping = new DealWithMapping(); private final DealWithMapping dealWithMapping = new DealWithMapping();
private final ToolUtil toolUtil = new ToolUtil();
private final HttpUtils httpUtils = new HttpUtils(); private final HttpUtils httpUtils = new HttpUtils();
{ {
@ -54,7 +54,7 @@ public class ProducerService {
ChangeRequestParam changeRequestParam){ ChangeRequestParam changeRequestParam){
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark); RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark);
String selectMainSql = CommonUtil.getSelectSql(requestMappingConfig, tableName); String selectMainSql = CommonUtil.getSelectSql(requestMappingConfig, tableName);
logger.info("查询主表sql : " + selectMainSql); // logger.info("查询主表sql : " + selectMainSql);
RecordSet recordSet = new RecordSet(); RecordSet recordSet = new RecordSet();
recordSet.executeQuery(selectMainSql, requestId); recordSet.executeQuery(selectMainSql, requestId);
Map<String, Object> requestParam = new HashMap<>(); Map<String, Object> requestParam = new HashMap<>();
@ -69,10 +69,6 @@ public class ProducerService {
if(!Objects.isNull(changeRequestParam)){ if(!Objects.isNull(changeRequestParam)){
changeRequestParam.changeRequestParam(requestParam); changeRequestParam.changeRequestParam(requestParam);
} }
// logger.info(Util.logStr("requestId : {}, msg:{}", requestId, JSONObject.toJSONString(requestParam)));
String sendMQ = Util.null2DefaultStr(toolUtil.getSystemParamValue("sendMQ"),"");
if("1".equals(sendMQ)){
RocketConsumerUtil.producerSendMsg(configName, JSONObject.toJSONString(requestParam), requestId); RocketConsumerUtil.producerSendMsg(configName, JSONObject.toJSONString(requestParam), requestId);
} }
} }
}

View File

@ -42,14 +42,14 @@ public class PassWordServiceImpl extends CusInfoActionService {
String content = message.getContent(); String content = message.getContent();
ModifyPassWord passWord = JSONObject.parseObject(content, ModifyPassWord.class); ModifyPassWord passWord = JSONObject.parseObject(content, ModifyPassWord.class);
logger.info(Util.logStr("cusPassWordAction messageId: {},UserInfo : {} ",message.getId(),JSONObject.toJSONString(passWord))); logger.info(Util.logStr("cusPassWordAction messageId: {},UserInfo : {} ",message.getId(),JSONObject.toJSONString(passWord)));
String outKey = passWord.getId(); // String outKey = passWord.getId();
String hrmId = consumerMapper.getHrmIdByOutKey(outKey); // String hrmId = consumerMapper.getHrmIdByOutKey(outKey);
if(StringUtils.isBlank(hrmId)){ // if(StringUtils.isBlank(hrmId)){
throw new CustomerException(Util.logStr("the userId is {} , no personnel information found in oa!", outKey)); // throw new CustomerException(Util.logStr("the userId is {} , no personnel information found in oa!", outKey));
} // }
if (!consumerMapper.updatePasswordById(hrmId, Util.getEncrypt(passWord.getPassword()))) { // if (!consumerMapper.updatePasswordById(hrmId, Util.getEncrypt(passWord.getPassword()))) {
throw new CustomerException("update user password error!"); // throw new CustomerException("update user password error!");
} // }
writeInOA(message.getId()); writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
} catch (Exception e) { } catch (Exception e) {

View File

@ -3,23 +3,14 @@ package weaver.xuanran.wang.shyl_mq.service.impl;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.weaver.general.TimeUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import weaver.conn.RecordSet;
import weaver.hrm.finance.SalaryManager;
import weaver.hrm.resource.ResourceComInfo; import weaver.hrm.resource.ResourceComInfo;
import weaver.xuanran.wang.shyl_mq.constant.RocketMQConstant;
import weaver.xuanran.wang.shyl_mq.service.CusInfoActionService;
import weaver.xuanran.wang.shyl_mq.entity.MQMessage; import weaver.xuanran.wang.shyl_mq.entity.MQMessage;
import weaver.xuanran.wang.shyl_mq.entity.UserInfo; import weaver.xuanran.wang.shyl_mq.entity.UserInfo;
import weaver.xuanran.wang.shyl_mq.service.CusInfoActionService;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
/** /**
* <h1></h1> * <h1></h1>
@ -35,6 +26,7 @@ public class UserServiceImpl extends CusInfoActionService {
logger = Util.getLogger("mq-consumer-user"); logger = Util.getLogger("mq-consumer-user");
} }
} }
/** /**
* <h1></h1> * <h1></h1>
* @author xuanran.wang * @author xuanran.wang
@ -44,78 +36,14 @@ public class UserServiceImpl extends CusInfoActionService {
**/ **/
@Override @Override
public ConsumeConcurrentlyStatus cusCreateAction(MQMessage message) { public ConsumeConcurrentlyStatus cusCreateAction(MQMessage message) {
String nextHrmId = "";
try { try {
String content = message.getContent(); String content = message.getContent();
UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class); UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
logger.info(Util.logStr("userCusCreateAction messageId: {}, UserInfo : {} ",message.getId(), JSONObject.toJSONString(userInfo))); logger.info(Util.logStr("userCusCreateAction messageId: {}, UserInfo : {} ",message.getId(), JSONObject.toJSONString(userInfo)));
String outKey = Util.null2DefaultStr(userInfo.getId(),""); updateLoginId(userInfo);
if(StringUtils.isBlank(outKey)){
throw new CustomerException("create user id can not null!");
}
String userId = consumerMapper.getHrmIdByOutKey(outKey);
// 如果存在就走更新
if(StringUtils.isNotBlank(userId)){
return cusUpdateAction(message);
}
String userInfoDepartmentId = userInfo.getDepartmentId();
// 部门id
if(StringUtils.isBlank(userInfoDepartmentId)){
throw new CustomerException("userInfo userInfoDepartmentId can not be empty!");
}
Map<String, Integer> depInfoByOutKey = consumerMapper.getDepInfoByOutKey(userInfo.getDepartmentId());
if (MapUtils.isEmpty(depInfoByOutKey)) {
// 通过外键获取部门信息数据为空
throw new CustomerException("The department information data obtained by foreign key is empty!");
}
nextHrmId = getNextHrmId();
List<Object> params = initHrmParam(nextHrmId, userInfo, depInfoByOutKey);
String departmentId = Util.null2DefaultStr(depInfoByOutKey.get("departmentId"), "");
if(StringUtils.isBlank(departmentId)){
departmentId = Util.null2DefaultStr(depInfoByOutKey.get("DEPARTMENTID"), "");
}
String subCompanyId = Util.null2DefaultStr(depInfoByOutKey.get("subCompanyId"), "");
if(StringUtils.isBlank(subCompanyId)){
departmentId = Util.null2DefaultStr(depInfoByOutKey.get("SUBCOMPANYID"), "");
}
RecordSet insertRs = new RecordSet();
//使用sql新增人员
String insertSql = "insert into HrmResource(systemlanguage,workcode,departmentid,subcompanyid1," +
" status,createrid,createdate,lastmodid,lastmoddate,lastname,sex,loginid," +
" password,birthday,certificatenum,email, mobile,outkey,id) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
if (insertRs.executeUpdate(insertSql, params)) {
char separator = Util.getSeparator();
Calendar todayCal = Calendar.getInstance();
String today = Util.add0(todayCal.get(Calendar.YEAR), 4) + "-" +
Util.add0(todayCal.get(Calendar.MONTH) + 1, 2) + "-" +
Util.add0(todayCal.get(Calendar.DAY_OF_MONTH), 2);
String userPara = "" + 1 + separator + today;
insertRs.executeProc("HrmResource_CreateInfo", "" + nextHrmId + separator + userPara + separator + userPara);
ResourceComInfo resourceComInfo = new ResourceComInfo();
resourceComInfo.addResourceInfoCache(nextHrmId);
SalaryManager salaryManager = new SalaryManager();
salaryManager.initResourceSalary(nextHrmId);
String para1 = "" + nextHrmId + separator + "" + separator + departmentId + separator + subCompanyId + separator + "0" + separator + "0";
insertRs.executeProc("HrmResource_Trigger_Insert", para1);
String sql_1 = ("insert into HrmInfoStatus (itemid,hrmid) values(1," + nextHrmId + ")");
insertRs.execute(sql_1);
String sql_2 = ("insert into HrmInfoStatus (itemid,hrmid) values(2," + nextHrmId + ")");
insertRs.execute(sql_2);
String sql_3 = ("insert into HrmInfoStatus (itemid,hrmid) values(3," + nextHrmId + ")");
insertRs.execute(sql_3);
String sql_10 = ("insert into HrmInfoStatus (itemid,hrmid) values(10," + nextHrmId + ")");
insertRs.execute(sql_10);
resourceComInfo.updateResourceInfoCache(nextHrmId);
writeInOA(message.getId()); writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}else {
throw new CustomerException(Util.logStr("insert HrmResource error sql : {}, params : {}", insertSql, JSONObject.toJSONString(params)));
}
}catch (Exception e){ }catch (Exception e){
if(StringUtils.isNotBlank(nextHrmId)){
consumerMapper.deleteHrmById(nextHrmId);
}
throw new CustomerException(Util.logStr("hrmCreateAction error : {}", e.getMessage())); throw new CustomerException(Util.logStr("hrmCreateAction error : {}", e.getMessage()));
} }
} }
@ -133,14 +61,15 @@ public class UserServiceImpl extends CusInfoActionService {
String content = message.getContent(); String content = message.getContent();
UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class); UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
logger.info(Util.logStr("userCusDeleteAction messageId: {},UserInfo : {} ", message.getId(),JSONObject.toJSONString(userInfo))); logger.info(Util.logStr("userCusDeleteAction messageId: {},UserInfo : {} ", message.getId(),JSONObject.toJSONString(userInfo)));
String id = userInfo.getId(); String id = Util.null2DefaultStr(userInfo.getId(),"");
if(StringUtils.isBlank(id)){ if(StringUtils.isBlank(id)){
throw new CustomerException("userInfo id can not be empty!"); throw new CustomerException("del user id not null!");
} }
boolean success = consumerMapper.deleteHrmByOutKey(id); if (!consumerMapper.deleteHrmById(id)) {
if (!success) { throw new CustomerException("del user sql execute error!");
throw new CustomerException(Util.logStr("update user status error!"));
} }
ResourceComInfo resourceComInfo = new ResourceComInfo();
resourceComInfo.updateResourceInfoCache(id);
writeInOA(message.getId()); writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
} catch (Exception e) { } catch (Exception e) {
@ -161,108 +90,31 @@ public class UserServiceImpl extends CusInfoActionService {
String content = message.getContent(); String content = message.getContent();
UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class); UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
logger.info(Util.logStr("userCusUpdateAction messageId: {},UserInfo : {} ", message.getId(), JSONObject.toJSONString(userInfo))); logger.info(Util.logStr("userCusUpdateAction messageId: {},UserInfo : {} ", message.getId(), JSONObject.toJSONString(userInfo)));
String userInfoId = Util.null2DefaultStr(userInfo.getId(),""); updateLoginId(userInfo);
String userInfoDepartmentId = Util.null2DefaultStr(userInfo.getDepartmentId(),"");
// 接口人员id
if(StringUtils.isBlank(userInfoId)){
throw new CustomerException("userInfo id can not be empty!");
}
// 部门id
if(StringUtils.isBlank(userInfoDepartmentId)){
throw new CustomerException("userInfo userInfoDepartmentId can not be empty!");
}
// oa部门信息
Map<String, Integer> depInfoByOutKey = consumerMapper.getDepInfoByOutKey(userInfo.getDepartmentId());
if (MapUtils.isEmpty(depInfoByOutKey)) {
// 通过外键获取部门信息数据为空
throw new CustomerException("The department information data obtained by foreign key is empty!");
}
// oa人员id
String hrmId = consumerMapper.getHrmIdByOutKey(userInfoId);
if(StringUtils.isBlank(hrmId)){
logger.error(Util.logStr("userInfoId = [{}], No personnel information found in oa!", userInfoId));
return cusCreateAction(message);
}
//使用sql新增人员
String updateSql = "update HrmResource set systemlanguage = ?, workcode = ?, departmentid = ?, subcompanyid1 = ?," +
" status = ?,createrid = ?, createdate = ?, lastmodid = ? ,lastmoddate = ? ,lastname = ? ,sex = ?, loginid = ?, " +
" password = ?, birthday = ?,certificatenum = ?,email = ?, mobile = ? , outkey = ? where id = ? ";
List<Object> params = initHrmParam(hrmId, userInfo, depInfoByOutKey);
RecordSet updateRs = new RecordSet();
if(!updateRs.executeUpdate(updateSql, params)){
throw new CustomerException(Util.logStr("update HrmResource error sql : {}, params : {}", updateSql, JSONObject.toJSONString(params)));
}
ResourceComInfo resourceComInfo = new ResourceComInfo();
// 清空缓存
resourceComInfo.updateResourceInfoCache(hrmId);
writeInOA(message.getId()); writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS; return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}catch (Exception e){ }catch (Exception e){
throw new CustomerException(Util.logStr("userCusUpdateAction execute error : [{}]!", e.getMessage())); throw new CustomerException(Util.logStr("userCusUpdateAction execute error : [{}]!", e.getMessage()));
} }
} }
/** /**
* <h1>/</h1> * <h1></h1>
* @author xuanran.wang * @author xuanran.wang
* @dateTime 2023/1/3 13:34 * @dateTime 2023/3/28 13:07
* @param nextHrmId oaid * @param userInfo
* @param userInfo mq
* @param depInfoByOutKey
* @return /
**/ **/
private List<Object> initHrmParam(String nextHrmId, UserInfo userInfo, Map<String, Integer> depInfoByOutKey){ public void updateLoginId(UserInfo userInfo) throws Exception {
String password = Util.getEncrypt(RocketMQConstant.DEFAULT_PASSWORD); String id = Util.null2DefaultStr(userInfo.getId(),"");
String date = TimeUtil.getCurrentDateString();
ArrayList<Object> params = new ArrayList<>();
String userName = Util.null2DefaultStr(userInfo.getUserName(),""); String userName = Util.null2DefaultStr(userInfo.getUserName(),"");
String departmentId = Util.null2DefaultStr(depInfoByOutKey.get("departmentId"), ""); if(StringUtils.isBlank(id) || StringUtils.isBlank(userName)){
if(StringUtils.isBlank(departmentId)){ throw new CustomerException("create user id or userName can not null!");
departmentId = Util.null2DefaultStr(depInfoByOutKey.get("DEPARTMENTID"), "");
} }
String subCompanyId = Util.null2DefaultStr(depInfoByOutKey.get("subCompanyId"), ""); if (!consumerMapper.updateHrmLoginIdById(id, userName)) {
if(StringUtils.isBlank(subCompanyId)){ throw new CustomerException("update loginId sql execute error!");
subCompanyId = Util.null2DefaultStr(depInfoByOutKey.get("SUBCOMPANYID"), "");
} }
// 语言 ResourceComInfo resourceComInfo = new ResourceComInfo();
params.add(7); // 清空缓存
// 工号 resourceComInfo.updateResourceInfoCache(id);
params.add(userName);
// 部门id
params.add(departmentId);
// 分部id
params.add(subCompanyId);
// 状态
params.add(1);
// 创建人
params.add(1);
// 创建日期
params.add(date);
// 最后修改人
params.add(1);
// 最后修改日期
params.add(date);
// 人员名称
params.add(Util.null2DefaultStr(userInfo.getDisplayName(), ""));
// 性别 如果没传就默认男
params.add(RocketMQConstant.SEX_MAPPING.get(Util.null2DefaultStr(userInfo.getGender(), RocketMQConstant.SEX_BOY)));
// 登陆名
params.add(userName);
// 密码
params.add(password);
// 生日
params.add(Util.null2DefaultStr(userInfo.getBirthDate(), ""));
// 身份证号码
params.add(Util.null2DefaultStr(userInfo.getIdCardNo(), ""));
// 邮箱
params.add(Util.null2DefaultStr(userInfo.getEmail(), ""));
// 手机号
params.add(Util.null2DefaultStr(userInfo.getMobile(), ""));
// 用户out key
params.add(Util.null2DefaultStr(userInfo.getId(),""));
// oaId
params.add(nextHrmId);
return params;
} }
@Override @Override

View File

@ -0,0 +1,274 @@
package weaver.xuanran.wang.shyl_mq.service.impl;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
import com.alibaba.fastjson.JSONObject;
import com.weaver.general.TimeUtil;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import weaver.conn.RecordSet;
import weaver.hrm.finance.SalaryManager;
import weaver.hrm.resource.ResourceComInfo;
import weaver.xuanran.wang.shyl_mq.constant.RocketMQConstant;
import weaver.xuanran.wang.shyl_mq.service.CusInfoActionService;
import weaver.xuanran.wang.shyl_mq.entity.MQMessage;
import weaver.xuanran.wang.shyl_mq.entity.UserInfo;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
/**
* <h1>-</h1>
*
* @Author xuanran.wang
* @Date 2022/12/30 13:04
*/
public class UserServiceImplBack extends CusInfoActionService {
private Logger logger = Util.getLogger("mq-consumer-user");
{
if(null == logger){
logger = Util.getLogger("mq-consumer-user");
}
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/1/3 13:37
* @param message mq
* @return /
**/
@Override
public ConsumeConcurrentlyStatus cusCreateAction(MQMessage message) {
String nextHrmId = "";
try {
String content = message.getContent();
UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
logger.info(Util.logStr("userCusCreateAction messageId: {}, UserInfo : {} ",message.getId(), JSONObject.toJSONString(userInfo)));
String outKey = Util.null2DefaultStr(userInfo.getId(),"");
if(StringUtils.isBlank(outKey)){
throw new CustomerException("create user id can not null!");
}
String userId = consumerMapper.getHrmIdByOutKey(outKey);
// 如果存在就走更新
if(StringUtils.isNotBlank(userId)){
return cusUpdateAction(message);
}
String userInfoDepartmentId = userInfo.getDepartmentId();
// 部门id
if(StringUtils.isBlank(userInfoDepartmentId)){
throw new CustomerException("userInfo userInfoDepartmentId can not be empty!");
}
Map<String, Integer> depInfoByOutKey = consumerMapper.getDepInfoByOutKey(userInfo.getDepartmentId());
if (MapUtils.isEmpty(depInfoByOutKey)) {
// 通过外键获取部门信息数据为空
throw new CustomerException("The department information data obtained by foreign key is empty!");
}
logger.info(Util.logStr("depInfoByOutKey : {}", JSONObject.toJSONString(depInfoByOutKey)));
nextHrmId = getNextHrmId();
List<Object> params = initHrmParam(nextHrmId, userInfo, depInfoByOutKey);
String departmentId = Util.null2DefaultStr(depInfoByOutKey.get("departmentId"), "");
if(StringUtils.isBlank(departmentId)){
departmentId = Util.null2DefaultStr(depInfoByOutKey.get("DEPARTMENTID"), "");
}
String subCompanyId = Util.null2DefaultStr(depInfoByOutKey.get("subCompanyId"), "");
if(StringUtils.isBlank(subCompanyId)){
departmentId = Util.null2DefaultStr(depInfoByOutKey.get("SUBCOMPANYID"), "");
}
RecordSet insertRs = new RecordSet();
//使用sql新增人员
String insertSql = "insert into HrmResource(systemlanguage,workcode,departmentid,subcompanyid1," +
" status,createrid,createdate,lastmodid,lastmoddate,lastname,sex,loginid," +
" password,birthday,certificatenum,email, mobile,outkey,id) " +
" values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
if (insertRs.executeUpdate(insertSql, params)) {
char separator = Util.getSeparator();
Calendar todayCal = Calendar.getInstance();
String today = Util.add0(todayCal.get(Calendar.YEAR), 4) + "-" +
Util.add0(todayCal.get(Calendar.MONTH) + 1, 2) + "-" +
Util.add0(todayCal.get(Calendar.DAY_OF_MONTH), 2);
String userPara = "" + 1 + separator + today;
insertRs.executeProc("HrmResource_CreateInfo", "" + nextHrmId + separator + userPara + separator + userPara);
ResourceComInfo resourceComInfo = new ResourceComInfo();
resourceComInfo.addResourceInfoCache(nextHrmId);
SalaryManager salaryManager = new SalaryManager();
salaryManager.initResourceSalary(nextHrmId);
String para1 = "" + nextHrmId + separator + "" + separator + departmentId + separator + subCompanyId + separator + "0" + separator + "0";
insertRs.executeProc("HrmResource_Trigger_Insert", para1);
String sql_1 = ("insert into HrmInfoStatus (itemid,hrmid) values(1," + nextHrmId + ")");
insertRs.execute(sql_1);
String sql_2 = ("insert into HrmInfoStatus (itemid,hrmid) values(2," + nextHrmId + ")");
insertRs.execute(sql_2);
String sql_3 = ("insert into HrmInfoStatus (itemid,hrmid) values(3," + nextHrmId + ")");
insertRs.execute(sql_3);
String sql_10 = ("insert into HrmInfoStatus (itemid,hrmid) values(10," + nextHrmId + ")");
insertRs.execute(sql_10);
resourceComInfo.updateResourceInfoCache(nextHrmId);
writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}else {
throw new CustomerException(Util.logStr("insert HrmResource error sql : {}, params : {}", insertSql, JSONObject.toJSONString(params)));
}
}catch (Exception e){
if(StringUtils.isNotBlank(nextHrmId)){
consumerMapper.deleteHrmById(nextHrmId);
}
throw new CustomerException(Util.logStr("hrmCreateAction error : {}", e.getMessage()));
}
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/1/3 13:38
* @param message mq
* @return /
**/
@Override
public ConsumeConcurrentlyStatus cusDeleteAction(MQMessage message) {
try {
String content = message.getContent();
UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
logger.info(Util.logStr("userCusDeleteAction messageId: {},UserInfo : {} ", message.getId(),JSONObject.toJSONString(userInfo)));
String id = userInfo.getId();
if(StringUtils.isBlank(id)){
throw new CustomerException("userInfo id can not be empty!");
}
boolean success = consumerMapper.deleteHrmByOutKey(id);
if (!success) {
throw new CustomerException(Util.logStr("update user status error!"));
}
writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
} catch (Exception e) {
throw new CustomerException(Util.logStr("hrmDeleteAction execute error : [{}]!", e.getMessage()));
}
}
/**
* <h1></h1>
* @author xuanran.wang
* @dateTime 2023/1/3 13:39
* @param message mq
* @return /
**/
@Override
public ConsumeConcurrentlyStatus cusUpdateAction(MQMessage message) {
try {
String content = message.getContent();
UserInfo userInfo = JSONObject.parseObject(content, UserInfo.class);
logger.info(Util.logStr("userCusUpdateAction messageId: {},UserInfo : {} ", message.getId(), JSONObject.toJSONString(userInfo)));
String userInfoId = Util.null2DefaultStr(userInfo.getId(),"");
String userInfoDepartmentId = Util.null2DefaultStr(userInfo.getDepartmentId(),"");
// 接口人员id
if(StringUtils.isBlank(userInfoId)){
throw new CustomerException("userInfo id can not be empty!");
}
// 部门id
if(StringUtils.isBlank(userInfoDepartmentId)){
throw new CustomerException("userInfo userInfoDepartmentId can not be empty!");
}
// oa部门信息
Map<String, Integer> depInfoByOutKey = consumerMapper.getDepInfoByOutKey(userInfo.getDepartmentId());
if (MapUtils.isEmpty(depInfoByOutKey)) {
// 通过外键获取部门信息数据为空
throw new CustomerException("The department information data obtained by foreign key is empty!");
}
logger.info(Util.logStr("depInfoByOutKey : {}", JSONObject.toJSONString(depInfoByOutKey)));
// oa人员id
String hrmId = consumerMapper.getHrmIdByOutKey(userInfoId);
if(StringUtils.isBlank(hrmId)){
logger.error(Util.logStr("userInfoId = [{}], No personnel information found in oa!", userInfoId));
return cusCreateAction(message);
}
//使用sql新增人员
String updateSql = "update HrmResource set systemlanguage = ?, workcode = ?, departmentid = ?, subcompanyid1 = ?," +
" status = ?,createrid = ?, createdate = ?, lastmodid = ? ,lastmoddate = ? ,lastname = ? ,sex = ?, loginid = ?, " +
" password = ?, birthday = ?,certificatenum = ?,email = ?, mobile = ? , outkey = ? where id = ? ";
List<Object> params = initHrmParam(hrmId, userInfo, depInfoByOutKey);
RecordSet updateRs = new RecordSet();
if(!updateRs.executeUpdate(updateSql, params)){
throw new CustomerException(Util.logStr("update HrmResource error sql : {}, params : {}", updateSql, JSONObject.toJSONString(params)));
}
ResourceComInfo resourceComInfo = new ResourceComInfo();
// 清空缓存
resourceComInfo.updateResourceInfoCache(hrmId);
writeInOA(message.getId());
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}catch (Exception e){
throw new CustomerException(Util.logStr("userCusUpdateAction execute error : [{}]!", e.getMessage()));
}
}
/**
* <h1>/</h1>
* @author xuanran.wang
* @dateTime 2023/1/3 13:34
* @param nextHrmId oaid
* @param userInfo mq
* @param depInfoByOutKey
* @return /
**/
private List<Object> initHrmParam(String nextHrmId, UserInfo userInfo, Map<String, Integer> depInfoByOutKey){
String password = Util.getEncrypt(RocketMQConstant.DEFAULT_PASSWORD);
String date = TimeUtil.getCurrentDateString();
ArrayList<Object> params = new ArrayList<>();
String userName = Util.null2DefaultStr(userInfo.getUserName(), "");
String departmentId = Util.null2DefaultStr(depInfoByOutKey.get("departmentId"), "");
if(StringUtils.isBlank(departmentId)){
departmentId = Util.null2DefaultStr(depInfoByOutKey.get("DEPARTMENTID"), "");
}
String subCompanyId = Util.null2DefaultStr(depInfoByOutKey.get("subCompanyId"), "");
if(StringUtils.isBlank(subCompanyId)){
subCompanyId = Util.null2DefaultStr(depInfoByOutKey.get("SUBCOMPANYID"), "");
}
// 语言
params.add(7);
// 工号
params.add(userName);
// 部门id
params.add(departmentId);
// 分部id
params.add(subCompanyId);
// 状态
params.add(1);
// 创建人
params.add(1);
// 创建日期
params.add(date);
// 最后修改人
params.add(1);
// 最后修改日期
params.add(date);
// 人员名称
params.add(Util.null2DefaultStr(userInfo.getDisplayName(), ""));
// 性别 如果没传就默认男
params.add(RocketMQConstant.SEX_MAPPING.get(Util.null2DefaultStr(userInfo.getGender(), RocketMQConstant.SEX_BOY)));
// 登陆名
params.add(userName);
// 密码
params.add(password);
// 生日
params.add(Util.null2DefaultStr(userInfo.getBirthDate(), ""));
// 身份证号码
params.add(Util.null2DefaultStr(userInfo.getIdCardNo(), ""));
// 邮箱
params.add(Util.null2DefaultStr(userInfo.getEmail(), ""));
// 手机号
params.add(Util.null2DefaultStr(userInfo.getMobile(), ""));
// 用户out key
params.add(Util.null2DefaultStr(userInfo.getId(),""));
// oaId
params.add(nextHrmId);
return params;
}
@Override
public ConsumeConcurrentlyStatus cusPassWordAction(MQMessage message) {
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
}

View File

@ -1,4 +1,4 @@
package weaver.xuanran.wang.shyl_mq.util;//package weaver.xuanran.wang.shyl.mq.util; package weaver.xuanran.wang.shyl_mq.util;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException; import aiyh.utils.excention.CustomerException;
@ -37,15 +37,21 @@ import java.util.*;
*/ */
public class RocketConsumerUtil { public class RocketConsumerUtil {
private static Logger log = Util.getLogger("mq-util"); private static Logger log = Util.getLogger("mq-util");
private static Logger producerLog = Util.getLogger("mq-producer");
private static final ConsumerMapper consumerMapper = Util.getMapper(ConsumerMapper.class); private static final ConsumerMapper consumerMapper = Util.getMapper(ConsumerMapper.class);
private static final ToolUtil tool = new ToolUtil(); private static final ToolUtil tool = new ToolUtil();
private static final int ERROR_LOG_ID; private static final int ERROR_LOG_ID;
private static final ToolUtil toolUtil = new ToolUtil();
static { static {
ERROR_LOG_ID = Util.getIntValue(tool.getSystemParamValue("mqErrorLogModelId"), -1); ERROR_LOG_ID = Util.getIntValue(tool.getSystemParamValue("mqErrorLogModelId"), -1);
if(log == null){ if(log == null){
log = Util.getLogger("mq-util"); log = Util.getLogger("mq-util");
} }
if(producerLog == null){
producerLog = Util.getLogger("mq-producer");
}
} }
/** /**
@ -83,7 +89,7 @@ public class RocketConsumerUtil {
CusInfoActionService cusInfoActionService, String configName){ CusInfoActionService cusInfoActionService, String configName){
Map<String, Object> configMap = RocketMQFactory.CONFIG_MAPS.get(configName); Map<String, Object> configMap = RocketMQFactory.CONFIG_MAPS.get(configName);
int maxReconsumeTimes = Util.getIntValue(Util.null2String(configMap.get("MaxReconsumeTimes")), RocketMQConstant.DEFAULT_MAX_RECONSUME_TIMES); int maxReconsumeTimes = Util.getIntValue(Util.null2String(configMap.get("MaxReconsumeTimes")), RocketMQConstant.DEFAULT_MAX_RECONSUME_TIMES);
MessageExt messageExt = null; MessageExt messageExt;
String msgBody = ""; String msgBody = "";
String mqMessageId = ""; String mqMessageId = "";
MQMessage mqMessage = null; MQMessage mqMessage = null;
@ -143,7 +149,7 @@ public class RocketConsumerUtil {
mqMessage.setError(e.getMessage()); mqMessage.setError(e.getMessage());
List<String> ids = CusInfoToOAUtil.executeBatchByEntity(ERROR_LOG_ID, Collections.singletonList(mqMessage), ""); List<String> ids = CusInfoToOAUtil.executeBatchByEntity(ERROR_LOG_ID, Collections.singletonList(mqMessage), "");
if(CollectionUtils.isEmpty(ids)){ if(CollectionUtils.isEmpty(ids)){
log.error("insert into mq_error_log failed!"); log.error(Util.logStr("messageId : {}, insert into mq_error_log failed!", mqMessageId));
} }
} }
log.error(Util.logStr("MQ producer error already bigger maxReconsumeTimes! messageId : {}",mqMessageId)); log.error(Util.logStr("MQ producer error already bigger maxReconsumeTimes! messageId : {}",mqMessageId));
@ -164,6 +170,10 @@ public class RocketConsumerUtil {
* @param requestId id * @param requestId id
**/ **/
public static void producerSendMsg(String configName, String msg, String requestId) { public static void producerSendMsg(String configName, String msg, String requestId) {
String sendMQ = Util.null2DefaultStr(toolUtil.getSystemParamValue("sendMQ"),"");
if(!"1".equals(sendMQ)){
return;
}
// 先从本地缓存中获取生产者对象 // 先从本地缓存中获取生产者对象
DefaultMQProducer producer = RocketMQFactory.getMQProducer(configName); DefaultMQProducer producer = RocketMQFactory.getMQProducer(configName);
// 获取配置信息 // 获取配置信息
@ -171,9 +181,10 @@ public class RocketConsumerUtil {
// 队列名 // 队列名
String topic = Util.null2DefaultStr(configMap.get("Topic"), ""); String topic = Util.null2DefaultStr(configMap.get("Topic"), "");
// tag // tag
String tag = Util.null2DefaultStr(configMap.get("Tag"), ""); // String tag = Util.null2DefaultStr(configMap.get("Tag"), "");
Message message; Message message;
try { try {
producerLog.info(Util.logStr("requestId: {}, msg: {}", requestId, msg));
message = new Message(topic, msg.getBytes(RemotingHelper.DEFAULT_CHARSET)); message = new Message(topic, msg.getBytes(RemotingHelper.DEFAULT_CHARSET));
} catch (Exception e) { } catch (Exception e) {
throw new CustomerException(Util.logStr("init message error : {} !", e.getMessage())); throw new CustomerException(Util.logStr("init message error : {} !", e.getMessage()));
@ -190,12 +201,12 @@ public class RocketConsumerUtil {
} catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) { } catch (MQClientException | RemotingException | MQBrokerException | InterruptedException e) {
throw new CustomerException(Util.logStr("producer send message error!: {}", e.getMessage())); throw new CustomerException(Util.logStr("producer send message error!: {}", e.getMessage()));
} }
log.info(Util.logStr("requestId: {}, result : {}",requestId, JSONObject.toJSONString(result))); producerLog.info(Util.logStr("requestId: {}, result : {}",requestId, JSONObject.toJSONString(result)));
SendStatus sendStatus = result.getSendStatus(); SendStatus sendStatus = result.getSendStatus();
// 如果失败 // 如果失败
if (!SendStatus.SEND_OK.equals(sendStatus)) { if (!SendStatus.SEND_OK.equals(sendStatus)) {
String error = Util.logStr("producer send message call back status is not ok! the message is {}, the status is {}.", msg, sendStatus); String error = Util.logStr("producer send message call back status is not ok! the message is {}, the status is {}.", msg, sendStatus);
log.error(error); producerLog.error(error);
// 如果重试超过最大次数 // 如果重试超过最大次数
if(count >= RocketMQConstant.SEND_MAX_COUNT){ if(count >= RocketMQConstant.SEND_MAX_COUNT){
throw new CustomerException(error + " and retry > max"); throw new CustomerException(error + " and retry > max");

View File

@ -72,6 +72,16 @@ public class VoucherPayableAction extends SafeCusBaseAction {
@RequiredMark("ip") @RequiredMark("ip")
private String ip; private String ip;
@PrintParamMark
@RequiredMark("应付凭证远程文件名称前缀")
private String pavFileName;
@PrintParamMark
@RequiredMark("付款凭证远程文件名称前缀")
private String pmvFileName;
@PrintParamMark @PrintParamMark
@ActionOptionalParam(desc = "是否删除生成的临时本地文件,true - 删除 false - 不删除", value = "false") @ActionOptionalParam(desc = "是否删除生成的临时本地文件,true - 删除 false - 不删除", value = "false")
private String deleteTemp = "false"; private String deleteTemp = "false";
@ -86,10 +96,10 @@ public class VoucherPayableAction extends SafeCusBaseAction {
String fileName = ""; String fileName = "";
String remotePath = ""; String remotePath = "";
if (Integer.parseInt(voucherType) == 1) { if (Integer.parseInt(voucherType) == 1) {
fileName = "Pav" + Util.getTime("yyyyMMddHHmmss") + ".txt"; fileName = pavFileName + Util.getTime("yyyyMMddHHmmssSSSS") + ".txt";
remotePath = pavRemotePath; remotePath = pavRemotePath;
} else if (Integer.parseInt(voucherType) == 2) { } else if (Integer.parseInt(voucherType) == 2) {
fileName = "Pmv" + Util.getTime("yyyyMMddHHmmss") + ".txt"; fileName = pmvFileName + Util.getTime("yyyyMMddHHmmssSSSS") + ".txt";
remotePath = pmvRemotePath; remotePath = pmvRemotePath;
} }
log.info("远程连接地址:" + "smb://" + ip + remotePath); log.info("远程连接地址:" + "smb://" + ip + remotePath);

View File

@ -0,0 +1,246 @@
package weaver.youhong.ai.haripijiu.action.sapdocking;
import aiyh.utils.Util;
import aiyh.utils.action.SafeCusBaseAction;
import aiyh.utils.annotation.*;
import aiyh.utils.excention.CustomerException;
import aiyh.utils.tool.cn.hutool.core.lang.Assert;
import lombok.Setter;
import org.jetbrains.annotations.NotNull;
import weaver.general.GCONST;
import weaver.hrm.User;
import weaver.soa.workflow.request.RequestInfo;
import weaver.xiao.commons.config.entity.RequestMappingConfig;
import weaver.xiao.commons.config.service.DealWithMapping;
import weaver.youhong.ai.haripijiu.action.sapdocking.util.SmbjUtil;
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
/**
* <h1>action</h1>
*
* <p>create: 2023/4/17 14:57</p>
*
* @author youHong.ai
*/
@ActionDesc(author = "youhong.ai", value = "对私凭证action")
@Setter
public class VoucherPayableNewAction extends SafeCusBaseAction {
private final DealWithMapping dealWithMapping = new DealWithMapping();
@PrintParamMark
@RequiredMark("请求参数配置表配置唯一标识字段!")
@ActionDefaultTestValue("duisi")
private String onlyMark;
@PrintParamMark
@ActionOptionalParam(value = "false", desc = "是否自动提交流程 false 不提交; true : 提交")
private String submitAction = "false";
@PrintParamMark
@ActionOptionalParam(value = "true", desc = "是否失败后阻断流程, false 不阻断; true 阻断")
private String block = "true";
@PrintParamMark
@RequiredMark("凭证类型1- 应付凭证; 2- 付款凭证")
private String voucherType;
@PrintParamMark
@RequiredMark("应付凭证远程路径")
private String pavRemotePath;
@PrintParamMark
@RequiredMark("付款凭证远程路径")
private String pmvRemotePath;
@PrintParamMark
@RequiredMark("用户名")
private String userName;
@PrintParamMark
@RequiredMark("密码")
private String password;
@PrintParamMark
@RequiredMark("ip")
private String ip;
@PrintParamMark
@RequiredMark("应付凭证远程文件名称前缀")
private String pavFileName;
@PrintParamMark
@RequiredMark("付款凭证远程文件名称前缀")
private String pmvFileName;
@PrintParamMark
@ActionOptionalParam(desc = "是否删除生成的临时本地文件,true - 删除 false - 不删除", value = "false")
private String deleteTemp = "false";
@Override
public void doSubmit(String requestId, String billTable, int workflowId, User user, RequestInfo requestInfo) {
try {
SmbjUtil smbjUtil = new SmbjUtil();
String tempFilePath = getFile(billTable, requestInfo);
String fileName = "";
String remotePath = "";
if (Integer.parseInt(voucherType) == 1) {
fileName = pavFileName + Util.getTime("yyyyMMddHHmmssSSSS") + ".txt";
remotePath = pavRemotePath;
} else if (Integer.parseInt(voucherType) == 2) {
fileName = pmvFileName + Util.getTime("yyyyMMddHHmmssSSSS") + ".txt";
remotePath = pmvRemotePath;
}
log.info("远程连接地址:" + "smb://" + ip + remotePath);
log.info("本地文件地址: " + tempFilePath);
smbjUtil.smbPut("smb://" + ip + remotePath, tempFilePath, userName, password, fileName);
if (Boolean.parseBoolean(deleteTemp)) {
Files.delete(Paths.get(tempFilePath));
}
/* ******************* 是否提交流程 ******************* */
if (Boolean.parseBoolean(submitAction)) {
this.submitWorkflow(requestId, user.getUID());
}
} catch (Exception e) {
log.error("推送应付款凭证失败!" + e.getMessage());
if (Boolean.parseBoolean(block)) {
throw new CustomerException(e.getMessage(), e);
}
}
}
public void submitWorkflow(String requestId, Integer userId) {
Util.submitWorkflowThread(Integer.parseInt(requestId), userId, "sap对接自动提交流程");
}
private String getFile(String billTable, RequestInfo requestInfo) {
dealWithMapping.setMainTable(billTable);
RequestMappingConfig requestMappingConfig = dealWithMapping.treeDealWithUniqueCode(onlyMark);
Map<String, Object> requestParam = dealWithMapping.getRequestParam(getObjMainTableValue(requestInfo), requestMappingConfig);
Assert.notEmpty(requestParam, "query config error, can not query result by onlyMark:[{}],Please check the configuration table", onlyMark);
// 借方
List<Object> debit = (List<Object>) requestParam.get("debit");
// 贷方
List<Object> creditSide = (List<Object>) requestParam.get("creditSide");
// 凭证头
Map<String, Object> heads = (Map<String, Object>) requestParam.get("heads");
Assert.notEmpty(heads, "No relevant voucher header data was found. Please check the configuration table and process table data.");
Assert.notEmpty(debit, "No relevant voucher details have been queried. Please check whether there is data in the process schedule.");
Assert.notEmpty(creditSide, "No credit data was found. Please check whether the configuration table is configured correctly and whether the process data exists.");
return createFile(debit, creditSide, heads);
}
private String createFile(List<Object> debit, List<Object> creditSide, Map<String, Object> heads) {
StringBuilder sb = new StringBuilder();
// 写入凭证头
List<String> headKeys = new ArrayList<>();
for (Map.Entry<String, Object> entry : heads.entrySet()) {
headKeys.add(entry.getKey());
}
headKeys = sortKey(headKeys);
for (String headKey : headKeys) {
sb.append(heads.get(headKey)).append("\t");
}
sb.deleteCharAt(sb.lastIndexOf("\t"));
sb.append("\r\n");
// 写入借方信息
writeList(debit, sb);
// 写入贷方信息
writeList(creditSide, sb);
String filePath = getFilePath();
try {
OutputStreamWriter out = new OutputStreamWriter(
Files.newOutputStream(Paths.get(filePath)), StandardCharsets.UTF_8);
out.write(sb.toString());
out.close();
} catch (IOException e) {
throw new CustomerException(Util.logStr("can not writer file [{}]", filePath));
}
return filePath;
}
private void writeList(List<Object> list, StringBuilder sb) {
Map<String, Object> firstMap = (Map<String, Object>) list.get(0);
List<String> keys = new ArrayList<>();
for (Map.Entry<String, Object> entry : firstMap.entrySet()) {
keys.add(entry.getKey());
}
if (list.size() > 1) {
Map<String, Object> secondMap = (Map<String, Object>) list.get(1);
for (Map.Entry<String, Object> entry : secondMap.entrySet()) {
if (keys.contains(entry.getKey())) {
continue;
}
keys.add(entry.getKey());
}
}
keys = sortKey(keys);
for (Object o : list) {
Map<String, Object> map = (Map<String, Object>) o;
for (String key : keys) {
if (map.containsKey(key)) {
sb.append(map.get(key))
.append("\t");
}
}
sb.deleteCharAt(sb.lastIndexOf("\t"));
sb.append("\r\n");
}
}
private List<String> sortKey(List<String> list) {
return list.stream()
.map(Integer::parseInt)
.sorted()
.map(Util::null2String)
.collect(Collectors.toList());
}
@NotNull
private String getFilePath() {
String sysFilePath = GCONST.getSysFilePath();
String filePath;
if (sysFilePath.endsWith(File.separator)) {
filePath = sysFilePath + "cus_temp" + File.separator + "voucher-new" + File.separator +
System.currentTimeMillis() + "-voucher-new-" + UUID.randomUUID() + ".txt";
} else {
filePath = sysFilePath + File.separator + "cus_temp" + File.separator + "voucher" + File.separator +
System.currentTimeMillis() + "-voucher-new-" + UUID.randomUUID() + ".txt";
}
Path path = Paths.get(filePath);
if (!Files.exists(path)) {
Path parent = path.getParent();
try {
Files.createDirectories(parent);
} catch (IOException e) {
throw new CustomerException(Util.logStr("can not create file [{}]", filePath));
}
}
return filePath;
}
}

View File

@ -1,6 +1,7 @@
package weaver.youhong.ai.haripijiu.action.sapdocking.config.service; package weaver.youhong.ai.haripijiu.action.sapdocking.config.service;
import aiyh.utils.Util; import aiyh.utils.Util;
import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import ebu7common.youhong.ai.bean.Builder; import ebu7common.youhong.ai.bean.Builder;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@ -192,12 +193,14 @@ public class SapConfigService {
List<SapConfigDetail> credit = collect.get(1); List<SapConfigDetail> credit = collect.get(1);
Assert.notEmpty(debit, "debit config not be null!"); Assert.notEmpty(debit, "debit config not be null!");
Assert.notEmpty(credit, "credit config not be bull!");
List<VoucherItem> debtorList = getVoucherItems(workflowData, debit); List<VoucherItem> debtorList = getVoucherItems(workflowData, debit);
result.add(debtorList); result.add(debtorList);
if (CollectionUtil.isNotEmpty(credit)) {
List<VoucherItem> creditorList = getVoucherItems(workflowData, credit); List<VoucherItem> creditorList = getVoucherItems(workflowData, credit);
result.add(creditorList); result.add(creditorList);
}
return result; return result;
} }

View File

@ -15,6 +15,7 @@ import weaver.soa.workflow.request.RequestInfo;
import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper; import weaver.youhong.ai.pcn.actioin.generateloginid.mapper.GenerateLoginIdMapper;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -57,9 +58,11 @@ public class GenerateLoginIdAction extends SafeCusBaseAction {
Map<String, String> mainTableValue = super.getMainTableValue(requestInfo); Map<String, String> mainTableValue = super.getMainTableValue(requestInfo);
String subCompanyName = mainTableValue.get(subCompanyTextField); String subCompanyName = mainTableValue.get(subCompanyTextField);
String subCompanyId = mapper.selectSubCompanyIdBySubCompanyName(subCompanyName); String subCompanyId = mapper.selectSubCompanyIdBySubCompanyName(subCompanyName);
Map<String, String> lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%"); // Map<String, String> lastLoginIdInfo = mapper.selectLastLoginId(subCompanyName, subCompanyId, subCompanyName + "%");
String loginIdNo = lastLoginIdInfo.get("loginIdNo"); // String loginIdNo = lastLoginIdInfo.get("loginIdNo");
String loginId = prefixFill(loginIdNo, subCompanyName); // String loginId = prefixFill(loginIdNo, subCompanyName);
List<String> loginIdList = mapper.selectLoginIdList(subCompanyId);
String loginId = subCompanyName + formatList(loginIdList, Integer.parseInt(numberFillQuantity));
if (mapper.updateLoginId(billTable, requestId, loginId, loginIdField)) { if (mapper.updateLoginId(billTable, requestId, loginId, loginIdField)) {
try { try {
Thread.sleep(500); Thread.sleep(500);
@ -74,6 +77,48 @@ public class GenerateLoginIdAction extends SafeCusBaseAction {
} }
} }
/**
* <h2></h2>
*
* @param list
* @param length
* @return
*/
public String formatList(List<String> list, int length) {
NumberFormat format = NumberFormat.getInstance();
format.setMinimumIntegerDigits(length);
format.setGroupingUsed(false);
if (list == null || list.isEmpty()) {
return format.format(0);
}
int maxNum = 0;
for (String s : list) {
if (s != null && !s.isEmpty()) {
int num = 0;
boolean foundNum = false;
// 从末尾向前读取
for (int i = s.length() - 1; i >= 0; i--) {
char c = s.charAt(i);
if (Character.isDigit(c)) {
foundNum = true;
int digit = c - '0';
// 根据数字位数计算数字大小
num += digit * Math.pow(10, s.length() - i - 1);
} else if (foundNum) {
// 遇到非数字字符,停止读取
break;
}
}
if (num > maxNum) {
maxNum = num;
}
}
}
return format.format(maxNum + 1);
}
/** /**
* <h2></h2> * <h2></h2>
* *

View File

@ -5,6 +5,7 @@ import aiyh.utils.annotation.recordset.Select;
import aiyh.utils.annotation.recordset.SqlMapper; import aiyh.utils.annotation.recordset.SqlMapper;
import aiyh.utils.annotation.recordset.Update; import aiyh.utils.annotation.recordset.Update;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -47,6 +48,16 @@ public interface GenerateLoginIdMapper {
); );
/**
* <h2></h2>
*
* @param subCompanyId id
* @return
*/
@Select("select LOGINID from hrmresource where SUBCOMPANYID1 = #{subCompanyId}")
List<String> selectLoginIdList(@ParamMapper("subCompanyId") String subCompanyId);
/** /**
* <h2>loginId</h2> * <h2>loginId</h2>
* *

View File

@ -0,0 +1,16 @@
#修改当前配置文件后需要重启, you must restart service at change the config file after
#
# 当前需要同步的语言, current active language
cus.multilingual.active=ZHS,IDN
#中文
cus.multilingual.ZHS=7
#印尼
cus.multilingual.IDN=22
# 泰语
cus.multilingual.THA=17
# 英语
cus.multilingual.ENG=8
# 越南
cus.multilingual.VIE=14
# 葡萄牙
cus.multilingual.POR=21

View File

@ -0,0 +1,5 @@
producerGroup=weaver-car
serverAddr=114.115.168.220:9876
topic=AUTH_CONSOLE_ORG_TOPIC
tag=*
consumerGroup=weaver-car-consumer

View File

@ -0,0 +1,24 @@
# ???????
corpSecret=5eab6957b4944d75acfa9cfcc8feff5a
agentId=10000060
corpId=wwdbb6b075752cc1b9
# ??token???
tokenUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/gettoken
# ??????
userInfoUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/user/get
# ??????
departmentInfoUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/department/list
# ??????
addTodoTaskUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/task/create
# ??????
updateTodoTaskUrl=http://ramos-develop.shdata.com:11080/uranus/cgi-bin/request/task/update
# ?????????appId
appId=wwdbb6b075752cc1b9
# ????????????ID
modelId=112
# ???????????sql ????????outkey ??sql?? select outkey from hrmresource where id in (${ids}) ??
hrmSenderConvertRuleSql=select lastname from hrmresource where id in (${ids})
# ?????
hrmReceiveConvertRuleSql=select lastname from hrmresource where id in (${ids})
# oa token??????????
expiryBeforeTime=5

View File

@ -0,0 +1,5 @@
bootstrap.servers=10.184.42.41:9094,10.184.42.42:9094,10.184.42.40:9094
acks=all
retries=1
key.serializer=org.apache.kafka.common.serialization.StringSerializer
value.serializer=org.apache.kafka.common.serialization.StringSerializer

View File

@ -1,15 +0,0 @@
package xuanran.wang.http_test.annotations;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/10 10:46
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
public @interface CusRequest {
}

View File

@ -0,0 +1,24 @@
package xuanran.wang.http_test.annotations;
import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
import xuanran.wang.http_test.annotations.request_type.CusRequestType;
import xuanran.wang.http_test.constant.CusRequestClientConstant;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/10 10:46
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
@Documented
@CusRequestAddress()
public @interface CusRequestClient {
@AliasFor(annotation = CusRequestAddress.class, attribute = "host")
String host() default "";
@AliasFor(annotation = CusRequestAddress.class, attribute = "port")
int port() default 0;
}

View File

@ -3,14 +3,14 @@ package xuanran.wang.http_test.annotations;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
* <h1></h1> * <h1></h1>
* *
* @author xuanran.wang * @author xuanran.wang
* @date 2023/3/10 17:00 * @date 2023/3/16 19:59
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER}) @Target({ElementType.TYPE, ElementType.METHOD})
@Documented @Documented
public @interface CusPathQuery { public @interface CusRequestUrl {
String value(); String url();
} }

View File

@ -1,15 +0,0 @@
package xuanran.wang.http_test.annotations;
import java.lang.annotation.*;
/**
* <h1> map, </h1>
*
* @author xuanran.wang
* @date 2023/3/10 13:06
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER)
@Documented
public @interface GetPathValue {
}

View File

@ -1,15 +1,16 @@
package xuanran.wang.http_test.annotations; package xuanran.wang.http_test.annotations.body;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
* <h1>post</h1> * <h1></h1>
* *
* @author xuanran.wang * @author xuanran.wang
* @date 2023/3/10 13:48 * @date 2023/3/20 21:27
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.PARAMETER) @Target(ElementType.PARAMETER)
@Documented @Documented
public @interface PostBody { public @interface CusRequestBody {
} }

View File

@ -0,0 +1,16 @@
package xuanran.wang.http_test.annotations.handle;
import java.lang.annotation.*;
/**
* <h1>handle</h1>
*
* @author xuanran.wang
* @date 2023/3/16 15:37
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
public @interface CusHandle {
int order() default 0;
}

View File

@ -0,0 +1,23 @@
package xuanran.wang.http_test.annotations.handle;
import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
import xuanran.wang.http_test.annotations.CusRequestUrl;
import xuanran.wang.http_test.annotations.request_type.CusRequestType;
import xuanran.wang.http_test.constant.CusRequestClientConstant;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/20 21:14
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@CusHandle(order = 0)
public @interface CusPreLoadHandle {
@AliasFor(annotation = CusHandle.class, attribute = "order")
int order() default 0;
}

View File

@ -0,0 +1,19 @@
package xuanran.wang.http_test.annotations.handle;
import xuanran.wang.http_test.handle.CusRequestAfterHandle;
import xuanran.wang.http_test.test.TestRequestAfterHandle;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/24 14:44
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
public @interface CusReqAfterHandleRegister {
Class<?> afterHandle();
}

View File

@ -0,0 +1,19 @@
package xuanran.wang.http_test.annotations.handle;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/22 11:29
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
public @interface CusResponseSuccessHandle {
String successKey();
String successCondition();
String errorMsg();
String data();
}

View File

@ -14,7 +14,7 @@ import java.lang.annotation.*;
* @date 2023/3/14 22:50 * @date 2023/3/14 22:50
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ElementType.METHOD,ElementType.PARAMETER})
@Documented @Documented
public @interface CusPathQuery { public @interface CusPathQuery {
/** /**

View File

@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type; package xuanran.wang.http_test.annotations.request_type;
import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
import xuanran.wang.http_test.annotations.CusRequestUrl;
import xuanran.wang.http_test.constant.CusRequestClientConstant;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -11,6 +15,12 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Documented @Documented
@CusRequestUrl(url = "")
@CusRequestType(requestType = CusRequestClientConstant.DELETE)
public @interface CusRequestDelete { public @interface CusRequestDelete {
String url() default ""; @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
String url();
@AliasFor(annotation = CusRequestType.class, attribute = "requestType")
int requestType() default CusRequestClientConstant.DELETE;
} }

View File

@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type; package xuanran.wang.http_test.annotations.request_type;
import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
import xuanran.wang.http_test.annotations.CusRequestUrl;
import xuanran.wang.http_test.constant.CusRequestClientConstant;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -9,8 +13,14 @@ import java.lang.annotation.*;
* @date 2023/3/10 10:15 * @date 2023/3/10 10:15
*/ */
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ElementType.METHOD, ElementType.TYPE})
@Documented @Documented
@CusRequestUrl(url = "")
@CusRequestType(requestType = CusRequestClientConstant.GET)
public @interface CusRequestGet{ public @interface CusRequestGet{
String url() default ""; @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
String url();
@AliasFor(annotation = CusRequestType.class, attribute = "requestType")
int requestType() default CusRequestClientConstant.GET;
} }

View File

@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type; package xuanran.wang.http_test.annotations.request_type;
import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
import xuanran.wang.http_test.annotations.CusRequestUrl;
import xuanran.wang.http_test.constant.CusRequestClientConstant;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -11,6 +15,12 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
@Documented @Documented
@CusRequestUrl(url = "")
@CusRequestType(requestType = CusRequestClientConstant.POST)
public @interface CusRequestPost { public @interface CusRequestPost {
String url() default ""; @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
String url();
@AliasFor(annotation = CusRequestType.class, attribute = "requestType")
int requestType() default CusRequestClientConstant.POST;
} }

View File

@ -1,5 +1,9 @@
package xuanran.wang.http_test.annotations.request_type; package xuanran.wang.http_test.annotations.request_type;
import aiyh.utils.tool.cn.hutool.core.annotation.AliasFor;
import xuanran.wang.http_test.annotations.CusRequestUrl;
import xuanran.wang.http_test.constant.CusRequestClientConstant;
import java.lang.annotation.*; import java.lang.annotation.*;
/** /**
@ -11,6 +15,12 @@ import java.lang.annotation.*;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD}) @Target({ElementType.METHOD})
@Documented @Documented
@CusRequestUrl(url = "")
@CusRequestType(requestType = CusRequestClientConstant.PUT)
public @interface CusRequestPut { public @interface CusRequestPut {
String url() default ""; @AliasFor(annotation = CusRequestUrl.class, attribute = "url")
String url();
@AliasFor(annotation = CusRequestType.class, attribute = "requestType")
int requestType() default CusRequestClientConstant.PUT;
} }

View File

@ -0,0 +1,16 @@
package xuanran.wang.http_test.annotations.request_type;
import java.lang.annotation.*;
/**
* <h1></h1>
*
* @author xuanran.wang
* @date 2023/3/16 23:07
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
public @interface CusRequestType {
int requestType() default 0;
}

Some files were not shown because too many files have changed in this diff Show More