供应商同步,多语言化检查,labelhtmlUtils编写
parent
7efbec9808
commit
062fc0466d
|
@ -0,0 +1,170 @@
|
||||||
|
package aiyh.utils;
|
||||||
|
|
||||||
|
import aiyh.utils.entity.LabelHtmlIndex;
|
||||||
|
import aiyh.utils.service.UtilService;
|
||||||
|
import weaver.systeminfo.SystemEnv;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author EBU7-dev1-ayh
|
||||||
|
* create 2021/12/13 0013 10:29
|
||||||
|
* 多语言工具类
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class LabelHtmlUtils {
|
||||||
|
|
||||||
|
private final UtilService utilService = new UtilService();
|
||||||
|
private Map<String, Object> htmlLabel = null;
|
||||||
|
|
||||||
|
public LabelHtmlUtils(String prefix) {
|
||||||
|
if (!this.init(prefix)) {
|
||||||
|
throw new RuntimeException("配置文件异常,请检查配置文件结构是否符合要求!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabelHtmlUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化配置信息
|
||||||
|
*
|
||||||
|
* @param prefix 前缀
|
||||||
|
* @return 是否初始化成功
|
||||||
|
*/
|
||||||
|
public synchronized boolean init(String prefix) {
|
||||||
|
if (this.htmlLabel != null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.htmlLabel = Util.readProperties2Map("htmlLabelIndex", prefix);
|
||||||
|
return this.htmlLabel != null;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定语言id的自定义标签
|
||||||
|
*
|
||||||
|
* @param id 自定义标签id
|
||||||
|
* @param languageId 语言id
|
||||||
|
* @param defaultStr 默认字符串
|
||||||
|
* @return 自定义标签对应的语言字符串,或者默认字符串
|
||||||
|
*/
|
||||||
|
public String getHtmlLabelName(int id, int languageId, String defaultStr) {
|
||||||
|
String htmlLabelName = SystemEnv.getHtmlLabelName(id, languageId);
|
||||||
|
return htmlLabelName == null ? defaultStr : htmlLabelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定语言id的自定义标签
|
||||||
|
*
|
||||||
|
* @param id 标签id
|
||||||
|
* @param languageId 语言id
|
||||||
|
* @return 自定义标签的语言字符串
|
||||||
|
*/
|
||||||
|
public String getHtmlLabelName(int id, int languageId) {
|
||||||
|
return SystemEnv.getHtmlLabelName(id, languageId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过语言id截取多语言字符串
|
||||||
|
*
|
||||||
|
* @param languageId 语言id
|
||||||
|
* @param languageStr 多语言字符串
|
||||||
|
* @return 截取后的字符串
|
||||||
|
*/
|
||||||
|
public String getHtmlLabelNameByStr(int languageId, String languageStr) {
|
||||||
|
String pattern = "(`~`" + languageId + " )(?<label>(\\w*|\\W*|[\\u4e00-\\u9fa5]*))(`~`)";
|
||||||
|
Pattern compile = Pattern.compile(pattern);
|
||||||
|
Matcher matcher = compile.matcher(languageStr);
|
||||||
|
if (matcher.find()) {
|
||||||
|
return matcher.group("label");
|
||||||
|
}
|
||||||
|
return languageStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取配置多余元文件详细
|
||||||
|
*
|
||||||
|
* @param key 键
|
||||||
|
*/
|
||||||
|
public Map<String, Object> getHtmlLabelMap(String key) {
|
||||||
|
if (this.htmlLabel == null) {
|
||||||
|
throw new RuntimeException("请初始化以读取配置信息,调用方法init(String prefix)");
|
||||||
|
}
|
||||||
|
Map<String, Object> map;
|
||||||
|
try {
|
||||||
|
map = (Map<String, Object>) this.htmlLabel.get(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("配置文件异常,请检查配置文件结构是否符合要求!");
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取配置文件中的多语言配置
|
||||||
|
*
|
||||||
|
* @param key 多语言配置中的前缀
|
||||||
|
* @return 多语言配置Map
|
||||||
|
*/
|
||||||
|
public Map<String, String> getHtmlLabel(String key) {
|
||||||
|
if (this.htmlLabel == null) {
|
||||||
|
throw new RuntimeException("请初始化以读取配置信息,调用方法init(String prefix)");
|
||||||
|
}
|
||||||
|
Map<String, String> map;
|
||||||
|
try {
|
||||||
|
map = (Map<String, String>) this.htmlLabel.get(key);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("配置文件异常,请检查配置文件结构是否符合要求!");
|
||||||
|
}
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取配置文件中的多语言配置
|
||||||
|
*
|
||||||
|
* @param key 多语言配置中的前缀
|
||||||
|
* @return 多语言配置对象
|
||||||
|
*/
|
||||||
|
public LabelHtmlIndex getLabelHtmlIndex(String key) {
|
||||||
|
if (this.htmlLabel == null) {
|
||||||
|
throw new RuntimeException("请初始化以读取配置信息,调用方法init(String prefix)");
|
||||||
|
}
|
||||||
|
Map<String, Object> map;
|
||||||
|
LabelHtmlIndex labelHtmlIndex;
|
||||||
|
try {
|
||||||
|
map = (Map<String, Object>) this.htmlLabel.get(key);
|
||||||
|
labelHtmlIndex = Util.mapToObject(map, LabelHtmlIndex.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("配置文件异常,请检查配置文件结构是否符合要求!");
|
||||||
|
}
|
||||||
|
return labelHtmlIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取配置文件中的多语言配置
|
||||||
|
*
|
||||||
|
* @param map 多语言配置中的对象
|
||||||
|
* @return 多语言配置对象
|
||||||
|
*/
|
||||||
|
public LabelHtmlIndex getLabelHtmlIndex(Map<String, Object> map, String key) {
|
||||||
|
LabelHtmlIndex labelHtmlIndex;
|
||||||
|
Map<String, Object> resultMap;
|
||||||
|
try {
|
||||||
|
resultMap = (Map<String, Object>) map.get(key);
|
||||||
|
labelHtmlIndex = Util.mapToObject(resultMap, LabelHtmlIndex.class);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
throw new RuntimeException("map转换异常!");
|
||||||
|
}
|
||||||
|
return labelHtmlIndex;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1044,6 +1044,7 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据配置文件文件名以及前缀获取对应的配置文件信息
|
* 根据配置文件文件名以及前缀获取对应的配置文件信息
|
||||||
|
*
|
||||||
* @param fileName
|
* @param fileName
|
||||||
* @param prefix
|
* @param prefix
|
||||||
* @return
|
* @return
|
||||||
|
@ -1088,6 +1089,7 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理配置文件的key和value映射关系
|
* 处理配置文件的key和value映射关系
|
||||||
|
*
|
||||||
* @param prePrefix 前缀
|
* @param prePrefix 前缀
|
||||||
* @param key key
|
* @param key key
|
||||||
* @param value value
|
* @param value value
|
||||||
|
@ -1219,7 +1221,7 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Object prop2MapPutValue(Object value) {
|
public static Object prop2MapPutValue(Object value) {
|
||||||
if(value == null){
|
if (value == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
String valueStr = String.valueOf(value).trim();
|
String valueStr = String.valueOf(value).trim();
|
||||||
|
@ -1227,10 +1229,10 @@ public class Util extends weaver.general.Util {
|
||||||
return valueStr.substring(1, valueStr.length() - 1);
|
return valueStr.substring(1, valueStr.length() - 1);
|
||||||
}
|
}
|
||||||
if (valueStr.contains(",")) {
|
if (valueStr.contains(",")) {
|
||||||
if(valueStr.contains("\\,")){
|
if (valueStr.contains("\\,")) {
|
||||||
String[] split = valueStr.split("(?<!\\\\),");
|
String[] split = valueStr.split("(?<!\\\\),");
|
||||||
for (int i = 0; i < split.length; i ++){
|
for (int i = 0; i < split.length; i++) {
|
||||||
split[i] = split[i].replaceAll("\\\\,",",");
|
split[i] = split[i].replaceAll("\\\\,", ",");
|
||||||
}
|
}
|
||||||
return split;
|
return split;
|
||||||
}
|
}
|
||||||
|
@ -1329,10 +1331,12 @@ public class Util extends weaver.general.Util {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 去重
|
||||||
public static <T> List<T> deWeight(List<T> list, Function<? super T, ?> keyExtractor) {
|
public static <T> List<T> deWeight(List<T> list, Function<? super T, ?> keyExtractor) {
|
||||||
return list.stream().filter(distinctByKey(keyExtractor)).collect(Collectors.toList());
|
return list.stream().filter(distinctByKey(keyExtractor)).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
private static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) {
|
||||||
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
|
Map<Object, Boolean> seen = new ConcurrentHashMap<>();
|
||||||
// putIfAbsent添加不存在的键,返回null,如果为null表示不重复
|
// putIfAbsent添加不存在的键,返回null,如果为null表示不重复
|
||||||
|
@ -1528,12 +1532,12 @@ public class Util extends weaver.general.Util {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getHtmlLabelName(int id, int languageId, String defaultStr){
|
public static String getHtmlLabelName(int id, int languageId, String defaultStr) {
|
||||||
String htmlLabelName = SystemEnv.getHtmlLabelName(id, languageId);
|
String htmlLabelName = SystemEnv.getHtmlLabelName(id, languageId);
|
||||||
return htmlLabelName == null ? defaultStr : htmlLabelName;
|
return htmlLabelName == null ? defaultStr : htmlLabelName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getHtmlLabelName(int id, int languageId){
|
public static String getHtmlLabelName(int id, int languageId) {
|
||||||
return SystemEnv.getHtmlLabelName(id, languageId);
|
return SystemEnv.getHtmlLabelName(id, languageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1557,24 +1561,25 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据流程和流程字段查询文档目录
|
* 根据流程和流程字段查询文档目录
|
||||||
|
*
|
||||||
* @param workflowId
|
* @param workflowId
|
||||||
* @param docField
|
* @param docField
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getDocCategorys(String workflowId,String docField){
|
public static String getDocCategorys(String workflowId, String docField) {
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
rs.executeQuery("select formid from workflow_base where id = ?",workflowId);
|
rs.executeQuery("select formid from workflow_base where id = ?", workflowId);
|
||||||
String formId = Util.recordeSet2Entity(rs, String.class);
|
String formId = Util.recordeSet2Entity(rs, String.class);
|
||||||
String query = "select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)";
|
String query = "select doccategory from workflow_fileupload where fieldid = (select id from workflow_billfield where fieldname = ? and billid = ?)";
|
||||||
rs.executeQuery(query,docField,formId);
|
rs.executeQuery(query, docField, formId);
|
||||||
String docCategorys =Util.null2String(Util.recordeSet2Entity(rs, String.class));
|
String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class));
|
||||||
if(StringUtils.isNullOrEmpty(docCategorys)){
|
if (StringUtils.isNullOrEmpty(docCategorys)) {
|
||||||
query = "select doccategory from workflow_base where id = ?";
|
query = "select doccategory from workflow_base where id = ?";
|
||||||
rs.executeQuery(query,workflowId);
|
rs.executeQuery(query, workflowId);
|
||||||
rs.next();
|
rs.next();
|
||||||
docCategorys = Util.null2String(rs.getString(1));
|
docCategorys = Util.null2String(rs.getString(1));
|
||||||
}
|
}
|
||||||
if(StringUtils.isNullOrEmpty(docCategorys)){
|
if (StringUtils.isNullOrEmpty(docCategorys)) {
|
||||||
docCategorys = ",,1";
|
docCategorys = ",,1";
|
||||||
}
|
}
|
||||||
return docCategorys;
|
return docCategorys;
|
||||||
|
@ -1582,35 +1587,36 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据流程和流程字段查询文档目录
|
* 根据流程和流程字段查询文档目录
|
||||||
|
*
|
||||||
* @param workflowId
|
* @param workflowId
|
||||||
* @param docFieldId
|
* @param docFieldId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getDocCategorysById(String workflowId,String docFieldId){
|
public static String getDocCategorysById(String workflowId, String docFieldId) {
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
// rs.executeQuery("select formid from workflow_base where id = ?",workflowId);
|
// rs.executeQuery("select formid from workflow_base where id = ?",workflowId);
|
||||||
// String formId = Util.recordeSet2Entity(rs, String.class);
|
// String formId = Util.recordeSet2Entity(rs, String.class);
|
||||||
String query = "select doccategory from workflow_fileupload where workflowid = ? and fieldid = ?";
|
String query = "select doccategory from workflow_fileupload where workflowid = ? and fieldid = ?";
|
||||||
rs.executeQuery(query,workflowId,docFieldId);
|
rs.executeQuery(query, workflowId, docFieldId);
|
||||||
String docCategorys =Util.null2String(Util.recordeSet2Entity(rs, String.class));
|
String docCategorys = Util.null2String(Util.recordeSet2Entity(rs, String.class));
|
||||||
if(StringUtils.isNullOrEmpty(docCategorys)){
|
if (StringUtils.isNullOrEmpty(docCategorys)) {
|
||||||
query = "select doccategory from workflow_base where id = ?";
|
query = "select doccategory from workflow_base where id = ?";
|
||||||
rs.executeQuery(query,workflowId);
|
rs.executeQuery(query, workflowId);
|
||||||
rs.next();
|
rs.next();
|
||||||
docCategorys = Util.null2String(rs.getString(1));
|
docCategorys = Util.null2String(rs.getString(1));
|
||||||
}
|
}
|
||||||
if(StringUtils.isNullOrEmpty(docCategorys)){
|
if (StringUtils.isNullOrEmpty(docCategorys)) {
|
||||||
docCategorys = ",,1";
|
docCategorys = ",,1";
|
||||||
}
|
}
|
||||||
return docCategorys;
|
return docCategorys;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String null2DefaultStr(Object obj, String defaultStr){
|
public static String null2DefaultStr(Object obj, String defaultStr) {
|
||||||
String objStr = Util.null2String(obj);
|
String objStr = Util.null2String(obj);
|
||||||
if(StringUtils.isNullOrEmpty(objStr) && StringUtils.isNullOrEmpty(defaultStr)){
|
if (StringUtils.isNullOrEmpty(objStr) && StringUtils.isNullOrEmpty(defaultStr)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if(StringUtils.isNullOrEmpty(objStr) && !StringUtils.isNullOrEmpty(defaultStr)){
|
if (StringUtils.isNullOrEmpty(objStr) && !StringUtils.isNullOrEmpty(defaultStr)) {
|
||||||
return defaultStr;
|
return defaultStr;
|
||||||
}
|
}
|
||||||
return objStr;
|
return objStr;
|
||||||
|
@ -1618,6 +1624,112 @@ public class Util extends weaver.general.Util {
|
||||||
|
|
||||||
|
|
||||||
public static <T> T mapToObject(Map<String, Object> map, Class<T> t) throws Exception {
|
public static <T> T mapToObject(Map<String, Object> map, Class<T> t) throws Exception {
|
||||||
|
if (map == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
T obj = t.newInstance();
|
||||||
|
Field[] fields = obj.getClass().getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
int mod = field.getModifiers();
|
||||||
|
if (Modifier.isStatic(mod) || Modifier.isFinal(mod)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
field.setAccessible(true);
|
||||||
|
if (field.getType().equals(String.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, String.valueOf(map.get(field.getName())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(Integer.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Integer.valueOf(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(Boolean.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Boolean.valueOf(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(Float.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Float.valueOf(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(Double.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Double.valueOf(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(int.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Integer.parseInt(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(float.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Float.parseFloat(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(double.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Double.parseDouble(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (field.getType().equals(boolean.class)) {
|
||||||
|
if (map.containsKey(field.getName())) {
|
||||||
|
if (map.get(field.getName()) == null || "".equals(map.get(field.getName()))) {
|
||||||
|
field.set(obj, null);
|
||||||
|
} else {
|
||||||
|
field.set(obj, Boolean.parseBoolean(String.valueOf(map.get(field.getName()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T strMapToObject(Map<String, String> map, Class<T> t) throws Exception {
|
||||||
if (map == null) {
|
if (map == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
package aiyh.utils.entity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author EBU7-dev1-ayh
|
||||||
|
* create 2021/12/13 0013 11:19
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
public class LabelHtmlIndex {
|
||||||
|
private Integer labelIndex;
|
||||||
|
private String defaultStr;
|
||||||
|
|
||||||
|
public LabelHtmlIndex() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public LabelHtmlIndex(Integer labelIndex, String defaultStr) {
|
||||||
|
this.labelIndex = labelIndex;
|
||||||
|
this.defaultStr = defaultStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getLabelIndex() {
|
||||||
|
return labelIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getDefaultStr() {
|
||||||
|
return defaultStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "LabelHtmlIndex{" +
|
||||||
|
"labelIndex='" + labelIndex + '\'' +
|
||||||
|
", defaultStr='" + defaultStr + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,10 @@
|
||||||
package com.api.aiyh_pcn.copy_attachment.service;
|
package com.api.aiyh_pcn.copy_attachment.service;
|
||||||
|
|
||||||
|
import aiyh.utils.ApiResult;
|
||||||
import aiyh.utils.zwl.common.ToolUtil;
|
import aiyh.utils.zwl.common.ToolUtil;
|
||||||
|
import com.api.aiyh_pcn.copy_attachment.dao.DocTemplateDao;
|
||||||
import com.api.workflow.constant.RequestAuthenticationConstant;
|
import com.api.workflow.constant.RequestAuthenticationConstant;
|
||||||
import com.engine.workflow.biz.requestForm.FileBiz;
|
import com.engine.workflow.biz.requestForm.FileBiz;
|
||||||
import aiyh.utils.ApiResult;
|
|
||||||
import com.api.aiyh_pcn.copy_attachment.dao.DocTemplateDao;
|
|
||||||
import weaver.general.Util;
|
import weaver.general.Util;
|
||||||
import weaver.hrm.User;
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
public class CopyAttachmentService {
|
public class CopyAttachmentService {
|
||||||
public static String copyFile(User user, Map<String, Object> params){
|
public static String copyFile(User user, Map<String, Object> params) {
|
||||||
ToolUtil toolUtil = new ToolUtil();
|
ToolUtil toolUtil = new ToolUtil();
|
||||||
// 建模表名称
|
// 建模表名称
|
||||||
String tableName = String.valueOf(params.get("tableName"));
|
String tableName = String.valueOf(params.get("tableName"));
|
||||||
|
@ -34,14 +34,14 @@ public class CopyAttachmentService {
|
||||||
String workflowId = String.valueOf(params.get("workflowId"));
|
String workflowId = String.valueOf(params.get("workflowId"));
|
||||||
DocTemplateDao docTemplateDao = new DocTemplateDao();
|
DocTemplateDao docTemplateDao = new DocTemplateDao();
|
||||||
int[] docIds = null;
|
int[] docIds = null;
|
||||||
try{
|
try {
|
||||||
// docIds = docTemplateDao.copyFile(user.getUID(), tableName, fieldName, configId);
|
// docIds = docTemplateDao.copyFile(user.getUID(), tableName, fieldName, configId);
|
||||||
docIds = docTemplateDao.copyFile(user, tableName, fieldName, configId,workflowId,fileFieldId);
|
docIds = docTemplateDao.copyFile(user, tableName, fieldName, configId, workflowId, fileFieldId);
|
||||||
}catch(Exception e){
|
} catch (Exception e) {
|
||||||
toolUtil.writeErrorLog("复制文件出错: " + e);
|
toolUtil.writeErrorLog("复制文件出错: " + e);
|
||||||
return null;
|
return ApiResult.error("复制文件出错!");
|
||||||
}
|
}
|
||||||
if(docIds == null){
|
if (docIds == null) {
|
||||||
return ApiResult.error("未查询到附件模板!");
|
return ApiResult.error("未查询到附件模板!");
|
||||||
}
|
}
|
||||||
/*try{
|
/*try{
|
||||||
|
@ -64,17 +64,18 @@ public class CopyAttachmentService {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return ApiResult.error("删除失败!");
|
return ApiResult.error("删除失败!");
|
||||||
}
|
}
|
||||||
return ApiResult.success(array,"删除成功!");
|
return ApiResult.success(array, "删除成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询文档信息
|
* 查询文档信息
|
||||||
|
*
|
||||||
* @param user user对象
|
* @param user user对象
|
||||||
* @param params 前端参数
|
* @param params 前端参数
|
||||||
* @return 文档信息
|
* @return 文档信息
|
||||||
*/
|
*/
|
||||||
public static String queryFilesData(User user, Map<String, Object> params){
|
public static String queryFilesData(User user, Map<String, Object> params) {
|
||||||
String listType = Util.null2String(String.valueOf(params.get("listType")),"list");
|
String listType = Util.null2String(String.valueOf(params.get("listType")), "list");
|
||||||
int requestid = Util.getIntValue(Util.null2String(String.valueOf(params.get("requestid"))), -1);
|
int requestid = Util.getIntValue(Util.null2String(String.valueOf(params.get("requestid"))), -1);
|
||||||
int desrequestid = Util.getIntValue(Util.null2String(String.valueOf(params.get("desrequestid"))), -1);
|
int desrequestid = Util.getIntValue(Util.null2String(String.valueOf(params.get("desrequestid"))), -1);
|
||||||
int isprint = Util.getIntValue(Util.null2String(String.valueOf(params.get("isprint"))), 0);
|
int isprint = Util.getIntValue(Util.null2String(String.valueOf(params.get("isprint"))), 0);
|
||||||
|
@ -83,12 +84,12 @@ public class CopyAttachmentService {
|
||||||
String f_weaver_belongto_usertype = Util.null2String(String.valueOf(params.get("f_weaver_belongto_usertype")));
|
String f_weaver_belongto_usertype = Util.null2String(String.valueOf(params.get("f_weaver_belongto_usertype")));
|
||||||
String authStr = Util.null2String(String.valueOf(params.get(RequestAuthenticationConstant.AUTHORITY_STRING)));
|
String authStr = Util.null2String(String.valueOf(params.get(RequestAuthenticationConstant.AUTHORITY_STRING)));
|
||||||
String authSignatureStr = Util.null2String(String.valueOf(params.get(RequestAuthenticationConstant.AUTHORITY_SIGNATURESTRING)));
|
String authSignatureStr = Util.null2String(String.valueOf(params.get(RequestAuthenticationConstant.AUTHORITY_SIGNATURESTRING)));
|
||||||
Map<String,Object> paramsMap = new HashMap<>();
|
Map<String, Object> paramsMap = new HashMap<>();
|
||||||
paramsMap.put("user",user);
|
paramsMap.put("user", user);
|
||||||
Map<String,Object> retobj;
|
Map<String, Object> retobj;
|
||||||
try {
|
try {
|
||||||
retobj = FileBiz.getFileDatas(Util.null2String(params.get("docIds")),listType,requestid,desrequestid,
|
retobj = FileBiz.getFileDatas(Util.null2String(params.get("docIds")), listType, requestid, desrequestid,
|
||||||
isprint,f_weaver_belongto_userid,f_weaver_belongto_usertype,true,false,authStr,authSignatureStr,paramsMap);
|
isprint, f_weaver_belongto_userid, f_weaver_belongto_usertype, true, false, authStr, authSignatureStr, paramsMap);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return ApiResult.error("查询附件信息失败:" + e);
|
return ApiResult.error("查询附件信息失败:" + e);
|
||||||
|
|
|
@ -355,7 +355,8 @@ public class FaDDContractService {
|
||||||
String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
|
String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
String userInfo = ufContractInfoDTO.getUserInfo();
|
String userInfo = ufContractInfoDTO.getUserInfo();
|
||||||
User user = JSON.parseObject(userInfo, new TypeReference<User>() {});
|
User user = JSON.parseObject(userInfo, new TypeReference<User>() {
|
||||||
|
});
|
||||||
// 获取流程中的合同字段的文档目录id
|
// 获取流程中的合同字段的文档目录id
|
||||||
rs.executeQuery(
|
rs.executeQuery(
|
||||||
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
|
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
|
||||||
|
@ -418,7 +419,8 @@ public class FaDDContractService {
|
||||||
String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
|
String.valueOf(ufContractInfoDTO.getWorkflowType()), 4);
|
||||||
RecordSet rs = new RecordSet();
|
RecordSet rs = new RecordSet();
|
||||||
String userInfo = ufContractInfoDTO.getUserInfo();
|
String userInfo = ufContractInfoDTO.getUserInfo();
|
||||||
User user = JSON.parseObject(userInfo, new TypeReference<User>() {});
|
User user = JSON.parseObject(userInfo, new TypeReference<User>() {
|
||||||
|
});
|
||||||
// 获取流程中的合同字段的文档目录id
|
// 获取流程中的合同字段的文档目录id
|
||||||
rs.executeQuery(
|
rs.executeQuery(
|
||||||
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
|
"select formid from workflow_base where id = ?", ufContractInfoDTO.getWorkflowType());
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package customization.test;
|
package customization.test;
|
||||||
|
|
||||||
|
import aiyh.utils.LabelHtmlUtils;
|
||||||
import aiyh.utils.Util;
|
import aiyh.utils.Util;
|
||||||
|
import aiyh.utils.entity.LabelHtmlIndex;
|
||||||
import aiyh.utils.fileUtil.ProperUtil;
|
import aiyh.utils.fileUtil.ProperUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
|
import com.api.aiyh_pcn.patentWall.service.PatentWallService;
|
||||||
|
@ -404,4 +406,20 @@ public class NewUtilTest {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetTime() {
|
||||||
|
System.out.println(System.currentTimeMillis());
|
||||||
|
System.out.println(System.currentTimeMillis());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPro() {
|
||||||
|
LabelHtmlUtils labelHtmlUtils = new LabelHtmlUtils("aiyh.htmlLabel.porsche");
|
||||||
|
Map<String, Object> faDDContractController = labelHtmlUtils.getHtmlLabelMap("FaDDContractController");
|
||||||
|
System.out.println(faDDContractController);
|
||||||
|
LabelHtmlIndex labelHtmlIndex = labelHtmlUtils.getLabelHtmlIndex(faDDContractController, "singedErr");
|
||||||
|
System.out.println(labelHtmlIndex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,13 +117,15 @@ public class AddCustomer_Action extends ToolUtil implements Action {
|
||||||
}
|
}
|
||||||
} catch (LoginIdRepeatException e) {
|
} catch (LoginIdRepeatException e) {
|
||||||
this.writeErrorLog(e + "\n");
|
this.writeErrorLog(e + "\n");
|
||||||
this.request.getRequestManager().setMessagecontent("登录名重复,请重新输入登录名");
|
this.request.getRequestManager().setMessagecontent(aiyh.utils.Util.getHtmlLabelName(-91703,
|
||||||
this.request.getRequestManager().setMessageid("登录名重复");
|
request.getRequestManager().getUser().getLanguage(), "登录名重复,请重新输入登录名"));
|
||||||
|
this.request.getRequestManager().setMessageid("1");
|
||||||
return Action.FAILURE_AND_CONTINUE;
|
return Action.FAILURE_AND_CONTINUE;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
this.writeDebuggerLog("insert customer error!");
|
this.writeDebuggerLog("insert customer error!");
|
||||||
this.writeDebuggerLog(e + "\n");
|
this.writeDebuggerLog(e + "\n");
|
||||||
this.request.getRequestManager().setMessagecontent("生成外部用户错误,请联系管理员!");
|
this.request.getRequestManager().setMessagecontent(aiyh.utils.Util.getHtmlLabelName(-91704,
|
||||||
|
request.getRequestManager().getUser().getLanguage(), "生成外部用户错误,请联系管理员!"));
|
||||||
this.request.getRequestManager().setMessageid("2");
|
this.request.getRequestManager().setMessageid("2");
|
||||||
} finally {
|
} finally {
|
||||||
this.writeDebuggerLog(className, "------------" + className + " End -----------------");
|
this.writeDebuggerLog(className, "------------" + className + " End -----------------");
|
||||||
|
|
Loading…
Reference in New Issue