Compare commits

...

2 Commits

Author SHA1 Message Date
youHong.ai abf48d1d7d 冲突解决 2023-04-14 10:19:25 +08:00
youHong.ai aeb04f41d4 修改文件 2023-04-14 10:16:48 +08:00
15 changed files with 552 additions and 132 deletions

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

@ -3870,7 +3870,23 @@ 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 "";
}
/**
*
*
@ -3879,21 +3895,21 @@ public class Util extends weaver.general.Util {
* @param lanuage 7 8 9
*/
public static String moreLanugageHandler(String oldName, String newName, String lanuage) {
List languageIds = getActiveLanguageIds();//获取系统支持的多语言
List languageIds = getActiveLanguageIds();// 获取系统支持的多语言
String newMoreLanuage = "";
//要按照当前系统支持的多语言id进行拼接处理
// 要按照当前系统支持的多语言id进行拼接处理
if (oldName.startsWith("~`~`") && oldName.endsWith("`~`~")) {
// 获取当前系统存在的多语言id
// 思路先按照系统存在的语言进行拼接之后判断oldname包含那些语言进行过滤将除了lanuage的其他语言都替换成之前的
//多语言的中间处理
// 多语言的中间处理
String tempLanuage = joinLanuage(newName, languageIds);
//中间处理转成map
// 中间处理转成map
Map splitMultilangData = splitMultilangData(tempLanuage);
Map<String, String> lanuageMap = new HashMap<>();
for (Object id : languageIds) {
String labelLanuage = "`~`" + id;
if (oldName.contains(labelLanuage)) {
//获取过滤的语言name
// 获取过滤的语言name
String formatLanuageName = formatMultiLang(oldName, String.valueOf(id));
if (!weaver.general.StringUtil.isEmpty(formatLanuageName)) {
lanuageMap.put(String.valueOf(id), formatLanuageName);
@ -3913,12 +3929,12 @@ public class Util extends weaver.general.Util {
}
newMoreLanuage = stitchMultilangData(splitMultilangData);
} else {
//要根据系统支持的语言进行拼接
// 要根据系统支持的语言进行拼接
newMoreLanuage = joinLanuage(newName, languageIds);
}
return newMoreLanuage;
}
/**
*
*

View File

@ -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());

View File

@ -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);
}

View File

@ -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<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);
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",
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<FunctionListConfigItem> 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<FunctionListConfigItem> selectFunctionListAll();
/**

View File

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

View File

@ -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<String, Object> judgeCreateRight(HttpServletRequest request) {
@ -118,37 +119,40 @@ public class InterceptRequestLogImpl extends AbstractServiceProxy implements Req
@Override
@ServiceMethodDynamicProxy(desc = "保存和提交流程时,判断是否开启隐私")
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);
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<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);
}
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<String, Object> forwardSubmit(HttpServletRequest request) {
return null;
}
@Override
public Map<String, Object> requestWithdraw(HttpServletRequest httpServletRequest) {
return null;
}
@Override
public Map<String, Object> remarkSubmit(HttpServletRequest request) {
return null;
}
@Override
public Map<String, Object> functionManage(HttpServletRequest request, HttpServletResponse response) {

View File

@ -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;
/**
* <h1></h1>
@ -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<String, Object> getRequestLogBaseInfo(Map<String, Object> params) {
@ -42,52 +35,14 @@ public class RequestLogShowOrHiddenImpl extends AbstractServiceProxy implements
@ServiceMethodDynamicProxy(desc = "控制是否显示隐私签字意见")
public Map<String, Object> getRequestLogList(HttpServletRequest request, Map<String, Object> params) {
Map<String, Object> result = (Map<String, Object>) 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<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);
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;
}

View File

@ -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 {
/**
* <h2>id</h2>
*
* @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);
/**
* <h2></h2>
* <h2></h2>
*
* @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<String> 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);
/**
* <h2></h2>
* <h2>id</h2>
*
* @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<String> 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<String> selectPrivacyGroup(@ParamMapper("workflowId") String workflowId,
@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,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;
/**
* <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("添加隐私按钮!未开启隐私");
// 未开启隐私,更新签字意见隐私信息为不隐私
Integer logId = mapper.selectRequestLogId(requestId, nodeId, userId);
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) {
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);
}
}
/**
* <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);
logger.info("查询到hrmIds数据" + JSON.toJSONString(hrmIds));
logger.info("当前用户Id:" + userId);
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) {
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<String> privacyUserList = mapper.selectPrivacyGroup(workflowId, "%," + user.getUID() + ",%");
if (CollectionUtil.isEmpty(privacyUserList)) {
// 不存在签字意见组中,所有隐私信息不可查看
hiddenAll(result, requestId);
logger.info("不在隐私组最终的结果: " + JSON.toJSONString(result));
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");
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", "");
}
})
.collect(Collectors.toList());
result.put("loglist", newLogList);
}
}

View File

@ -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<SapConfigDetail> credit = collect.get(1);
Assert.notEmpty(debit, "debit config not be null!");
Assert.notEmpty(credit, "credit config not be bull!");
List<VoucherItem> debtorList = getVoucherItems(workflowData, debit);
result.add(debtorList);
List<VoucherItem> creditorList = getVoucherItems(workflowData, credit);
result.add(creditorList);
if (CollectionUtil.isNotEmpty(credit)) {
List<VoucherItem> creditorList = getVoucherItems(workflowData, credit);
result.add(creditorList);
}
return result;
}

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

@ -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<String, Integer>> 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);
}
}