From 2857d0a3df691bf50a7c50941c91ef1bb1e9e089 Mon Sep 17 00:00:00 2001
From: "youHong.ai" <774495953@qq.com>
Date: Thu, 16 Feb 2023 19:00:32 +0800
Subject: [PATCH] =?UTF-8?q?ssl=E6=B5=8B=E8=AF=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
javascript/common/dev.js | 59 ++
.../youhong.ai/pcn/workflow_code_block.js | 156 ++++-
.../aiyh/utils/action/SafeCusBaseAction.java | 543 +++++++++--------
.../utils/excention/CustomerException.java | 88 +--
.../java/aiyh/utils/httpUtil/HttpManager.java | 193 +++---
.../java/aiyh/utils/httpUtil/ResponeVo.java | 569 +++++++++---------
.../aiyh/utils/httpUtil/util/HttpUtils.java | 314 +++++-----
.../java/aiyh/utils/tool/ASCIIStrCache.java | 30 +
src/main/java/aiyh/utils/tool/Assert.java | 289 +++++++++
src/main/java/aiyh/utils/tool/CharUtil.java | 336 +++++++++++
.../java/aiyh/utils/tool/StrFormatter.java | 364 +++++++++++
.../controller/RaceTrackController.java | 47 ++
.../ai/pcn/racetrack/dto/RaceTrackEvent.java | 32 +
.../pcn/racetrack/mapper/RacetrackMapper.java | 50 ++
.../racetrack/service/RaceTrackService.java | 59 ++
.../ai/pcn/racetrack/vo/RaceTrackVo.java | 27 +
.../mapper/ApaLevelByScoreMapper.java | 10 +-
.../service/ApaLevelByScoreService.java | 7 +-
.../vo/ApaDataBtnShowVo.java | 22 +
.../action/CaElectronicSignatureAction.java | 81 +++
.../SendEmailToExternalPersonnelAction.java | 175 +++---
常用信息.md | 34 +-
22 files changed, 2556 insertions(+), 929 deletions(-)
create mode 100644 src/main/java/aiyh/utils/tool/ASCIIStrCache.java
create mode 100644 src/main/java/aiyh/utils/tool/Assert.java
create mode 100644 src/main/java/aiyh/utils/tool/CharUtil.java
create mode 100644 src/main/java/aiyh/utils/tool/StrFormatter.java
create mode 100644 src/main/java/com/api/youhong/ai/pcn/racetrack/controller/RaceTrackController.java
create mode 100644 src/main/java/com/api/youhong/ai/pcn/racetrack/dto/RaceTrackEvent.java
create mode 100644 src/main/java/com/api/youhong/ai/pcn/racetrack/mapper/RacetrackMapper.java
create mode 100644 src/main/java/com/api/youhong/ai/pcn/racetrack/service/RaceTrackService.java
create mode 100644 src/main/java/com/api/youhong/ai/pcn/racetrack/vo/RaceTrackVo.java
create mode 100644 src/main/java/com/api/youhong/ai/pcn/workflow/doworkflowtomodel/vo/ApaDataBtnShowVo.java
create mode 100644 src/main/java/weaver/youhong/ai/intellectualproperty/action/CaElectronicSignatureAction.java
diff --git a/javascript/common/dev.js b/javascript/common/dev.js
index c414c7a..cb46f64 100644
--- a/javascript/common/dev.js
+++ b/javascript/common/dev.js
@@ -27,6 +27,11 @@ WfForm.OPER_SAVECOMPLETE = '保存后页面跳转前 KB900210501'
WfForm.OPER_WITHDRAW = '撤回 KB900201101'
WfForm.OPER_CLOSE = '页面关闭'
+/**
+ * 注册流程事件
+ * @param type
+ * @param callback
+ */
WfForm.registerCheckEvent = (type, callback = (callback) = {}) => {
// WfForm.registerCheckEvent(WfForm.OPER_SAVE+","+WfForm.OPER_SUBMIT,function(callback){
// //... 执行自定义逻辑
@@ -164,6 +169,60 @@ WfForm.getDetailAllRowIndexStr = function (detailMark) {
// }
}
+/**
+ 添加明细行并设置初始值
+ * 参数 参数类型 必须 说明
+ * detailMark String 是 明细表标示,明细1就是detail_1,以此递增类推
+ * initAddRowData JSON 否 给新增后设置初始值,格式为{field110:{value:”11”},field112:{value:”22”},…},注意key不带下划线标示
+ * @param detailMark
+ * @param initAddRowData
+ */
+WfForm.addDetailRow = function (detailMark, initAddRowData = {}) {
+// //明细2添加一行并给新添加的行字段field111赋值
+// WfForm.addDetailRow("detail_2",{field111:{value:"初始值"}});
+// //添加一行并给浏览按钮字段赋值
+// WfForm.addDetailRow("detail_2",{field222:{
+// value: "2,3",
+// specialobj:[
+// {id:"2",name:"张三"},
+// {id:"3",name:"李四"}
+// ]
+// }});
+// //动态字段赋值,明细1添加一行并给字段名称为begindate的字段赋值
+// var begindatefield = WfForm.convertFieldNameToId("begindate", "detail_1");
+// var addObj = {};
+// addObj[begindatefield] = {value:"2019-03-01"};
+// WfForm.addDetailRow("detail_1", addObj);
+// //不推荐这种动态键值写法,IE不支持,避免掉
+// WfForm.addDetailRow("detail_1",{[begindatefield]:{value:"2019-03-01"}})
+}
+
+/**
+ * 系统样式的Confirm确认框
+ * 参数 参数类型 必须 说明
+ * content String 是 确认信息
+ * okEvent Function 是 点击确认事件
+ * cancelEvent Function 否 点击取消事件
+ * otherInfo Object 否 自定义信息(按钮名称)
+ * @param content
+ * @param okEvent
+ * @param cancelEvent
+ * @param otherInfo
+ */
+WfForm.showConfirm = function (content, okEvent, cancelEvent, otherInfo = {}) {
+ // WfForm.showConfirm("确认删除吗?", function(){
+ // alert("删除成功");
+ // });
+ // WfForm.showConfirm("请问你是否需要技术协助?",function(){
+ // alert("点击确认调用的事件");
+ // },function(){
+ // alert("点击取消调用的事件");
+ // },{
+ // title:"信息确认", //弹确认框的title,仅PC端有效
+ // okText:"需要", //自定义确认按钮名称
+ // cancelText:"不需要" //自定义取消按钮名称
+ // });
+}
/* ******************* 建模表开发依赖 ******************* */
diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js
index 56892b0..59bbd3f 100644
--- a/javascript/youhong.ai/pcn/workflow_code_block.js
+++ b/javascript/youhong.ai/pcn/workflow_code_block.js
@@ -305,52 +305,133 @@ $(() => {
$(() => {
const workflowInsertValueConfig = [
{
- table: '',
- targetTable: '',
+ table: 'detail_1',
+ targetTable: 'detail_3',
filedMapping: [{
- source: '',
- target: ''
+ source: 'mbmc',
+ target: 'name'
+ }, {
+ source: 'mbms',
+ target: 'description'
+ }, {
+ source: 'zp',
+ target: 'score'
+ }, {
+ source: 'zwpj',
+ target: 'grpj'
+ }, {
+ source: 'mbmc',
+ target: 'ldpf'
+ }, {
+ source: 'ldpj',
+ target: 'ldpj'
}]
}, {
- table: '',
- targetTable: '',
- filedMapping: []
+ table: 'detail_2',
+ targetTable: 'detail_3',
+ filedMapping: [{
+ source: 'xx',
+ target: 'name'
+ }, {
+ source: 'ms',
+ target: 'description'
+ }, {
+ source: 'zp',
+ target: 'score'
+ }, {
+ source: 'zwpj',
+ target: 'grpj'
+ }, {
+ source: 'mbmc',
+ target: 'ldpf'
+ }, {
+ source: 'ldpj',
+ target: 'ldpj'
+ }]
}
]
- (function start() {
+ /**
+ * 执行提交时将配置中的明细表数据合并到指定的明细表中
+ */
+ WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, (continueRun) => {
+ start()
+ continueRun()
+ })
+
+
+ /**
+ * 开始执行合并操作
+ */
+ function start() {
let mappingResult = []
workflowInsertValueConfig.forEach(item => {
let valueMapping = getDetailValueMapping(item)
mappingResult = [...mappingResult, ...valueMapping]
})
- })()
-
- function setValue(valueMapping) {
-
+ setValue(mappingResult)
}
+
+ /**
+ * 设置表数据到指定的明细表中
+ * @param valueMapping 值映射数组
+ */
+ function setValue(valueMapping) {
+ valueMapping.forEach(row => {
+ let rowData = {}
+ row.forEach(item => {
+ if (!rowData[item.targetTable]) {
+ rowData[item.targetTable] = {}
+ }
+ rowData[item.targetTable][Utils.convertNameToIdUtil({
+ fieldName: item.targetField,
+ table: item.targetTable
+ })] = {
+ value: item.value
+ }
+ })
+ Object.keys(rowData).forEach(key => {
+ WfForm.addDetailRow(key, rowData[key]);
+ })
+ })
+ }
+
+ /**
+ * 获取明细值和对应字段的映射数组
+ * @param configItem 配置项
+ * @returns {*[]} 明细字段和对应值的映射数组
+ */
function getDetailValueMapping(configItem) {
let detailIdsStr = WfForm.getDetailAllRowIndexStr(configItem.table);
let detailIdArr = detailIdsStr.split(",")
let result = []
for (let i = 0; i < detailIdArr.length; i++) {
- let fieldValueMapping = getValueByConfig(configItem.filedMapping, configItem.table, i)
+ let fieldValueMapping = getValueByConfig(configItem.filedMapping, configItem.table, detailIdArr[i], configItem.targetTable)
result.push(fieldValueMapping)
}
return result
}
- function getValueByConfig(fieldMapping, tableName, detailIndex) {
+ /**
+ * 通过配置数据获取值
+ * @param fieldMapping 字段映射规则数组
+ * @param tableName 表名称
+ * @param detailIndex 明细表下标
+ * @param targetTable 目标表
+ * @returns {*[]} 对应明细行的值数组
+ */
+ function getValueByConfig(fieldMapping, tableName, detailIndex, targetTable) {
let result = []
fieldMapping.forEach(item => {
let fieldValue = Utils.getFiledValueByName({
fieldName: item.source,
- TableName: tableName
+ table: tableName
}, detailIndex)
result.push({
targetField: item.target,
- value: fieldValue
+ value: fieldValue,
+ targetTable: targetTable
})
})
return result
@@ -360,3 +441,46 @@ $(() => {
})
/* ******************* 流程明细数据整合插入end ******************* */
+
+
+/* ******************* 当明细数据未加载完成时 控制流程提交 start ******************* */
+$(() => {
+ const config = {
+ table: 'detail_1',
+ field: ['fj']
+ }
+
+ function check() {
+ let detailRowIndexStr = WfForm.getDetailAllRowIndexStr(config.table);
+ let rowIndexArr = detailRowIndexStr.split(",");
+ try {
+ rowIndexArr.forEach(item => {
+ config.field.forEach(field => {
+ let value = WfForm.getFieldValue(WfForm.convertFieldNameToId(field,
) + "_" + item)
+ if (value == '' || value == null) {
+ throw field + " is can not be null!";
+ }
+ })
+
+ })
+ } catch (err) {
+ return false
+ }
+ return true
+ }
+
+ WfForm.registerCheckEvent(WfForm.OPER_SUBMIT, callback => {
+ if (check()) {
+ callback()
+ } else {
+ WfForm.showConfirm("~`~` " + "7 模版文件生成中,请稍后在提交! " + " `~`8 Template file generation, please submit later! " + "`~`~", function () {
+ }, function () {
+ }, {
+ title: "~`~` " + "7 提交检查提示 " + "`~` 8 Submit check prompt " + "`~`~", //弹确认框的title,仅PC端有效
+ okText: "OK", //自定义确认按钮名称
+ cancelText: "Cancel" //自定义取消按钮名称
+ });
+ }
+ })
+})
+/* ******************* 当明细数据未加载完成时 控制流程提交 end ******************* */
\ No newline at end of file
diff --git a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java
index e97c6d7..c1e81df 100644
--- a/src/main/java/aiyh/utils/action/SafeCusBaseAction.java
+++ b/src/main/java/aiyh/utils/action/SafeCusBaseAction.java
@@ -2,7 +2,7 @@ package aiyh.utils.action;
import aiyh.utils.Util;
import aiyh.utils.excention.CustomerException;
-import org.apache.commons.lang3.StringUtils;
+import com.google.common.base.Strings;
import org.apache.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import weaver.hrm.User;
@@ -12,7 +12,6 @@ import weaver.workflow.request.RequestManager;
import weaver.workflow.workflow.WorkflowBillComInfo;
import weaver.workflow.workflow.WorkflowComInfo;
-import java.io.IOException;
import java.util.*;
/**
@@ -21,269 +20,279 @@ import java.util.*;
* @author EBU7-dev-1 aiyh
*/
public abstract class SafeCusBaseAction implements Action {
-
-
- /**
- * 全局日志对象
- */
- protected final Logger log = Util.getLogger();
- private final Map actionHandleMethod = new HashMap<>();
-
- /**
- * 初始化流程默认的处理方法
- */
- private void initHandleMethod() {
- // 提交
- actionHandleMethod.put(ActionRunType.SUBMIT, this::doSubmit);
- // 退回
- actionHandleMethod.put(ActionRunType.REJECT, this::doReject);
- // 撤回
- actionHandleMethod.put(ActionRunType.WITHDRAW, this::doWithdraw);
- // 强制收回
- actionHandleMethod.put(ActionRunType.DRAW_BACK, this::doDrawBack);
- }
-
-
- @Override
- public final String execute(RequestInfo requestInfo) {
- RequestManager requestManager = requestInfo.getRequestManager();
- String billTable = requestManager.getBillTableName();
- String requestId = requestInfo.getRequestid();
- User user = requestInfo.getRequestManager().getUser();
- int workflowId = requestManager.getWorkflowid();
- // 操作类型 submit - 提交 reject - 退回 等
- String src = requestManager.getSrc();
- if ("".equals(billTable)) {
- WorkflowComInfo workflowComInfo = new WorkflowComInfo();
- String formId = workflowComInfo.getFormId(String.valueOf(workflowId));
- WorkflowBillComInfo workflowBillComInfo = new WorkflowBillComInfo();
- billTable = workflowBillComInfo.getTablename(formId);
- }
- try {
- Util.verifyRequiredField(this);
- if (StringUtils.isEmpty(src)) {
- src = "submit";
- }
- // 初始化默认的流程处理方法
- initHandleMethod();
- // 提供自定义注册处理方法
- registerHandler(actionHandleMethod);
- // 获取流程对应的处理方法
- SafeCusBaseActionHandleFunction cusBaseActionHandleFunction = actionHandleMethod.get(src);
- // 默认没有直接成功不做拦截
- if (null == cusBaseActionHandleFunction) {
- return Action.SUCCESS;
- }
- cusBaseActionHandleFunction.handle(requestId, billTable, workflowId, user, requestInfo);
- } catch (CustomerException e) {
- if (e.getCode() != null && e.getCode() == 500) {
- Util.actionFail(requestManager, e.getMessage());
- return Action.FAILURE_AND_CONTINUE;
- }
- if (this.exceptionCallback(e, requestManager)) {
- return Action.FAILURE_AND_CONTINUE;
- }
- } catch (Exception e) {
- if (this.exceptionCallback(e, requestManager)) {
- return Action.FAILURE_AND_CONTINUE;
- }
- }
- return Action.SUCCESS;
- }
-
-
- /**
- * 程序执行异常回调
- *
- * @param e 异常信息
- * @param requestManager requestManager对象
- * @return 是否阻止action往下提交,true- 阻止, false-放行
- */
- public boolean exceptionCallback(Exception e, RequestManager requestManager) {
- e.printStackTrace();
- log.error(Util.logStr("getDataId action fail, exception message is [{}], error stack trace msg is: \n{}",
- e.getMessage(), Util.getErrString(e)));
- Util.actionFail(requestManager, e.getMessage());
- return true;
- }
-
-
- /**
- * 流程其他流转类型处理方法注册
- *
- * @param actionHandleMethod 处理方法对应map
- */
- public void registerHandler(Map actionHandleMethod) {
- }
-
-
- /**
- * action 提交流程业务处理方法
- * 具体业务逻辑实现
- * 全局存在log成员变量,用于日志的输出 Util.actionFailException(requestManager,"error msg"); 用于提示action执行失败
- *
- *
- * @param requestId 流程请求ID
- * @param billTable 流程对应主表名称
- * @param workflowId 流程对应流程ID
- * @param user 当前节点操作者用户
- * @param requestInfo 请求管理对象
- */
-
- public abstract void doSubmit(String requestId, String billTable, int workflowId,
- User user, RequestInfo requestInfo);
-
-
- /**
- * action 退回流程业务处理方法
- * 具体业务逻辑实现
- * 全局存在log成员变量,用于日志的输出 Util.actionFailException(requestManager,"error msg"); 用于提示action执行失败
- *
- *
- * @param requestId 流程请求ID
- * @param billTable 流程对应主表名称
- * @param workflowId 流程对应流程ID
- * @param user 当前节点操作者用户
- * @param requestInfo 请求管理对象
- */
- public void doReject(String requestId, String billTable, int workflowId,
- User user, RequestInfo requestInfo) {
- }
-
- /**
- * action 撤回、撤回流程流程业务处理方法
- * 具体业务逻辑实现
- * 全局存在log成员变量,用于日志的输出 Util.actionFailException(requestManager,"error msg"); 用于提示action执行失败
- *
- *
- * @param requestId 流程请求ID
- * @param billTable 流程对应主表名称
- * @param workflowId 流程对应流程ID
- * @param user 当前节点操作者用户
- * @param requestInfo 请求管理对象
- */
- public void doWithdraw(String requestId, String billTable, int workflowId,
- User user, RequestInfo requestInfo) {
- }
-
-
- /**
- * action 强制收回流程业务处理方法
- * 具体业务逻辑实现
- * 全局存在log成员变量,用于日志的输出 Util.actionFailException(requestManager,"error msg"); 用于提示action执行失败
- *
- *
- * @param requestId 流程请求ID
- * @param billTable 流程对应主表名称
- * @param workflowId 流程对应流程ID
- * @param user 当前节点操作者用户
- * @param requestInfo 请求管理对象
- */
- public void doDrawBack(String requestId, String billTable, int workflowId,
- User user, RequestInfo requestInfo) {
- }
-
- /**
- * 获取流程主表数据
- *
- * @return 流程主表数据
- */
- protected Map getMainTableValue(RequestInfo requestInfo) {
- // 获取主表数据
- Property[] propertyArr = requestInfo.getMainTableInfo().getProperty();
- return getStringMap(propertyArr);
- }
-
- @NotNull
- private Map getStringMap(Property[] propertyArr) {
- if (null == propertyArr) {
- return Collections.emptyMap();
- }
- Map mainTable = new HashMap<>((int) Math.ceil(propertyArr.length * 1.4));
- for (Property property : propertyArr) {
- String fieldName = property.getName();
- String value = property.getValue();
- mainTable.put(fieldName, value);
- }
- return mainTable;
- }
-
-
- /**
- * 获取所有明细数据
- *
- * @return 以明细表需要为键,以明细表数据为值的键值对明细数据信息
- */
- protected Map>> getDetailTableValue(RequestInfo requestInfo) {
- DetailTable[] detailTableArr = requestInfo.getDetailTableInfo().getDetailTable();
- return getListMap(detailTableArr);
- }
-
-
- @NotNull
- private Map>> getListMap(DetailTable[] detailTableArr) {
- Map>> detailDataList = new HashMap<>((int) Math.ceil(detailTableArr.length * 1.4));
- for (DetailTable detailTable : detailTableArr) {
- List