diff --git a/.gitignore b/.gitignore index 6788321..df06ebd 100644 --- a/.gitignore +++ b/.gitignore @@ -54,4 +54,5 @@ node_modules #/lib/jitulib/ #/lib/classbean #src/main/youhong_ai_old_src/ -#src/main/youhong_ai_jitu_src/ \ No newline at end of file +#src/main/youhong_ai_jitu_src/ +/src/main/java/com/cloudstore/dev/api/service/Service_devTable.java \ No newline at end of file diff --git a/javascript/youhong.ai/pcn/workflow_code_block.js b/javascript/youhong.ai/pcn/workflow_code_block.js index 3bc9bfc..5029599 100644 --- a/javascript/youhong.ai/pcn/workflow_code_block.js +++ b/javascript/youhong.ai/pcn/workflow_code_block.js @@ -927,7 +927,11 @@ $(() => { // 表名 tableName: "uf_hgpxtz", // 文档字段 - docIdField: 'clwd' + docIdField: 'clwd', + // 阅读时长字段 + timeField: '', + // 版本 1 - 2 + version: '2' } function pxlx() { diff --git a/src/main/java/aiyh/utils/mapper/UtilMapper.java b/src/main/java/aiyh/utils/mapper/UtilMapper.java index 9cb8bd6..2b553ba 100644 --- a/src/main/java/aiyh/utils/mapper/UtilMapper.java +++ b/src/main/java/aiyh/utils/mapper/UtilMapper.java @@ -61,8 +61,8 @@ public interface UtilMapper { "dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," + "(case when di.imagefilename = '' or di.imagefilename is null then dc.DOCSUBJECT else di.imagefilename end) image_file_name " + "from DocDetail dc " + - "left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " + "left join docimagefile di on (dc.id = #{docId} and dc.id = di.docid) " + + "left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " + "where dc.id = #{docId} ") DocImageInfo selectDocImageInfo(@ParamMapper("docId") String docId); @@ -72,8 +72,8 @@ public interface UtilMapper { "dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," + "(case when di.imagefilename = '' or di.imagefilename is null then dc.DOCSUBJECT else di.imagefilename end) image_file_name " + "from DocDetail dc " + - "left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " + "left join docimagefile di on (dc.id in ($t{docIds}) and dc.id = di.docid )" + + "left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " + "where dc.id in ($t{docIds})") List selectDocImageInfos(@ParamMapper("docIds") String docIds); @@ -83,8 +83,8 @@ public interface UtilMapper { "dc.DOCCREATEDATE doc_create_date,dc.DOCCREATETIME doc_create_time," + "(case when di.imagefilename = '' or di.imagefilename is null then dc.DOCSUBJECT else di.imagefilename end) image_file_name " + "from DocDetail dc " + - "left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " + "left join docimagefile di on (dc.id in ($t{docIds}) and dc.id = di.docid )" + + "left join imagefile img on img.IMAGEFILEID = di.IMAGEFILEID " + "where dc.id in ($t{docIds})") List selectDocImageInfos(@ParamMapper("docIds") String[] docIds); diff --git a/src/main/java/com/api/youhong/ai/ihgzhouji/userinfoel/mapper/UserInfoMapper.java b/src/main/java/com/api/youhong/ai/ihgzhouji/userinfoel/mapper/UserInfoMapper.java index f149ea3..ec4e44d 100644 --- a/src/main/java/com/api/youhong/ai/ihgzhouji/userinfoel/mapper/UserInfoMapper.java +++ b/src/main/java/com/api/youhong/ai/ihgzhouji/userinfoel/mapper/UserInfoMapper.java @@ -1,9 +1,6 @@ package com.api.youhong.ai.ihgzhouji.userinfoel.mapper; -import aiyh.utils.annotation.recordset.ParamMapper; -import aiyh.utils.annotation.recordset.Select; -import aiyh.utils.annotation.recordset.SqlMapper; -import aiyh.utils.annotation.recordset.SqlString; +import aiyh.utils.annotation.recordset.*; import weaver.hrm.User; import java.util.List; @@ -112,6 +109,7 @@ public interface UserInfoMapper { "or concat(',',financeleader,',') like concat(',',#{userId},',')\n" + "or concat(',',fbleader,',') like concat(',',#{userId},',')\n" + "or concat(',',hrleader,',') like concat(',',#{userId},',')") + @ToLowerCase List> selectRoles(@ParamMapper("userId") int uid); /** diff --git a/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java b/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java index 82f72d3..63b43f3 100644 --- a/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java +++ b/src/main/java/com/api/youhong/ai/pcn/examcontrol/controller/ExamBtnControlController.java @@ -2,6 +2,7 @@ package com.api.youhong.ai.pcn.examcontrol.controller; import aiyh.utils.ApiResult; import aiyh.utils.Util; +import com.alibaba.fastjson.JSON; import com.api.youhong.ai.pcn.examcontrol.service.ExamBtnControlService; import io.swagger.v3.oas.annotations.parameters.RequestBody; import org.apache.log4j.Logger; @@ -105,8 +106,9 @@ public class ExamBtnControlController { public String readTimeDoc(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody Map params) { try { + log.info("阅读文档数据: " + JSON.toJSONString(params)); User user = HrmUserVarify.getUser(request, response); - return ApiResult.success(service.readTimeDoc(user,params)); + return ApiResult.success(service.readTimeDoc(user, params)); } catch (Exception e) { log.error("is read doc error!\n" + Util.getErrString(e)); return ApiResult.error("system error!"); diff --git a/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java b/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java index 955dfc5..84630a5 100644 --- a/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java +++ b/src/main/java/com/api/youhong/ai/pcn/examcontrol/service/ExamBtnControlService.java @@ -286,9 +286,10 @@ public class ExamBtnControlService { int currentReadTimeInt = Util.getIntValue(currentReadTime, 0); // 查询是否存在已读的数据 Map readTimeDocInfo = mapper.selectReadTimeTag(user.getUID(), docId); - int dataId = Util.getIntValue(Util.null2String(readTimeDocInfo.get("id")), 0); + int dataId = -1; // 如果存在,吧原来的已读时长加上现在的已读时长 if (CollectionUtil.isNotEmpty(readTimeDocInfo)) { + dataId = Util.getIntValue(Util.null2String(readTimeDocInfo.get("id")), 0); String readTime = Util.null2String(readTimeDocInfo.get("readTime")); int readTimeInt = Util.getIntValue(readTime, 0); currentReadTimeInt += readTimeInt; diff --git a/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java b/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java new file mode 100644 index 0000000..7a8c134 --- /dev/null +++ b/src/main/java/com/customization/youhong/guoxiaojun/sso/impl/SsoGuoXiaoJunPocImpl.java @@ -0,0 +1,32 @@ +package com.customization.youhong.guoxiaojun.sso.impl; + +import aiyh.utils.Util; +import com.weaverboot.frame.ioc.anno.classAnno.WeaSsoIocComponent; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaSsoIoc; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaSsoParam; +import org.apache.log4j.Logger; + +/** + *

国小君单点登录poc阶段

+ * + *

create: 2023/7/13 15:25

+ * + * @author youHong.ai + */ + +@WeaSsoIocComponent("SsoGuoXiaoJunPocService") +public class SsoGuoXiaoJunPocImpl { + + private final Logger log = Util.getLogger(); + + /** + * 参数weaSsoParam,字段为 request response paramMap + * + * @param weaSsoParam 请求信息 + */ + @WeaSsoIoc(order = 1, description = "单点登录逻辑1") + public void ssoLogin(WeaSsoParam weaSsoParam) { + String servletPath = weaSsoParam.getRequest().getServletPath(); + log.info(servletPath); + } +} diff --git a/src/main/java/com/customization/youhong/pcn/datasmultilingual/MultilingualUtil.java b/src/main/java/com/customization/youhong/pcn/datasmultilingual/MultilingualUtil.java new file mode 100644 index 0000000..77fa9d7 --- /dev/null +++ b/src/main/java/com/customization/youhong/pcn/datasmultilingual/MultilingualUtil.java @@ -0,0 +1,151 @@ +package com.customization.youhong.pcn.datasmultilingual; + +import aiyh.utils.tool.cn.hutool.core.collection.CollectionUtil; +import aiyh.utils.tool.cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import weaver.hrm.User; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + *

多语言解析工具

+ * + *

create: 2023/7/13 15:37

+ * + * @author youHong.ai + */ +public class MultilingualUtil { + + + /** + *

解析表单多语言

+ * + * @param rspJson json对象 + * @param user 当前用户 + */ + public static void parseMultilingual(JSONObject rspJson, User user) { + if (Objects.isNull(rspJson) || Objects.isNull(user)) { + return; + } + if (!rspJson.containsKey("datas")) { + return; + } + List> datas = (List>) rspJson.get("datas"); + if (CollectionUtil.isEmpty(datas)) { + return; + } + String startPattern = "~`~`"; + String endPattern = "`~`~"; + String pattern = Pattern.quote(startPattern) + "(.*?)" + Pattern.quote(endPattern); + for (Map data : datas) { + for (Map.Entry entry : data.entrySet()) { + String value = entry.getValue(); + if (Objects.isNull(value)) { + continue; + } + String multilingualStr = findString(value, startPattern, endPattern); + if (StrUtil.isBlank(multilingualStr)) { + continue; + } + Map languageMap = getLanguageMap(multilingualStr); + if (CollectionUtil.isEmpty(languageMap)) { + continue; + } + String label = languageMap.get(user.getLanguage()); + if (StrUtil.isBlank(label)) { + continue; + } + entry.setValue(value.replaceAll(pattern, label)); + } + } + } + + + /** + *

获取多语言map

+ * + * @param multilingualStr 处理后的多语言字符串 + * @return 多语言map + */ + public static Map getLanguageMap(String multilingualStr) { + String[] split = multilingualStr.split("`~`"); + Map result = new HashMap<>(8); + for (String str : split) { + LabelEntity labelEntity = parseLanguageStr(str); + result.put(labelEntity.getLanguageId(), labelEntity.getLabel()); + } + return result; + } + + /** + *

查找多语言字符串

+ * + * @param input 源字符串 + * @param startPattern 开始字符 + * @param endPattern 结束字符串 + * @return 多语言字符串 + */ + public static String findString(String input, String startPattern, String endPattern) { + if (StrUtil.isBlank(input)) { + return null; + } + // 构建正则表达式模式 + String pattern = Pattern.quote(startPattern) + "(.*?)" + Pattern.quote(endPattern); + Pattern regex = Pattern.compile(pattern); + Matcher matcher = regex.matcher(input); + if (matcher.find()) { + // 返回第一个匹配的结果 + return matcher.group(1); + } else { + // 未找到匹配的结果 + return null; + } + } + + /** + *

解析多语言字符串对应语言和字符串

+ * + * @param input 源字符串 + * @return 多语言结果 + */ + public static LabelEntity parseLanguageStr(String input) { + int number = 0; + String remainingString = input; + // 正则表达式匹配开头的数字 + String regex = "^\\d+"; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(input); + + if (matcher.find()) { + String matchedNumber = matcher.group(); + number = Integer.parseInt(matchedNumber); + // 从原始字符串中去除开头的数字部分 + remainingString = input.substring(matchedNumber.length()).trim(); + } + + return new LabelEntity(number, remainingString); + } + + public static class LabelEntity { + private final int languageId; + private final String label; + + public LabelEntity(int languageId, String label) { + this.languageId = languageId; + this.label = label; + } + + public int getLanguageId() { + return languageId; + } + + public String getLabel() { + return label; + } + } +} diff --git a/src/main/youhong_ai_old_src/com/api/aiyh_fute/sign_in/service/SignFtService.java b/src/main/youhong_ai_old_src/com/api/aiyh_fute/sign_in/service/SignFtService.java index 6ebd83a..41d9439 100644 --- a/src/main/youhong_ai_old_src/com/api/aiyh_fute/sign_in/service/SignFtService.java +++ b/src/main/youhong_ai_old_src/com/api/aiyh_fute/sign_in/service/SignFtService.java @@ -118,7 +118,7 @@ public class SignFtService { Map result = new HashMap<>(16); try { tokenUtils.setAlgorithm(Algorithm.HMAC256(clientSecret)); - } catch (UnsupportedEncodingException e) { + } catch (Exception e) { throw new RuntimeException(e); } String tokenExpires = Util.getCusConfigValueNullOrEmpty("TOKEN_EXPIRES", "3600"); diff --git a/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java b/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java new file mode 100644 index 0000000..bd25064 --- /dev/null +++ b/src/test/java/youhong/ai/pcn/multilingual/StringFinder.java @@ -0,0 +1,40 @@ +package youhong.ai.pcn.multilingual; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class StringFinder { + public static String findString(String input, String startPattern, String endPattern) { + // 构建正则表达式模式 + String pattern = Pattern.quote(startPattern) + "(.*?)" + Pattern.quote(endPattern); + Pattern regex = Pattern.compile(pattern); + + Matcher matcher = regex.matcher(input); + String str = input; + System.out.println(str.replaceAll(pattern, "woshiyigeshabi")); + + if (matcher.find()) { + // 返回第一个匹配的结果 + return matcher.group(1); + } else { + // 未找到匹配的结果 + return null; + } + } + + public static void main(String[] args) { + String input = "

~`~`7当与商业伙伴、客户或第三方打交道时,必须避免留下任何保时捷进行不寻常的业务实践或有针对性的措施以对业务决策施加不公平的影响的印象。`~`8When dealing with Business Partners, Customers or Third Parties, it is essential to avoid any impression that PCN engages in unusual business practices or targeted measures to exercise unfair influence on business decisions. `~`~

"; + String startPattern = "~`~`"; + String endPattern = "`~`~"; + String output = findString(input, startPattern, endPattern); + System.out.println("Result: " + output); + String[] split = output.split("`~`"); + for (String s : split) { + System.out.println(s); + StringParser.StringEntity stringEntity = StringParser.parseString(s); + System.out.println(stringEntity.getNumber()); + String remainingString = stringEntity.getRemainingString(); + System.out.println(remainingString); + } + } +} diff --git a/src/test/java/youhong/ai/pcn/multilingual/StringParser.java b/src/test/java/youhong/ai/pcn/multilingual/StringParser.java new file mode 100644 index 0000000..fd7cfd5 --- /dev/null +++ b/src/test/java/youhong/ai/pcn/multilingual/StringParser.java @@ -0,0 +1,50 @@ +package youhong.ai.pcn.multilingual; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class StringParser { + public static class StringEntity { + private final int number; + private final String remainingString; + + public StringEntity(int number, String remainingString) { + this.number = number; + this.remainingString = remainingString; + } + + public int getNumber() { + return number; + } + + public String getRemainingString() { + return remainingString; + } + } + + public static StringEntity parseString(String input) { + int number = 0; + String remainingString = input; + // 正则表达式匹配开头的数字 + String regex = "^\\d+"; + Pattern pattern = Pattern.compile(regex); + Matcher matcher = pattern.matcher(input); + + if (matcher.find()) { + String matchedNumber = matcher.group(); + number = Integer.parseInt(matchedNumber); + // 从原始字符串中去除开头的数字部分 + remainingString = input.substring(matchedNumber.length()); + } + + return new StringEntity(number, remainingString); + } + + public static void main(String[] args) { + String input = "123Hello World!"; + StringEntity result = parseString(input); + + System.out.println("Number: " + result.getNumber()); + System.out.println("Remaining String: " + result.getRemainingString()); + } +}