保时捷考试控制

dev
youhong.ai 2023-07-14 14:44:38 +08:00
parent 79c4547d38
commit b1c18bcb06
11 changed files with 291 additions and 12 deletions

3
.gitignore vendored
View File

@ -54,4 +54,5 @@ node_modules
#/lib/jitulib/
#/lib/classbean
#src/main/youhong_ai_old_src/
#src/main/youhong_ai_jitu_src/
#src/main/youhong_ai_jitu_src/
/src/main/java/com/cloudstore/dev/api/service/Service_devTable.java

View File

@ -927,7 +927,11 @@ $(() => {
// 表名
tableName: "uf_hgpxtz",
// 文档字段
docIdField: 'clwd'
docIdField: 'clwd',
// 阅读时长字段
timeField: '',
// 版本 1 - 2
version: '2'
}
function pxlx() {

View File

@ -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<DocImageInfo> 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<DocImageInfo> selectDocImageInfos(@ParamMapper("docIds") String[] docIds);

View File

@ -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<Map<String, Object>> selectRoles(@ParamMapper("userId") int uid);
/**

View File

@ -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<String, Object> 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!");

View File

@ -286,9 +286,10 @@ public class ExamBtnControlService {
int currentReadTimeInt = Util.getIntValue(currentReadTime, 0);
// 查询是否存在已读的数据
Map<String, Object> 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;

View File

@ -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;
/**
* <h1>poc</h1>
*
* <p>create: 2023/7/13 15:25</p>
*
* @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);
}
}

View File

@ -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;
/**
* <h1></h1>
*
* <p>create: 2023/7/13 15:37</p>
*
* @author youHong.ai
*/
public class MultilingualUtil {
/**
* <h2></h2>
*
* @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<Map<String, String>> datas = (List<Map<String, String>>) rspJson.get("datas");
if (CollectionUtil.isEmpty(datas)) {
return;
}
String startPattern = "~`~`";
String endPattern = "`~`~";
String pattern = Pattern.quote(startPattern) + "(.*?)" + Pattern.quote(endPattern);
for (Map<String, String> data : datas) {
for (Map.Entry<String, String> entry : data.entrySet()) {
String value = entry.getValue();
if (Objects.isNull(value)) {
continue;
}
String multilingualStr = findString(value, startPattern, endPattern);
if (StrUtil.isBlank(multilingualStr)) {
continue;
}
Map<Integer, String> 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));
}
}
}
/**
* <h2>map</h2>
*
* @param multilingualStr
* @return map
*/
public static Map<Integer, String> getLanguageMap(String multilingualStr) {
String[] split = multilingualStr.split("`~`");
Map<Integer, String> result = new HashMap<>(8);
for (String str : split) {
LabelEntity labelEntity = parseLanguageStr(str);
result.put(labelEntity.getLanguageId(), labelEntity.getLabel());
}
return result;
}
/**
* <h2></h2>
*
* @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;
}
}
/**
* <h2></h2>
*
* @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;
}
}
}

View File

@ -118,7 +118,7 @@ public class SignFtService {
Map<String, Object> 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");

View File

@ -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 = "<span><p>~`~`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. `~`~</p></span>";
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);
}
}
}

View File

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