From aeb04f41d40fb0b50672082f74b80a3accecbc05 Mon Sep 17 00:00:00 2001 From: "youHong.ai" <774495953@qq.com> Date: Fri, 14 Apr 2023 10:16:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- javascript/youhong.ai/yihong/index.js | 75 ++++++ src/main/java/aiyh/utils/Util.java | 16 ++ .../RequestLogAuthorityController.java | 6 +- .../mapper/RequestLogAuthorityMapper.java | 7 + .../service/RequestLogAuthorityService.java | 24 +- .../mapper/FunctionListMapper.java | 6 +- .../pojo/FunctionListConfigItem.java | 4 + .../impl/InterceptRequestLogImpl.java | 69 +++--- .../impl/RequestLogShowOrHiddenImpl.java | 59 +---- .../mapper/InterceptRequestLogMapper.java | 92 ++++++-- .../pojo/RequestLogPrivacyEntity.java | 40 ++++ .../util/PrivacyRequestLogUtil.java | 216 ++++++++++++++++++ .../config/service/SapConfigService.java | 9 +- .../prop/prop2map/JituMultilingual.properties | 16 ++ .../java/youhong/ai/utiltest/GenericTest.java | 29 ++- 15 files changed, 544 insertions(+), 124 deletions(-) create mode 100644 javascript/youhong.ai/yihong/index.js create mode 100644 src/main/java/com/customization/youhong/deerge/requestlog/pojo/RequestLogPrivacyEntity.java create mode 100644 src/main/java/com/customization/youhong/deerge/requestlog/util/PrivacyRequestLogUtil.java create mode 100644 src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties diff --git a/javascript/youhong.ai/yihong/index.js b/javascript/youhong.ai/yihong/index.js new file mode 100644 index 0000000..bceba14 --- /dev/null +++ b/javascript/youhong.ai/yihong/index.js @@ -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 +}) + +/* ******************* 按钮变灰 ******************* */ \ No newline at end of file diff --git a/src/main/java/aiyh/utils/Util.java b/src/main/java/aiyh/utils/Util.java index cc5f158..0c7bf0d 100644 --- a/src/main/java/aiyh/utils/Util.java +++ b/src/main/java/aiyh/utils/Util.java @@ -3870,4 +3870,20 @@ public class Util extends weaver.general.Util { } 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 ""; + } + } diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java index b8cf5d8..b98f420 100644 --- a/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java +++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/controller/RequestLogAuthorityController.java @@ -37,10 +37,12 @@ public class RequestLogAuthorityController { @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) 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 { 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) { log.info("get privacy authority error!" + Util.getErrString(e)); return ApiResult.error(e.getMessage()); diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java index 0201d68..e76d9b3 100644 --- a/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java +++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/mapper/RequestLogAuthorityMapper.java @@ -30,4 +30,11 @@ public interface RequestLogAuthorityMapper { "and (',' || authority_members || ',') like #{userLike} and enable_status = 1") RequestLogAuthority selectLogPrivacyConfig(@ParamMapper("userLike") String userLike, @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); } diff --git a/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java b/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java index 05f3519..fe6f835 100644 --- a/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java +++ b/src/main/java/com/api/youhong/ai/geerde/requestlog/service/RequestLogAuthorityService.java @@ -1,10 +1,13 @@ package com.api.youhong.ai.geerde.requestlog.service; 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.pojo.RequestLogAuthority; import weaver.hrm.User; +import java.util.HashMap; +import java.util.Map; import java.util.Objects; /** @@ -18,8 +21,25 @@ public class RequestLogAuthorityService { private final RequestLogAuthorityMapper mapper = Util.getMapper(RequestLogAuthorityMapper.class); - public boolean getPrivacyAuthority(User user, String workflowId) { + public Map getPrivacyAuthority(User user, String workflowId, String requestId, String nodeId) { + Map result = new HashMap<>(); + result.put("show", true); 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; } } diff --git a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java index 205abcd..6d7fdeb 100644 --- a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java +++ b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/mapper/FunctionListMapper.java @@ -27,8 +27,8 @@ public interface FunctionListMapper { column = "button_icon", id = @Id(value = String.class, methodId = 1)) ) - @Select("select * from uf_fun_list_config where CONCAT(',' , subcompany_id , ',') like #{userSubCompanyLike}") - @SelectOracle("select * from uf_fun_list_config where (',' || 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} order by sort_num") List selectFunctionList(@ParamMapper("userSubCompanyLike") String userSubCompanyLike); @@ -42,7 +42,7 @@ public interface FunctionListMapper { column = "button_icon", 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 selectFunctionListAll(); /** diff --git a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java index 0c72146..84d5006 100644 --- a/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java +++ b/src/main/java/com/api/youhong/ai/taibao/fcuntionlist/pojo/FunctionListConfigItem.java @@ -35,4 +35,8 @@ public class FunctionListConfigItem { /** 图标数量接口地址 */ @SqlOracleDbFieldAnn("NUMBER_URL") private String numberUrl; + + /** 排序字段 */ + @SqlOracleDbFieldAnn("SORT_NUM") + private String sortNum; } diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java b/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java index 5670e1c..45f36a5 100644 --- a/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java +++ b/src/main/java/com/customization/youhong/deerge/requestlog/impl/InterceptRequestLogImpl.java @@ -1,8 +1,7 @@ package com.customization.youhong.deerge.requestlog.impl; import aiyh.utils.Util; -import aiyh.utils.tool.cn.hutool.core.util.StrUtil; -import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper; +import com.customization.youhong.deerge.requestlog.util.PrivacyRequestLogUtil; import com.engine.core.cfg.annotation.ServiceDynamicProxy; import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy; 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.impl.RequestFormServiceImpl; import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; import weaver.workflow.request.RequestManager; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; 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"; private final Logger log = Util.getLogger(); - private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class); + private final PrivacyRequestLogUtil privacyRequestLogUtil = new PrivacyRequestLogUtil(); @Override public Map judgeCreateRight(HttpServletRequest request) { @@ -118,37 +119,40 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req @Override @ServiceMethodDynamicProxy(desc = "保存和提交流程时,判断是否开启隐私") public Map requestSubmit(HttpServletRequest request) { - + log.info("requestSubmit:=>"); + return handlerRequestLogPrivacy(request); + } + + @Override + @ServiceMethodDynamicProxy(desc = "转发流程、意见征询时,判断是否开启隐私") + public Map forwardSubmit(HttpServletRequest request) { + log.info("forwardSubmit:=>"); + return handlerRequestLogPrivacy(request); + } + + @Override + @ServiceMethodDynamicProxy(desc = "转发流程、意见征询时,判断是否开启隐私") + public Map remarkSubmit(HttpServletRequest request) { + log.info("remarkSubmit:=>"); + return handlerRequestLogPrivacy(request); + } + + @Nullable + private Map handlerRequestLogPrivacy(HttpServletRequest request) { Map result = (Map) executeMethod(request); try { - log.info("调用提交流程和保存流程后的返回参数: " + result); 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()); if (SUCCESS.equals(type)) { // 保存成功,这里对隐私的签字意见做处理 - String userId = request.getParameter("userId"); - 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 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); - } + privacyRequestLogUtil.privacyRequestLogHandle(request); } } catch (Exception e) { log.error("add privacy request log error! " + Util.getErrString(e)); @@ -156,20 +160,11 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req return result; } - @Override - public Map forwardSubmit(HttpServletRequest request) { - return null; - } - @Override public Map requestWithdraw(HttpServletRequest httpServletRequest) { return null; } - @Override - public Map remarkSubmit(HttpServletRequest request) { - return null; - } @Override public Map functionManage(HttpServletRequest request, HttpServletResponse response) { diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java b/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java index 719d594..b0f6be4 100644 --- a/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java +++ b/src/main/java/com/customization/youhong/deerge/requestlog/impl/RequestLogShowOrHiddenImpl.java @@ -1,23 +1,17 @@ package com.customization.youhong.deerge.requestlog.impl; import aiyh.utils.Util; -import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil; -import aiyh.utils.tool.cn.hutool.core.util.StrUtil; -import com.customization.youhong.deerge.requestlog.mapper.InterceptRequestLogMapper; +import com.alibaba.fastjson.JSON; +import com.customization.youhong.deerge.requestlog.util.PrivacyRequestLogUtil; import com.engine.core.cfg.annotation.ServiceDynamicProxy; import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy; import com.engine.core.impl.aop.AbstractServiceProxy; import com.engine.workflow.service.RequestLogService; import com.engine.workflow.service.impl.RequestLogServiceImpl; import org.apache.log4j.Logger; -import weaver.hrm.HrmUserVarify; -import weaver.hrm.User; import javax.servlet.http.HttpServletRequest; -import java.util.ArrayList; -import java.util.List; import java.util.Map; -import java.util.stream.Collectors; /** *

是否显示隐私签字意见

@@ -29,9 +23,8 @@ import java.util.stream.Collectors; @ServiceDynamicProxy(target = RequestLogServiceImpl.class, desc = "拦截签字意见信息,是否需要隐私控制") 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 public Map getRequestLogBaseInfo(Map params) { @@ -42,52 +35,14 @@ public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements @ServiceMethodDynamicProxy(desc = "控制是否显示隐私签字意见") public Map getRequestLogList(HttpServletRequest request, Map params) { Map result = (Map) executeMethod(request, params); - + Logger log = Util.getLogger(); try { - String isMonitor = request.getParameter("ismonitor"); - boolean isPrint = "1".equals(Util.null2String(request.getParameter("isprint"))); - // 如果是流程监控,全部返回 - if (!StrUtil.isBlank(isMonitor) && !isPrint) { - return result; - } - User user = HrmUserVarify.getUser(request, null); - List> logList = (List>) result.get("loglist"); - List logIds = new ArrayList<>(); - for (Map 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 privacyLogIds; - // 如果是打印,所有隐私都不显示 - if (isPrint) { - privacyLogIds = mapper.selectPrivacyLogIdAll(Util.join(logIds, ","), "-1", Util.null2String(params.get("requestid"))); - } else { - // 如果不是,不显示除自己和隐私组之外的其他人的信息 - List 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 finalPrivacyLogIds = privacyLogIds; - List> newLogList = logList.stream() - .filter(item -> !finalPrivacyLogIds.contains(Util.null2String(item.get("logid")))) - .collect(Collectors.toList()); - result.put("loglist", newLogList); + privacyRequestLogUtil.requestLogList(result, params, request); + log.info("最终的返回结果: " + JSON.toJSONString(result)); } catch (Exception e) { log.error("filter request log list error!" + Util.getErrString(e)); } + return result; } diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/mapper/InterceptRequestLogMapper.java b/src/main/java/com/customization/youhong/deerge/requestlog/mapper/InterceptRequestLogMapper.java index cc89b77..f367c08 100644 --- a/src/main/java/com/customization/youhong/deerge/requestlog/mapper/InterceptRequestLogMapper.java +++ b/src/main/java/com/customization/youhong/deerge/requestlog/mapper/InterceptRequestLogMapper.java @@ -1,6 +1,7 @@ package com.customization.youhong.deerge.requestlog.mapper; import aiyh.utils.annotation.recordset.*; +import com.customization.youhong.deerge.requestlog.pojo.RequestLogPrivacyEntity; import java.util.List; @@ -14,19 +15,18 @@ import java.util.List; @SqlMapper public interface InterceptRequestLogMapper { + /** *

查询签字意见的id

* * @param requestId 流程requestid - * @param remark 签字意见内容 * @param nodeId 节点id * @param operator 操作者 * @return 签字意见id */ - @Select("select logid from workflow_requestlog where REQUESTID = #{requestId} and REMARK = #{remark} " + - "and NODEID = #{nodeId} and OPERATOR = #{operator}") + @Select("select logid from workflow_requestlog where REQUESTID = #{requestId} " + + "and NODEID = #{nodeId} and OPERATOR = #{operator} order by LOGID desc ") Integer selectRequestLogId(@ParamMapper("requestId") String requestId, - @ParamMapper("remark") String remark, @ParamMapper("nodeId") String nodeId, @ParamMapper("operator") String operator); @@ -42,40 +42,53 @@ public interface InterceptRequestLogMapper { */ @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}") Boolean insertPrivacyLog( @ParamMapper("dataId") int dataId, @ParamMapper("logId") Integer logId, @ParamMapper("userId") String userId, @ParamMapper("nodeId") String nodeId, - @ParamMapper("requestId") String requestId); + @ParamMapper("requestId") String requestId, + @ParamMapper("targetHrm") String field5, + @ParamMapper("enablePrivacy") String enablePrivacy); + /** - *

查询隐私签字意见

+ *

跟新签字意见隐私状态

* - * @param logIds 签字意见ids - * @param uid 用户ID - * @param requestId 请求id - * @return 隐私签字意见 + * @param logId 签字意见id + * @param userId 用户id + * @param nodeId 节点id + * @param requestId 请求id + * @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})") - List selectPrivacyLogId( - @ParamMapper("logIds") String logIds, - @ParamMapper("userId") String uid, - @ParamMapper("requestId") String requestId); + @Update("update uf_privacy_log_info set enable_privacy = #{enablePrivacy} where request_id = #{requestId} " + + "and node_id = #{nodeId} and user_id = #{userId} and log_id = #{logId},") + boolean updateRequestLogStatus(@ParamMapper("logId") Integer logId, + @ParamMapper("userId") String userId, + @ParamMapper("nodeId") String nodeId, + @ParamMapper("requestId") String requestId, + @ParamMapper("enablePrivacy") String enablePrivacy); /** - *

查询隐私签字意见

+ *

查询签字意见隐私表id

* - * @param logIds 签字意见ids - * @param requestId 请求id - * @return 隐私签字意见 + * @param requestId 流程id + * @param nodeId 节点id + * @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})") - List selectPrivacyLogIdAll(@ParamMapper("logIds") String logIds, - @ParamMapper("userId") String uid, - @ParamMapper("requestId") String requestId); + @Select("select id from uf_privacy_log_info where request_id = #{requestId} and " + + "node_id = #{nodeId} and user_id = #{userId} and log_id = #{logId}") + Integer selectRequestLogDataId(@ParamMapper("requestId") String requestId, + @ParamMapper("nodeId") String nodeId, + @ParamMapper("userId") String userId, + @ParamMapper("logId") String logId); /** @@ -91,4 +104,35 @@ public interface InterceptRequestLogMapper { "and workflow_type = #{workflowId} and (',' || authority_members || ',') like #{userLike}") List selectPrivacyGroup(@ParamMapper("workflowId") String workflowId, @ParamMapper("userLike") String userLike); + + /** + *

查询用户信息

+ * + * @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); + + /** + *

查询所有启用隐私的签字意见id

+ * + * @param requestId 流程请求id + * @return 所有启用隐私的签字意见id + */ + @Select("select log_id from uf_privacy_log_info where request_id = #{requestId} and enable_privacy = 1") + List selectAllLogId(String requestId); + + /** + *

查询非当前用户所在隐私组的隐私签字意见

+ * + * @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 selectOtherGroupPrivacyLog(@ParamMapper("userId") String userId, + @ParamMapper("requestId") String requestId); } diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/pojo/RequestLogPrivacyEntity.java b/src/main/java/com/customization/youhong/deerge/requestlog/pojo/RequestLogPrivacyEntity.java new file mode 100644 index 0000000..b9ece16 --- /dev/null +++ b/src/main/java/com/customization/youhong/deerge/requestlog/pojo/RequestLogPrivacyEntity.java @@ -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; + +/** + *

签字意见隐私日志信息

+ * + *

create: 2023/3/28 15:08

+ * + * @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; +} diff --git a/src/main/java/com/customization/youhong/deerge/requestlog/util/PrivacyRequestLogUtil.java b/src/main/java/com/customization/youhong/deerge/requestlog/util/PrivacyRequestLogUtil.java new file mode 100644 index 0000000..99168e2 --- /dev/null +++ b/src/main/java/com/customization/youhong/deerge/requestlog/util/PrivacyRequestLogUtil.java @@ -0,0 +1,216 @@ +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.Arrays; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + *

隐私签字意见处理

+ * + *

create: 2023/3/28 14:44

+ * + * @author youHong.ai + */ +public class PrivacyRequestLogUtil { + + private final InterceptRequestLogMapper mapper = Util.getMapper(InterceptRequestLogMapper.class); + + /** + *

隐私信息日志处理

+ * + * @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("添加隐私按钮!未开启隐私"); + // 未开启隐私,更新签字意见隐私信息为不隐私 + Integer logId = mapper.selectRequestLogId(requestId, nodeId, userId); + if (logId > 0) { + mapper.updateRequestLogStatus(logId, userId, nodeId, requestId, "0"); + } + } + + /** + *

插入更新隐私信息

+ * + * @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) { + Integer logId = mapper.selectRequestLogId(requestId, nodeId, userId); + Logger logger = Util.getLogger(); + 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); + } + } + + /** + *

没有添加隐私按钮开关的逻辑处理

+ * + * @param nodeId 节点id + * @param requestId 请求id + * @param userId 用户id + * @param field5 转发的用户信息 + */ + private void hasNotEnablePrivacy(String nodeId, String requestId, String userId, String field5) { + // 通过节点id,requestId和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 hrmIds = Arrays.asList(split); + logger.info("查询到hrmIds数据:" + JSON.toJSONString(hrmIds)); + logger.info("当前用户Id:" + userId); + if (hrmIds.contains(userId)) { + // 默认签字意见隐私 + insertRequestPrivacyLog(userId, nodeId, requestId, field5, "1"); + } + // 不是转发等情况回复,默认处理方式处理 + + } + + /** + *

流程日志列表隐藏控制列表

+ * + * @param result 结果 + * @param params 请求参数 + * @param request 请求体 + */ + + public void requestLogList(Map result, Map params, HttpServletRequest request) { + Logger logger = Util.getLogger(); + 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); + logger.info("结果: " + JSON.toJSONString(result)); + if (isPrint) { + // 打印 + hiddenAll(result, requestId); + logger.info("最终的结果: " + JSON.toJSONString(result)); + return; + } + // 是流程监控 + if (!StrUtil.isBlank(isMonitor)) { + logger.info("流程监控最终的结果: " + JSON.toJSONString(result)); + return; + } + + // 查询隐私组 + String workflowId = Util.null2String(params.get("workflowid")); + List privacyUserList = mapper.selectPrivacyGroup(workflowId, "%," + user.getUID() + ",%"); + if (CollectionUtil.isEmpty(privacyUserList)) { + // 不存在签字意见组中,所有隐私信息不可查看 + hiddenAll(result, requestId); + logger.info("不在隐私组最终的结果: " + JSON.toJSONString(result)); + return; + } + // 查询非本组隐私的隐私信息 + List> logList = (List>) result.get("loglist"); + List privacyLogList = mapper.selectOtherGroupPrivacyLog(Util.join(privacyUserList, ","), requestId); + hiddenContentOrHiddenLog(result, logList, privacyLogList); + } + + + /** + *

隐藏所有签字意见

+ * + * @param result 结果 + * @param requestId 请求id + */ + private void hiddenAll(Map result, String requestId) { + List> logList = (List>) result.get("loglist"); + List privacyLogIdList = mapper.selectAllLogId(requestId); + if (CollectionUtil.isEmpty(privacyLogIdList)) { + return; + } + hiddenContentOrHiddenLog(result, logList, privacyLogIdList); + } + + /** + *

隐藏内容或者整条日志

+ * + * @param result 结果 + * @param logList 日志list + * @param privacyLogIdList 隐私列表 + */ + private static void hiddenContentOrHiddenLog(Map result, List> logList, List privacyLogIdList) { + String showContent = Util.getCusConfigValueNullOrEmpty("REQUEST_LOG_SHOW_CONTENT", "false"); + if (!Boolean.parseBoolean(showContent)) { + List> newLogList = logList.stream() + .filter(item -> !privacyLogIdList.contains(Util.null2String(item.get("logid")))) + .collect(Collectors.toList()); + result.put("loglist", newLogList); + return; + } + List> newLogList = logList.stream() + .peek(item -> { + if (privacyLogIdList.contains(Util.null2String(item.get("logid")))) { + item.put("log_remarkHtml", ""); + } + }) + .collect(Collectors.toList()); + result.put("loglist", newLogList); + } +} diff --git a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java index 4429ea8..82eb60a 100644 --- a/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java +++ b/src/main/java/weaver/youhong/ai/haripijiu/action/sapdocking/config/service/SapConfigService.java @@ -1,6 +1,7 @@ package weaver.youhong.ai.haripijiu.action.sapdocking.config.service; import aiyh.utils.Util; +import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.lang.Assert; import ebu7common.youhong.ai.bean.Builder; import org.apache.log4j.Logger; @@ -192,12 +193,14 @@ public class SapConfigService { List credit = collect.get(1); Assert.notEmpty(debit, "debit config not be null!"); - Assert.notEmpty(credit, "credit config not be bull!"); + List debtorList = getVoucherItems(workflowData, debit); result.add(debtorList); - List creditorList = getVoucherItems(workflowData, credit); - result.add(creditorList); + if (CollectionUtil.isNotEmpty(credit)) { + List creditorList = getVoucherItems(workflowData, credit); + result.add(creditorList); + } return result; } diff --git a/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties b/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties new file mode 100644 index 0000000..4d44973 --- /dev/null +++ b/src/main/resources/WEB-INF/prop/prop2map/JituMultilingual.properties @@ -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 \ No newline at end of file diff --git a/src/test/java/youhong/ai/utiltest/GenericTest.java b/src/test/java/youhong/ai/utiltest/GenericTest.java index 35b9269..86a43a4 100644 --- a/src/test/java/youhong/ai/utiltest/GenericTest.java +++ b/src/test/java/youhong/ai/utiltest/GenericTest.java @@ -1,5 +1,10 @@ package youhong.ai.utiltest; +import aiyh.utils.Util; +import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil; +import basetest.BaseTest; +import org.junit.Test; + import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; @@ -8,7 +13,7 @@ import java.util.List; import java.util.Map; -public class GenericTest { +public class GenericTest extends BaseTest { private final List> map = new ArrayList<>(); @@ -55,4 +60,26 @@ public class GenericTest { } } + + @Test + public void teset() { + List list = new ArrayList(); + list.add(1); + list.add(2); + System.out.println(CollectionUtil.sub(list, 0, 10)); + } + + + @Test + public void parseLanguage() { + System.out.println(Util.parseLanguageString("~`~`7 行政管理`~`8 administrative management`~`9 行政管理`~`~", "8")); + } + + + @Test + public void teeet() throws ClassNotFoundException { + Class aClass = Class.forName("weaver.aiyh_jitu.pushdata.service.toones.GetUUIDFromProjectIdFieldImpl"); + System.out.println(aClass); + } + } \ No newline at end of file