diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..afc5d88 Binary files /dev/null and b/.DS_Store differ diff --git a/aiyh/utils/ApiResult.java b/aiyh/utils/ApiResult.java new file mode 100644 index 0000000..d7afe63 --- /dev/null +++ b/aiyh/utils/ApiResult.java @@ -0,0 +1,66 @@ +package aiyh.utils; + +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSON; + + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/27 0027 10:21 + * api调用结果类封装 + */ + + +public class ApiResult { + private final int code; + private final String msg; + private final Object data; + + public ApiResult(int code, String msg, Object data) { + this.code = code; + this.msg = msg; + this.data = data; + } + + + public static String successNoData(){ + return ApiResult.success(null, 200, "请求成功!"); + } + + public static String success(Object data){ + return ApiResult.success(data, 200, "请求成功!"); + } + + public static String success(Object data, String msg){ + return ApiResult.success(data, 200, msg); + } + + public static String success(Object data, int code, String msg){ + return JSON.toJSONString(new ApiResult(code, msg, data)); + } + + public static String error(){ + return ApiResult.error(0, "服务器异常!"); + } + + public static String error(String msg){ + return ApiResult.error(0, msg); + } + + public static String error(int code, String msg){ + return JSON.toJSONString(new ApiResult(code, msg, null)); + } + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } + + public Object getData() { + return data; + } + +} diff --git a/aiyh/utils/HotDeployToolUtil.java b/aiyh/utils/HotDeployToolUtil.java new file mode 100644 index 0000000..12e113f --- /dev/null +++ b/aiyh/utils/HotDeployToolUtil.java @@ -0,0 +1,74 @@ +package aiyh.utils; + +import aiyh.utils.zwl.common.ToolUtil; + + +import java.io.ByteArrayOutputStream; +import java.io.FileInputStream; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/25 0025 10:53 + * 热部署 自定义类加载器 + */ + + +public class HotDeployToolUtil extends ClassLoader { + ToolUtil toolUtil = new ToolUtil(); + private final String classpath; + private final String className; + + public HotDeployToolUtil(String classpath, String className) { + this.classpath = classpath; + this.className = className; + } + + @Override + public Class loadClass(String name, boolean resolve) throws ClassNotFoundException { + Class loadedClass = findLoadedClass(name); + // 需要我自己去加载 + if (loadedClass == null) { + loadedClass = findClass(name); + if (loadedClass != null) { + return loadedClass; + } + } + return super.loadClass(name, resolve); + } + + + @Override + public Class findClass(String name) throws ClassNotFoundException { + if (name.startsWith("java.")) { + return getSystemClassLoader().loadClass(name); + } + byte[] data; + String classPath = name.replace(".", System.getProperties().getProperty("file.separator")) + ".class"; + try { + data = this.loadClassData(classPath); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + return this.defineClass(name, data, 0, data.length); + } + + public byte[] loadClassData(String name) throws Exception { + FileInputStream inputStream; + try { + toolUtil.writeDebuggerLog(classpath + name); + inputStream = new FileInputStream(classpath + name); + // 定义字节数组输出流 + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + int b = 0; + while ((b = inputStream.read()) != -1) { + baos.write(b); + } + inputStream.close(); + return baos.toByteArray(); + } catch (Exception e) { + e.printStackTrace(); + throw new ClassNotFoundException(); + } + } +} diff --git a/aiyh/utils/Util.java b/aiyh/utils/Util.java new file mode 100644 index 0000000..8805f19 --- /dev/null +++ b/aiyh/utils/Util.java @@ -0,0 +1,1356 @@ +package aiyh.utils; + +import aiyh.utils.annotation.DateFormatAn; +import aiyh.utils.entity.AInputStream; +import aiyh.utils.entity.AZipOutputStream; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.entity.ListZipEntity; +import aiyh.utils.mapUtil.UtilHashMap; +import aiyh.utils.mapUtil.UtilLinkedHashMap; +import aiyh.utils.service.UtilService; +import aiyh.utils.sqlUtil.builderSql.impl.BuilderSqlImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.impl.PrepWhereImpl; +import aiyh.utils.sqlUtil.whereUtil.impl.WhereImpl; +import aiyh.utils.zwl.common.ToolUtil; +import cn.hutool.core.util.ObjectUtil; +import com.ibm.icu.text.SimpleDateFormat; +import weaver.common.util.string.StringUtil; +import weaver.conn.RecordSet; +import weaver.general.GCONST; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; +import weaver.workflow.workflow.WorkflowVersion; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.beans.BeanInfo; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.io.*; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.math.BigDecimal; +import java.net.URLDecoder; +import java.text.ParseException; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.zip.ZipEntry; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 11:42 + * dao 工具类 + */ + + +public class Util extends weaver.general.Util { + + static ToolUtil toolUtil = new ToolUtil(); + private static final UtilService utilService = new UtilService(); + private static final RecordSet rs = new RecordSet(); + + + /** + * 获取指定格式的当前时间 + * + * @param format 格式化字符串 + * @return 指定格式日期的字符串 + */ + public static String getTime(String format) { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat(format); + return formatter.format(date); + } + + /** + * 创建一个SQL where条件,不推荐使用 + * + * @return Where对象 + */ + @Deprecated + public static Where createWhereImpl() { + return new WhereImpl(); + } + + /** + * 创建一个SQL where条件 + * + * @return Where对象 + */ + public static Where createPrepWhereImpl() { + return new PrepWhereImpl(); + } + + /** + * 创建一个Map工具,可以自定义一些功能,比如链式添加键值对,自定义过滤条件等 + * + * @return UtilHashMap对象 + */ + public static UtilHashMap createUtilHashMap() { + return new UtilHashMap<>(); + } + + /** + * 创建一个SQL构建工具类,通过构建工具可以实现SQL的构建 + * + * @return BuilderSqlImpl对象 + */ + public static BuilderSqlImpl createSqlBuilder() { + return new BuilderSqlImpl(); + } + + /** + * 创建一个Map工具,可以自定义一些功能,比如链式添加键值对,自定义过滤条件等 + * + * @return UtilLinkedHashMap对象 + */ + public static UtilLinkedHashMap createUtilLinkedHashMap() { + return new UtilLinkedHashMap<>(); + } + + /** + * 判断map是否为空或者是否没有数据 + * + * @param map 判断的map对象 + * @return 是否为空或者和大小为0 + */ + public static boolean mapIsNullOrEmpty(Map map) { + return Objects.isNull(map) || map.size() == 0; + } + + /** + * 去除前后的英文逗号 + * + * @param sqlBuilder 构建的SQL StringBuilder对象 + * @return 处理后的SQL字符串 + */ + public static String removeSeparator(StringBuilder sqlBuilder) { + String str = sqlBuilder.toString().trim(); + String removeSeparator = ","; + if (str.endsWith(removeSeparator)) { +// 如果以分割号结尾,则去除分割号 + str = str.substring(0, str.length() - 1); + } + if (str.trim().startsWith(removeSeparator)) { + str = str.substring(1); + } + return str; + } + + public static String removeSeparator(StringBuilder sqlBuilder, String removeSeparator) { + String str = sqlBuilder.toString().trim(); + if (str.endsWith(removeSeparator)) { +// 如果以分割号结尾,则去除分割号 + str = str.substring(0, str.length() - 1); + } + if (str.trim().startsWith(removeSeparator)) { + str = str.substring(1); + } + return str; + } + + /** + * 通过RecordSet对象,获取查询后的值,返回map + * + * @param rs 执行查询语句后的RecordSet对象 + * @param conversion 是否大小写转驼峰命名 + * @return 封装后的Map的值 + */ + private static Map getMapMapping(RecordSet rs, boolean conversion) { + Map map = new HashMap<>(); + String[] columnType = rs.getColumnTypeName(); + int colCounts = 0; + colCounts = rs.getColCounts() == 0 ? columnType.length : rs.getColCounts(); + toolUtil.writeErrorLog(Arrays.toString(columnType)); + toolUtil.writeErrorLog("字段数:" + colCounts); + for (int i = 1; i <= colCounts; i++) { + String key = null; + String type = "varchar"; + if (columnType != null) { + if (columnType.length != colCounts) { + type = "varchar"; + } else { + type = columnType[i - 1]; + } + } + if (conversion) { + key = toCamelCase(rs.getColumnName(i)); + } else { + key = rs.getColumnName(i); + } + rs.getColumnName(i); + if ("int".equalsIgnoreCase(type) || "Integer".equalsIgnoreCase(type) + || "Long".equalsIgnoreCase(type) || "BIGINT".equalsIgnoreCase(type) + || "NUMBER".equalsIgnoreCase(type) || "INTEGER".equalsIgnoreCase(type) + || "TINYINT".equalsIgnoreCase(type) || "SMALLINT".equalsIgnoreCase(type)) { + map.put(key, rs.getInt(i) == -1 ? rs.getString(i) : rs.getInt(i)); + continue; + } + if ("FLOAT".equalsIgnoreCase(type)) { + map.put(key, rs.getFloat(i)); + continue; + } + if ("DATE".equalsIgnoreCase(type) || "TIMESTAMP".equalsIgnoreCase(type) + || "DATETIME".equalsIgnoreCase(type)) { + map.put(key, rs.getDouble(i)); + continue; + } + if ("DOUBLE".equalsIgnoreCase(type)) { + map.put(key, rs.getDouble(i)); + continue; + } + if ("DECIMAL".equalsIgnoreCase(type) || "NUMERIC".equalsIgnoreCase(type)) { + map.put(key, rs.getDouble(i)); + continue; + } + map.put(key, rs.getString(i)); + } + return map; + } + + /** + * 通过RecordSet对象获取map结果 + * + * @param rs RecordSet对象 + * @return 查询结果map + */ + public static Map recordSet2Map(RecordSet rs) { + if (rs.next()) { + return getMapMapping(rs, false); + } + return null; + } + + /*** + * 通过RecordSet对象获取查询后的map结果 + * @param rs RecordSet对象 + * @param conversion 是否下划线转驼峰命名 + * @return 查询结果map对象 + */ + public static Map recordSet2Map(RecordSet rs, boolean conversion) { + if (rs.next()) { + return getMapMapping(rs, conversion); + } + return null; + } + + /** + * 通过RecordSet对象获取map结果 + * + * @param rs RecordSet对象 + * @return 查询结果map集合 + */ + public static List> recordSet2MapList(RecordSet rs) { + List> list = new ArrayList<>(); + while (rs.next()) { + list.add(getMapMapping(rs, false)); + } + return list; + } + + /*** + * 通过RecordSet对象获取查询后的map结果 + * @param rs RecordSet对象 + * @param conversion 是否下划线转驼峰命名 + * @return 查询结果map集合 + */ + public static List> recordSet2MapList(RecordSet rs, boolean conversion) { + List> list = new ArrayList<>(); + while (rs.next()) { + list.add(getMapMapping(rs, conversion)); + } + return list; + } + + + /** + * 获取查询SQL的映射实体 + * + * @param rs 查询结果 RecordSet类 + * @param t 反射获取的对象 + * @param emptyFields 对象的字段 + * @param 返回一个赋值后的对象 + * @return 处理后的对象 + * @throws IllegalAccessException IllegalAccessException异常 + */ + private static T getMappingEntity(RecordSet rs, T t, List emptyFields) throws IllegalAccessException { + for (Field field : emptyFields) { + String fieldName = field.getName(); + field.setAccessible(true); + if (field.getType().equals(String.class)) { + field.set(t, rs.getString(fieldName)); + continue; + } + if (field.getType().equals(Integer.class) || field.getType().equals(int.class) + || field.getType().equals(short.class) || field.getType().equals(long.class) + || field.getType().equals(Long.class)) { + field.set(t, rs.getInt(fieldName)); + continue; + } + if (field.getType().equals(boolean.class) || field.getType().equals(Boolean.class)) { + field.set(t, rs.getBoolean(fieldName)); + continue; + } + if (field.getType().equals(Float.class) || field.getType().equals(float.class)) { + field.set(t, rs.getFloat(fieldName)); + continue; + } + if (field.getType().equals(Double.class) || field.getType().equals(double.class)) { + field.set(t, rs.getDouble(fieldName)); + continue; + } + if (field.getType().equals(Date.class)) { + if (field.isAnnotationPresent(DateFormatAn.class)) { + DateFormatAn annotation = field.getAnnotation(DateFormatAn.class); + String value = annotation.value(); + try { + field.set(t, new SimpleDateFormat(value).parse(rs.getString(fieldName))); + } catch (ParseException e) { + e.printStackTrace(); + field.set(t, null); + } + } else { + try { + field.set(t, rs.getDate(fieldName)); + } catch (Exception e) { + field.set(t, null); + } + } + continue; + } + if (field.getType().equals(BigDecimal.class)) { + field.set(t, rs.getDouble(fieldName)); + } + } + return t; + } + + + /** + * 获取查询SQL的映射实体 + * + * @param rs 查询结果 RecordSet类 + * @param t 反射获取的对象 + * @param emptyFields 对象的字段 + * @param conversion 是否下划线转驼峰 + * @param 返回一个赋值后的对象 + * @return 处理后的对象 + * @throws IllegalAccessException IllegalAccessException 异常 + */ + private static T getMappingEntity(RecordSet rs, T t, List emptyFields, boolean conversion) throws IllegalAccessException { + if (!conversion) { + return getMappingEntity(rs, t, emptyFields); + } + for (Field field : emptyFields) { + String fieldName = toUnderlineCase(field.getName()); + field.setAccessible(true); + if (field.getType().equals(String.class)) { + field.set(t, rs.getString(fieldName)); + continue; + } + if (field.getType().equals(Integer.class) || field.getType().equals(int.class) + || field.getType().equals(short.class) || field.getType().equals(long.class) + || field.getType().equals(Long.class)) { + field.set(t, rs.getInt(fieldName)); + continue; + } + if (field.getType().equals(boolean.class) || field.getType().equals(Boolean.class)) { + field.set(t, rs.getBoolean(fieldName)); + continue; + } + if (field.getType().equals(Float.class) || field.getType().equals(float.class)) { + field.set(t, rs.getFloat(fieldName)); + continue; + } + if (field.getType().equals(Double.class) || field.getType().equals(double.class)) { + field.set(t, rs.getDouble(fieldName)); + continue; + } + if (field.getType().equals(Date.class)) { + if (field.isAnnotationPresent(DateFormatAn.class)) { + DateFormatAn annotation = field.getAnnotation(DateFormatAn.class); + String value = annotation.value(); + try { + field.set(t, new SimpleDateFormat(value).parse(rs.getString(fieldName))); + } catch (ParseException e) { + e.printStackTrace(); + field.set(t, null); + } + } else { + try { + field.set(t, rs.getDate(fieldName)); + } catch (Exception e) { + field.set(t, null); + } + } + continue; + } + if (field.getType().equals(BigDecimal.class)) { + field.set(t, rs.getDouble(fieldName)); + } + } + return t; + } + + @Deprecated + public static T recordeSet2Empty(RecordSet rs, Class clazz, boolean conversion) { + return recordeSet2Entity(rs, clazz, conversion); + } + + /** + * 通过查询结果获取到一个映射对象 + * + * @param rs 查询结果 + * @param clazz 需要映射的类 + * @param conversion 是否下划线转驼峰 + * @param 泛型 + * @return 转换后的对象 + */ + public static T recordeSet2Entity(RecordSet rs, Class clazz, boolean conversion) { + if (clazz == null) { + return null; + } + try { + if (rs.next()) { + T t = clazz.newInstance(); + List entityFields = getEmptyFields(clazz); + if (entityFields == null) { + toolUtil.writeErrorLog("emptyFields is empty!"); + return null; + } + return getMappingEntity(rs, t, entityFields, conversion); + } + } catch (InstantiationException | IllegalAccessException e) { + toolUtil.writeErrorLog("err" + "\n" + e); + return null; + } + return null; + } + + + @Deprecated + public static T recordeSet2Empty(RecordSet rs, Class clazz) { + return recordeSet2Entity(rs, clazz); + } + + /** + * 通过查询结果获取到一个映射对象 + * + * @param rs 查询结果 + * @param clazz 需要映射的类 + * @param 返回改类的实例对象 + * @return 处理后的实体类 + */ + public static T recordeSet2Entity(RecordSet rs, Class clazz) { + if (clazz == null) { + return null; + } + if (clazz.equals(String.class)) { + if (rs.next()) { + return (T) rs.getString(1); + } + return null; + } else if (clazz.equals(Integer.class)) { + if (rs.next()) { + return (T) Integer.valueOf(rs.getInt(1)); + } + return null; + } else if (clazz.equals(Double.class)) { + if (rs.next()) { + return (T) Double.valueOf(rs.getDouble(1)); + } + return null; + } else if (clazz.equals(Float.class)) { + if (rs.next()) { + return (T) Float.valueOf(rs.getFloat(1)); + } + return null; + } else if (clazz.equals(Boolean.class)) { + if (rs.next()) { + return (T) Boolean.valueOf(rs.getBoolean(1)); + } + return null; + } + try { + if (rs.next()) { + T t = clazz.newInstance(); + List emptyFields = getEmptyFields(clazz); + if (emptyFields == null) { + return null; + } + return getMappingEntity(rs, t, emptyFields); + } + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + return null; + } + return null; + } + + + /** + * 获取数据库映射的集合 + * + * @param rs 查询对象 + * @param clazz 需要映射的类 + * @param conversion 是否下划线转驼峰 + * @param 返回映射实体类集合 + * @return 处理后的实体类集合 + */ + public static List recordeSet2Array(RecordSet rs, Class clazz, boolean conversion) { + if (clazz == null) { + return null; + } + List list = new ArrayList<>(); + List entityFields = getEmptyFields(clazz); + if (entityFields == null) { + return null; + } + while (rs.next()) { + try { + T t = clazz.newInstance(); + list.add(getMappingEntity(rs, t, entityFields, conversion)); + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + return null; + } + } + return list; + } + + /** + * 获取数据库映射的集合 + * + * @param rs 查询对象 + * @param clazz 需要映射的类 + * @param 返回映射实体类集合 + * @return 转换后的实体类集合 + */ + public static List recordeSet2Array(RecordSet rs, Class clazz) { + if (clazz == null) { + return null; + } + List list = new ArrayList<>(); + List emptyFields = getEmptyFields(clazz); + if (emptyFields == null) { + return null; + } + while (rs.next()) { + try { + if (clazz.equals(String.class)) { + list.add((T) rs.getString(1)); + } else if (clazz.equals(Integer.class)) { + list.add((T) Integer.valueOf(rs.getInt(1))); + } else if (clazz.equals(Double.class)) { + list.add((T) Double.valueOf(rs.getDouble(1))); + } else if (clazz.equals(Float.class)) { + list.add((T) Float.valueOf(rs.getFloat(1))); + } else if (clazz.equals(Boolean.class)) { + list.add((T) Boolean.valueOf(rs.getBoolean(1))); + } else { + T t = clazz.newInstance(); + list.add(getMappingEntity(rs, t, emptyFields)); + } + } catch (InstantiationException | IllegalAccessException e) { + e.printStackTrace(); + return null; + } + } + return list; + } + + + /** + * 下划线转驼峰 + * + * @param underlineStr 带有下划线的字符串 + * @return 驼峰字符串 + */ + public static String toCamelCase(String underlineStr) { + if (underlineStr == null) { + return null; + } + // 分成数组 + char[] charArray = underlineStr.toCharArray(); + // 判断上次循环的字符是否是"_" + boolean underlineBefore = false; + StringBuilder buffer = new StringBuilder(); + for (int i = 0, l = charArray.length; i < l; i++) { + // 判断当前字符是否是"_",如果跳出本次循环 + if (charArray[i] == 95) { + underlineBefore = true; + } else if (underlineBefore) { + // 如果为true,代表上次的字符是"_",当前字符需要转成大写 + buffer.append(charArray[i] -= 32); + underlineBefore = false; + } else { + // 不是"_"后的字符就直接追加 + buffer.append(charArray[i]); + } + } + return buffer.toString(); + } + + /** + * 驼峰转 下划线 + * + * @param camelCaseStr 驼峰字符串 + * @return 带下滑线的String + */ + public static String toUnderlineCase(String camelCaseStr) { + if (camelCaseStr == null) { + return null; + } + // 将驼峰字符串转换成数组 + char[] charArray = camelCaseStr.toCharArray(); + StringBuilder buffer = new StringBuilder(); + //处理字符串 + for (int i = 0, l = charArray.length; i < l; i++) { + if (charArray[i] >= 65 && charArray[i] <= 90) { + buffer.append("_").append(charArray[i] += 32); + } else { + buffer.append(charArray[i]); + } + } + return buffer.toString(); + } + + /** + * 根据类获取到对应的字段,包括父类的字段 + * + * @param clazz 需要获取字段的类 + * @return java字段信息 + */ + public static List getEntityFields(Class clazz) { + Class temClass = clazz; + List fieldList = new ArrayList<>(); + while (temClass != null && temClass != Object.class) { + fieldList.addAll(Arrays.asList(temClass.getDeclaredFields())); + temClass = temClass.getSuperclass(); + } + if (fieldList.size() == 0) { + return null; + } + return fieldList; + } + + + public static List getEmptyFields(Class clazz) { + return getEntityFields(clazz); + } + + /** + * 根据查询语句生成java文件 + * + * @param query 查询语句 + * @param javaName 文件名 + * @param packageName 包名 + * @throws IOException io异常 + */ + private static void createJavaFile(String query, String javaName, String packageName) throws IOException { + RecordSet rs = new RecordSet(); + rs.executeQuery(query); + List list = new ArrayList<>(); + int colCounts = rs.getColCounts() == 0 ? rs.getColumnTypeName().length : rs.getColCounts(); + for (int i = 1; i <= colCounts; i++) { + list.add(rs.getColumnName(i)); + } + String[] columnType = rs.getColumnTypeName(); + StringBuilder content = new StringBuilder(); + StringBuilder importBuilder = new StringBuilder(); + StringBuilder getBuilder = new StringBuilder(); + StringBuilder setBuilder = new StringBuilder(); + StringBuilder toStringBuilder = new StringBuilder("\n\t@Override\n"); + String packageStr = "\npackage " + packageName + "; \n\n"; + content.append("\npublic class "); + String className = Util.toCamelCase(javaName); + char[] chars = className.toCharArray(); + if (!Character.isUpperCase(chars[0])) { + chars[0] -= 32; + } + className = String.valueOf(chars) + "DTO"; + toStringBuilder.append("\tpublic String toString() {\n\t\treturn \"") + .append(className) + .append("{\" +\n"); + content.append(className).append(" {\n\n"); + for (int i = 0; i < list.size(); i++) { + content.append(getClassField(columnType[i], list.get(i), importBuilder, getBuilder, setBuilder, toStringBuilder)); + } + toStringBuilder.append("\t\t\t\t'}';\n\t}"); + content.append(setBuilder) + .append(getBuilder) + .append(toStringBuilder.toString().replace("{\" +\n\t\t\t\t\", ", "{\" +\n\t\t\t\t\"")) + .append("\n}"); + String contentStr = packageStr + importBuilder + content; + String path = GCONST.getRootPath().replace(File.separator + "web" + File.separator, + File.separator + "src" + File.separator) + packageName.replace(".", File.separator) + File.separator + className + ".java"; + System.out.println(path); + File file = new File(URLDecoder.decode(path, "utf-8")); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } else { + try { + System.out.println("已存在文件:" + packageName + "." + className + ".java"); + System.out.print("你想如何处理该文件:替换[r/R] 重命名[w/W] 跳过[n/N] ? "); + Scanner scanner = new Scanner(System.in); + String next = scanner.next(); + System.out.println(next); + if ("w".equalsIgnoreCase(next)) { + System.out.print("请输入新的文件名:"); + String newName = scanner.next(); + System.out.println(newName); + System.out.println("处理中..."); + createJavaFile(query, newName, packageName); + } else if ("n".equalsIgnoreCase(next)) { + System.out.println("跳过文件生成!"); + return; + } + } catch (Exception e) { + System.out.println("已存在文件:" + packageName + "." + className + ".java"); + } + } + FileOutputStream fos = new FileOutputStream(file); + byte[] contentInBytes = contentStr.getBytes(); + fos.write(contentInBytes); + fos.flush(); + fos.close(); + System.out.println("完成"); + } + + /** + * 根据表名生成java文件 + * + * @param tableName 表名 + * @param packageName 包名 + * @throws IOException io异常 + */ + public static void creatJavaFileByTable(String tableName, String packageName) throws IOException { + RecordSet recordSet = new RecordSet(); + String dbType = recordSet.getDBType(); + String query; + System.out.println(dbType); + if ("mysql".equalsIgnoreCase(dbType)) { + query = "select * from " + tableName + " limit 1"; + } else if ("sqlserver".equalsIgnoreCase(dbType)) { + query = "select TOP 1 * from " + tableName; + } else { + query = "select TOP 1 * from " + tableName; + } + createJavaFile(query, tableName, packageName); + } + + /** + * 根据查询语句生成java问阿金 + * + * @param sql 查询语句 + * @param fileName java文件名 + * @param packageName 包名 + * @throws IOException io 异常 + */ + public static void creatJavaFileBySql(String sql, String fileName, String packageName) throws IOException { + RecordSet recordSet = new RecordSet(); + String dbType = recordSet.getDBType(); + String query; + System.out.println(dbType); + if ("mysql".equalsIgnoreCase(dbType)) { + query = "select * from (" + sql + ") as temp limit 1"; + } else if ("sqlserver".equalsIgnoreCase(dbType)) { + query = "select TOP 1 * from (" + sql + ") as temp"; + } else { + query = "select TOP 1 * from (" + sql + ") as temp"; + } + createJavaFile(query, fileName, packageName); + } + + /** + * java字段和数据库字段映射 + * + * @param type 数据库字段类型 + * @param name 数据库字段名 + * @param importBuilder 导包的构建 + * @param getBuilder getter方法的构建 + * @param setBuilder setter方法的构建 + * @param toStringBuilder toString方法的构建 + * @return java字段 + */ + public static String getClassField(String type, String name, StringBuilder importBuilder, + StringBuilder getBuilder, StringBuilder setBuilder, StringBuilder toStringBuilder) { + if ("TINYINT".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic boolean is") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(boolean ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + return "\tprivate boolean " + toCamelCase(name) + ";\n"; + } + if ("int".equalsIgnoreCase(type) || "SMALLINT".equalsIgnoreCase(type) + || "MEDIUMINT".equalsIgnoreCase(type) || "NUMBER".equalsIgnoreCase(type) + || "INTEGER".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic int get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(int ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + return "\tprivate int " + toCamelCase(name) + ";\n"; + } + if ("BIGINT".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic long get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(long ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + return "\tprivate long " + toCamelCase(name) + ";\n"; + } + if ("double".equalsIgnoreCase(type) || "BINARY_DOUBLE".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic double get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(double ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + return "\tprivate double " + toCamelCase(name) + ";\n"; + } + if ("float".equalsIgnoreCase(type) || "BINARY_FLOAT".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic float get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(float ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + return "\tprivate float " + toCamelCase(name) + ";\n"; + } + if ("DECIMAL".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic BigDecimal get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(BigDecimal ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + importBuilder.append("import java.math.BigDecimal;\n"); + return "\tprivate BigDecimal " + toCamelCase(name) + ";\n"; + } + if ("DATE".equalsIgnoreCase(type) || "DATETIME".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic Date get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(Date ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + importBuilder.append("import java.util.Date;\n"); + return "\tprivate Date" + toCamelCase(name) + ";\n"; + } + if ("char".equalsIgnoreCase(type) || "VARCHAR".equalsIgnoreCase(type) || "TEXT".equalsIgnoreCase(type)) { + getBuilder.append("\n\tpublic String get") + .append(getFirstCase(toCamelCase(name))) + .append("(){\n") + .append("\t\treturn this.") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + setBuilder.append("\n\tpublic void set") + .append(getFirstCase(toCamelCase(name))) + .append("(String ") + .append(toCamelCase(name)) + .append("){\n") + .append("\t\tthis.") + .append(toCamelCase(name)) + .append(" = ") + .append(toCamelCase(name)) + .append(";\n\t}\n"); + toStringBuilder.append("\t\t\t\t\", ") + .append(toCamelCase(name)) + .append("='\" + ") + .append(toCamelCase(name)) + .append(" + '\\'' +\n"); + return "\tprivate String " + toCamelCase(name) + ";\n"; + } + return ""; + } + + /** + * 首字母转大写 + * + * @param str 需要转换的字符串 + * @return 首字母转为大写后的字符串 + */ + public static String getFirstCase(String str) { + char[] chars = str.toCharArray(); + if (!Character.isUpperCase(chars[0])) { + chars[0] -= 32; + } + return String.valueOf(chars); + } + + + /** + * 通过文件名获取到对应的配置文件map对象 + * + * @param fileName prop/prop2map/文件夹下的文件名(不包含.properties) + * @return 配置文件对应的map对象 + */ + public static Map getProperties2Map(String fileName) { + String propertyPath = GCONST.getPropertyPath(); + if (StringUtil.isNullOrEmpty(fileName)) { + return null; + } + if (fileName.contains(".properties")) { + fileName.replace(".properties", ""); + } + String path = propertyPath + "prop2map" + File.separator + fileName + ".properties"; + Properties prop = new Properties(); + Map map = new HashMap<>(); + InputStream inputStream = null; + try { + inputStream = new BufferedInputStream(new FileInputStream(path)); + prop.load(inputStream); + Enumeration enumeration = prop.propertyNames(); + while (enumeration.hasMoreElements()) { + String key = String.valueOf(enumeration.nextElement()); + map.put(key, prop.getProperty(key)); + } + } catch (IOException e) { + throw new RuntimeException("找不到文件:" + path); + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return map; + } + + /** + * 通过文件名获取到对应的配置文件map对象 + * + * @param fileName prop/prop2map/文件夹下的文件名(不包含.properties) + * @param prefix 配置文件中配置项的前缀 + * @return 配置文件指定前缀对应的map对象 + */ + public static Map getProperties2Map(String fileName, String prefix) { + String propertyPath = GCONST.getPropertyPath(); + if (StringUtil.isNullOrEmpty(fileName)) { + return null; + } + if (fileName.contains(".properties")) { + fileName.replace(".properties", ""); + } + String path = propertyPath + "prop2map" + File.separator + fileName + ".properties"; + Properties prop = new Properties(); + Map map = new HashMap<>(); + InputStream inputStream = null; + try { + inputStream = new BufferedInputStream(new FileInputStream(path)); + prop.load(inputStream); + Enumeration enumeration = prop.propertyNames(); + while (enumeration.hasMoreElements()) { + String key = (String) enumeration.nextElement(); + if (key.contains(prefix + ".")) { + map.put(key.replace(prefix + ".", ""), prop.getProperty(key)); + } + } + } catch (IOException e) { + throw new RuntimeException("找不到文件:" + path); + } finally { + try { + if (inputStream != null) { + inputStream.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return map; + } + + public static Map> parsingSq2Map(String sql) { + Map> map = new HashMap<>(); + String pattern = "\\{{2}(?((?!\\$)\\S)+?)\\.(?\\S+?)}{2}"; + Pattern compile = Pattern.compile(pattern); + Matcher matcher = compile.matcher(sql); + while (matcher.find()) { + if (map.containsKey(matcher.group("table"))) { + map.get(matcher.group("table")).add(matcher.group("field")); + } else { + map.put(matcher.group("table"), new ArrayList() {{ + add(matcher.group("field")); + }}); + } + } + return map; + } + + public static Matcher parsingSql2Matcher(String sql) { + String pattern = "\\{{2}(?
((?!\\$)\\S)+?)\\.(?\\S+?)}{2}"; + Pattern compile = Pattern.compile(pattern); + return compile.matcher(sql); + } + + public static String parsingSqlByRequestAndWorkflowId(String sql, String requestId, String workflowId) { + String requestIdPattern = "\\{{2}(\\$requestId)?}{2}"; + String workflowIdIdPattern = "\\{{2}(\\$workflowId)?}{2}"; + String result = sql.replaceAll(requestIdPattern, StringUtil.isNullOrEmpty(requestId) ? "''" : requestId); + result = result.replaceAll(workflowIdIdPattern, StringUtil.isNullOrEmpty(workflowId) ? "''" : workflowId); + return result; + } + + public static String parsingSq(String sql, Map params) { + String result = sql; + String requestIdPattern = "\\{{2}(\\$requestId)?}{2}"; + String workflowIdIdPattern = "\\{{2}(\\$workflowId)?}{2}"; + result = result.replaceAll(requestIdPattern, ObjectUtil.isNull(params.get("requestId")) ? "''" : "'" + params.get("requestId") + "'"); + result = result.replaceAll(workflowIdIdPattern, ObjectUtil.isNull(params.get("workflowId")) ? "''" : "'" + params.get("workflowId") + "'"); + for (Map.Entry param : params.entrySet()) { + String pattern_ = "#\\{{2}(" + param.getKey() + ")?}{2}"; + result = result.replaceAll(pattern_, ObjectUtil.isNull(param.getValue()) ? "''" : String.valueOf(param.getValue())); + String pattern = "\\{{2}(" + param.getKey() + ")?}{2}"; + result = result.replaceAll(pattern, ObjectUtil.isNull(param.getValue()) ? "''" : "'" + param.getValue() + "'"); + } + return result; + } + + public static List deWeight(List list, Function keyExtractor) { + return list.stream().filter(distinctByKey(keyExtractor)).collect(Collectors.toList()); + } + + private static Predicate distinctByKey(Function keyExtractor) { + Map seen = new ConcurrentHashMap<>(); +// putIfAbsent添加不存在的键,返回null,如果为null表示不重复 + return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; + } + + + public static Map object2Map(Object obj) { + if (obj == null) { + return null; + } + Map map = new HashMap<>(); + try { + BeanInfo beanInfo = Introspector.getBeanInfo(obj.getClass()); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor property : propertyDescriptors) { + String key = property.getName(); + if (key.compareToIgnoreCase("class") == 0) { + continue; + } + Method getter = property.getReadMethod(); + Object value = getter != null ? getter.invoke(obj) : null; + map.put(key, value); + } + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } + + + public static String getWorkflowNameById(String workflowid) { + RecordSet rs = new RecordSet(); + String sql = "select workflowname from workflow_base where id = ?"; + rs.executeQuery(sql, workflowid); + if (rs.next()) { + return rs.getString("workflowname"); + } + return ""; + } + + public static Object getRequestTitleById(String requestid) { + RecordSet rs = new RecordSet(); + String sql = "select requestnamenew from workflow_requestbase where requestid = ?"; + rs.executeQuery(sql, requestid); + if (rs.next()) { + return rs.getString("requestnamenew"); + } + return ""; + } + + + public static ApiConfigMainDTO queryApiConfig(String id) { + ApiConfigMainDTO apiConfigMain = utilService.getApiConfigMain(id); +// System.out.println(JSON.toJSONString(apiConfigMain)); + return apiConfigMain; + } + + public static ApiConfigMainDTO queryApiConfigTree(String id) { + ApiConfigMainDTO apiConfigMain = utilService.getApiConfigMainTree(id); +// System.out.println(JSON.toJSONString(apiConfigMain)); + return apiConfigMain; + } + + public static AZipOutputStream createZip(List inputList) throws IOException { + return createZip(inputList, File.separator); + } + + private static AZipOutputStream createZip(List inputList, String base) throws IOException { + FileOutputStream fileOutputStream = null; + + try { + File file = new File(AZipOutputStream.filePath); + if (!file.exists()) { + //先得到文件的上级目录,并创建上级目录,在创建文件 + file.getParentFile().mkdirs(); + try { + //创建文件 + file.createNewFile(); + } catch (IOException ex) { + ex.printStackTrace(); + } + } + fileOutputStream = new FileOutputStream(file); + } catch (FileNotFoundException e) { + e.printStackTrace(); + } + if (fileOutputStream == null) { + return null; + } + AZipOutputStream zipOut = new AZipOutputStream(fileOutputStream); + int catchLen = 10 * 1024; + for (int i = 0; i < inputList.size(); i++) { + T item = inputList.get(i); + if (item instanceof InputStream) { +// 属于单级文件,直接压缩并返回 + try { + zipOut.putNextEntry(new ZipEntry(base + i)); + } catch (IOException e) { + throw new IOException(e.toString()); + } + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = ((InputStream) item).read(buffer)) != -1) { + zipOut.write(buffer, 0, len); + } + zipOut.closeEntry(); + } + if (item instanceof AInputStream) { + try { + zipOut.putNextEntry(new ZipEntry(((AInputStream) item).getFileName())); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = ((AInputStream) item).getInputStream().read(buffer)) != -1) { + try { + zipOut.write(buffer, 0, len); + } catch (IOException e) { + e.printStackTrace(); + } + } + zipOut.closeEntry(); + } + if (item instanceof ListZipEntity) { + ListZipEntity listZipEntity = (ListZipEntity) item; + if (listZipEntity.isDirectory()) { +// 表示属于文件夹,循环添加处理文件夹 + handlerDirectory(listZipEntity.getFileList(), zipOut, base + listZipEntity.getDirectory() + File.separator); + } else { + List aInputStreams = listZipEntity.getaInputStreamList(); + for (AInputStream aInputStream : aInputStreams) { + try { + zipOut.putNextEntry(new ZipEntry(aInputStream.getFileName())); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = (aInputStream.getInputStream()).read(buffer)) != -1) { + try { + zipOut.write(buffer, 0, len); + } catch (IOException e) { + e.printStackTrace(); + } + } + zipOut.closeEntry(); + } + } + } + } + return zipOut; + } + + private static void handlerDirectory(List fileList, AZipOutputStream zipOut, String base) throws IOException { + int catchLen = 10 * 1024; + for (ListZipEntity listZipEntity : fileList) { + if (listZipEntity.isDirectory()) { +// 如果是文件夹 + handlerDirectory(listZipEntity.getFileList(), zipOut, base + listZipEntity.getDirectory() + File.separator); + } else { + List aInputStreams = listZipEntity.getaInputStreamList(); + for (AInputStream aInputStream : aInputStreams) { + try { + zipOut.putNextEntry(new ZipEntry(aInputStream.getFileName())); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = (aInputStream.getInputStream()).read(buffer)) != -1) { + try { + zipOut.write(buffer, 0, len); + } catch (IOException e) { + e.printStackTrace(); + } + } + zipOut.closeEntry(); + } + } + } + } + + public static Map queryLanguage(int groupId, int languageId) { + return utilService.queryLanguage(groupId, languageId); + } + + public static Map queryLanguage(int groupId, HttpServletRequest request, HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + int languageId = user.getLanguage(); + return utilService.queryLanguage(groupId, languageId); + } + + + public static String getHtmlLabelName(int id, int languageId, String defaultStr){ + String htmlLabelName = SystemEnv.getHtmlLabelName(id, languageId); + return htmlLabelName == null ? defaultStr : htmlLabelName; + } + + public static String getHtmlLabelName(int id, int languageId){ + return SystemEnv.getHtmlLabelName(id, languageId); + } + + + /** + * 获取流程主表 + * + * @param workflowId + * @return + */ + public static String getMainTable(String workflowId) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String query = "select tablename from workflow_bill " + + " where id in (select formid from workflow_base " + + " where id in (" + versionStringByWfid + ") )"; + rs.executeQuery(query); + rs.next(); + return rs.getString(1); + } + +} diff --git a/aiyh/utils/annotation/DateFormatAn.java b/aiyh/utils/annotation/DateFormatAn.java new file mode 100644 index 0000000..a360561 --- /dev/null +++ b/aiyh/utils/annotation/DateFormatAn.java @@ -0,0 +1,17 @@ +package aiyh.utils.annotation; + + +import java.lang.annotation.*; + +/** + * @author EBU7-dev1-ay + * @date 2021/9/3 0003 16:02 + * 时间映射自定义注解 + */ + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +@Documented +public @interface DateFormatAn { + String value() default "yyyy-MM-dd HH:mm:ss"; +} diff --git a/aiyh/utils/dao/UtilDao.java b/aiyh/utils/dao/UtilDao.java new file mode 100644 index 0000000..c5fd264 --- /dev/null +++ b/aiyh/utils/dao/UtilDao.java @@ -0,0 +1,44 @@ +package aiyh.utils.dao; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigDetailDTO; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.entity.MultiLanguageDTO; +import weaver.conn.RecordSet; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/14 0014 12:09 + * 数据库交互 + */ + + +public class UtilDao { + private final RecordSet rs = new RecordSet(); + + + public ApiConfigMainDTO getApiConfigMain(String id) { + String query = "select id,workflow_type,api_url,api_name from uf_api_param_config where id = ?"; + rs.executeQuery(query, id); + return Util.recordeSet2Entity(rs, ApiConfigMainDTO.class, true); + } + + public List getApiConfigDetail(int mainId) { + String query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " + + "dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql " + + "from uf_api_param_config_dt1 dt " + + "left join workflow_field_table_view wf on wf.id = dt.workflow_field " + + "where mainid = ? and (are_use is null or are_use = 1)"; + rs.executeQuery(query, mainId); + return Util.recordeSet2Array(rs, ApiConfigDetailDTO.class, true); + } + + public List queryLanguage(int groupId) { + String query = "select * from uf_multi_language_dt1 where mainid = ?"; + rs.executeQuery(query, groupId); + return Util.recordeSet2Array(rs, MultiLanguageDTO.class, true); + } + +} diff --git a/aiyh/utils/entity/AInputStream.java b/aiyh/utils/entity/AInputStream.java new file mode 100644 index 0000000..a1cfa82 --- /dev/null +++ b/aiyh/utils/entity/AInputStream.java @@ -0,0 +1,31 @@ +package aiyh.utils.entity; + +import java.io.InputStream; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/25 0025 18:00 + * inputStream + */ + + +public class AInputStream { + private String fileName; + private InputStream inputStream; + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public InputStream getInputStream() { + return inputStream; + } + + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } +} diff --git a/aiyh/utils/entity/AZipOutputStream.java b/aiyh/utils/entity/AZipOutputStream.java new file mode 100644 index 0000000..f49216d --- /dev/null +++ b/aiyh/utils/entity/AZipOutputStream.java @@ -0,0 +1,64 @@ +package aiyh.utils.entity; + +import org.jetbrains.annotations.NotNull; +import weaver.file.FileUpload; +import weaver.system.SystemComInfo; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.nio.charset.Charset; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.UUID; +import java.util.zip.ZipOutputStream; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/25 0025 17:38 + * zipoutputstaream + */ + + +public class AZipOutputStream extends ZipOutputStream { + + private ZipOutputStream zipOutputStream; + public static String filePath; + private OutputStream out; + static { + filePath = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; + filePath += "zip" + File.separator + System.currentTimeMillis() + UUID.randomUUID() + ".zip"; + } + + public AZipOutputStream(@NotNull OutputStream out) { + super(out); + this.out = out; + } + + public AZipOutputStream(@NotNull OutputStream out, @NotNull Charset charset) { + super(out, charset); + this.out = out; + } + + @Override + public void close() throws IOException { + try { + Files.deleteIfExists(Paths.get(AZipOutputStream.filePath)); + } catch (IOException e) { + e.printStackTrace(); + }finally { + out.flush(); + super.flush(); + super.close(); + out.close(); + } + } + + public ZipOutputStream getZipOutputStream() { + return zipOutputStream; + } + + public void setZipOutputStream(ZipOutputStream zipOutputStream) { + this.zipOutputStream = zipOutputStream; + } +} diff --git a/aiyh/utils/entity/ApiConfigDetailDTO.java b/aiyh/utils/entity/ApiConfigDetailDTO.java new file mode 100644 index 0000000..b05f518 --- /dev/null +++ b/aiyh/utils/entity/ApiConfigDetailDTO.java @@ -0,0 +1,123 @@ + +package aiyh.utils.entity; + + +public class ApiConfigDetailDTO extends BaseTree{ + + private int id; + private int lineNum; + private String paramName; + private int paramType; + private int objectChild; + private int parentLine; + private int changeRule; + private String paramValue; + private String workflowField; + private String tablename; + private String arraySql; + + public void setId(int id){ + this.id = id; + } + + public void setLineNum(int lineNum){ + this.lineNum = lineNum; + } + + public void setParamName(String paramName){ + this.paramName = paramName; + } + + public void setParamType(int paramType){ + this.paramType = paramType; + } + + public void setObjectChild(int objectChild){ + this.objectChild = objectChild; + } + + public void setParentLine(int parentLine){ + this.parentLine = parentLine; + } + + public void setChangeRule(int changeRule){ + this.changeRule = changeRule; + } + + public void setParamValue(String paramValue){ + this.paramValue = paramValue; + } + + public void setWorkflowField(String workflowField){ + this.workflowField = workflowField; + } + + public void setTablename(String tablename){ + this.tablename = tablename; + } + + public void setArraySql(String arraySql){ + this.arraySql = arraySql; + } + + public int getId(){ + return this.id; + } + + public int getLineNum(){ + return this.lineNum; + } + + public String getParamName(){ + return this.paramName; + } + + public int getParamType(){ + return this.paramType; + } + + public int getObjectChild(){ + return this.objectChild; + } + + public int getParentLine(){ + return this.parentLine; + } + + public int getChangeRule(){ + return this.changeRule; + } + + public String getParamValue(){ + return this.paramValue; + } + + public String getWorkflowField(){ + return this.workflowField; + } + + public String getTablename(){ + return this.tablename; + } + + public String getArraySql(){ + return this.arraySql; + } + + @Override + public String toString() { + return "ApiConfigDetailDTO{" + + "id='" + id + '\'' + + ", lineNum='" + lineNum + '\'' + + ", paramName='" + paramName + '\'' + + ", paramType='" + paramType + '\'' + + ", objectChild='" + objectChild + '\'' + + ", parentLine='" + parentLine + '\'' + + ", changeRule='" + changeRule + '\'' + + ", paramValue='" + paramValue + '\'' + + ", workflowField='" + workflowField + '\'' + + ", tablename='" + tablename + '\'' + + ", arraySql='" + arraySql + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/aiyh/utils/entity/ApiConfigMainDTO.java b/aiyh/utils/entity/ApiConfigMainDTO.java new file mode 100644 index 0000000..a08a47c --- /dev/null +++ b/aiyh/utils/entity/ApiConfigMainDTO.java @@ -0,0 +1,65 @@ + +package aiyh.utils.entity; + + +import java.util.List; + +public class ApiConfigMainDTO { + + private int id; + private int workflowType; + private String apiUrl; + private String apiName; + private List details; + + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + + public void setId(int id){ + this.id = id; + } + + public void setWorkflowType(int workflowType){ + this.workflowType = workflowType; + } + + public void setApiUrl(String apiUrl){ + this.apiUrl = apiUrl; + } + + public void setApiName(String apiName){ + this.apiName = apiName; + } + + public int getId(){ + return this.id; + } + + public int getWorkflowType(){ + return this.workflowType; + } + + public String getApiUrl(){ + return this.apiUrl; + } + + public String getApiName(){ + return this.apiName; + } + + @Override + public String toString() { + return "ApiConfigMainDTO{" + + "id=" + id + + ", workflowType=" + workflowType + + ", apiUrl='" + apiUrl + '\'' + + ", apiName='" + apiName + '\'' + + ", details=" + details + + '}'; + } +} \ No newline at end of file diff --git a/aiyh/utils/entity/BaseTree.java b/aiyh/utils/entity/BaseTree.java new file mode 100644 index 0000000..947034e --- /dev/null +++ b/aiyh/utils/entity/BaseTree.java @@ -0,0 +1,22 @@ +package aiyh.utils.entity; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/12 0012 14:04 + * 树形 + */ + + +public class BaseTree { + private List children; + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } +} diff --git a/aiyh/utils/entity/FnainvoiceinterfaceDTO.java b/aiyh/utils/entity/FnainvoiceinterfaceDTO.java new file mode 100644 index 0000000..29bdab6 --- /dev/null +++ b/aiyh/utils/entity/FnainvoiceinterfaceDTO.java @@ -0,0 +1,363 @@ + +package aiyh.utils.entity; + + +public class FnainvoiceinterfaceDTO { + + private int id; + private int type; + private String interfaceurl; + private int status; + private int interfaceType; + private String userName; + private String password; + private String lastmodify; + private String weightPercent; + private String tokenurl; + private String openIDurl; + private String client_id; + private String client_secret; + private String sqm; + private String Client; + private String GTAXID; + private String imageCatalog; + private int noNeedCheck; + private String noNeedCheckAmount; + private String account; + private String corpName; + private String cid; + private String synInvoiceUrl; + private String synBillingInfoUrl; + private String synDocUrl; + private String subIds; + private int subIdStatus; + private String jsUrl; + private String createAppUrl; + private String appName; + private String checkUrl; + private String javaUrl; + private String oaUrl; + private String webUrl; + private String aesKey; + + public void setId(int id){ + this.id = id; + } + + public void setType(int type){ + this.type = type; + } + + public void setInterfaceurl(String interfaceurl){ + this.interfaceurl = interfaceurl; + } + + public void setStatus(int status){ + this.status = status; + } + + public void setInterfaceType(int interfaceType){ + this.interfaceType = interfaceType; + } + + public void setUserName(String userName){ + this.userName = userName; + } + + public void setPassword(String password){ + this.password = password; + } + + public void setLastmodify(String lastmodify){ + this.lastmodify = lastmodify; + } + + public void setWeightPercent(String weightPercent){ + this.weightPercent = weightPercent; + } + + public void setTokenurl(String tokenurl){ + this.tokenurl = tokenurl; + } + + public void setOpenIDurl(String openIDurl){ + this.openIDurl = openIDurl; + } + + public void setClientId(String client_id){ + this.client_id = client_id; + } + + public void setClientSecret(String client_secret){ + this.client_secret = client_secret; + } + + public void setSqm(String sqm){ + this.sqm = sqm; + } + + public void setClient(String Client){ + this.Client = Client; + } + + public void setGTAXID(String GTAXID){ + this.GTAXID = GTAXID; + } + + public void setImageCatalog(String imageCatalog){ + this.imageCatalog = imageCatalog; + } + + public void setNoNeedCheck(int noNeedCheck){ + this.noNeedCheck = noNeedCheck; + } + + public void setNoNeedCheckAmount(String noNeedCheckAmount){ + this.noNeedCheckAmount = noNeedCheckAmount; + } + + public void setAccount(String account){ + this.account = account; + } + + public void setCorpName(String corpName){ + this.corpName = corpName; + } + + public void setCid(String cid){ + this.cid = cid; + } + + public void setSynInvoiceUrl(String synInvoiceUrl){ + this.synInvoiceUrl = synInvoiceUrl; + } + + public void setSynBillingInfoUrl(String synBillingInfoUrl){ + this.synBillingInfoUrl = synBillingInfoUrl; + } + + public void setSynDocUrl(String synDocUrl){ + this.synDocUrl = synDocUrl; + } + + public void setSubIds(String subIds){ + this.subIds = subIds; + } + + public void setSubIdStatus(int subIdStatus){ + this.subIdStatus = subIdStatus; + } + + public void setJsUrl(String jsUrl){ + this.jsUrl = jsUrl; + } + + public void setCreateAppUrl(String createAppUrl){ + this.createAppUrl = createAppUrl; + } + + public void setAppName(String appName){ + this.appName = appName; + } + + public void setCheckUrl(String checkUrl){ + this.checkUrl = checkUrl; + } + + public void setJavaUrl(String javaUrl){ + this.javaUrl = javaUrl; + } + + public void setOaUrl(String oaUrl){ + this.oaUrl = oaUrl; + } + + public void setWebUrl(String webUrl){ + this.webUrl = webUrl; + } + + public void setAesKey(String aesKey){ + this.aesKey = aesKey; + } + + public int getId(){ + return this.id; + } + + public int getType(){ + return this.type; + } + + public String getInterfaceurl(){ + return this.interfaceurl; + } + + public int getStatus(){ + return this.status; + } + + public int getInterfaceType(){ + return this.interfaceType; + } + + public String getUserName(){ + return this.userName; + } + + public String getPassword(){ + return this.password; + } + + public String getLastmodify(){ + return this.lastmodify; + } + + public String getWeightPercent(){ + return this.weightPercent; + } + + public String getTokenurl(){ + return this.tokenurl; + } + + public String getOpenIDurl(){ + return this.openIDurl; + } + + public String getClientId(){ + return this.client_id; + } + + public String getClientSecret(){ + return this.client_secret; + } + + public String getSqm(){ + return this.sqm; + } + + public String getClient(){ + return this.Client; + } + + public String getGTAXID(){ + return this.GTAXID; + } + + public String getImageCatalog(){ + return this.imageCatalog; + } + + public int getNoNeedCheck(){ + return this.noNeedCheck; + } + + public String getNoNeedCheckAmount(){ + return this.noNeedCheckAmount; + } + + public String getAccount(){ + return this.account; + } + + public String getCorpName(){ + return this.corpName; + } + + public String getCid(){ + return this.cid; + } + + public String getSynInvoiceUrl(){ + return this.synInvoiceUrl; + } + + public String getSynBillingInfoUrl(){ + return this.synBillingInfoUrl; + } + + public String getSynDocUrl(){ + return this.synDocUrl; + } + + public String getSubIds(){ + return this.subIds; + } + + public int getSubIdStatus(){ + return this.subIdStatus; + } + + public String getJsUrl(){ + return this.jsUrl; + } + + public String getCreateAppUrl(){ + return this.createAppUrl; + } + + public String getAppName(){ + return this.appName; + } + + public String getCheckUrl(){ + return this.checkUrl; + } + + public String getJavaUrl(){ + return this.javaUrl; + } + + public String getOaUrl(){ + return this.oaUrl; + } + + public String getWebUrl(){ + return this.webUrl; + } + + public String getAesKey(){ + return this.aesKey; + } + + @Override + public String toString() { + return "FnainvoiceinterfaceDTO{" + + "id='" + id + '\'' + + ", type='" + type + '\'' + + ", interfaceurl='" + interfaceurl + '\'' + + ", status='" + status + '\'' + + ", interfaceType='" + interfaceType + '\'' + + ", userName='" + userName + '\'' + + ", password='" + password + '\'' + + ", lastmodify='" + lastmodify + '\'' + + ", weightPercent='" + weightPercent + '\'' + + ", tokenurl='" + tokenurl + '\'' + + ", openIDurl='" + openIDurl + '\'' + + ", client_id='" + client_id + '\'' + + ", client_secret='" + client_secret + '\'' + + ", sqm='" + sqm + '\'' + + ", Client='" + Client + '\'' + + ", GTAXID='" + GTAXID + '\'' + + ", imageCatalog='" + imageCatalog + '\'' + + ", noNeedCheck='" + noNeedCheck + '\'' + + ", noNeedCheckAmount='" + noNeedCheckAmount + '\'' + + ", account='" + account + '\'' + + ", corpName='" + corpName + '\'' + + ", cid='" + cid + '\'' + + ", synInvoiceUrl='" + synInvoiceUrl + '\'' + + ", synBillingInfoUrl='" + synBillingInfoUrl + '\'' + + ", synDocUrl='" + synDocUrl + '\'' + + ", subIds='" + subIds + '\'' + + ", subIdStatus='" + subIdStatus + '\'' + + ", jsUrl='" + jsUrl + '\'' + + ", createAppUrl='" + createAppUrl + '\'' + + ", appName='" + appName + '\'' + + ", checkUrl='" + checkUrl + '\'' + + ", javaUrl='" + javaUrl + '\'' + + ", oaUrl='" + oaUrl + '\'' + + ", webUrl='" + webUrl + '\'' + + ", aesKey='" + aesKey + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/aiyh/utils/entity/ListZipEntity.java b/aiyh/utils/entity/ListZipEntity.java new file mode 100644 index 0000000..d043cc7 --- /dev/null +++ b/aiyh/utils/entity/ListZipEntity.java @@ -0,0 +1,50 @@ +package aiyh.utils.entity; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/25 0025 17:29 + * 批量压缩 + */ + + +public class ListZipEntity { + private String directory; + private boolean isDirectory; + private List aInputStreamList; + private List fileList; + + { + this.isDirectory = false; + } + + public boolean isDirectory() { + return isDirectory; + } + + public String getDirectory() { + return directory; + } + + public void setDirectory(String directory) { + this.isDirectory = true; + this.directory = directory; + } + + public List getFileList() { + return fileList; + } + + public void setFileList(List fileList) { + this.fileList = fileList; + } + + public List getaInputStreamList() { + return aInputStreamList; + } + + public void setaInputStreamList(List aInputStreamList) { + this.aInputStreamList = aInputStreamList; + } +} diff --git a/aiyh/utils/entity/MultiLanguageDTO.java b/aiyh/utils/entity/MultiLanguageDTO.java new file mode 100644 index 0000000..465de58 --- /dev/null +++ b/aiyh/utils/entity/MultiLanguageDTO.java @@ -0,0 +1,73 @@ + +package aiyh.utils.entity; + + +public class MultiLanguageDTO { + + private int id; + private int mainid; + private String bswyz; + private String znCh; + private String enUs; + private String znHk; + + public void setId(int id){ + this.id = id; + } + + public void setMainid(int mainid){ + this.mainid = mainid; + } + + public void setBswyz(String bswyz){ + this.bswyz = bswyz; + } + + public void setZnCh(String znCh){ + this.znCh = znCh; + } + + public void setEnUs(String enUs){ + this.enUs = enUs; + } + + public void setZnHk(String znHk){ + this.znHk = znHk; + } + + public int getId(){ + return this.id; + } + + public int getMainid(){ + return this.mainid; + } + + public String getBswyz(){ + return this.bswyz; + } + + public String getZnCh(){ + return this.znCh; + } + + public String getEnUs(){ + return this.enUs; + } + + public String getZnHk(){ + return this.znHk; + } + + @Override + public String toString() { + return "MultiLanguageDTO{" + + "id='" + id + '\'' + + ", mainid='" + mainid + '\'' + + ", bswyz='" + bswyz + '\'' + + ", znCh='" + znCh + '\'' + + ", enUs='" + enUs + '\'' + + ", znHk='" + znHk + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/aiyh/utils/fileUtil/WatermarkPoint.java b/aiyh/utils/fileUtil/WatermarkPoint.java new file mode 100644 index 0000000..d4646b3 --- /dev/null +++ b/aiyh/utils/fileUtil/WatermarkPoint.java @@ -0,0 +1,44 @@ +package aiyh.utils.fileUtil; + +/** + * @author EBU7-dev1-ayh + * @date 2021/9/8 0008 14:02 + * watermark point + */ + + +public class WatermarkPoint { + private Integer X; + private Integer Y; + private WatermarkPointEnum location; + + public WatermarkPoint(Integer x, Integer y) { + this.X = x; + this.Y = y; + } + + public WatermarkPoint(WatermarkPointEnum location) { + this.location = location; + } + + public WatermarkPointEnum getLocation() { + return location; + } + + public Integer getX() { + return X; + } + + public Integer getY() { + return Y; + } + + @Override + public String toString() { + return "WatermarkPoint{" + + "X=" + X + + ", Y=" + Y + + ", location=" + location + + '}'; + } +} diff --git a/aiyh/utils/fileUtil/WatermarkPointEnum.java b/aiyh/utils/fileUtil/WatermarkPointEnum.java new file mode 100644 index 0000000..fa0c597 --- /dev/null +++ b/aiyh/utils/fileUtil/WatermarkPointEnum.java @@ -0,0 +1,30 @@ +package aiyh.utils.fileUtil; + +/** + * @author @author EBU7-dev1-ay + * @date 2021/9/8 0008 14:16 + * watermarkPointEnum + */ + +public enum WatermarkPointEnum { + /** + * 水印位置为中间 + */ + CENTER, + /** + * 水印位置为左上 + */ + LEFT_TOP, + /** + * 水印为值为左下 + */ + LEFT_BOTTOM, + /** + * 水印为值为右上 + */ + RIGHT_TOP, + /** + * 水印位置为右下 + */ + RIGHT_BOTTOM +} diff --git a/aiyh/utils/fileUtil/WritWatermark.java b/aiyh/utils/fileUtil/WritWatermark.java new file mode 100644 index 0000000..a7a2d94 --- /dev/null +++ b/aiyh/utils/fileUtil/WritWatermark.java @@ -0,0 +1,803 @@ +package aiyh.utils.fileUtil; + +import weaver.conn.RecordSet; +import weaver.file.FileUpload; +import weaver.file.ImageFileManager; +import weaver.general.Util; +import weaver.system.SystemComInfo; + +import javax.imageio.ImageIO; +import javax.swing.*; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.URLDecoder; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.UUID; + +/** + * @author EBU7-dev1-ayh + * @date 2021/9/2 0002 16:59 + * 水印图片封装 + */ + + +public class WritWatermark { + + /** + * 根据系统中物理文件的id添加水印 + * + * @param imageId 物理文件id + * @param pressText 水印文字 + * @param color 水印文字颜色 + * @param fontName 水印文字字体 PLAIN(普通) BOLD(粗体) ITALIC(斜体) + * @param fontStyle 水印文字样式 + * @param fontSize 水印文字大小 + * @param watermarkPoint 水印位置对象 + * @param degree 旋转角度 + * @param alpha 透明度 0-1 + * @param lineSpacing 行间距(倍数) + * @return 带水印的物理图片的ID + * @throws IOException io异常 + */ + public static int addTextWatermarkById(int imageId, String pressText, Color color, String fontName, int fontStyle + , int fontSize, WatermarkPoint watermarkPoint, double degree, float alpha, double lineSpacing) throws IOException { + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageId); + if(inputStreamById == null){ + throw new RuntimeException("Failed to obtain the image to which a watermark is to be added. " + + "Check whether the file exists in the system and ensure that the file is in the image format."); + } +// 将输入流读取为图片 + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + double lineHeight = fontSize * lineSpacing; + // 创建bufferedImage + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = bufferedImage.createGraphics(); + // 设置对线段的锯齿状边缘处理 + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(image, 0, 0, width, height, null); + Font font = new Font(fontName, fontStyle, fontSize); + graphics.setColor(color); + graphics.setFont(font); +// 设置旋转角度 + graphics.rotate(Math.toRadians(degree), (double) width / 2, (double) height / 2); +// 设置透明度 + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + String[] pressTexts = pressText.split("\n"); + String maxStr = ""; + int max = 0; +// 求出最大长度值 + for (String press : pressTexts) { + if (press.length() > max) { + max = press.length(); + maxStr = press; + } + } + int X; + int Y; + int fontWidth = graphics.getFontMetrics(graphics.getFont()).charsWidth(maxStr.toCharArray(), 0, max); + int fontsHeight = (int) Math.round(lineHeight) * pressTexts.length; + if (watermarkPoint.getLocation() == null) { + X = watermarkPoint.getX(); + Y = watermarkPoint.getY(); + } else { + // 水印放在中间 + if (watermarkPoint.getLocation().equals(WatermarkPointEnum.CENTER)) { + X = (width / 2) - (fontWidth / 2); + Y = (height / 2) - (fontsHeight / 2); + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.LEFT_TOP)) { + // 水印放在左上 + X = 10; + Y = 10; + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.LEFT_BOTTOM)) { + // 水印放在左下 + X = 10; + Y = height - fontsHeight - 10; + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.RIGHT_TOP)) { + // 水印放在右上 + X = width - fontWidth - 10; + Y = 10; + } else { + // 水印放在右下 + X = width - fontWidth - 10; + Y = height - fontsHeight - 10; + } + } + + for (int i = 0; i < pressTexts.length; i++) { +// 防止重叠,需要对Y进行特殊处理 + graphics.drawString(pressTexts[i], X, Y + ((int) Math.round(lineHeight) * (i + 1))); + } + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + graphics.dispose(); +// 获取图片后缀 + String query = "select imagefilename from imagefile where imagefileid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, imageId); + String suffix = "jpg"; + String imageFileName = ""; + if (rs.next()) { + imageFileName = Util.null2String(rs.getString(1)); + suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1); + } + String createDir = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; +// 防止高并发下文件名重复导致文件覆盖的问题 + String tempPath = createDir + imageFileName + System.currentTimeMillis() + UUID.randomUUID() + "." + suffix; + File file = new File(tempPath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } +// 输出到临时目录 + FileOutputStream outputStreamTem = new FileOutputStream(URLDecoder.decode(tempPath, "utf-8")); + ImageIO.write(bufferedImage, suffix, outputStreamTem); + outputStreamTem.close(); +// 保存生成的水印图片到压缩包 + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream(tempPath), imageFileName); +// 建议虚拟机进行一次垃圾回收,防止临时文件被其他文件流保存而无法删除临时文件 + System.gc(); +// 删除临时文件, 防止文件删除失败,设置一个自旋操作,加大文件删除的几率 + boolean deleteFlag = true; + int n = 0; + while (deleteFlag) { + try { + n++; + Files.delete(Paths.get(tempPath)); + deleteFlag = false; + } catch (Exception e) { +// 设置线程沉睡500毫秒,等待jvm进行垃圾回收,将持有临时文件的流对象回收,确保临时文件能删除 + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + return i; + } + if (n > 5) { + deleteFlag = false; + } + } + } + return i; + } + + + /** + * 通过物理问文件id添加图片水印 + * + * @param imageId 物理文件id + * @param picId 水印图片物理文件id + * @param watermarkPoint 水印位置对象 + * @param degree 旋转角度 + * @param alpha 透明度 0-1 + * @return 带水印的物理图片的ID + * @throws IOException io异常 + */ + public static int addPicWatermarkById(int imageId, int picId + , WatermarkPoint watermarkPoint, double degree, float alpha) throws IOException { + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageId); + if(inputStreamById == null){ + throw new RuntimeException("Failed to obtain the image to which a watermark is to be added. " + + "Check whether the file exists in the system and ensure that the file is in the image format."); + } +// 将输入流读取为图片 + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + // 创建bufferedImage + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = bufferedImage.createGraphics(); + // 设置对线段的锯齿状边缘处理 + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(image, 0, 0, width, height, null); +// 设置旋转角度 + graphics.rotate(Math.toRadians(degree), (double) width / 2, (double) height / 2); +// 设置透明度 + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); +// 获取水印图片 + InputStream inputStreamImgIcon = ImageFileManager.getInputStreamById(picId); + if(inputStreamImgIcon == null){ + throw new RuntimeException("The obtained watermark logo image is empty"); + } + Image logoImg = ImageIO.read(inputStreamImgIcon); + int logoWidth = logoImg.getWidth(null); + int logoHeight = logoImg.getHeight(null); + int X; + int Y; + if (watermarkPoint.getLocation() == null) { + X = watermarkPoint.getX(); + Y = watermarkPoint.getY(); + } else { + // 水印放在中间 + if (watermarkPoint.getLocation().equals(WatermarkPointEnum.CENTER)) { + X = (width / 2) - (logoWidth / 2); + Y = (height / 2) - (logoHeight / 2); + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.LEFT_TOP)) { + // 水印放在左上 + X = 10; + Y = 10; + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.LEFT_BOTTOM)) { + // 水印放在左下 + X = 10; + Y = height - logoHeight - 10; + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.RIGHT_TOP)) { + // 水印放在右上 + X = width - logoWidth - 10; + Y = 10; + } else { + // 水印放在右下 + X = width - logoWidth - 10; + Y = height - logoHeight - 10; + } + } + graphics.drawImage(logoImg, X, Y, null); + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + graphics.dispose(); +// 获取图片后缀 + String query = "select imagefilename from imagefile where imagefileid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, imageId); + String suffix = "jpg"; + String imageFileName = ""; + if (rs.next()) { + imageFileName = Util.null2String(rs.getString(1)); + suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1); + } + String createDir = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; +// 防止高并发下文件名重复导致文件覆盖的问题 + String tempPath = createDir + imageFileName + System.currentTimeMillis() + UUID.randomUUID() + "." + suffix; + File file = new File(tempPath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } +// 输出到临时目录 + FileOutputStream outputStreamTem = new FileOutputStream(URLDecoder.decode(tempPath, "utf-8")); + ImageIO.write(bufferedImage, suffix, outputStreamTem); + outputStreamTem.close(); +// 保存生成的水印图片到压缩包 + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream(tempPath), imageFileName); +// 建议虚拟机进行一次垃圾回收,防止临时文件被其他文件流保存而无法删除临时文件 + System.gc(); +// 删除临时文件, 防止文件删除失败,设置一个自旋操作,加大文件删除的几率 + boolean deleteFlag = true; + int n = 0; + while (deleteFlag) { + try { + n++; + Files.delete(Paths.get(tempPath)); + deleteFlag = false; + } catch (Exception e) { +// 设置线程沉睡500毫秒,等待jvm进行垃圾回收,将持有临时文件的流对象回收,确保临时文件能删除 + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + return i; + } + if (n > 5) { + deleteFlag = false; + } + } + } + return i; + } + + + /** + * 通过物理问文件id添加图片水印 + * + * @param imageId 水印图片物理文件id + * @param logoInput 水印图片的输入流 + * @param watermarkPoint 水印位置对象 + * @param degree 旋转角度 + * @param alpha 透明度 0-1 + * @return 带水印的物理图片的ID + * @throws IOException io异常 + */ + public static int addPicWatermarkById(int imageId, InputStream logoInput + , WatermarkPoint watermarkPoint, double degree, float alpha) throws IOException { + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageId); + if(inputStreamById == null){ + throw new RuntimeException("Failed to obtain the image to which a watermark is to be added. " + + "Check whether the file exists in the system and ensure that the file is in the image format."); + } +// 将输入流读取为图片 + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + // 创建bufferedImage + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = bufferedImage.createGraphics(); + // 设置对线段的锯齿状边缘处理 + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(image, 0, 0, width, height, null); +// 设置旋转角度 + graphics.rotate(Math.toRadians(degree), (double) width / 2, (double) height / 2); +// 设置透明度 + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + if(logoInput == null){ + throw new RuntimeException("The obtained watermark logo image is empty"); + } +// 获取水印图片 + ImageIcon logoImgIcon = new ImageIcon(ImageIO.read(logoInput)); + Image logoImg = logoImgIcon.getImage(); + int logoWidth = logoImg.getWidth(null); + int logoHeight = logoImg.getHeight(null); + int X; + int Y; + if (watermarkPoint.getLocation() == null) { + X = watermarkPoint.getX(); + Y = watermarkPoint.getY(); + } else { + // 水印放在中间 + if (watermarkPoint.getLocation().equals(WatermarkPointEnum.CENTER)) { + X = (width / 2) - (logoWidth / 2); + Y = (height / 2) - (logoHeight / 2); + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.LEFT_TOP)) { + // 水印放在左上 + X = 10; + Y = 10; + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.LEFT_BOTTOM)) { + // 水印放在左下 + X = 10; + Y = height - logoHeight - 10; + } else if (watermarkPoint.getLocation().equals(WatermarkPointEnum.RIGHT_TOP)) { + // 水印放在右上 + X = width - logoWidth - 10; + Y = 10; + } else { + // 水印放在右下 + X = width - logoWidth - 10; + Y = height - logoHeight - 10; + } + } + graphics.drawImage(logoImg, X, Y, null); + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + graphics.dispose(); +// 获取图片后缀 + String query = "select imagefilename from imagefile where imagefileid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, imageId); + String suffix = "jpg"; + String imageFileName = ""; + if (rs.next()) { + imageFileName = Util.null2String(rs.getString(1)); + suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1); + } + String createDir = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; +// 防止高并发下文件名重复导致文件覆盖的问题 + String tempPath = createDir + imageFileName + System.currentTimeMillis() + UUID.randomUUID() + "." + suffix; + File file = new File(tempPath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } +// 输出到临时目录 + FileOutputStream outputStreamTem = new FileOutputStream(URLDecoder.decode(tempPath, "utf-8")); + ImageIO.write(bufferedImage, suffix, outputStreamTem); + outputStreamTem.close(); +// 保存生成的水印图片到压缩包 + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream(tempPath), imageFileName); +// 建议虚拟机进行一次垃圾回收,防止临时文件被其他文件流保存而无法删除临时文件 + System.gc(); +// 删除临时文件, 防止文件删除失败,设置一个自旋操作,加大文件删除的几率 + boolean deleteFlag = true; + int n = 0; + while (deleteFlag) { + try { + n++; + Files.delete(Paths.get(tempPath)); + deleteFlag = false; + } catch (Exception e) { +// 设置线程沉睡500毫秒,等待jvm进行垃圾回收,将持有临时文件的流对象回收,确保临时文件能删除 + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + return i; + } + if (n > 5) { + deleteFlag = false; + } + } + } + return i; + } + + /** + * + * @param imageId 物理图片id + * @param pressText 水印文字 + * @param color 水印文字颜色 + * @param fontName 水印字体名字 + * @param fontStyle 水印字体样式 + * @param fontSize 水印字体大小 + * @param degree 水印旋转角度 + * @param alpha 水印透明度 + * @param lineSpacing 水印文字行间距(倍数) + * @param moveX 水印X轴偏移量 + * @param moveY 水印Y轴偏移量 + * @param randomX 水印X轴随机偏移量 + * @return 带水印的物理图片id + * @throws IOException io异常 + */ + public static int addTextTileWatermarkById(int imageId, String pressText, Color color, String fontName, int fontStyle + , int fontSize, double degree, float alpha, double lineSpacing, int moveX, int moveY, int randomX) throws IOException { + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageId); + if(inputStreamById == null){ + throw new RuntimeException("Failed to obtain the image to which a watermark is to be added. " + + "Check whether the file exists in the system and ensure that the file is in the image format."); + } +// 将输入流读取为图片 + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + double lineHeight = fontSize * lineSpacing; + // 创建bufferedImage + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = bufferedImage.createGraphics(); + // 设置对线段的锯齿状边缘处理 + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(image, 0, 0, width, height, null); + Font font = new Font(fontName, fontStyle, fontSize); + graphics.setColor(color); + graphics.setFont(font); +// 设置旋转角度 + graphics.rotate(Math.toRadians(degree), (double) width / 2, (double) height / 2); +// 设置透明度 + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + String[] pressTexts = pressText.split("\n"); + String maxStr = ""; + int max = 0; +// 求出最大长度值 + for (String press : pressTexts) { + if (press.length() > max) { + max = press.length(); + maxStr = press; + } + } + int X; + int Y; + int fontWidth = graphics.getFontMetrics(graphics.getFont()).charsWidth(maxStr.toCharArray(), 0, max); + int fontsHeight = (int) Math.round(lineHeight) * pressTexts.length; + int mustX = fontWidth; + int mustY = fontsHeight; + int start = - (width + height); + int end = width + height; + X = start; + Y = start; + int random = 0; + + // 循环Y,每次偏移防止重叠的最小偏移量加上自定义的偏移量 + for (; Y <= end; Y = Y + moveY + mustY ){ + // 循环X,每次偏移防止重叠的最小偏移量加上自定义偏移量 + for (; X <= end; X = X + moveX + mustX){ + for (int i = 0; i < pressTexts.length; i ++){ + // 防止重叠对Y做文字偏移 + graphics.drawString(pressTexts[i], X + random, Y + (int) Math.ceil(lineHeight) * (i + 1) ); + } + + } + X = start; + if(random == 0){ + random = - randomX; + }else { + random = 0; + } + } + + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + graphics.dispose(); +// 获取图片后缀 + String query = "select imagefilename from imagefile where imagefileid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, imageId); + String suffix = "jpg"; + String imageFileName = ""; + if (rs.next()) { + imageFileName = Util.null2String(rs.getString(1)); + suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1); + } + String createDir = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; +// 防止高并发下文件名重复导致文件覆盖的问题 + String tempPath = createDir + imageFileName + System.currentTimeMillis() + UUID.randomUUID() + "." + suffix; + File file = new File(tempPath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } +// 输出到临时目录 + FileOutputStream outputStreamTem = new FileOutputStream(URLDecoder.decode(tempPath, "utf-8")); + ImageIO.write(bufferedImage, suffix, outputStreamTem); + outputStreamTem.close(); +// 保存生成的水印图片到压缩包 + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream(tempPath), imageFileName); +// 建议虚拟机进行一次垃圾回收,防止临时文件被其他文件流保存而无法删除临时文件 + System.gc(); +// 删除临时文件, 防止文件删除失败,设置一个自旋操作,加大文件删除的几率 + boolean deleteFlag = true; + int n = 0; + while (deleteFlag) { + try { + n++; + Files.delete(Paths.get(tempPath)); + deleteFlag = false; + } catch (Exception e) { +// 设置线程沉睡500毫秒,等待jvm进行垃圾回收,将持有临时文件的流对象回收,确保临时文件能删除 + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + return i; + } + if (n > 5) { + deleteFlag = false; + } + } + } + return i; + } + + /** + * + * @param imageId 物理图片id + * @param picId 水印物理文件id + * @param degree 水印旋转角度 + * @param alpha 水印透明度 + * @param moveX 水印X轴偏移量 + * @param moveY 水印Y轴偏移量 + * @param randomX 水印X轴随机偏移量 + * @return 带水印的物理图片id + * @throws IOException io异常 + */ + public static int addPicTileWatermarkById(int imageId, int picId + , double degree, float alpha, int moveX, int moveY, int randomX) throws IOException { + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageId); + if(inputStreamById == null){ + throw new RuntimeException("Failed to obtain the image to which a watermark is to be added. " + + "Check whether the file exists in the system and ensure that the file is in the image format."); + } +// 将输入流读取为图片 + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + // 创建bufferedImage + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = bufferedImage.createGraphics(); + // 设置对线段的锯齿状边缘处理 + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(image, 0, 0, width, height, null); +// 设置旋转角度 + graphics.rotate(Math.toRadians(degree), (double) width / 2, (double) height / 2); +// 设置透明度 + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); +// 获取水印图片 + InputStream inputStreamImgIcon = ImageFileManager.getInputStreamById(picId); + if(inputStreamImgIcon == null){ + throw new RuntimeException("The obtained watermark logo image is empty"); + } + ImageIcon logoImgIcon = new ImageIcon(ImageIO.read(inputStreamImgIcon)); + Image logoImg = logoImgIcon.getImage(); + int logoWidth = logoImg.getWidth(null); + int logoHeight = logoImg.getHeight(null); + int X; + int Y; + int mustX = logoWidth; + int mustY = logoHeight; + int start = - (width + height); + int end = width + height; + X = start; + Y = start; + int random = 0; + + // 循环Y,每次偏移防止重叠的最小偏移量加上自定义的偏移量 + for (; Y <= end; Y = Y + moveY + mustY ){ + // 循环X,每次偏移防止重叠的最小偏移量加上自定义偏移量 + for (; X <= end; X = X + moveX + mustX){ + graphics.drawImage(logoImg, X + random, Y, null); + } + X = start; + if(random == 0){ + random = - randomX; + }else { + random = 0; + } + } + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + graphics.dispose(); +// 获取图片后缀 + String query = "select imagefilename from imagefile where imagefileid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, imageId); + String suffix = "jpg"; + String imageFileName = ""; + if (rs.next()) { + imageFileName = Util.null2String(rs.getString(1)); + suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1); + } + String createDir = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; +// 防止高并发下文件名重复导致文件覆盖的问题 + String tempPath = createDir + imageFileName + System.currentTimeMillis() + UUID.randomUUID() + "." + suffix; + File file = new File(tempPath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } +// 输出到临时目录 + FileOutputStream outputStreamTem = new FileOutputStream(URLDecoder.decode(tempPath, "utf-8")); + ImageIO.write(bufferedImage, suffix, outputStreamTem); + outputStreamTem.close(); +// 保存生成的水印图片到压缩包 + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream(tempPath), imageFileName); +// 建议虚拟机进行一次垃圾回收,防止临时文件被其他文件流保存而无法删除临时文件 + System.gc(); +// 删除临时文件, 防止文件删除失败,设置一个自旋操作,加大文件删除的几率 + boolean deleteFlag = true; + int n = 0; + while (deleteFlag) { + try { + n++; + Files.delete(Paths.get(tempPath)); + deleteFlag = false; + } catch (Exception e) { +// 设置线程沉睡500毫秒,等待jvm进行垃圾回收,将持有临时文件的流对象回收,确保临时文件能删除 + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + return i; + } + if (n > 5) { + deleteFlag = false; + } + } + } + return i; + } + + + /** + * + * @param imageId 物理图片id + * @param logoInput 水印图片输入流 + * @param degree 水印旋转角度 + * @param alpha 水印透明度 + * @param moveX 水印X轴偏移位置 + * @param moveY 水印Y轴偏移位置 + * @param randomX 水印X轴随机偏移量 + * @return 带水印的物理图片id + * @throws IOException io异常 + */ + public static int addPicTileWatermarkById(int imageId, InputStream logoInput + , double degree, float alpha, int moveX, int moveY, int randomX) throws IOException { + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageId); + if(inputStreamById == null){ + throw new RuntimeException("Failed to obtain the image to which a watermark is to be added. " + + "Check whether the file exists in the system and ensure that the file is in the image format."); + } +// 将输入流读取为图片 + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + // 创建bufferedImage + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics2D graphics = bufferedImage.createGraphics(); + // 设置对线段的锯齿状边缘处理 + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(image, 0, 0, width, height, null); +// 设置旋转角度 + graphics.rotate(Math.toRadians(degree), (double) width / 2, (double) height / 2); +// 设置透明度 + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, alpha)); + if(logoInput == null){ + throw new RuntimeException("The obtained watermark logo image is empty"); + } +// 获取水印图片 + ImageIcon logoImgIcon = new ImageIcon(ImageIO.read(logoInput)); + Image logoImg = logoImgIcon.getImage(); + int logoWidth = logoImg.getWidth(null); + int logoHeight = logoImg.getHeight(null); + int X; + int Y; + int mustX = logoWidth; + int mustY = logoHeight; + int start = - (width + height); + int end = width + height; + X = start; + Y = start; + int random = 0; + + // 循环Y,每次偏移防止重叠的最小偏移量加上自定义的偏移量 + for (; Y <= end; Y = Y + moveY + mustY ){ + // 循环X,每次偏移防止重叠的最小偏移量加上自定义偏移量 + for (; X <= end; X = X + moveX + mustX){ + graphics.drawImage(logoImg, X + random, Y, null); + } + X = start; + if(random == 0){ + random = - randomX; + }else { + random = 0; + } + } + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + graphics.dispose(); +// 获取图片后缀 + String query = "select imagefilename from imagefile where imagefileid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, imageId); + String suffix = "jpg"; + String imageFileName = ""; + if (rs.next()) { + imageFileName = Util.null2String(rs.getString(1)); + suffix = imageFileName.substring(imageFileName.lastIndexOf(".") + 1); + } + String createDir = FileUpload.getCreateDir(new SystemComInfo().getFilesystem()) + "tempfile" + File.separator; +// 防止高并发下文件名重复导致文件覆盖的问题 + String tempPath = createDir + imageFileName + System.currentTimeMillis() + UUID.randomUUID() + "." + suffix; + File file = new File(tempPath); + if (!file.getParentFile().exists()) { + file.getParentFile().mkdirs(); + } + if (!file.exists()) { + file.createNewFile(); + } +// 输出到临时目录 + FileOutputStream outputStreamTem = new FileOutputStream(URLDecoder.decode(tempPath, "utf-8")); + ImageIO.write(bufferedImage, suffix, outputStreamTem); + outputStreamTem.close(); +// 保存生成的水印图片到压缩包 + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream(tempPath), imageFileName); +// 建议虚拟机进行一次垃圾回收,防止临时文件被其他文件流保存而无法删除临时文件 + System.gc(); +// 删除临时文件, 防止文件删除失败,设置一个自旋操作,加大文件删除的几率 + boolean deleteFlag = true; + int n = 0; + while (deleteFlag) { + try { + n++; + Files.delete(Paths.get(tempPath)); + deleteFlag = false; + } catch (Exception e) { +// 设置线程沉睡500毫秒,等待jvm进行垃圾回收,将持有临时文件的流对象回收,确保临时文件能删除 + try { + Thread.sleep(500); + } catch (InterruptedException interruptedException) { + return i; + } + if (n > 5) { + deleteFlag = false; + } + } + } + return i; + } + + +} diff --git a/aiyh/utils/function/FindChildren.java b/aiyh/utils/function/FindChildren.java new file mode 100644 index 0000000..f6edef7 --- /dev/null +++ b/aiyh/utils/function/FindChildren.java @@ -0,0 +1,12 @@ +package aiyh.utils.function; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/12 0012 14:17 + * 获取顶级父类 + */ + +@FunctionalInterface +public interface FindChildren { + boolean findChildren(T t,T t1); +} diff --git a/aiyh/utils/function/VerifyParent.java b/aiyh/utils/function/VerifyParent.java new file mode 100644 index 0000000..db5c1a4 --- /dev/null +++ b/aiyh/utils/function/VerifyParent.java @@ -0,0 +1,12 @@ +package aiyh.utils.function; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/12 0012 14:17 + * 获取顶级父类 + */ + +@FunctionalInterface +public interface VerifyParent { + boolean verifyParent(T t); +} diff --git a/aiyh/utils/httpUtil/ExtendedIOUtils.java b/aiyh/utils/httpUtil/ExtendedIOUtils.java new file mode 100644 index 0000000..2968ead --- /dev/null +++ b/aiyh/utils/httpUtil/ExtendedIOUtils.java @@ -0,0 +1,39 @@ +package aiyh.utils.httpUtil; + +import java.io.Closeable; +import java.io.Flushable; +import java.io.IOException; + +/** + * IO流拓展工具类,补充IOUtils新版本中废弃的closeQuietly + * + * @author EBU7-dev1-ayh + * @since 2021/08/30 17:56 + */ +public class ExtendedIOUtils { + + public static void flush(Flushable... resources) throws IOException { + int length = resources.length; + for (int i = 0; i < length; ++i) { + Flushable resource = resources[i]; + if (resource != null) { + resource.flush(); + } + } + } + + public static void closeQuietly(Closeable... resources) { + int length = resources.length; + for (int i = 0; i < length; ++i) { + Closeable resource = resources[i]; + if (resource != null) { + try { + resource.close(); + } catch (IOException e) { + //ignore exception + } + } + } + } + +} diff --git a/aiyh/utils/httpUtil/HttpArgsType.java b/aiyh/utils/httpUtil/HttpArgsType.java new file mode 100644 index 0000000..0ddfb2f --- /dev/null +++ b/aiyh/utils/httpUtil/HttpArgsType.java @@ -0,0 +1,26 @@ +package aiyh.utils.httpUtil; + +/** + * @author @author EBU7-dev1-ay + * @date 2021/9/1 0001 10:52 + * httpposttype + */ + +public class HttpArgsType { + /** + * put请求 + */ + public static final String HTTP_POST_PUT = "PUT"; + /** + * post请求 + */ + public static final String HTTP_POST_POST = "POST"; + + public static final String HTTP_HTTPS = "https"; + + public static final String HTTP_HTTP = "http"; + + public static final String DEFAULT_CONTENT_TYPE = "application/x-www-form-urlencoded;charset=utf-8"; + public static final String X_WWW_FORM_URLENCODED = "application/x-www-form-urlencoded"; + public static final String APPLICATION_JSON = "application/json;charset=utf-8"; +} diff --git a/aiyh/utils/httpUtil/HttpManager.java b/aiyh/utils/httpUtil/HttpManager.java new file mode 100644 index 0000000..f524875 --- /dev/null +++ b/aiyh/utils/httpUtil/HttpManager.java @@ -0,0 +1,87 @@ +package aiyh.utils.httpUtil; + +import org.apache.http.client.config.RequestConfig; +import org.apache.http.conn.ssl.NoopHostnameVerifier; +import org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; +import org.apache.http.ssl.SSLContextBuilder; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; + + +/** + * @author EBU7-dev1-ayh + * @since 2021/08/30 17:56 + **/ +public class HttpManager { + + /** + * 创建连接池管理对象 + */ + + + private static final int CONNECT_TIMEOUT = 30000; + private static final int CONNECTION_REQUEST_TIMEOUT = 10000; + private static final int SOCKET_TIMEOUT = 30000; + private static final int MAX_TOTAL = 500; + private static final int MAX_PRE_ROUTE = 500; + + /** + * 设置请求配置 + */ + static RequestConfig requestConfig = RequestConfig.custom() + //网络请求的超时时间 + .setConnectTimeout(CONNECT_TIMEOUT) + //连接池去获取连接的超时时间 + .setConnectionRequestTimeout(CONNECTION_REQUEST_TIMEOUT) + //设置socket超时时间 + .setSocketTimeout(SOCKET_TIMEOUT) + .build(); + static PoolingHttpClientConnectionManager manager = new PoolingHttpClientConnectionManager(); + static { + // 配置最大的连接数 + manager.setMaxTotal(MAX_TOTAL); + // 每个路由最大连接数(路由是根据host来管理的,大小不好控制) + manager.setDefaultMaxPerRoute(MAX_PRE_ROUTE); + } + + /** + * 获取连接对象 从连接池里面去获取,根据url创建对应的对象,http / https + * @param url 请求地址 + * @return 连接对象 + */ + public static CloseableHttpClient getHttpConnection(String url){ + if(url.trim().toUpperCase().startsWith(HttpArgsType.HTTP_HTTPS.toUpperCase())){ + SSLContext sslContext; + SSLConnectionSocketFactory sslsf = null; + try { + sslContext = new SSLContextBuilder().loadTrustMaterial(null, (x509Certificates, s) -> { +// 绕过所有验证 + return true; + }).build(); + HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE; + sslsf = new SSLConnectionSocketFactory(sslContext,hostnameVerifier); + } catch (NoSuchAlgorithmException | KeyStoreException | KeyManagementException e) { + e.printStackTrace(); + } + return HttpClients.custom() + .setSSLSocketFactory(sslsf) + .setConnectionManager(manager) + .setConnectionManagerShared(true) + .setDefaultRequestConfig(requestConfig) + .build(); + }else{ + return HttpClients.custom() + .setConnectionManager(manager) + .setDefaultRequestConfig(requestConfig) + .setConnectionManagerShared(true) + .build(); + } + } +} diff --git a/aiyh/utils/httpUtil/ResponeVo.java b/aiyh/utils/httpUtil/ResponeVo.java new file mode 100644 index 0000000..6ea192a --- /dev/null +++ b/aiyh/utils/httpUtil/ResponeVo.java @@ -0,0 +1,110 @@ +package aiyh.utils.httpUtil; + + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.annotation.JSONField; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.apache.http.Header; + +import java.util.Arrays; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/31 0031 17:16 + * http请求相应 + */ + +public class ResponeVo { + /** + * 相应状态码 + */ + int code; + /** + * 相应内容 + */ + String entityString; + /** + * 相应头信息 + */ + @JSONField(serialize = false) + Header[] allHeaders; + Locale locale; + + public int getCode() { + return code; + } + + /** + * 根据相应结果转化为map集合 + * @return 资源皇后的map集合 + * @throws JsonProcessingException JSON转换异常 + */ + public Map getEntityMap() throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + return mapper.readValue(this.getEntityString(), Map.class); + } + + /** + * 根据相应结果,转化为实体类 + * @param clazz 需要映射的实体类 + * @param 需要转换实体类的泛型 + * @return 转换后的实体类 + * @throws JsonProcessingException JSON转换异常 + */ + public T getEntity(Class clazz) throws JsonProcessingException { + ObjectMapper mapper = new ObjectMapper(); + return mapper.readValue(this.getEntityString(), clazz); + } + + /** + * 根据相应结果转化为实体集合 + * @param clazz 需要映射的实体类 + * @param 需要转换的实体类的泛型 + * @return 转换后的实体类的集合 + */ + public List getEntityArray(Class clazz) { + return JSON.parseArray(this.getEntityString(), clazz); + } + + public Locale getLocale() { + return locale; + } + + public void setLocale(Locale locale) { + this.locale = locale; + } + + public void setCode(int code) { + this.code = code; + } + + public Header[] getAllHeaders() { + return allHeaders; + } + + public void setAllHeaders(Header[] allHeaders) { + this.allHeaders = allHeaders; + } + + public String getEntityString() { + return entityString; + } + + public void setEntityString(String entityString) { + this.entityString = entityString; + } + + @Override + public String toString() { + return "ResponeVo{" + + "code=" + code + + ", entityString='" + entityString + '\'' + + ", locale=" + locale + + '}'; + } +} + diff --git a/aiyh/utils/httpUtil/httpAsync/HttpAsyncThread.java b/aiyh/utils/httpUtil/httpAsync/HttpAsyncThread.java new file mode 100644 index 0000000..1e875c9 --- /dev/null +++ b/aiyh/utils/httpUtil/httpAsync/HttpAsyncThread.java @@ -0,0 +1,54 @@ +package aiyh.utils.httpUtil.httpAsync; + +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.util.EntityUtils; +import aiyh.utils.httpUtil.ExtendedIOUtils; +import aiyh.utils.httpUtil.ResponeVo; + +import java.util.Locale; +import java.util.concurrent.Callable; + +/** + * @author EBU7-dev1-ayh + * @date 2021/9/2 0002 22:55 + * async + */ + + +public class HttpAsyncThread implements Callable { + + private final CloseableHttpClient httpClient; + private final HttpUriRequest request; + private String DEFAULT_ENCODING = "UTF-8"; + + public HttpAsyncThread(CloseableHttpClient httpClient, HttpUriRequest request, String DEFAULT_ENCODING) { + this.httpClient = httpClient; + this.request = request; + this.DEFAULT_ENCODING = DEFAULT_ENCODING; + } + + @Override + public ResponeVo call() throws Exception { + ResponeVo responeVo = new ResponeVo(); + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); + HttpEntity entity = response.getEntity(); + Header[] allHeaders = response.getAllHeaders(); + Locale locale = response.getLocale(); + responeVo.setLocale(locale); + responeVo.setAllHeaders(allHeaders); + responeVo.setEntityString(EntityUtils.toString(entity, DEFAULT_ENCODING)); + responeVo.setCode(response.getStatusLine().getStatusCode()); + } catch (Exception e) { + throw e; + } + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + return responeVo; + } +} diff --git a/aiyh/utils/httpUtil/httpAsync/HttpAsyncThreadCallBack.java b/aiyh/utils/httpUtil/httpAsync/HttpAsyncThreadCallBack.java new file mode 100644 index 0000000..aa6ebee --- /dev/null +++ b/aiyh/utils/httpUtil/httpAsync/HttpAsyncThreadCallBack.java @@ -0,0 +1,40 @@ +package aiyh.utils.httpUtil.httpAsync; + +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.impl.client.CloseableHttpClient; +import aiyh.utils.httpUtil.ExtendedIOUtils; + +import java.util.function.Consumer; + +/** + * @author EBU7-dev1-ayh + * @date 2021/9/2 0002 23:18 + * callback + */ + + +public class HttpAsyncThreadCallBack implements Runnable{ + private final CloseableHttpClient httpClient; + private final HttpUriRequest request; + private final Consumer consumer; + + public HttpAsyncThreadCallBack(CloseableHttpClient httpClient, HttpUriRequest request, Consumer consumer){ + this.httpClient = httpClient; + this.request = request; + this.consumer = consumer; + } + + @Override + public void run() { + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); + consumer.accept(response); + } catch (Exception e) { + consumer.accept(null); + } + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + } +} diff --git a/aiyh/utils/httpUtil/staticUtil/GlobalStaticCache.java b/aiyh/utils/httpUtil/staticUtil/GlobalStaticCache.java new file mode 100644 index 0000000..3160924 --- /dev/null +++ b/aiyh/utils/httpUtil/staticUtil/GlobalStaticCache.java @@ -0,0 +1,24 @@ +package aiyh.utils.httpUtil.staticUtil; + + +import java.util.HashMap; +import java.util.Map; + +/** +* @author EBU7-dev1-ayh +* @since 2021/08/30 17:56 +*/ +public class GlobalStaticCache { + + /** + * 全局请求头 + */ + public static Map header = new HashMap<>(); + + + /** + * 依赖参数容器 + */ + public static Map paramMap = new HashMap<>(); + +} diff --git a/aiyh/utils/httpUtil/staticUtil/HttpStaticUtils.java b/aiyh/utils/httpUtil/staticUtil/HttpStaticUtils.java new file mode 100644 index 0000000..0728fcd --- /dev/null +++ b/aiyh/utils/httpUtil/staticUtil/HttpStaticUtils.java @@ -0,0 +1,836 @@ +package aiyh.utils.httpUtil.staticUtil; + +import aiyh.utils.httpUtil.util.CloseThread; +import com.alibaba.fastjson.JSON; +import com.google.common.base.Strings; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.StringBody; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import aiyh.utils.httpUtil.ExtendedIOUtils; +import aiyh.utils.httpUtil.HttpArgsType; +import aiyh.utils.httpUtil.HttpManager; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.httpAsync.HttpAsyncThread; +import aiyh.utils.httpUtil.httpAsync.HttpAsyncThreadCallBack; +import aiyh.utils.zwl.common.ToolUtil; +import weaver.file.ImageFileManager; + +import java.io.*; +import java.util.*; +import java.util.concurrent.*; +import java.util.function.Consumer; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/31 0031 17:16 + * http请求工具 + */ + + +public class HttpStaticUtils { + // 默认编码 + public static String DEFAULT_ENCODING = "UTF-8"; + + private static final ToolUtil toolUtil = new ToolUtil(); + + // 线程池 + public static final ThreadPoolExecutor executorService; + static { + // private final ExecutorService executorService = Executors.newFixedThreadPool(3); + ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder(); + ThreadFactory threadFactory = threadFactoryBuilder.setNameFormat("xxx-pool-%d").build(); + executorService = new ThreadPoolExecutor(5, 200, 0L, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(1024), + threadFactory, + new ThreadPoolExecutor.AbortPolicy()); + } + + + public static HttpPost getHttpPost(String url) { + HttpPost httpPost = new HttpPost(url); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(10000) + .setConnectionRequestTimeout(10000) + .setRedirectsEnabled(true) + .build(); + httpPost.setConfig(requestConfig); + return httpPost; + } + + public static HttpGet getHttpGet(String url) { + HttpGet httpGet = new HttpGet(url); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(10000) + .setConnectionRequestTimeout(10000) + .setRedirectsEnabled(true) + .build(); + httpGet.setConfig(requestConfig); + return httpGet; + } + + /** + * get请求 + * @param url 请求地址 + * @return 请求结果 + * @throws IOException io异常 + */ + public static ResponeVo apiGet(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpGet); + } + + + /** + * delete请求 + * @param url 请求地址 + * @return 请求结果 + * @throws IOException io异常 + */ + public static ResponeVo apiDelete(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpDelete); + } + + /** + * get请求 + * @param url 请求地址 + * @param headers 请求头 + * @return 响应结果封装 + * @throws IOException io异常 + */ + public static ResponeVo apiGet(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpGet); + } + + /** + * delete请求 + * @param url 请求地址 + * @param headers 请求头 + * @return 请求结果 + * @throws IOException io异常 + */ + public static ResponeVo apiDelete(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpDelete); + } + + public static ResponeVo apiGet(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpGet); + } + + public static ResponeVo apiDelete(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpDelete); + } + + /** + * 回调方法 + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void apiGet(String url, Map params, Map headers, Consumer consumer) throws IOException { + + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + System.out.println(getUrl); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + callBackRequest(httpConnection, httpGet, consumer); + } + + /** + * 回调方法 + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void apiDelete(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + callBackRequest(httpConnection, httpDelete, consumer); + } + + /** + * post请求 + * @param url 请求地址 + * @param params 请求参数 + * @return 请求结果 + * @throws IOException io异常 + */ + public static ResponeVo apiPost(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPost); + } + + public static ResponeVo apiPut(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPut); + } + + + /** + * post请求 + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头 + * @return 请求结果 + * @throws IOException io异常 + */ + public static ResponeVo apiPost(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPost); + } + + public static ResponeVo apiPut(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPut); + } + + public static ResponeVo apiUploadFile(String url,InputStream inputStream, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = uploadFileByInputStream(url,inputStream, fileKey,fileName, paramsMap, headerMap); + return baseRequest(httpConnection, httpPost); + } + + public static ResponeVo apiUploadFile(String url,File file, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = uploadFileByInputStream(url,file, fileKey,fileName, paramsMap, headerMap); + return baseRequest(httpConnection, httpPost); + } + + public static ResponeVo apiUploadFileById(String url,int id, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + InputStream inputStream = ImageFileManager.getInputStreamById(id); + HttpPost httpPost = uploadFileByInputStream(url,inputStream, fileKey,fileName, paramsMap, headerMap); + return baseRequest(httpConnection, httpPost); + } + + public static HttpPost uploadFileByInputStream(String url,InputStream inputStream, String fileKey,String fileName, + Map params, Map headers){ + MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + builder.addBinaryBody(fileKey,inputStream, ContentType.MULTIPART_FORM_DATA,fileName); + for (Map.Entry param : params.entrySet()){ + StringBody stringBody = new StringBody(param.getValue(),ContentType.MULTIPART_FORM_DATA); + builder.addPart(param.getKey(),stringBody); + } + HttpPost httpPost = new HttpPost(url.trim()); + + for (Map.Entry entry : headers.entrySet()) { + if("Content-Type".equalsIgnoreCase(entry.getKey())){ + continue; + } + httpPost.setHeader(entry.getKey(), entry.getValue()); + } + httpPost.setHeader("Content-Type", "multipart/form-data"); + HttpEntity entity = builder.build(); + httpPost.setEntity(entity); + return httpPost; + } + + public static HttpPost uploadFileByInputStream(String url,File file, String fileKey,String fileName, + Map params, Map headers){ + MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + builder.addBinaryBody(fileKey,file, ContentType.MULTIPART_FORM_DATA,fileName); + for (Map.Entry param : params.entrySet()){ + StringBody stringBody = new StringBody(param.getValue(),ContentType.MULTIPART_FORM_DATA); + builder.addPart(param.getKey(),stringBody); + } + HttpPost httpPost = new HttpPost(url.trim()); + + for (Map.Entry entry : headers.entrySet()) { + if("Content-Type".equalsIgnoreCase(entry.getKey())){ + continue; + } + httpPost.setHeader(entry.getKey(), entry.getValue()); + } + httpPost.setHeader("Content-Type", "multipart/form-data"); + HttpEntity entity = builder.build(); + httpPost.setEntity(entity); + return httpPost; + } + + + /** + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void apiPost(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + callBackRequest(httpConnection, httpPost, consumer); + } + + /** + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void apiPut(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + callBackRequest(httpConnection, httpPut, consumer); + } + + /** + * 回调请求方法 + * @param httpClient httpclient对象 + * @param request 请求对象 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + private static void callBackRequest(CloseableHttpClient httpClient, HttpUriRequest request, Consumer consumer) throws IOException { + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); + consumer.accept(response); + } catch (Exception e) { + toolUtil.writeErrorLog(" http调用失败:" + e); + throw e; + } +// new CloseThread(httpClient,response).run(); + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + } + + + /** + * 请求封装 + * @param httpClient httpclient对象 + * @param request 请求对象 + * @return 第三方请求结果 + * @throws IOException io异常 + */ + public static ResponeVo baseRequest(CloseableHttpClient httpClient, HttpUriRequest request) throws IOException { + ResponeVo responeVo = new ResponeVo(); + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); + HttpEntity entity = response.getEntity(); + Header[] allHeaders = response.getAllHeaders(); + Locale locale = response.getLocale(); + responeVo.setLocale(locale); + responeVo.setAllHeaders(allHeaders); + responeVo.setEntityString(EntityUtils.toString(entity, DEFAULT_ENCODING)); + responeVo.setCode(response.getStatusLine().getStatusCode()); + } catch (Exception e) { + toolUtil.writeErrorLog(" http调用失败:" + e); + throw e; + } +// new CloseThread(httpClient,response).run(); + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + return responeVo; + } + + /** + * 异步get请求 + * + * @param url 请求地址 + * @return 请求结果 Future类 + * @throws IOException io异常 + */ + public static Future asyncApiGet(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpGet, DEFAULT_ENCODING)); + } + + public static Future asyncApiUploadFile(String url,InputStream inputStream, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = uploadFileByInputStream(url,inputStream, fileKey,fileName, paramsMap, headerMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + public static Future asyncApiUploadFile(String url,File file, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = uploadFileByInputStream(url,file, fileKey,fileName, paramsMap, headerMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + public static Future asyncApiUploadFileById(String url,int id, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + InputStream inputStream = ImageFileManager.getInputStreamById(id); + HttpPost httpPost = uploadFileByInputStream(url,inputStream, fileKey,fileName, paramsMap, headerMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + + /** + * 异步delete请求 + * + * @param url 请求地址 + * @return 请求结果Future类 + * @throws IOException io异常 + */ + public static Future asyncApiDelete(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpDelete, DEFAULT_ENCODING)); + } + + /** + * 异步get请求 + * + * @param url 请求地址 + * @param headers 请求头 + * @return 请求结果 + * @throws IOException io异常 + */ + public static Future asyncApiGet(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpGet, DEFAULT_ENCODING)); + } + + public static Future asyncApiDelete(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpDelete, DEFAULT_ENCODING)); + } + + public static Future asyncApiGet(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpGet, DEFAULT_ENCODING)); + } + + public static Future asyncApiDelete(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpDelete, DEFAULT_ENCODING)); + } + + /** + * 回调方法 + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void asyncApiGet(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpGet, consumer)); + } + + /** + * 回调方法 + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void asyncApiDelete(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpDelete, consumer)); + } + + public static Future asyncApiPost(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + public static Future asyncApiPut(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPut, DEFAULT_ENCODING)); + } + + + public static Future asyncApiPost(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + public static Future asyncApiPut(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPut, DEFAULT_ENCODING)); + } + + /** + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void asyncApiPost(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpPost, consumer)); + } + + /** + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public static void asyncApiPut(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpPut, consumer)); + } + + + /** + * 处理post请求参数等,根据请求头设置参数类型 + * @param url 请求地址 + * @param headerMap 请求头 + * @param paramsMap 请求参数 + * @return 请求结果 + * @throws UnsupportedEncodingException 编码转换异常 + */ + private static HttpPost handleHttpPost(String url, Map headerMap, Map paramsMap) throws UnsupportedEncodingException { + String contentType = ""; + HttpPost httpPost = new HttpPost(url.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpPost.setHeader(entry.getKey(), entry.getValue()); + if ("Content-Type".equalsIgnoreCase(entry.getKey())) { + contentType = entry.getValue(); + } + } + if (Strings.isNullOrEmpty(contentType)) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + httpPost.setHeader("Content-Type", HttpArgsType.DEFAULT_CONTENT_TYPE); + httpPost.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.X_WWW_FORM_URLENCODED.toUpperCase())) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + httpPost.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.APPLICATION_JSON.toUpperCase())) { + StringEntity stringEntity = new StringEntity(JSON.toJSONString(paramsMap)); + httpPost.setEntity(stringEntity); + } + return httpPost; + } + + private static HttpPut handleHttpPut(String url, Map headerMap, Map paramsMap) throws UnsupportedEncodingException { + String contentType = ""; + HttpPut httpPut = new HttpPut(url.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpPut.setHeader(entry.getKey(), entry.getValue()); + if ("Content-Type".equalsIgnoreCase(entry.getKey())) { + contentType = entry.getValue(); + } + } + if (Strings.isNullOrEmpty(contentType)) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + httpPut.setHeader("Content-Type", HttpArgsType.DEFAULT_CONTENT_TYPE); + httpPut.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.X_WWW_FORM_URLENCODED.toUpperCase())) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + httpPut.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.APPLICATION_JSON.toUpperCase())) { + StringEntity stringEntity = new StringEntity(JSON.toJSONString(paramsMap)); + httpPut.setEntity(stringEntity); + } + return httpPut; + } + + private static String inputStreamToString(InputStream is) { + String line = ""; + StringBuilder total = new StringBuilder(); + BufferedReader rd = new BufferedReader(new InputStreamReader(is)); + try { + while ((line = rd.readLine()) != null) { + total.append(line); + } + } catch (IOException e) { + toolUtil.writeErrorLog(e.getLocalizedMessage() + "\n" + e); + } + return total.toString(); + } + + /** + * 请求头处理,添加全局请求头 + * @param headers 请求头 + * @return 处理后的请求头 + */ + public static Map headersHandle(Map headers) { + Map map = new HashMap<>(); + if (headers != null && headers.size() > 0) { + if (GlobalStaticCache.header != null && GlobalStaticCache.header.size() > 0) { + map.putAll(GlobalStaticCache.header); + } + map.putAll(headers); + } else { + map.putAll(GlobalStaticCache.header); + } + return map; + } + + /** + * 请求参数处理。添加全局请求参数 + * @param params 请求参数 + * @return 处理后的请求参数 + */ + public static Map paramsHandle(Map params) { + Map map = new HashMap<>(); + if (params != null && params.size() > 0) { + if (GlobalStaticCache.paramMap != null && GlobalStaticCache.paramMap.size() > 0) { + map.putAll(GlobalStaticCache.paramMap); + } + map.putAll(params); + } else { + map.putAll(GlobalStaticCache.paramMap); + } + return map; + } + + /** + * url地址处理,get请求地址序列化 + * @param url 请求地址 + * @param params 请求参数 + * @return 处理后的url + */ + public static String urlHandle(String url, Map params) { + if(params == null || params.size() <= 0){ + return url; + } + String serializeParams = serializeParams(params); + String getUrl; + if (!url.contains("?")) { + if (url.endsWith("/")) { + getUrl = url.substring(0, url.length() - 1) + "?" + serializeParams; + } else { + getUrl = url + "?" + serializeParams; + } + } else { + if (url.endsWith("?")) { + getUrl = url + serializeParams; + } else { + getUrl = url + "&" + serializeParams; + } + } + return getUrl; + } + + /** + * 请求参数序列化 + * @param params 请求参数 + * @return 处理后的参数 + */ + private static String serializeParams(Map params) { + if (params != null && params.size() > 0) { + StringBuilder builder = new StringBuilder(); + for (Map.Entry entry : params.entrySet()) { + builder.append("&"); + builder.append(entry.getKey()); + builder.append("="); + builder.append(entry.getValue()); + } + return removeSeparator(builder); + } + return ""; + } + + private static String removeSeparator(StringBuilder sqlBuilder) { + String str = sqlBuilder.toString().trim(); + String removeSeparator = "&"; + if (str.endsWith(removeSeparator)) { +// 如果以分&号结尾,则去除&号 + str = str.substring(0, str.length() - 1); + } + if (str.trim().startsWith(removeSeparator)) { +// 如果以&开头,则去除& + str = str.substring(1); + } + return str; + } +} diff --git a/aiyh/utils/httpUtil/util/CloseThread.java b/aiyh/utils/httpUtil/util/CloseThread.java new file mode 100644 index 0000000..fd95ed3 --- /dev/null +++ b/aiyh/utils/httpUtil/util/CloseThread.java @@ -0,0 +1,34 @@ +package aiyh.utils.httpUtil.util; + +import aiyh.utils.httpUtil.ExtendedIOUtils; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.impl.client.CloseableHttpClient; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/5 0005 16:09 + */ + + +public class CloseThread implements Runnable { + + private CloseableHttpClient httpClient; + private CloseableHttpResponse response; + + public CloseThread(CloseableHttpClient httpClient, CloseableHttpResponse response) { + this.httpClient = httpClient; + this.response = response; + } + + @Override + public void run() { + try { + Thread.sleep(1000 * 60); + } catch (InterruptedException e) { + e.printStackTrace(); + }finally { + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + } + } +} diff --git a/aiyh/utils/httpUtil/util/GlobalCache.java b/aiyh/utils/httpUtil/util/GlobalCache.java new file mode 100644 index 0000000..60b68be --- /dev/null +++ b/aiyh/utils/httpUtil/util/GlobalCache.java @@ -0,0 +1,42 @@ +package aiyh.utils.httpUtil.util; + + +import java.util.HashMap; +import java.util.Map; + +/** +* @author EBU7-dev1-ayh +* @since 2021/08/30 17:56 +*/ +public class GlobalCache { + + /** + * 全局请求头 + */ + public Map header = new HashMap<>(); + + + /** + * 依赖参数容器 + */ + public Map paramMap = new HashMap<>(); + + public Map uptHeader(String key, String value){ + header.put(key,value); + return header; + } + + public Map uptParam(String key, Object value){ + paramMap.put(key,value); + return paramMap; + } + + public void clearHeader(){ + header.clear(); + } + + public void clearParam(){ + paramMap.clear(); + } + +} diff --git a/aiyh/utils/httpUtil/util/HttpUtils.java b/aiyh/utils/httpUtil/util/HttpUtils.java new file mode 100644 index 0000000..ddc4070 --- /dev/null +++ b/aiyh/utils/httpUtil/util/HttpUtils.java @@ -0,0 +1,772 @@ +package aiyh.utils.httpUtil.util; + +import com.alibaba.fastjson.JSON; +import com.google.common.base.Strings; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import org.apache.http.Header; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; +import org.apache.http.entity.mime.HttpMultipartMode; +import org.apache.http.entity.mime.MultipartEntityBuilder; +import org.apache.http.entity.mime.content.StringBody; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.protocol.HTTP; +import org.apache.http.util.EntityUtils; +import aiyh.utils.httpUtil.ExtendedIOUtils; +import aiyh.utils.httpUtil.HttpArgsType; +import aiyh.utils.httpUtil.HttpManager; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.httpAsync.HttpAsyncThread; +import aiyh.utils.httpUtil.httpAsync.HttpAsyncThreadCallBack; +import aiyh.utils.zwl.common.ToolUtil; +import weaver.file.ImageFileManager; + +import java.io.*; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import java.util.*; +import java.util.concurrent.*; +import java.util.function.Consumer; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/31 0031 17:16 + * http请求工具 与HttpStaticUtils使用相同,说明请查看HttpStaticUtils + */ + + +public class HttpUtils { + // 默认编码 + private String DEFAULT_ENCODING = "UTF-8"; + + private final ToolUtil toolUtil = new ToolUtil(); + + private final GlobalCache globalCache = new GlobalCache(); +// 线程池 + private final ThreadPoolExecutor executorService; + { + // private final ExecutorService executorService = Executors.newFixedThreadPool(3); + ThreadFactoryBuilder threadFactoryBuilder = new ThreadFactoryBuilder(); + ThreadFactory threadFactory = threadFactoryBuilder.setNameFormat("xxx-pool-%d").build(); + executorService = new ThreadPoolExecutor(5, 200, 0L, + TimeUnit.MILLISECONDS, + new LinkedBlockingQueue<>(1024), + threadFactory, + new ThreadPoolExecutor.AbortPolicy()); + } + + public HttpUtils() { + + } + + public GlobalCache getGlobalCache() { + return globalCache; + } + + public void setDEFAULT_ENCODING() { + this.DEFAULT_ENCODING = DEFAULT_ENCODING; + } + + public HttpUtils(String DEFAULT_ENCODING) { + this.DEFAULT_ENCODING = DEFAULT_ENCODING; + } + + public HttpPost getHttpPost(String url) { + HttpPost httpPost = new HttpPost(url); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(10000) + .setConnectionRequestTimeout(10000) + .setRedirectsEnabled(true) + .build(); + httpPost.setConfig(requestConfig); + return httpPost; + } + + public HttpGet getHttpGet(String url) { + HttpGet httpGet = new HttpGet(url); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(10000) + .setConnectionRequestTimeout(10000) + .setRedirectsEnabled(true) + .build(); + httpGet.setConfig(requestConfig); + return httpGet; + } + + /** + * get请求 + * + * @param url 请求地址 + * @return 请求结果 + * @throws IOException io异常 + */ + public ResponeVo apiGet(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpGet); + } + + + /** + * delete请求 + * + * @param url 请求地址 + * @return 请求结果 + * @throws IOException io异常 + */ + public ResponeVo apiDelete(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpDelete); + } + + /** + * get请求 + * + * @param url 请求地址 + * @param headers 请求头 + * @return 请求结果 + * @throws IOException io异常 + */ + public ResponeVo apiGet(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpGet); + } + + public ResponeVo apiDelete(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpDelete); + } + + public ResponeVo apiGet(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpGet); + } + + public ResponeVo apiDelete(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return baseRequest(httpConnection, httpDelete); + } + + /** + * 回调方法 + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void apiGet(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + callBackRequest(httpConnection, httpGet, consumer); + } + + /** + * 回调方法 + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void apiDelete(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + callBackRequest(httpConnection, httpDelete, consumer); + } + + public ResponeVo apiPost(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPost); + } + + + public ResponeVo apiPut(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPut); + } + + + public ResponeVo apiPost(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPost); + } + + + public ResponeVo apiPut(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return baseRequest(httpConnection, httpPut); + } + + public ResponeVo apiUploadFile(String url,InputStream inputStream, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = uploadFileByInputStream(url,inputStream, fileKey,fileName, paramsMap, headerMap); + return baseRequest(httpConnection, httpPost); + } + + public ResponeVo apiUploadFile(String url,File file, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = uploadFileByInputStream(url,file, fileKey,fileName, paramsMap, headerMap); + return baseRequest(httpConnection, httpPost); + } + + public ResponeVo apiUploadFileById(String url,int id, String fileKey,String fileName, + Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + InputStream inputStream = ImageFileManager.getInputStreamById(id); + HttpPost httpPost = uploadFileByInputStream(url,inputStream, fileKey,fileName, paramsMap, headerMap); + return baseRequest(httpConnection, httpPost); + } + + + /** + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void apiPost(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + callBackRequest(httpConnection, httpPost, consumer); + } + + /** + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void apiPut(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + callBackRequest(httpConnection, httpPut, consumer); + } + + + + private void callBackRequest(CloseableHttpClient httpClient, HttpUriRequest request, Consumer consumer) throws IOException { + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); + consumer.accept(response); + } catch (Exception e) { + toolUtil.writeErrorLog(" http调用失败:" + e); + throw e; + } +// new CloseThread(httpClient,response).run(); + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + } + + + public ResponeVo baseRequest(CloseableHttpClient httpClient, HttpUriRequest request) throws IOException { + ResponeVo responeVo = new ResponeVo(); + CloseableHttpResponse response = null; + try { + response = httpClient.execute(request); + HttpEntity entity = response.getEntity(); + Header[] allHeaders = response.getAllHeaders(); + Locale locale = response.getLocale(); + responeVo.setLocale(locale); + responeVo.setAllHeaders(allHeaders); + responeVo.setEntityString(EntityUtils.toString(entity, DEFAULT_ENCODING)); + responeVo.setCode(response.getStatusLine().getStatusCode()); + } catch (Exception e) { + toolUtil.writeErrorLog(" http调用失败:" + e); + throw e; + } +// new CloseThread(httpClient,response).run(); + ExtendedIOUtils.closeQuietly(httpClient); + ExtendedIOUtils.closeQuietly(response); + return responeVo; + } + + + /** + * get请求 + * + * @param url 请求地址 + * @return 请求结果 + * @throws IOException io异常 + */ + public Future asyncApiGet(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpGet, DEFAULT_ENCODING)); + } + + + /** + * delete请求 + * + * @param url 请求地址 + * @return 异步请求结果 + * @throws IOException io异常 + */ + public Future asyncApiDelete(String url) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headers = headersHandle(null); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headers.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpDelete, DEFAULT_ENCODING)); + } + + /** + * get请求 + * + * @param url 请求地址 + * @param headers 请求头 + * @return 异步请求结果 + * @throws IOException io异常 + */ + public Future asyncApiGet(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpGet, DEFAULT_ENCODING)); + } + + public Future asyncApiDelete(String url, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map params = paramsHandle(null); + String getUrl = urlHandle(url, params); + Map headerMap = headersHandle(headers); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpDelete, DEFAULT_ENCODING)); + } + + public Future asyncApiGet(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpGet, DEFAULT_ENCODING)); + } + + public Future asyncApiDelete(String url, Map params, Map headers) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + return executorService.submit(new HttpAsyncThread(httpConnection, httpDelete, DEFAULT_ENCODING)); + } + + /** + * 回调方法 + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调函数 + * @throws IOException io异常 + */ + public void asyncApiGet(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpGet httpGet = new HttpGet(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpGet.setHeader(entry.getKey(), entry.getValue()); + } + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpGet, consumer)); + } + + /** + * + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void asyncApiDelete(String url, Map params, Map headers, Consumer consumer) throws IOException { + Map paramsMap = paramsHandle(params); + String getUrl = urlHandle(url, paramsMap); + Map headerMap = headersHandle(headers); + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + HttpDelete httpDelete = new HttpDelete(getUrl.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpDelete.setHeader(entry.getKey(), entry.getValue()); + } + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpDelete, consumer)); + } + + public Future asyncApiPost(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + public Future asyncApiPut(String url, Map params) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(null); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPut, DEFAULT_ENCODING)); + } + + + public Future asyncApiPost(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPost, DEFAULT_ENCODING)); + } + + public Future asyncApiPut(String url, Map params, Map headers) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + return executorService.submit(new HttpAsyncThread(httpConnection, httpPut, DEFAULT_ENCODING)); + } + + + /** + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void asyncApiPost(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPost httpPost = handleHttpPost(url, headerMap, paramsMap); + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpPost, consumer)); + } + + + /** + * @param url 请求地址 + * @param params 请求参数 + * @param headers 请求头信息 + * @param consumer 回调方法 + * @throws IOException io异常 + */ + public void asyncApiPut(String url, Map params, Map headers, Consumer consumer) throws IOException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(url); + Map paramsMap = paramsHandle(params); + Map headerMap = headersHandle(headers); + HttpPut httpPut = handleHttpPut(url, headerMap, paramsMap); + executorService.execute(new HttpAsyncThreadCallBack(httpConnection, httpPut, consumer)); + } + + + private HttpPost handleHttpPost(String url, Map headerMap, Map paramsMap) throws UnsupportedEncodingException { + String contentType = ""; + HttpPost httpPost = new HttpPost(url.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpPost.setHeader(entry.getKey(), entry.getValue()); + if ("Content-Type".equalsIgnoreCase(entry.getKey())) { + contentType = entry.getValue(); + } + } + if (Strings.isNullOrEmpty(contentType)) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()))); + } + httpPost.setHeader("Content-Type", HttpArgsType.DEFAULT_CONTENT_TYPE); + httpPost.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.X_WWW_FORM_URLENCODED.toUpperCase())) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()))); + } + httpPost.setEntity(new UrlEncodedFormEntity(nvps)); +// } else if (contentType.toUpperCase().startsWith(HttpArgsType.APPLICATION_JSON.toUpperCase())) { + } else{ + StringEntity stringEntity = new StringEntity(JSON.toJSONString(paramsMap),DEFAULT_ENCODING); + httpPost.setEntity(stringEntity); + } + return httpPost; + } + + + public HttpPost uploadFileByInputStream(String url,InputStream inputStream, String fileKey,String fileName, + Map params, Map headers){ + MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + builder.setCharset(StandardCharsets.UTF_8); + builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + builder.addBinaryBody(fileKey,inputStream, ContentType.MULTIPART_FORM_DATA,fileName); + ContentType contentType= ContentType.create("text/plain",StandardCharsets.UTF_8); + for (Map.Entry param : params.entrySet()){ + StringBody stringBody = new StringBody(String.valueOf(param.getValue()), contentType); + builder.addPart(param.getKey(),stringBody); + } + HttpPost httpPost = new HttpPost(url.trim()); + + for (Map.Entry entry : headers.entrySet()) { + if("Content-Type".equalsIgnoreCase(entry.getKey())){ + continue; + } + httpPost.setHeader(entry.getKey(), entry.getValue()); + } + HttpEntity entity = builder.build(); + httpPost.setEntity(entity); + return httpPost; + } + + public HttpPost uploadFileByInputStream(String url,File file, String fileKey,String fileName, + Map params, Map headers){ + MultipartEntityBuilder builder = MultipartEntityBuilder.create(); + builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); + builder.addBinaryBody(fileKey,file, ContentType.MULTIPART_FORM_DATA,fileName); + for (Map.Entry param : params.entrySet()){ + StringBody stringBody = new StringBody(String.valueOf(param.getValue()),ContentType.MULTIPART_FORM_DATA); + builder.addPart(param.getKey(),stringBody); + } + HttpPost httpPost = new HttpPost(url.trim()); + + for (Map.Entry entry : headers.entrySet()) { + if("Content-Type".equalsIgnoreCase(entry.getKey())){ + continue; + } + httpPost.setHeader(entry.getKey(), entry.getValue()); + } + HttpEntity entity = builder.build(); + httpPost.setEntity(entity); + return httpPost; + } + + + private HttpPut handleHttpPut(String url, Map headerMap, Map paramsMap) throws UnsupportedEncodingException { + String contentType = ""; + HttpPut httpPut = new HttpPut(url.trim()); + for (Map.Entry entry : headerMap.entrySet()) { + httpPut.setHeader(entry.getKey(), entry.getValue()); + if ("Content-Type".equalsIgnoreCase(entry.getKey())) { + contentType = entry.getValue(); + } + } + if (Strings.isNullOrEmpty(contentType)) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()))); + } + httpPut.setHeader("Content-Type", HttpArgsType.DEFAULT_CONTENT_TYPE); + httpPut.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.X_WWW_FORM_URLENCODED.toUpperCase())) { + List nvps = new ArrayList<>(); + for (Map.Entry entry : paramsMap.entrySet()) { + nvps.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()))); + } + httpPut.setEntity(new UrlEncodedFormEntity(nvps)); + } else if (contentType.toUpperCase().startsWith(HttpArgsType.APPLICATION_JSON.toUpperCase())) { + StringEntity stringEntity = new StringEntity(JSON.toJSONString(paramsMap),DEFAULT_ENCODING); + httpPut.setEntity(stringEntity); + } + return httpPut; + } + + + private String inputStreamToString(InputStream is) { + String line = ""; + StringBuilder total = new StringBuilder(); + BufferedReader rd = new BufferedReader(new InputStreamReader(is)); + try { + while ((line = rd.readLine()) != null) { + total.append(line); + } + } catch (IOException e) { + toolUtil.writeErrorLog(e.getLocalizedMessage() + "\n" + e); + } + return total.toString(); + } + + public Map headersHandle(Map headers) { + Map map = new HashMap<>(); + if (headers != null && headers.size() > 0) { + if (globalCache.header != null && globalCache.header.size() > 0) { + map.putAll(globalCache.header); + } + map.putAll(headers); + } else { + map.putAll(globalCache.header); + } + return map; + } + + public Map paramsHandle(Map params) { + Map map = new HashMap<>(); + if (params != null && params.size() > 0) { + if (globalCache.paramMap != null && globalCache.paramMap.size() > 0) { + map.putAll(globalCache.paramMap); + } + map.putAll(params); + } else { + map.putAll(globalCache.paramMap); + } + return map; + } + + public String urlHandle(String url, Map params) { + if (params == null || params.size() <= 0) { + return url; + } + String serializeParams = serializeParams(params); + String getUrl; + if (!url.contains("?")) { + if (url.endsWith("/")) { + getUrl = url.substring(0, url.length() - 1) + "?" + serializeParams; + } else { + getUrl = url + "?" + serializeParams; + } + } else { + if (url.endsWith("?")) { + getUrl = url + serializeParams; + } else { + getUrl = url + "&" + serializeParams; + } + } + return getUrl; + } + + private String serializeParams(Map params) { + if (params != null && params.size() > 0) { + StringBuilder builder = new StringBuilder(); + for (Map.Entry entry : params.entrySet()) { + builder.append("&"); + builder.append(entry.getKey()); + builder.append("="); + builder.append(entry.getValue()); + } + return removeSeparator(builder); + } + return ""; + } + + private String removeSeparator(StringBuilder sqlBuilder) { + String str = sqlBuilder.toString().trim(); + String removeSeparator = "&"; + if (str.endsWith(removeSeparator)) { +// 如果以分&号结尾,则去除&号 + str = str.substring(0, str.length() - 1); + } + if (str.trim().startsWith(removeSeparator)) { +// 如果以&开头,则去除& + str = str.substring(1); + } + return str; + } +} diff --git a/aiyh/utils/mapUtil/ParaMap.java b/aiyh/utils/mapUtil/ParaMap.java new file mode 100644 index 0000000..f53d97f --- /dev/null +++ b/aiyh/utils/mapUtil/ParaMap.java @@ -0,0 +1,24 @@ +package aiyh.utils.mapUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/19 0019 19:40 + * map + */ + + +public class ParaMap extends HashMap implements Map { + + public static ParaMap create() { + return new ParaMap(); + } + + @Override + public ParaMap put(String name, Object value) { + super.put(name, value); + return this; + } +} diff --git a/aiyh/utils/mapUtil/UtilHashMap.java b/aiyh/utils/mapUtil/UtilHashMap.java new file mode 100644 index 0000000..fa21d13 --- /dev/null +++ b/aiyh/utils/mapUtil/UtilHashMap.java @@ -0,0 +1,42 @@ +package aiyh.utils.mapUtil; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/19 0019 19:45 + * utilMap + */ + + +public class UtilHashMap extends HashMap implements Map { + public UtilHashMap(){ + super(); + } + public UtilHashMap uPut(K key, V value) { + this.put(key,value); + return this; + } + + + public UtilHashMap uPutAll(Map m) { + super.putAll(m); + return this; + } + + public UtilHashMap uReplace(K key, V value) { + super.replace(key, value); + return this; + } + + public UtilHashMap filter(UtilMapFilter predicate){ + UtilHashMap newMap = new UtilHashMap<>(); + for (Entry entry : this.entrySet()){ + if(predicate.test(entry.getKey(), entry.getValue())){ + newMap.put(entry.getKey(),entry.getValue()); + } + } + return newMap; + } +} diff --git a/aiyh/utils/mapUtil/UtilLinkedHashMap.java b/aiyh/utils/mapUtil/UtilLinkedHashMap.java new file mode 100644 index 0000000..fb7aeaa --- /dev/null +++ b/aiyh/utils/mapUtil/UtilLinkedHashMap.java @@ -0,0 +1,43 @@ +package aiyh.utils.mapUtil; + +import java.util.LinkedHashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 15:06 + * LinkedHashMap + */ + + +public class UtilLinkedHashMap extends LinkedHashMap implements Map { + public UtilLinkedHashMap() { + super(); + } + + public UtilLinkedHashMap uPut(K key, V value) { + this.put(key, value); + return this; + } + + + public UtilLinkedHashMap uPutAll(Map m) { + super.putAll(m); + return this; + } + + public UtilLinkedHashMap uReplace(K key, V value) { + super.replace(key, value); + return this; + } + + public UtilLinkedHashMap filter(UtilMapFilter predicate) { + UtilLinkedHashMap newMap = new UtilLinkedHashMap<>(); + for (Entry entry : this.entrySet()) { + if (predicate.test(entry.getKey(), entry.getValue())) { + newMap.put(entry.getKey(), entry.getValue()); + } + } + return newMap; + } +} diff --git a/aiyh/utils/mapUtil/UtilMapFilter.java b/aiyh/utils/mapUtil/UtilMapFilter.java new file mode 100644 index 0000000..b887241 --- /dev/null +++ b/aiyh/utils/mapUtil/UtilMapFilter.java @@ -0,0 +1,11 @@ +package aiyh.utils.mapUtil; + +/** + * @author @author EBU7-dev1-ay + * @date 2021/8/19 0019 21:18 + * utilMapFilter + */ + +public interface UtilMapFilter { + boolean test(K k,V v); +} diff --git a/aiyh/utils/service/UtilService.java b/aiyh/utils/service/UtilService.java new file mode 100644 index 0000000..7c70cae --- /dev/null +++ b/aiyh/utils/service/UtilService.java @@ -0,0 +1,86 @@ +package aiyh.utils.service; + +import aiyh.utils.dao.UtilDao; +import aiyh.utils.entity.ApiConfigDetailDTO; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.entity.MultiLanguageDTO; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/14 0014 12:21 + * service类 + */ + + +public class UtilService { + private final UtilDao utilDao = new UtilDao(); + + public ApiConfigMainDTO getApiConfigMain(String id){ + ApiConfigMainDTO apiConfigMain = utilDao.getApiConfigMain(id); + List apiConfigDetails = utilDao.getApiConfigDetail(apiConfigMain.getId()); + apiConfigMain.setDetails(apiConfigDetails); + return apiConfigMain; + } + + public ApiConfigMainDTO getApiConfigMainTree(String id){ + ApiConfigMainDTO apiConfigMain = utilDao.getApiConfigMain(id); + List apiConfigDetails = utilDao.getApiConfigDetail(apiConfigMain.getId()); + List apiConfigDetailTreeList = list2Tree(apiConfigDetails); + apiConfigMain.setDetails(apiConfigDetailTreeList); + return apiConfigMain; + } + + private List list2Tree(List list) { + List treeList = new ArrayList<>(); + for (ApiConfigDetailDTO apiConfigDetailDTO : list) { + if (apiConfigDetailDTO.getObjectChild() == 0) { + ApiConfigDetailDTO child = findChild(list, apiConfigDetailDTO); + treeList.add(child); + } + } + return treeList; + } + + private ApiConfigDetailDTO findChild(List list, ApiConfigDetailDTO apiConfigDetailDTO) { + if (apiConfigDetailDTO.getParamType() != 3) { + return apiConfigDetailDTO; + } + for (ApiConfigDetailDTO ddConfigDetailDTO : list) { + if (ddConfigDetailDTO.getParentLine() == apiConfigDetailDTO.getLineNum()) { +// 子项 + if (apiConfigDetailDTO.getChildren() == null) { + apiConfigDetailDTO.setChildren(new ArrayList<>()); + } + apiConfigDetailDTO.getChildren().add(findChild(list, ddConfigDetailDTO)); + } + } + return apiConfigDetailDTO; + } + + public Map queryLanguage(int groupId, int languageId){ + List multiLanguageDTOS = utilDao.queryLanguage(groupId); + Map languageResult = new HashMap<>(); + if(languageId == 9){ +// 中文繁体 + for (MultiLanguageDTO multiLanguageDTO : multiLanguageDTOS) { + languageResult.put(multiLanguageDTO.getBswyz(),multiLanguageDTO.getZnHk()); + } + }else if(languageId == 8){ +// 英文 + for (MultiLanguageDTO multiLanguageDTO : multiLanguageDTOS) { + languageResult.put(multiLanguageDTO.getBswyz(),multiLanguageDTO.getEnUs()); + } + }else { +// 中文简体 + for (MultiLanguageDTO multiLanguageDTO : multiLanguageDTOS) { + languageResult.put(multiLanguageDTO.getBswyz(),multiLanguageDTO.getZnCh()); + } + } + return languageResult; + } +} diff --git a/aiyh/utils/sqlUtil/builderSql/BuilderSql.java b/aiyh/utils/sqlUtil/builderSql/BuilderSql.java new file mode 100644 index 0000000..6f61779 --- /dev/null +++ b/aiyh/utils/sqlUtil/builderSql/BuilderSql.java @@ -0,0 +1,24 @@ +package aiyh.utils.sqlUtil.builderSql; + +import aiyh.utils.sqlUtil.sqlResult.SqlResult; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.impl.WhereImpl; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ay + * @date 2021/8/23 0023 14:27 + * Builder sql + */ + +public interface BuilderSql { + SqlResult insertSql(String tableName, Map map); + SqlResult insertBatchSql(String tableName, List> mapList); + SqlResult updateSql(String tableName, Map map, Where where); + SqlResult updateBatchSql(String tableName, List> map, List whereList); + String insertSqlForString(String tableName, Map map); + String updateSqlForString(String tableName, Map map, WhereImpl where); +} diff --git a/aiyh/utils/sqlUtil/builderSql/impl/BuilderSqlImpl.java b/aiyh/utils/sqlUtil/builderSql/impl/BuilderSqlImpl.java new file mode 100644 index 0000000..fa9b0b8 --- /dev/null +++ b/aiyh/utils/sqlUtil/builderSql/impl/BuilderSqlImpl.java @@ -0,0 +1,450 @@ +package aiyh.utils.sqlUtil.builderSql.impl; + + +import aiyh.utils.Util; +import aiyh.utils.mapUtil.UtilHashMap; +import aiyh.utils.mapUtil.UtilLinkedHashMap; +import aiyh.utils.sqlUtil.builderSql.BuilderSql; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.impl.WhereImpl; +import weaver.conn.RecordSet; + + +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.stream.Collectors; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 14:45 + */ + + +public class BuilderSqlImpl implements BuilderSql { + private String DB_TYPE; + + { +// 获取当前数据库的类型 + this.DB_TYPE = (new RecordSet()).getDBType(); + } + + /** + * 构建插入语句 + * @param tableName 数据库表名 + * @param mapConfig 数据库字段和值 + * @return 自定义SQL实体类 + */ + @Override + public PrepSqlResultImpl insertSql(String tableName, Map mapConfig) { + UtilHashMap map = this.verifyMap(mapConfig); + List args = new ArrayList<>(); + StringBuilder sqlBuilder = new StringBuilder("insert into "); + sqlBuilder.append(tableName); + StringBuilder fieldBuilder = new StringBuilder(); + StringBuilder valueBuilder = new StringBuilder(); + map.forEach((field, value) -> { + fieldBuilder.append(field); + fieldBuilder.append(", "); + valueBuilder.append(" ?, "); + args.add(value); + }); + sqlBuilder.append(" ( "); + sqlBuilder.append(Util.removeSeparator(fieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Util.removeSeparator(valueBuilder)); + sqlBuilder.append(" )"); + return new PrepSqlResultImpl(sqlBuilder.toString(), args); + } + + public PrepSqlResultImpl insertSqlByEntity(String tableName, T t){ + List args = new ArrayList<>(); + StringBuilder sqlBuilder = new StringBuilder("insert into "); + sqlBuilder.append(tableName); + StringBuilder fieldBuilder = new StringBuilder(); + StringBuilder valueBuilder = new StringBuilder(); + + BeanInfo beanInfo = null; + try { + beanInfo = Introspector.getBeanInfo(t.getClass(), Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor proper : propertyDescriptors) { + String name = proper.getName(); + Method readMethod = proper.getReadMethod(); + Object invoke = readMethod.invoke(t); +// System.out.println(name); +// System.out.println(invoke); + if(invoke == null){ + continue; + } + fieldBuilder.append(name); + fieldBuilder.append(", "); + valueBuilder.append(" ?, "); + args.add(invoke); + } + } catch (Exception e) { + e.printStackTrace(); + } + sqlBuilder.append(" ( "); + sqlBuilder.append(Util.removeSeparator(fieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Util.removeSeparator(valueBuilder)); + sqlBuilder.append(" )"); + return new PrepSqlResultImpl(sqlBuilder.toString(), args); + } + + /** + * 构建批量插入SQL + * @param tableName 表名 + * @param mapListConfig 表对应的字段和值映射list + * @return 自定义批量SQL实体类 + */ + @Override + public BatchSqlResultImpl insertBatchSql(String tableName, List> mapListConfig) { + List> mapList = this.verifyMapList(mapListConfig); + StringBuilder sqlBuilder = new StringBuilder("insert into "); + sqlBuilder.append(tableName); + StringBuilder fieldBuilder = new StringBuilder(); + StringBuilder valueBuilder = new StringBuilder(); + List args = new ArrayList<>(); + AtomicInteger i = new AtomicInteger(); + mapList.forEach(item -> { + List arg = new ArrayList<>(); + item.forEach((field, value) -> { + if (i.get() == 0) { + fieldBuilder.append(field); + fieldBuilder.append(", "); + valueBuilder.append(" ?, "); + } + arg.add(value); + }); + args.add(arg); + i.getAndIncrement(); + }); + sqlBuilder.append(" ( "); + sqlBuilder.append(Util.removeSeparator(fieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Util.removeSeparator(valueBuilder)); + sqlBuilder.append(" )"); + return new BatchSqlResultImpl(sqlBuilder.toString(), args); + } + + public BatchSqlResultImpl insertBatchSqlByEntity(String tableName, List list) { + StringBuilder sqlBuilder = new StringBuilder("insert into "); + sqlBuilder.append(tableName); + StringBuilder fieldBuilder = new StringBuilder(); + StringBuilder valueBuilder = new StringBuilder(); + List args = new ArrayList<>(); + AtomicInteger i = new AtomicInteger(); + + list.forEach(item -> { + List arg = new ArrayList<>(); + BeanInfo beanInfo = null; + + try { + beanInfo = Introspector.getBeanInfo(item.getClass(), Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor proper : propertyDescriptors) { + String name = proper.getName(); + Method readMethod = proper.getReadMethod(); + Object invoke = readMethod.invoke(item); + if(invoke == null){ + continue; + } + if (i.get() == 0) { + fieldBuilder.append(name); + fieldBuilder.append(", "); + valueBuilder.append(" ?, "); + } + arg.add(invoke); + } + } catch (Exception e) { + e.printStackTrace(); + } + args.add(arg); + i.getAndIncrement(); + }); + sqlBuilder.append(" ( "); + sqlBuilder.append(Util.removeSeparator(fieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Util.removeSeparator(valueBuilder)); + sqlBuilder.append(" )"); + return new BatchSqlResultImpl(sqlBuilder.toString(), args); + } + + /** + * 构建更新语句 + * @param tableName 表名 + * @param mapConfig 表名所对应键值对 + * @param where 更新数据的条件 + * @return 自定义SQL实体类 + */ + @Override + public PrepSqlResultImpl updateSql(String tableName, Map mapConfig, Where where) { + UtilHashMap map = this.verifyMap(mapConfig); + this.verifyWhere(where); + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder fieldValue = new StringBuilder(); + List args = new ArrayList<>(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + map.forEach((field, value) -> { + fieldValue.append(field); + fieldValue.append(" = ?, "); + args.add(value); + }); + sqlBuilder.append(Util.removeSeparator(fieldValue)); + sqlBuilder.append(" "); + sqlBuilder.append(where.getSql()); + if (where.getArgs() != null && where.getArgs().size() > 0) { + args.addAll(where.getArgs()); + } + return new PrepSqlResultImpl(sqlBuilder.toString(), args); + } + + public PrepSqlResultImpl updateSqlByEntity(String tableName, T t, Where where){ + this.verifyWhere(where); + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder fieldValue = new StringBuilder(); + List args = new ArrayList<>(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + BeanInfo beanInfo = null; + try { + beanInfo = Introspector.getBeanInfo(t.getClass(), Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor proper : propertyDescriptors) { + String name = proper.getName(); + Method readMethod = proper.getReadMethod(); + Object invoke = readMethod.invoke(t); + if(invoke == null){ + continue; + } + fieldValue.append(name); + fieldValue.append(" = ?, "); + args.add(invoke); + } + } catch (Exception e) { + e.printStackTrace(); + } + sqlBuilder.append(Util.removeSeparator(fieldValue)); + sqlBuilder.append(" "); + sqlBuilder.append(where.getSql()); + if (where.getArgs() != null && where.getArgs().size() > 0) { + args.addAll(where.getArgs()); + } + return new PrepSqlResultImpl(sqlBuilder.toString(), args); + } + + + /** + * @param tableName 表名 + * @param mapListConfig 表名所对应的键值对数组 + * @param whereList 条件数组 + * @return 批量更新只适用于更新条件一样,但是参数不同的时候,比如更新条件都是id= ?,但是各id的数值不一样 + */ + @Override + public BatchSqlResultImpl updateBatchSql(String tableName, List> mapListConfig, List whereList) { + List> mapList = this.verifyMapList(mapListConfig); + this.verifyWhereList(whereList); + if (mapList.size() != whereList.size()) { + throw new RuntimeException("mapList与whereList长度不一致!mapList size and whereList size Not the same!"); + } + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder fieldValue = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + List args = new ArrayList<>(); + AtomicInteger i = new AtomicInteger(); + mapList.forEach(item -> { + List arg = new ArrayList<>(); + item.forEach((field, value) -> { + if (i.get() == 0) { + fieldValue.append(field); + fieldValue.append(" = ?, "); + } + arg.add(value); + }); + if (whereList.get(i.get()).getArgs() != null && whereList.get(i.get()).getArgs().size() > 0) { + arg.addAll(whereList.get(i.get()).getArgs()); + } + args.add(arg); + i.getAndIncrement(); + }); + sqlBuilder.append(Util.removeSeparator(fieldValue)); + sqlBuilder.append(" "); + sqlBuilder.append(whereList.get(0).getSql()); + return new BatchSqlResultImpl(sqlBuilder.toString(), args); + } + + public BatchSqlResultImpl updateBatchSqlByEntity(String tableName, List list, List whereList) { + this.verifyWhereList(whereList); + if (list.size() != whereList.size()) { + throw new RuntimeException("List与whereList长度不一致!mapList size and whereList size Not the same!"); + } + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder fieldValue = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + List args = new ArrayList<>(); + AtomicInteger i = new AtomicInteger(); + list.forEach(item -> { + List arg = new ArrayList<>(); + BeanInfo beanInfo = null; + try { + beanInfo = Introspector.getBeanInfo(item.getClass(), Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor proper : propertyDescriptors) { + String name = proper.getName(); + Method readMethod = proper.getReadMethod(); + Object invoke = readMethod.invoke(item); + if(invoke == null){ + continue; + } + if (i.get() == 0) { + fieldValue.append(name); + fieldValue.append(" = ?, "); + } + arg.add(invoke); + } + } catch (Exception e) { + e.printStackTrace(); + } + if (whereList.get(i.get()).getArgs() != null && whereList.get(i.get()).getArgs().size() > 0) { + arg.addAll(whereList.get(i.get()).getArgs()); + } + args.add(arg); + i.getAndIncrement(); + }); + sqlBuilder.append(Util.removeSeparator(fieldValue)); + sqlBuilder.append(" "); + sqlBuilder.append(whereList.get(0).getSql()); + return new BatchSqlResultImpl(sqlBuilder.toString(), args); + } + + /** + * 构建插入SQL语句 + * @param tableName 表名 + * @param mapConfig 参数 + * @return 拼接好的SQL + */ + @Override + public String insertSqlForString(String tableName, Map mapConfig) { + UtilHashMap map = this.verifyMap(mapConfig); + StringBuilder sqlBuilder = new StringBuilder("insert into "); + sqlBuilder.append(tableName); + StringBuilder fieldBuilder = new StringBuilder(); + StringBuilder valueBuilder = new StringBuilder(); + map.forEach((field, value) -> { + fieldBuilder.append(field); + fieldBuilder.append(", "); + valueBuilder.append("'"); + valueBuilder.append(value); + valueBuilder.append("'"); + valueBuilder.append(", "); + }); + sqlBuilder.append(" ( "); + sqlBuilder.append(Util.removeSeparator(fieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Util.removeSeparator(valueBuilder)); + sqlBuilder.append(" )"); + return sqlBuilder.toString(); + } + + /** + * 构建更新SQL语句 + * @param tableName 表名 + * @param mapConfig 参数 + * @return 拼接好的SQL + */ + @Override + public String updateSqlForString(String tableName, Map mapConfig, WhereImpl where) { + UtilHashMap map = this.verifyMap(mapConfig); + this.verifyWhere(where); + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder fieldValue = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + map.forEach((field, value) -> { + fieldValue.append(field); + fieldValue.append(" = "); + fieldValue.append("'"); + fieldValue.append(value); + fieldValue.append("'"); + fieldValue.append(", "); + }); + sqlBuilder.append(Util.removeSeparator(fieldValue)); + sqlBuilder.append(" "); + sqlBuilder.append(where.getSql()); + return sqlBuilder.toString(); + } + + + + + /** + * 验证构建SQL参数的,并且过滤到为null的数据 + * @param map 验证SQL参数map对象 + * @return 验证后的UtilHashMap + */ + public UtilHashMap verifyMap(Map map) { + UtilHashMap filterMap = Util.createUtilHashMap() + .uPutAll(map) + .filter((key, value) -> !Objects.isNull(key) && !Objects.isNull(value)); + if (Util.mapIsNullOrEmpty(filterMap)) { + throw new RuntimeException("map为空或没有数据! map is null or empty!"); + } + return filterMap; + } + + /** + * 验证批量SQL构建的数据 + * @param mapList 批量构建SQL的的工具 + * @return 验证和过滤后的数据 + */ + public List> verifyMapList(List> mapList) { + if (Objects.isNull(mapList)) { + throw new RuntimeException("mapList为null!mapList is null!"); + } + List> collect = mapList.stream().map(item -> + Util.createUtilLinkedHashMap() + .uPutAll(item) + .filter((key, value) -> !Objects.isNull(key) && !Objects.isNull(value)) + ).collect(Collectors.toList()); + if (mapList.size() == 0) { + throw new RuntimeException("mapList没有数据!mapList is empty!"); + } + return collect; + } + + /** + * 验证where条件是否符合 + * @param where where 条件对象 + */ + private void verifyWhere(Where where) { + if (where == null) { + throw new RuntimeException("where为null! where is null!"); + } + } + /** + * 验证where条件集合是否符合 + * @param whereList where 条件对象集合 + */ + private void verifyWhereList(List whereList) { + if (whereList == null) { + throw new RuntimeException("whereList为null! whereList is null!"); + } + whereList.forEach(item->{ + if(item == null){ + throw new RuntimeException("whereList中数据为null! whereDate is null in whereList!"); + } + }); + } +} diff --git a/aiyh/utils/sqlUtil/sqlResult/SqlResult.java b/aiyh/utils/sqlUtil/sqlResult/SqlResult.java new file mode 100644 index 0000000..df12d45 --- /dev/null +++ b/aiyh/utils/sqlUtil/sqlResult/SqlResult.java @@ -0,0 +1,9 @@ +package aiyh.utils.sqlUtil.sqlResult; + +/** + * @author EBU7-dev1-ay + * @date 2021/8/23 0023 14:41 + */ + +public interface SqlResult { +} diff --git a/aiyh/utils/sqlUtil/sqlResult/impl/BatchSqlResultImpl.java b/aiyh/utils/sqlUtil/sqlResult/impl/BatchSqlResultImpl.java new file mode 100644 index 0000000..8c034a7 --- /dev/null +++ b/aiyh/utils/sqlUtil/sqlResult/impl/BatchSqlResultImpl.java @@ -0,0 +1,28 @@ +package aiyh.utils.sqlUtil.sqlResult.impl; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/12 0012 16:57 + * sql参数和语句 + */ + + +public class BatchSqlResultImpl implements aiyh.utils.sqlUtil.sqlResult.SqlResult { + private final String sqlStr; + private final List batchList; + + public BatchSqlResultImpl(String sqlStr, List batchList) { + this.sqlStr = sqlStr; + this.batchList = batchList; + } + + public String getSqlStr() { + return sqlStr; + } + + public List getBatchList() { + return batchList; + } +} diff --git a/aiyh/utils/sqlUtil/sqlResult/impl/PrepSqlResultImpl.java b/aiyh/utils/sqlUtil/sqlResult/impl/PrepSqlResultImpl.java new file mode 100644 index 0000000..d41b15b --- /dev/null +++ b/aiyh/utils/sqlUtil/sqlResult/impl/PrepSqlResultImpl.java @@ -0,0 +1,30 @@ +package aiyh.utils.sqlUtil.sqlResult.impl; + +import aiyh.utils.sqlUtil.sqlResult.SqlResult; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 14:39 + * prepSqlResult + */ + + +public class PrepSqlResultImpl implements SqlResult { + private final String sqlStr; + private final List args; + + public PrepSqlResultImpl(String sqlStr, List args) { + this.sqlStr = sqlStr; + this.args = args; + } + + public String getSqlStr() { + return sqlStr; + } + + public List getArgs() { + return args; + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/InnerWhere.java b/aiyh/utils/sqlUtil/whereUtil/InnerWhere.java new file mode 100644 index 0000000..eafde33 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/InnerWhere.java @@ -0,0 +1,14 @@ +package aiyh.utils.sqlUtil.whereUtil; + +/** + * @author EBU7-dev1-ay + * @date 2021/8/23 0023 22:14 + * inner where + */ + +public interface InnerWhere { + InnerWhereOperator whereAnd(String key); + + InnerWhereOperator whereOr(String key); + Where endInnerWhere(); +} diff --git a/aiyh/utils/sqlUtil/whereUtil/InnerWhereOperator.java b/aiyh/utils/sqlUtil/whereUtil/InnerWhereOperator.java new file mode 100644 index 0000000..08e8d28 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/InnerWhereOperator.java @@ -0,0 +1,56 @@ +package aiyh.utils.sqlUtil.whereUtil; + +import java.util.List; + +/** + * @author EBU7-dev1-ay + * @date 2021/8/23 0023 22:15 + */ + +public interface InnerWhereOperator { + InnerWhere whereNull(); + + InnerWhere whereNotNull(); + + InnerWhere whereEqual(Object value); + + InnerWhere whereNotEqual(Object value); + + InnerWhere greaterThan(Object value); + + InnerWhere lessThan(Object value); + + InnerWhere greaterOrEqual(Object value); + + InnerWhere lessThanOrEqual(Object value); + + InnerWhere BetweenAnd(Object start, Object end); + + InnerWhere whereIn(Object... values); + + InnerWhere whereInList(List list); + + InnerWhere whereNotIn(Object... values); + + InnerWhere whereNotInList(List list); + + InnerWhere inSql(Object sql); + + InnerWhere notInSql(Object sql); + + InnerWhere whereLike(Object value); + + InnerWhere whereNotLike(Object value); + + InnerWhere whereExists(Object... values); + + InnerWhere whereNotExists(Object... values); + + InnerWhere whereExistsList(List list); + + InnerWhere whereNotExistsList(List list); + + InnerWhere whereExistsSql(Object sql); + + InnerWhere whereNotExistsSql(Object sql); +} diff --git a/aiyh/utils/sqlUtil/whereUtil/Where.java b/aiyh/utils/sqlUtil/whereUtil/Where.java new file mode 100644 index 0000000..05e9576 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/Where.java @@ -0,0 +1,23 @@ +package aiyh.utils.sqlUtil.whereUtil; + +import java.util.List; + +/** + * @author EBU7-dev1-ay + * @date 2021/8/23 0023 12:58 + * SQL条件类 + */ + +public interface Where { + WhereOperator whereAnd(String key); + + WhereOperator whereOr(String key); + + InnerWhereOperator andInnerWhere(String key); + + InnerWhereOperator orInnerWhere(String key); + + String getSql(); + + List getArgs(); +} diff --git a/aiyh/utils/sqlUtil/whereUtil/WhereOperator.java b/aiyh/utils/sqlUtil/whereUtil/WhereOperator.java new file mode 100644 index 0000000..4b363d5 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/WhereOperator.java @@ -0,0 +1,57 @@ +package aiyh.utils.sqlUtil.whereUtil; + +import java.util.List; + +/** + * @author EBU7-dev1-ay + * @date 2021/8/23 0023 13:00 + * wherevalue 接口 + */ + +public interface WhereOperator { + Where whereNull(); + + Where whereNotNull(); + + Where whereEqual(Object value); + + Where whereNotEqual(Object value); + + Where greaterThan(Object value); + + Where lessThan(Object value); + + Where greaterOrEqual(Object value); + + Where lessThanOrEqual(Object value); + + Where BetweenAnd(Object start, Object end); + + Where whereIn(Object ...values); + + Where whereInList(List list); + + Where whereNotIn(Object... values); + + Where whereNotInList(List list); + + Where inSql(Object sql); + + Where notInSql(Object sql); + + Where whereLike(Object value); + + Where whereNotLike(Object value); + + Where whereExists(Object ...values); + + Where whereNotExists(Object ...values); + + Where whereExistsList(List list); + + Where whereNotExistsList(List list); + + Where whereExistsSql(Object sql); + + Where whereNotExistsSql(Object sql); +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/InnerPrepWhereImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/InnerPrepWhereImpl.java new file mode 100644 index 0000000..bed436b --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/InnerPrepWhereImpl.java @@ -0,0 +1,57 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.InnerWhere; +import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; +import aiyh.utils.sqlUtil.whereUtil.Where; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 22:18 + */ + + +public class InnerPrepWhereImpl implements InnerWhere { + private final InnerPrepWhereOperatorImpl whereOperator; + private final PrepWhereImpl prepWhere; + + public InnerPrepWhereOperatorImpl getWhereOperator() { + return whereOperator; + } + + { + this.whereOperator = new InnerPrepWhereOperatorImpl(this); + } + + public InnerPrepWhereImpl(PrepWhereImpl prepWhere) { + this.prepWhere = prepWhere; + } + + @Override + public InnerWhereOperator whereAnd(String key) { + this.whereAppend(" and "); + this.whereAppend(key); + return this.whereOperator; + } + + @Override + public InnerWhereOperator whereOr(String key) { + this.whereAppend(" or "); + this.whereAppend(key); + return this.whereOperator; + } + + @Override + public Where endInnerWhere() { + this.whereAppend(" ) "); + return this.prepWhere; + } + + + public void whereAppend(Object key) { + this.prepWhere.whereAppend(key); + } + + public void addArgs(Object key) { + this.prepWhere.addArgs(key); + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/InnerPrepWhereOperatorImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/InnerPrepWhereOperatorImpl.java new file mode 100644 index 0000000..4fa0200 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/InnerPrepWhereOperatorImpl.java @@ -0,0 +1,241 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.InnerWhere; +import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 22:20 + */ + + +public class InnerPrepWhereOperatorImpl implements InnerWhereOperator { + private final InnerPrepWhereImpl innerPrepWhere; + + public InnerPrepWhereOperatorImpl(InnerPrepWhereImpl innerPrepWhere) { + this.innerPrepWhere = innerPrepWhere; + } + + @Override + public InnerWhere whereNull() { + this.innerPrepWhere.whereAppend(" is null "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotNull() { + this.innerPrepWhere.whereAnd(" is not null "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereEqual(Object value) { + this.innerPrepWhere.whereAppend(" = ? "); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotEqual(Object value) { + this.innerPrepWhere.whereAppend(" <> ? "); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere greaterThan(Object value) { + this.innerPrepWhere.whereAppend(" > ? "); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere lessThan(Object value) { + this.innerPrepWhere.whereAppend(" < ? "); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere greaterOrEqual(Object value) { + this.innerPrepWhere.whereAppend(" >= ? "); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere lessThanOrEqual(Object value) { + this.innerPrepWhere.whereAppend(" <= ? "); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere BetweenAnd(Object start, Object end) { + this.innerPrepWhere.whereAppend(" between ? "); + this.innerPrepWhere.addArgs(start); + this.innerPrepWhere.whereAppend(" and ? "); + this.innerPrepWhere.addArgs(end); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereIn(Object... values) { + this.innerPrepWhere.whereAppend(" in ( "); + for (int i = 0; i < values.length; i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(values[i]); + if (i < values.length - 1) { + this.innerPrepWhere.whereAppend(","); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereInList(List list) { + this.innerPrepWhere.whereAppend(" in ( "); + for (int i = 0; i < list.size(); i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(list.get(i)); + if (i < list.size() - 1) { + this.innerPrepWhere.whereAppend(","); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotIn(Object... values) { + this.innerPrepWhere.whereAppend(" not in ( "); + for (int i = 0; i < values.length; i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(values[i]); + if (i < values.length - 1) { + this.innerPrepWhere.whereAppend(","); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotInList(List list) { + this.innerPrepWhere.whereAppend(" not in ( "); + for (int i = 0; i < list.size(); i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(list.get(i)); + if (i < list.size() - 1) { + this.innerPrepWhere.whereAppend(", "); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere inSql(Object sql) { + this.innerPrepWhere.whereAppend(" in ( "); + this.innerPrepWhere.whereAppend(sql); + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere notInSql(Object sql) { + this.innerPrepWhere.whereAppend(" not in ( "); + this.innerPrepWhere.whereAppend(sql); + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereLike(Object value) { + this.innerPrepWhere.whereAppend(" like ?"); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotLike(Object value) { + this.innerPrepWhere.whereAppend(" not like ?"); + this.innerPrepWhere.addArgs(value); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereExists(Object... values) { + this.innerPrepWhere.whereAppend(" exists ( "); + for (int i = 0; i < values.length; i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(values[i]); + if (i < values.length - 1) { + this.innerPrepWhere.whereAppend(","); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotExists(Object... values) { + this.innerPrepWhere.whereAppend(" not exists ( "); + for (int i = 0; i < values.length; i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(values[i]); + if (i < values.length - 1) { + this.innerPrepWhere.whereAppend(","); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereExistsList(List list) { + this.innerPrepWhere.whereAppend(" exists ( "); + for (int i = 0; i < list.size(); i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(list.get(i)); + if (i < list.size() - 1) { + this.innerPrepWhere.whereAppend(", "); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotExistsList(List list) { + this.innerPrepWhere.whereAppend(" not exists ( "); + for (int i = 0; i < list.size(); i++) { + this.innerPrepWhere.whereAppend(" ? "); + this.innerPrepWhere.addArgs(list.get(i)); + if (i < list.size() - 1) { + this.innerPrepWhere.whereAppend(", "); + } + } + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereExistsSql(Object sql) { + this.innerPrepWhere.whereAppend(" exists ( "); + this.innerPrepWhere.whereAppend(sql); + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } + + @Override + public InnerWhere whereNotExistsSql(Object sql) { + this.innerPrepWhere.whereAppend(" not exists ( "); + this.innerPrepWhere.whereAppend(sql); + this.innerPrepWhere.whereAppend(" ) "); + return this.innerPrepWhere; + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/InnerWhereImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/InnerWhereImpl.java new file mode 100644 index 0000000..d6b2fe7 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/InnerWhereImpl.java @@ -0,0 +1,55 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.InnerWhere; +import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; +import aiyh.utils.sqlUtil.whereUtil.Where; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 13:18 + * 实现类 + */ + +@Deprecated +public class InnerWhereImpl implements InnerWhere { + private final InnerWhereOperator whereOperator; + private final WhereImpl where; + + { + this.whereOperator = new InnerWhereOperatorImpl(this); + } + + public InnerWhereOperator getWhereOperator() { + return whereOperator; + } + + public InnerWhereImpl(WhereImpl where) { + this.where = where; + } + + @Override + public InnerWhereOperator whereAnd(String key) { + this.where.whereAppend(" and "); + this.where.whereAppend(key); + return this.whereOperator; + } + + @Override + public InnerWhereOperator whereOr(String key) { + this.where.whereAppend(" or "); + this.where.whereAppend(key); + return this.whereOperator; + } + + + @Override + public Where endInnerWhere() { + this.where.whereAppend(" ) "); + return this.where; + } + + public void whereAppend(Object key){ + this.where.whereAppend(key); + } + +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/InnerWhereOperatorImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/InnerWhereOperatorImpl.java new file mode 100644 index 0000000..db5f39d --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/InnerWhereOperatorImpl.java @@ -0,0 +1,277 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.InnerWhere; +import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; +import weaver.conn.RecordSet; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 13:23 + */ + +@Deprecated +public class InnerWhereOperatorImpl implements InnerWhereOperator { + private final InnerWhereImpl where; + private String DB_TYPE; + + { +// 获取当前数据库的类型 + this.DB_TYPE = (new RecordSet()).getDBType(); + } + + public InnerWhereOperatorImpl(InnerWhereImpl where) { + this.where = where; + } + + + @Override + public InnerWhere whereNull() { + this.where.whereAppend(" is null "); + return this.where; + } + + @Override + public InnerWhere whereNotNull() { + this.where.whereAnd(" is not null "); + return this.where; + } + + @Override + public InnerWhere whereEqual(Object value) { + this.where.whereAppend(" = "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere whereNotEqual(Object value) { + this.where.whereAppend(" <> "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere greaterThan(Object value) { + this.where.whereAppend(" > "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere lessThan(Object value) { + this.where.whereAppend(" < "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere greaterOrEqual(Object value) { + this.where.whereAppend(" >= "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere lessThanOrEqual(Object value) { + this.where.whereAppend(" <= "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere BetweenAnd(Object start, Object end) { + this.where.whereAppend(" between "); + this.where.whereAppend("'"); + this.where.whereAppend(start); + this.where.whereAppend("'"); + this.where.whereAppend(" and "); + this.where.whereAppend("'"); + this.where.whereAppend(end); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere whereIn(Object... values) { + this.where.whereAppend(" in ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereInList(List list) { + this.where.whereAppend(" in ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereNotIn(Object... values) { + this.where.whereAppend(" not in ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereNotInList(List list) { + this.where.whereAppend(" not in ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere inSql(Object sql) { + this.where.whereAppend(" in ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere notInSql(Object sql) { + this.where.whereAppend(" not in ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereLike(Object value) { + this.where.whereAppend(" like "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere whereNotLike(Object value) { + this.where.whereAppend(" not like "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public InnerWhere whereExists(Object... values) { + this.where.whereAppend(" exists ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereNotExists(Object... values) { + this.where.whereAppend(" not exists ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereExistsList(List list) { + this.where.whereAppend(" exists ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereNotExistsList(List list) { + this.where.whereAppend(" not exists ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereExistsSql(Object sql) { + this.where.whereAppend(" exists ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public InnerWhere whereNotExistsSql(Object sql) { + this.where.whereAppend(" not exists ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/PrepWhereImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/PrepWhereImpl.java new file mode 100644 index 0000000..ddbcf62 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/PrepWhereImpl.java @@ -0,0 +1,77 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.WhereOperator; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 13:18 + * 实现类 + */ + + +public class PrepWhereImpl implements Where { + private final WhereOperator whereOperator; + private final StringBuilder sqlBuilder; + private final List args; + private final InnerPrepWhereImpl innerWhere; + { + this.whereOperator = new PrepWhereOperatorImpl(this); + this.sqlBuilder = new StringBuilder("where 1 = 1 "); + this.args = new ArrayList<>(); + this.innerWhere = new InnerPrepWhereImpl(this); + } + + @Override + public WhereOperator whereAnd(String key) { + this.sqlBuilder.append(" and "); + this.sqlBuilder.append(key); + return this.whereOperator; + } + + @Override + public WhereOperator whereOr(String key) { + this.sqlBuilder.append(" or "); + this.sqlBuilder.append(key); + return this.whereOperator; + } + + @Override + public InnerWhereOperator andInnerWhere(String key){ + this.sqlBuilder.append(" and ( "); + this.sqlBuilder.append(key); + return this.innerWhere.getWhereOperator(); + } + + @Override + public InnerWhereOperator orInnerWhere(String key){ + this.sqlBuilder.append(" or ( "); + this.sqlBuilder.append(key); + return this.innerWhere.getWhereOperator(); + } + + + + public void whereAppend(Object key){ + this.sqlBuilder.append(key); + } + + public void addArgs(Object value){ + this.args.add(value); + } + + + @Override + public String getSql(){ + return this.sqlBuilder.toString().replace(" 1 = 1 and", "").replace(" 1 = 1 or",""); + } + + @Override + public List getArgs() { + return this.args; + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/PrepWhereOperatorImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/PrepWhereOperatorImpl.java new file mode 100644 index 0000000..2786487 --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/PrepWhereOperatorImpl.java @@ -0,0 +1,220 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import org.jetbrains.annotations.NotNull; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.WhereOperator; +import weaver.conn.RecordSet; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 13:23 + */ + + +public class PrepWhereOperatorImpl implements WhereOperator { + private final PrepWhereImpl where; + private String DB_TYPE; + + { +// 获取当前数据库的类型 + this.DB_TYPE = (new RecordSet()).getDBType(); + } + + public PrepWhereOperatorImpl(PrepWhereImpl where) { + this.where = where; + } + + + @Override + public Where whereNull() { + this.where.whereAppend(" is null "); + return this.where; + } + + @Override + public Where whereNotNull() { + this.where.whereAnd(" is not null "); + return this.where; + } + + @Override + public Where whereEqual(Object value) { + this.where.whereAppend(" = ? "); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where whereNotEqual(Object value) { + this.where.whereAppend(" <> ? "); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where greaterThan(Object value) { + this.where.whereAppend(" > ? "); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where lessThan(Object value) { + this.where.whereAppend(" < ? "); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where greaterOrEqual(Object value) { + this.where.whereAppend(" >= ? "); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where lessThanOrEqual(Object value) { + this.where.whereAppend(" <= ? "); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where BetweenAnd(Object start, Object end) { + this.where.whereAppend(" between ? "); + this.where.addArgs(start); + this.where.whereAppend(" and ? "); + this.where.addArgs(end); + return this.where; + } + + @Override + public Where whereIn(Object... values) { + this.where.whereAppend(" in ( "); + return getWhere(values); + } + + @NotNull + private Where getWhere(Object[] values) { + for (int i = 0; i < values.length; i++) { + this.where.whereAppend(" ? "); + this.where.addArgs(values[i]); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereInList(List list) { + this.where.whereAppend(" in ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend(" ? "); + this.where.addArgs(list.get(i)); + if (i < list.size() - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotIn(Object ...values) { + this.where.whereAppend(" not in ( "); + return getWhere(values); + } + + @Override + public Where whereNotInList(List list) { + this.where.whereAppend(" not in ( "); + return getWhere(list); + } + + @Override + public Where inSql(Object sql) { + this.where.whereAppend(" in ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where notInSql(Object sql) { + this.where.whereAppend(" not in ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereLike(Object value) { + this.where.whereAppend(" like ?"); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where whereNotLike(Object value) { + this.where.whereAppend(" not like ?"); + this.where.addArgs(value); + return this.where; + } + + @Override + public Where whereExists(Object ...values) { + this.where.whereAppend(" exists ( "); + return getWhere(values); + } + + @Override + public Where whereNotExists(Object ...values) { + this.where.whereAppend(" not exists ( "); + return getWhere(values); + } + + @Override + public Where whereExistsList(List list) { + this.where.whereAppend(" exists ( "); + return getWhere(list); + } + + @Override + public Where whereNotExistsList(List list) { + this.where.whereAppend(" not exists ( "); + return getWhere(list); + } + + @NotNull + private Where getWhere(List list) { + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend(" ? "); + this.where.addArgs(list.get(i)); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereExistsSql(Object sql) { + this.where.whereAppend(" exists ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotExistsSql(Object sql) { + this.where.whereAppend(" not exists ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/WhereImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/WhereImpl.java new file mode 100644 index 0000000..0a8b13b --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/WhereImpl.java @@ -0,0 +1,68 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.WhereOperator; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 13:18 + * 实现类 + */ + +@Deprecated +public class WhereImpl implements Where { + private final WhereOperator whereOperator; + private final StringBuilder sqlBuilder; + private final InnerWhereImpl innerWhere; + + { + this.whereOperator = new WhereOperatorImpl(this); + this.sqlBuilder = new StringBuilder("where 1 = 1 "); + this.innerWhere = new InnerWhereImpl(this); + } + + @Override + public WhereOperator whereAnd(String key) { + this.sqlBuilder.append(" and "); + this.sqlBuilder.append(key); + return this.whereOperator; + } + + @Override + public WhereOperator whereOr(String key) { + this.sqlBuilder.append(" or "); + this.sqlBuilder.append(key); + return this.whereOperator; + } + + @Override + public InnerWhereOperator andInnerWhere(String key){ + this.sqlBuilder.append(" and ( "); + this.sqlBuilder.append(key); + return innerWhere.getWhereOperator(); + } + + @Override + public InnerWhereOperator orInnerWhere(String key){ + this.sqlBuilder.append(" or ( "); + this.sqlBuilder.append(key); + return innerWhere.getWhereOperator(); + } + + public void whereAppend(Object key){ + this.sqlBuilder.append(key); + } + + @Override + public String getSql(){ + return this.sqlBuilder.toString().replace(" 1 = 1 and", "").replace(" 1 = 1 or",""); + } + + @Override + public List getArgs() { + return null; + } +} diff --git a/aiyh/utils/sqlUtil/whereUtil/impl/WhereOperatorImpl.java b/aiyh/utils/sqlUtil/whereUtil/impl/WhereOperatorImpl.java new file mode 100644 index 0000000..c2a967d --- /dev/null +++ b/aiyh/utils/sqlUtil/whereUtil/impl/WhereOperatorImpl.java @@ -0,0 +1,277 @@ +package aiyh.utils.sqlUtil.whereUtil.impl; + +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.WhereOperator; +import weaver.conn.RecordSet; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @date 2021/8/23 0023 13:23 + */ + +@Deprecated +public class WhereOperatorImpl implements WhereOperator { + private final WhereImpl where; + private String DB_TYPE; + + { +// 获取当前数据库的类型 + this.DB_TYPE = (new RecordSet()).getDBType(); + } + + public WhereOperatorImpl(WhereImpl where) { + this.where = where; + } + + + @Override + public Where whereNull() { + this.where.whereAppend(" is null "); + return this.where; + } + + @Override + public Where whereNotNull() { + this.where.whereAnd(" is not null "); + return this.where; + } + + @Override + public Where whereEqual(Object value) { + this.where.whereAppend(" = "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where whereNotEqual(Object value) { + this.where.whereAppend(" <> "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where greaterThan(Object value) { + this.where.whereAppend(" > "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where lessThan(Object value) { + this.where.whereAppend(" < "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where greaterOrEqual(Object value) { + this.where.whereAppend(" >= "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where lessThanOrEqual(Object value) { + this.where.whereAppend(" <= "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where BetweenAnd(Object start, Object end) { + this.where.whereAppend(" between "); + this.where.whereAppend("'"); + this.where.whereAppend(start); + this.where.whereAppend("'"); + this.where.whereAppend(" and "); + this.where.whereAppend("'"); + this.where.whereAppend(end); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where whereIn(Object... values) { + this.where.whereAppend(" in ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereInList(List list) { + this.where.whereAppend(" in ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotIn(Object... values) { + this.where.whereAppend(" not in ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotInList(List list) { + this.where.whereAppend(" not in ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where inSql(Object sql) { + this.where.whereAppend(" in ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where notInSql(Object sql) { + this.where.whereAppend(" not in ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereLike(Object value) { + this.where.whereAppend(" like "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where whereNotLike(Object value) { + this.where.whereAppend(" not like "); + this.where.whereAppend("'"); + this.where.whereAppend(value); + this.where.whereAppend("'"); + return this.where; + } + + @Override + public Where whereExists(Object... values) { + this.where.whereAppend(" exists ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotExists(Object... values) { + this.where.whereAppend(" not exists ( "); + for (int i = 0; i < values.length; i++) { + this.where.whereAppend("'"); + this.where.whereAppend(values[i]); + this.where.whereAppend("'"); + if (i < values.length - 1) { + this.where.whereAppend(","); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereExistsList(List list) { + this.where.whereAppend(" exists ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotExistsList(List list) { + this.where.whereAppend(" not exists ( "); + for (int i = 0; i < list.size(); i++) { + this.where.whereAppend("'"); + this.where.whereAppend(list.get(i)); + this.where.whereAppend("'"); + if (i < list.size() - 1) { + this.where.whereAppend(", "); + } + } + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereExistsSql(Object sql) { + this.where.whereAppend(" exists ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } + + @Override + public Where whereNotExistsSql(Object sql) { + this.where.whereAppend(" not exists ( "); + this.where.whereAppend(sql); + this.where.whereAppend(" ) "); + return this.where; + } +} diff --git a/aiyh/utils/zwl/common/CusBaseAction.java b/aiyh/utils/zwl/common/CusBaseAction.java new file mode 100644 index 0000000..3e72683 --- /dev/null +++ b/aiyh/utils/zwl/common/CusBaseAction.java @@ -0,0 +1,98 @@ +package aiyh.utils.zwl.common; + + +import weaver.common.StringUtil; +import weaver.conn.RecordSetTrans; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; +import weaver.workflow.request.RequestManager; + +/** + * 自定义Action实现类,添加通用参数 + * @author bleach + * @date 2019-10-09 + * @version 1.0 + */ +public abstract class CusBaseAction extends ToolUtil implements Action { + //当前类名称 + private String className = this.getClass().getName(); + + + protected RequestInfo requestInfo;//流程请求信息实体类 + protected RecordSetTrans rsts = null;//流程操作事务数据集 + protected String tablename;//当前流程表单名称 + protected String requestId;//流程请求ID + protected String workflowId;//流程类型ID + protected User user = null;//当前用户 + protected int creater = -1;//流程创建人ID + protected RequestManager reqManager = null; + protected String[] baseArray = new String[3]; + + protected abstract String handle();//Action 具体操作 + + /** + * 实现父类方法 + * + * @param requestInfo requestInfo对象 + * @return string类型的数据 + */ + @Override + public String execute(RequestInfo requestInfo) { + this.requestInfo = requestInfo; + + this.rsts = requestInfo.getRsTrans(); + if (this.rsts == null) { + rsts = new RecordSetTrans(); + } + this.initParam(); + return handle(); + } + + /** + * 初始化常用参数 + */ + private void initParam() { + this.requestId = StringUtil.vString(requestInfo.getRequestid()); + this.workflowId = StringUtil.vString(requestInfo.getWorkflowid()); + this.reqManager = requestInfo.getRequestManager(); + this.user = reqManager.getUser(); + this.creater = reqManager.getCreater(); + + this.tablename = requestInfo.getRequestManager().getBillTableName(); + + //通过系统请求管理类获取表单名称失败,再次查询 + if ("".equals(this.tablename)) { + tablename = getBillTableNameByWorkflowId(this.workflowId); + } + + //获取流程基础数据 + String select_base_sql = "select * from workflow_requestbase where requestid = ?"; + try { + if (rsts == null) { + rsts = new RecordSetTrans(); + } + + String request_name = ""; + String request_mark = ""; + + if (rsts.executeQuery(select_base_sql, requestId)) { + while (rsts.next()) { + request_name = Util.null2String(rsts.getString("requestname")); + request_mark = Util.null2String(rsts.getString("requestmark")); + } + } + + baseArray[0] = this.requestId; + baseArray[1] = request_name; + baseArray[2] = request_mark; + + this.writeNewDebuggerLog(className, "main_requestname:[" + request_name + "],main_requestmark:[" + request_mark + "],workflowid:[" + workflowId + "],requestid:[" + requestId + "],tablename:[" + tablename + "]"); + } catch (Exception e1) { + // TODO Auto-generated catch block + e1.printStackTrace(); + this.writeNewDebuggerLog(className, "get workflow dataset error:[" + e1.getMessage() + "/" + e1.toString() + "]"); + } + } +} diff --git a/aiyh/utils/zwl/common/ToolUtil.java b/aiyh/utils/zwl/common/ToolUtil.java new file mode 100644 index 0000000..26d3d21 --- /dev/null +++ b/aiyh/utils/zwl/common/ToolUtil.java @@ -0,0 +1,501 @@ +package aiyh.utils.zwl.common; + +import aiyh.utils.zwl.common.logging.Logger; +import aiyh.utils.zwl.common.logging.LoggerFactory; +import weaver.conn.ConnStatementDataSource; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.GCONST; +import weaver.general.TimeUtil; +import weaver.general.Util; + +import java.io.*; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map; + +/** + * 常用工具方法-公用类 + * @author bleach + * @date 2018-01-18 + * @version 2.0 Modify By Weilin.Zhu 添加日志级别 2018-12-05 + * @version 3.0 Modify By Weilin.Zhu 修改日志输出方式,使用log4j 2020-03-10 + */ +public class ToolUtil extends BaseBean { + + Logger logger = LoggerFactory.getLogger("cus"); + + /** + * 是否开启调试模式 + */ + boolean isDebug = true; + + /** + * 日志层级 (0:调试[Debugger] 1:警告[Warning] 2:错误[Error] + */ + private int logLevel = 2; + + private RecordSet rs = new RecordSet(); + + /** + * 构造方法 + */ + public ToolUtil() { + // TODO Auto-generated constructor stub + logger = LoggerFactory.getLogger("cus"); + //是否开启日志模式 + String isopen = getSystemParamValue("Debug_Mode"); + + //输出日志级别 + logLevel = Util.getIntValue(getSystemParamValue("Logger_Level"),-1); + + if("1".equals(isopen)){ + isDebug = true; + } + } + + /** + * 根据流程类型ID获取其对应的表单名称 + * @param workflowid 流程类型ID + * @return 字符串 + */ + public String getBillTableNameByWorkflowId(String workflowid){ + String tablename = ""; + + if(!"".equals(workflowid)){ + String select_data = "select tablename from workflow_bill where id in (select formid from workflow_base where id = ?)"; + + if(rs.executeQuery(select_data, workflowid)){ + if(rs.next()){ + tablename = Util.null2String(rs.getString(1)); + } + } + } + + return tablename; + } + + /** + * 查询满足模糊查询的所有标识集合 + * @param likestr 模糊条件 + * @return 处理结果 + */ + public Map getSystemParamValueMap(String likestr){ + return getSystemParamList(likestr); + } + + /** + * 查询系统中所有参数配置 + * @return 参数结果 + */ + public Map getAllSystemParamValue(){ + return getSystemParamList(""); + } + + + /** + * 获取参数集合 + * @param likestr 模糊查询的条件 + * @return 集合 + */ + private Map getSystemParamList(String likestr){ + Map param_map = new HashMap(); + + String select_sql = "select uuid,paramvalue from uf_systemconfig"; + + RecordSet rs = new RecordSet(); + + if(!"".equals(likestr)){ + select_sql += " where uuid like '%" + likestr + "%'"; + } + + if(rs.execute(select_sql)){ + while(rs.next()){ + String uuid = Util.null2String(rs.getString(1)); + String paramvalue = Util.null2String(rs.getString(2)); + + param_map.put(uuid, paramvalue); + } + } + + return param_map; + + } + + /** + * 获取系统参数设置值 + * @param uuid 参数标识 + * @return 返回配置值 + */ + public String getSystemParamValue(String uuid){ + String paramvalue = ""; + + if(!"".equals(uuid)){ + String select_sql = "select paramvalue from uf_systemconfig where uuid = ?"; + + RecordSet rs = new RecordSet(); + rs.executeQuery(select_sql,uuid); + if(rs.next()){ + paramvalue = Util.null2String(rs.getString(1)); + } + } + + return paramvalue; + } + + /** + * 用数据库值,根据规则转换,获取其最终结果 + * @param cus_sql 自定义转换的SQL + * @param value 参数值 + * @return 配置值 + */ + public String getValueByChangeRule(String cus_sql,String value){ + + return getValueByChangeRule(cus_sql,value,""); + } + + /** + * 用数据库值,根据规则转换,获取其最终结果 + * @param cus_sql 自定义转换的SQL + * @param value 参数值 + * @param requestid 流程请求ID + * @return 转换后的值 + */ + public String getValueByChangeRule(String cus_sql,String value,String requestid){ + + return getValueByChangeRule(cus_sql,value,requestid,0); + } + + /** + * 用数据库值,根据规则转换,获取其最终结果 + * @param cus_sql 自定义转换的SQL + * @param value 参数值 + * @param requestid 流程请求ID + * @param detailKeyvalue 明细表主键值 + * @return 值 + */ + public String getValueByChangeRule(String cus_sql,String value,String requestid,int detailKeyvalue){ + return getValueByChangeRule(cus_sql,value,requestid,detailKeyvalue,null); + } + + /** + * 用数据库值,根据规则转换,获取其最终结果 + * @param cus_sql 自定义转换的SQL + * @param value 参数值 + * @param requestid 流程请求ID + * @param detailKeyvalue 明细表主键值 + * @param datasourceid 外部数据源ID + * @return 处理后的值 + */ + public String getValueByChangeRule(String cus_sql,String value,String requestid,int detailKeyvalue,String datasourceid){ + String endValue = ""; + + cus_sql = cus_sql.replace(" ", " "); + + cus_sql = cus_sql.replace("{?dt.id}", String.valueOf(detailKeyvalue)); + + //参数进行替换 + String sqlString = cus_sql.replace("{?requestid}", requestid); + + sqlString = sqlString.replace("?", value); + + sqlString = ToDBC(sqlString); + try { + if(datasourceid != null && !"".equals(datasourceid)){ + ConnStatementDataSource csds = new ConnStatementDataSource(datasourceid); + + csds.setStatementSql(sqlString); + + csds.executeQuery(); + + if(csds.next()){ + endValue = Util.null2String(csds.getString(1)); + } + + csds.close(); + }else{ + + RecordSet rs = new RecordSet(); + if(rs.executeQuery(sqlString)){ + rs.next(); + + endValue = Util.null2String(rs.getString(1)); + } + } + } catch (SQLException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + return endValue; + } + + + /** + * 用数据库值,根据规则转换,获取其最终结果 + * @param cus_sql 自定义转换的SQL + * @param value 参数值 + * @return 给处理后的值 + */ + public String getValueByChangeRule_SingleParam(String cus_sql,String value){ + String endValue = ""; + + cus_sql = cus_sql.replace(" ", " "); + + RecordSet rs = new RecordSet(); + + if(rs.executeQuery(cus_sql,value)){ + rs.next(); + + endValue = Util.null2String(rs.getString(1)); + } + + return endValue; + } + + /** + * 全角转半角 + * @param input 字符 + * @return 转换后的字符 + */ + public String ToDBC(String input) { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == '\u3000') { + c[i] = ' '; + } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + return returnString; + } + /** + * 根据字段ID获取其对应的字段名称 + * @param fieldid 字段id + * @return 字段名称 + */ + public String getFieldNameByFieldid(int fieldid){ + if(fieldid > 0){ + return getFieldNameByFieldid(String.valueOf(fieldid)); + }else{ + return ""; + } + } + + /** + * 根据字段ID获取其对应的字段名称 + * @param fieldid 字段id + * @return 字段名称 + */ + public String getFieldNameByFieldid(String fieldid){ + String fieldname = ""; + + if(!"".equals(fieldid)){ + + if(fieldid.startsWith(",")){ + fieldid = fieldid.substring(1); + } + + if(fieldid.endsWith(",")){ + fieldid =fieldid.substring(0,fieldid.length() - 1); + } + + String select_sql = "select fieldname from workflow_billfield where id in (" + fieldid + ")"; + + RecordSet rs = new RecordSet(); + + if(rs.execute(select_sql)){ + while(rs.next()){ + + fieldname += "," + Util.null2String(rs.getString(1)); + } + } + } + + if(fieldname.startsWith(",")){ + fieldname = fieldname.substring(1); + } + + return fieldname; + } + + /** + * 输出调试日志 + * @param logstr 日志信息 + */ + public void writeDebuggerLog(String logstr){ + if(logLevel >= 0){ + logger.info(logstr); + } + } + + /** + * 输出调试日志 + * @param className 类名称 + * @param logstr 日志信息 + */ + public void writeDebuggerLog(String className,String logstr){ + if(logLevel >= 0){ + logger.info(logstr); + } + } + + /** + * 输出警告日志 + * @param logstr 日志信息 + */ + public void writeWarningLog(String logstr){ + if(logLevel >= 1){ + logger.warn(logstr); + } + } + + + /** + * 输出警告日志 + * @param className 类名称 + * @param logstr 日志信息 + */ + public void writeWarningLog(String className,String logstr){ + if(logLevel >= 1){ + logger.warn(logstr); + } + } + + /** + * 输出错误日志 + * @param logstr 日志信息 + */ + public void writeErrorLog(String logstr){ + logger.error(logstr); + } + + + + /** + * 输出错误日志 + * @param className 类名称 + * @param logstr 日志信息 + */ + public void writeErrorLog(String className,String logstr){ + logger.error(logstr); + } + + + /** + * 日志输出 + * @param logstr 日志字符串 + */ + public void writeDebugLog(Object logstr){ + logger.info(logstr); + } + + /** + * 日志输出 + * @param logstr 日志字符串 + * @param o 对象 + */ + public void writeNewDebuggerLog(Object o,Object logstr){ + logger.info(logstr); + } + + /** + * 写入同步的日志文件 + * @param o 日志字符串 + * @param s 日志字符串 + * @deprecated 该写入文件的日志输出方式删除 + */ + protected void writeNewLog(String o,String s){ + try { + String filename = "cus_" + TimeUtil.getCurrentDateString() + "_ecology.log"; + + + String folder = GCONST.getRootPath() + "log" + File.separatorChar + "cus"; + + //this.writeDebugLog("folder:[" + folder + "]"); + + File f = new File(folder); + + // 创建文件夹 + if (!f.exists()) { + f.mkdirs(); + } + + f = new File(folder + File.separatorChar + filename); + //文件不存在,则直接创建 + if(!f.exists()){ + f.createNewFile(); + } + + BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f, true))); + + out.write("[" + o + "][" + TimeUtil.getCurrentTimeString() + "]:"+ s + "\r\n"); + + //关闭写入流 + out.close(); + + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + writeDebugLog("创建日志文件存在异常:[" + e.getMessage() + "/" + e.toString() + "]"); + } + } + + /** + * 根据建模模块ID获取其对应的表单名称 + * @param modeid 模块ID + * @return 建模表单名称 + */ + public String getTableNameByModeID(int modeid){ + String modeTableName = ""; + + if(modeid > 0){ + String select_sql = "select tablename from modeinfo m left join workflow_bill wb on m.formid = wb.id " + + "left join ModeFormExtend me on me.formid = wb.id where m.id = ?"; + + RecordSet rs = new RecordSet(); + + if(rs.executeQuery(select_sql,modeid)){ + if(rs.next()){ + modeTableName = Util.null2String(rs.getString(1)); + } + } + } + + return modeTableName; + } + + /** + * 根据流程请求ID获取其对应的表单名称 + * @param requestid 流程请求id + * @return 获取表名 + */ + public String getTableNameByRequestID(int requestid) { + String billTableName = ""; + if(requestid > 0) { + String select_sql = "select wbi.tablename from workflow_requestbase wr inner join workflow_base wb on wr.workflowid = wb.id " + + "inner join workflow_bill wbi on wbi.id = wb.formid where wr.requestid = ?"; + + RecordSet rs = new RecordSet(); + + if(rs.executeQuery(select_sql,requestid)){ + if(rs.next()){ + billTableName = Util.null2String(rs.getString(1)); + } + } + + } + return billTableName; + } + + /** + * @return the isDebug + */ + public boolean isDebug() { + return isDebug; + } +} diff --git a/aiyh/utils/zwl/common/logging/Log4JLogger.java b/aiyh/utils/zwl/common/logging/Log4JLogger.java new file mode 100644 index 0000000..83d4f12 --- /dev/null +++ b/aiyh/utils/zwl/common/logging/Log4JLogger.java @@ -0,0 +1,89 @@ +package aiyh.utils.zwl.common.logging; + +/** + * 写日志(log4j) + * @date 2020-03-10 + * @version 1.0 + */ +public class Log4JLogger implements Logger { + + private org.apache.log4j.Logger log; + //类名 + private String classname; + + @Override + public String getClassname() { + return classname; + } + + @Override + public void setClassname(String classname) { + this.classname = classname; + } + + @Override + public boolean isDebugEnabled() { + return log.isDebugEnabled(); + } + + @Override + public boolean isInfoEnabled() { + return log.isInfoEnabled(); + } + + @Override + public void debug(Object message) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.debug(classname+"."+method+"() - "+message); + } + + @Override + public void debug(Object message, Throwable exception) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.debug(classname+"."+method+"() - "+message, exception); + } + + @Override + public void info(Object message) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.info(classname+"."+method+"() - "+message); + } + + @Override + public void info(Object message, Throwable exception) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.info(classname+"."+method+"() - "+message, exception); + } + + @Override + public void warn(Object message) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.warn(classname+"."+method+"() - "+message); + } + + @Override + public void warn(Object message, Throwable exception) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.warn(classname+"."+method+"() - "+message, exception); + } + + @Override + public void error(Object message) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.error(classname+"."+method+"() - "+message); + } + + @Override + public void error(Object message, Throwable exception) { + String method = Thread.currentThread().getStackTrace()[2].getMethodName(); + log.error(classname+"."+method+"() - "+message, exception); + } + + @Override + public void init(String name) { + if("".equals(name)) { + name = "cuslog"; + } + log = org.apache.log4j.Logger.getLogger(name); + } +} diff --git a/aiyh/utils/zwl/common/logging/Logger.java b/aiyh/utils/zwl/common/logging/Logger.java new file mode 100644 index 0000000..4d987de --- /dev/null +++ b/aiyh/utils/zwl/common/logging/Logger.java @@ -0,0 +1,78 @@ +package aiyh.utils.zwl.common.logging; + +/** + * 日志接口(写) + * + * @author zwl + * @date 2020-03-10 + */ +public interface Logger { + + public boolean isDebugEnabled(); + + /** + * 打印debug日志 + * @param message 消息 + */ + public void debug(Object message); + + /** + * 打印debug日志 + * @param message 消息 + * @param exception 异常 + */ + public void debug(Object message, Throwable exception); + + public boolean isInfoEnabled(); + + /** + * 打印info日志 + * @param message 消息 + */ + public void info(Object message); + + + /** + * 打印info日志 + * @param message 消息 + * @param exception 异常 + */ + public void info(Object message, Throwable exception); + + /** + * 打印warn日志 + * @param message 消息 + */ + public void warn(Object message); + + /** + * 打印warn日志 + * @param message 消息 + * @param exception 异常 + */ + public void warn(Object message, Throwable exception); + + /** + * 打印error日志 + * @param message 错误消息 + */ + public void error(Object message); + + /** + * 打印error日志 + * @param message 消息 + * @param exception 异常 + */ + public void error(Object message, Throwable exception); + + public String getClassname(); + + public void setClassname(String classname); + + /** + * 初始化 + * + * @param name logger名称 + */ + public void init(String name); +} diff --git a/aiyh/utils/zwl/common/logging/LoggerFactory.java b/aiyh/utils/zwl/common/logging/LoggerFactory.java new file mode 100644 index 0000000..715dd32 --- /dev/null +++ b/aiyh/utils/zwl/common/logging/LoggerFactory.java @@ -0,0 +1,49 @@ +package aiyh.utils.zwl.common.logging; + + +/** + * 日志工厂类 + * + * @author zwl + * @date 2020-03-10 + * @version 1.0 + */ +public class LoggerFactory { + private static final String loggerName = "cus"; + + public static Logger getLogger(String LogName, String clazz) { + if("".equals(LogName)) { + LogName = loggerName; + } + Logger logger = new Log4JLogger(); + logger.setClassname(clazz); + logger.init(LogName); + return logger; + } + + /** + * 获取指定类的logger对象 + * @param clazz 类 + * @return 日志对象 + */ + public static Logger getLogger(Class clazz) { + return getLogger(loggerName,clazz.getCanonicalName()); + } + + /** + * 获取指定类的logger对象 + * @param className 类名 + * @return 日志对象 + */ + public static Logger getLogger(String className) { + return getLogger(loggerName,className); + } + /** + * 获取未指定指定类的logger对象 + * @return 日志对象 + */ + public static Logger getLogger() { + String className = Thread.currentThread().getStackTrace()[2].getClassName(); + return getLogger(loggerName, className); + } +} diff --git a/com/.DS_Store b/com/.DS_Store new file mode 100644 index 0000000..572743a Binary files /dev/null and b/com/.DS_Store differ diff --git a/com/api/aiyh_guijiu.zip b/com/api/aiyh_guijiu.zip new file mode 100644 index 0000000..2a7664b Binary files /dev/null and b/com/api/aiyh_guijiu.zip differ diff --git a/com/api/aiyh_guijiu/dao/ConflictWorkflowDao.java b/com/api/aiyh_guijiu/dao/ConflictWorkflowDao.java new file mode 100644 index 0000000..7edfa63 --- /dev/null +++ b/com/api/aiyh_guijiu/dao/ConflictWorkflowDao.java @@ -0,0 +1,212 @@ +package com.api.aiyh_guijiu.dao; + +import aiyh.utils.Util; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_guijiu.pojo.UfWorkflowConflicDt1DTO; +import com.api.aiyh_guijiu.pojo.WorkflowBaseInfoDTO; +import com.api.aiyh_guijiu.pojo.WorkflowConfigDTO; +import com.api.aiyh_guijiu.vo.ConfigInfoVo; +import org.h2.util.StringUtils; +import weaver.conn.RecordSet; +import weaver.workflow.workflow.WorkflowVersion; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/10 0010 11:27 + * 查询配置信息 + */ + + +public class ConflictWorkflowDao { + + RecordSet rs = new RecordSet(); + ToolUtil toolUtil = new ToolUtil(); + + public List queryConfig(String workflowId) { + + String query = "select * from uf_workflow_conflic_dt1 " + + "where workflow_type in (select id from workflow_base " + + "where activeVersionID in (select activeVersionID " + + "from workflow_base where id = ?) or id = ?)"; + rs.executeQuery(query, workflowId, workflowId); + UfWorkflowConflicDt1DTO ufWorkflowConflicDt1DTO = Util.recordeSet2Entity(rs, UfWorkflowConflicDt1DTO.class, true); + if (ufWorkflowConflicDt1DTO == null) { + return null; + } +// String ids = WorkflowVersion.getVersionStringByWfid(workflowId); + query = "select dt.id,dt.workflow_type,main.enable,wf.tablename,wf.fieldname start_date_field, " + + "wf1.fieldname start_time_field,wf2.fieldname end_date_field,wf4.fieldname hrm_field, " + + "wf3.fieldname end_time_field from uf_workflow_conflic main " + + "left join uf_workflow_conflic_dt1 dt on dt.mainid = main.id " + + "left join workflow_field_table_view wf on wf.id = dt.start_date_field " + + "left join workflow_field_table_view wf1 on wf1.id = dt.start_time_field " + + "left join workflow_field_table_view wf2 on wf2.id = dt.end_date_field " + + "left join workflow_field_table_view wf3 on wf3.id = dt.end_time_field " + + "left join workflow_field_table_view wf4 on wf4.id = dt.hrm_field " + + "where main.id = ? and main.enable = 0"; +// and dt.workflow_type not in (" + ids + ") + rs.executeQuery(query, ufWorkflowConflicDt1DTO.getMainid()); + return Util.recordeSet2Array(rs, WorkflowConfigDTO.class, true); + } + + public List queryConflict(WorkflowConfigDTO workflowConfigDTO, String startTime + , String startDate, String endTime, String endDate, String hrmId, String requestId) { +// (a,b)(c,d) == > (2021-09-10 12:00:23 , 2021-09-10 20:00:23) (2021-09-10 15:00:23 , 2021-09-10 19:00:23) +// select * from table where (hrm = ? or hrm like "%?%") and a <= d and b >= c and requestid != requestId; + String query = "select id from " + workflowConfigDTO.getTablename() + + " where (',' || " + workflowConfigDTO.getHrmField() +" || ',') like ('%,' || '" + hrmId + "' || ',%') " + + " and requestid != " + requestId + " and " + workflowConfigDTO.getStartDateField() + " is not null " + + " and " + workflowConfigDTO.getEndDateField() + " is not null" + + (StringUtils.isNullOrEmpty(workflowConfigDTO.getStartTimeField()) ? "" : " and " + workflowConfigDTO.getStartTimeField() + " is not null") + + (StringUtils.isNullOrEmpty(workflowConfigDTO.getEndTimeField()) ? "" : " and " + workflowConfigDTO.getEndTimeField() + " is not null"); + rs.executeQuery(query); + List integers = Util.recordeSet2Array(rs, String.class); + String ids = String.join(",", integers); + if(StringUtils.isNullOrEmpty(ids)){ + ids = "-1"; + } + query = "select * from " + + workflowConfigDTO.getTablename() + + " where to_date(concat(" + + workflowConfigDTO.getStartDateField() + + " || ' ' ," + + (StringUtils.isNullOrEmpty(workflowConfigDTO.getStartTimeField()) ? "'00:00:00'" : workflowConfigDTO.getStartTimeField()) + + "), 'yyyy-mm-dd hh24:mi:ss') <= to_date('" + + endDate + + " " + + (StringUtils.isNullOrEmpty(endTime) ? "23:59:59" : endTime) + + "', 'yyyy-mm-dd hh24:mi:ss')" + + " and to_date(concat(" + + workflowConfigDTO.getEndDateField() + + " || ' ' ," + + (StringUtils.isNullOrEmpty(workflowConfigDTO.getEndTimeField()) ? "'23:59:59'" : workflowConfigDTO.getEndTimeField()) + + "), 'yyyy-mm-dd hh24:mi:ss') >= to_date('" + + startDate + + " " + + (StringUtils.isNullOrEmpty(startTime) ? "00:00:00" : startTime) + + "', 'yyyy-mm-dd hh24:mi:ss') " + + " and id in (" + ids + ")"; + /*query = "select * from " + + workflowConfigDTO.getTablename() + + " where to_date(concat(" + + workflowConfigDTO.getStartDateField() + + " || ' ' ," + + (StringUtils.isNullOrEmpty(workflowConfigDTO.getStartTimeField()) ? "'00:00:00'" : workflowConfigDTO.getStartTimeField()) + + "), 'yyyy-mm-dd hh24:mi:ss') <= to_date('" + + endDate + + " " + + (StringUtils.isNullOrEmpty(endTime) ? "23:59:59" : endTime) + + "', 'yyyy-mm-dd hh24:mi:ss')" + + " and to_date(concat(" + + workflowConfigDTO.getEndDateField() + + " || ' ' ," + + (StringUtils.isNullOrEmpty(workflowConfigDTO.getEndTimeField()) ? "'23:59:59'" : workflowConfigDTO.getEndTimeField()) + + "), 'yyyy-mm-dd hh24:mi:ss') >= to_date('" + + startDate + + " " + + (StringUtils.isNullOrEmpty(startTime) ? "00:00:00" : startTime) + + "', 'yyyy-mm-dd hh24:mi:ss') " + + " and " + " (',' || " + workflowConfigDTO.getHrmField() + " || ',') like " + " ('%,' || '" + hrmId + "' || ',%') " + + " and requestid != " + requestId;*/ + /*hrmId + + " in (select regexp_substr(hrm_str, '[^,]+', 1, level) " + + "from dual connect by regexp_substr(hrm_str, '[^,]+', 1, level) is not null)" + + " and requestid != " + requestId;*/ +// toolUtil.writeErrorLog(query); + +// System.out.println(query); + /*query = "select * from " + workflowConfigDTO.getTablename() + " where to_date(concat(" + + workflowConfigDTO.getStartDateField() + " || ' ' ," + workflowConfigDTO.getStartTimeField() + + "), 'yyyy-mm-dd hh24:mi:ss') <= to_date(concat(" + + endDate + " " + endTime + "), 'yyyy-mm-dd hh24:mi:ss')" + + " and " + workflowConfigDTO.getEndDateField() + " || ' ' ," + workflowConfigDTO.getEndTimeField() + + "), 'yyyy-mm-dd hh24:mi:ss') >= to_date(concat(" + + startDate + " " + startTime + "), 'yyyy-mm-dd hh24:mi:ss') " + hrmId + + " and in (select regexp_substr(hrm_str, '[^,]+', 1, level) " + + "from dual connect by regexp_substr(hrm_str, '[^,]+', 1, level) is not null)";*/ + try { + rs.executeQuery(query); + }catch (Exception e){ + toolUtil.writeErrorLog("查询重复的流程错误,错误信息:" + e); + } + List list = new ArrayList<>(); + while(rs.next()){ +// 存在时间段冲突的数据,查询冲突数据的流程信息 + RecordSet rsT = new RecordSet(); + requestId = Util.null2String(rs.getString("requestid")); + query = "select distinct wrb.requestid,wrb.workflowid,wrb.requestnamenew,wb.workflowname, " + + "(case when hr.lastname is null and wrb.creater != 1 then '未知' " + + "when wrb.creater = 1 then '系统管理员' else hr.lastname end) creater, " + + "wrb.createdate,wrb.createtime from workflow_requestbase wrb " + + "left join HrmResource hr on wrb.creater = hr.id " + + "left join workflow_base wb on wb.id = wrb.workflowid " + + "where wrb.requestid = ?"; + rsT.executeQuery(query, requestId); + WorkflowBaseInfoDTO workflowBaseInfoDTO = Util.recordeSet2Entity(rsT, WorkflowBaseInfoDTO.class, true); + list.add(workflowBaseInfoDTO); + } +// if (rs.next()) { +// toolUtil.writeDebuggerLog("into next;"); +//// 存在时间段冲突的数据,查询冲突数据的流程信息 +// requestId = Util.null2String(rs.getString("requestid")); +// query = "select wrb.workflowid,wrb.requestid,wrb.requestnamenew,wb.workflowname, " + +// "(case when hr.lastname is null and wrb.creater != 1 then '未知' " + +// "when wrb.creater = 1 then '系统管理员' else hr.lastname end) creater, " + +// "wrb.createdate,wrb.createtime from workflow_requestbase wrb " + +// "left join HrmResource hr on wrb.creater = hr.id " + +// "left join workflow_base wb on wb.id = wrb.workflowid " + +// "where wrb.requestid = ?"; +// rs.executeQuery(query, requestId); +// return Util.recordeSet2Entity(rs, WorkflowBaseInfoDTO.class, true); +// } + if(list.size() == 0){ + return null; + } + return list; + } + + public List getWatermarkConfig(String workflowId) { + String query = "select id from workflow_base " + + "where activeVersionID in (select activeVersionID " + + "from workflow_base where id = ?) or id = ?"; + rs.executeQuery(query, workflowId, workflowId); + return Util.recordeSet2Array(rs, Integer.class); + } + + public WorkflowConfigDTO getWorkflowConfig(String workflowId){ + String query = "select * from uf_workflow_conflic_dt1 " + + "where workflow_type in (select id from workflow_base " + + "where activeVersionID in (select activeVersionID " + + "from workflow_base where id = ?) or id = ?)"; + rs.executeQuery(query, workflowId, workflowId); + UfWorkflowConflicDt1DTO ufWorkflowConflicDt1DTO = Util.recordeSet2Entity(rs, UfWorkflowConflicDt1DTO.class, true); + if (ufWorkflowConflicDt1DTO == null) { + return null; + } + String ids = WorkflowVersion.getVersionStringByWfid(workflowId); + query = "select dt.id,main.enable,wf.tablename,wf.fieldname start_date_field, " + + "wf1.fieldname start_time_field,wf2.fieldname end_date_field,wf4.fieldname hrm_field, " + + "wf3.fieldname end_time_field from uf_workflow_conflic main " + + "left join uf_workflow_conflic_dt1 dt on dt.mainid = main.id " + + "left join workflow_field_table_view wf on wf.id = dt.start_date_field " + + "left join workflow_field_table_view wf1 on wf1.id = dt.start_time_field " + + "left join workflow_field_table_view wf2 on wf2.id = dt.end_date_field " + + "left join workflow_field_table_view wf3 on wf3.id = dt.end_time_field " + + "left join workflow_field_table_view wf4 on wf4.id = dt.hrm_field " + + "where main.id = ? and main.enable = 0 and dt.workflow_type in (" + ids + ")"; + rs.executeQuery(query, ufWorkflowConflicDt1DTO.getMainid()); + return Util.recordeSet2Entity(rs,WorkflowConfigDTO.class,true); + } + + + public ConfigInfoVo getConfigInfo(String tableName,String workflowId){ + String query = "select cf.workflow_type ,cf.workflow_node ,cf.enable ,wf.fieldname workflow_field from " + tableName + + " cf left join workflow_field_table_view wf on wf.id = cf.workflow_field " + + " where cf.workflow_type = ?"; + rs.executeQuery(query,workflowId); + return Util.recordeSet2Entity(rs, ConfigInfoVo.class, true); + } +} diff --git a/com/api/aiyh_guijiu/pojo/UfWorkflowConflicDt1DTO.java b/com/api/aiyh_guijiu/pojo/UfWorkflowConflicDt1DTO.java new file mode 100644 index 0000000..926fac0 --- /dev/null +++ b/com/api/aiyh_guijiu/pojo/UfWorkflowConflicDt1DTO.java @@ -0,0 +1,83 @@ + +package com.api.aiyh_guijiu.pojo; + + +public class UfWorkflowConflicDt1DTO { + + private int id; + private int mainid; + private int workflowType; + private String startDateField; + private String startTimeField; + private String endDateField; + private String endTimeField; + + public void setId(int id){ + this.id = id; + } + + public void setMainid(int mainid){ + this.mainid = mainid; + } + + public void setWorkflowType(int workflowType){ + this.workflowType = workflowType; + } + + public void setStartDateField(String startDateField){ + this.startDateField = startDateField; + } + + public void setStartTimeField(String startTimeField){ + this.startTimeField = startTimeField; + } + + public void setEndDateField(String endDateField){ + this.endDateField = endDateField; + } + + public void setEndTimeField(String endTimeField){ + this.endTimeField = endTimeField; + } + + public int getId(){ + return this.id; + } + + public int getMainid(){ + return this.mainid; + } + + public int getWorkflowType(){ + return this.workflowType; + } + + public String getStartDateField(){ + return this.startDateField; + } + + public String getStartTimeField(){ + return this.startTimeField; + } + + public String getEndDateField(){ + return this.endDateField; + } + + public String getEndTimeField(){ + return this.endTimeField; + } + + @Override + public String toString() { + return "UfWorkflowConflicDt1DTO{" + + "id='" + id + '\'' + + ", mainid='" + mainid + '\'' + + ", workflowType='" + workflowType + '\'' + + ", startDateField='" + startDateField + '\'' + + ", startTimeField='" + startTimeField + '\'' + + ", endDateField='" + endDateField + '\'' + + ", endTimeField='" + endTimeField + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/com/api/aiyh_guijiu/pojo/WorkflowBaseInfoDTO.java b/com/api/aiyh_guijiu/pojo/WorkflowBaseInfoDTO.java new file mode 100644 index 0000000..9f38ea5 --- /dev/null +++ b/com/api/aiyh_guijiu/pojo/WorkflowBaseInfoDTO.java @@ -0,0 +1,83 @@ + +package com.api.aiyh_guijiu.pojo; + + +public class WorkflowBaseInfoDTO { + + private int workflowid; + private int requestid; + private String requestnamenew; + private String workflowname; + private String creater; + private String createdate; + private String createtime; + + public void setWorkflowid(int workflowid){ + this.workflowid = workflowid; + } + + public void setRequestid(int requestid){ + this.requestid = requestid; + } + + public void setRequestnamenew(String requestnamenew){ + this.requestnamenew = requestnamenew; + } + + public void setWorkflowname(String workflowname){ + this.workflowname = workflowname; + } + + public void setCreater(String creater){ + this.creater = creater; + } + + public void setCreatedate(String createdate){ + this.createdate = createdate; + } + + public void setCreatetime(String createtime){ + this.createtime = createtime; + } + + public int getWorkflowid(){ + return this.workflowid; + } + + public int getRequestid(){ + return this.requestid; + } + + public String getRequestnamenew(){ + return this.requestnamenew; + } + + public String getWorkflowname(){ + return this.workflowname; + } + + public String getCreater(){ + return this.creater; + } + + public String getCreatedate(){ + return this.createdate; + } + + public String getCreatetime(){ + return this.createtime; + } + + @Override + public String toString() { + return "WorkflowBaseInfoDTO{" + + "workflowid='" + workflowid + '\'' + + ", requestid='" + requestid + '\'' + + ", requestnamenew='" + requestnamenew + '\'' + + ", workflowname='" + workflowname + '\'' + + ", creater='" + creater + '\'' + + ", createdate='" + createdate + '\'' + + ", createtime='" + createtime + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/com/api/aiyh_guijiu/pojo/WorkflowConfigDTO.java b/com/api/aiyh_guijiu/pojo/WorkflowConfigDTO.java new file mode 100644 index 0000000..c27e94c --- /dev/null +++ b/com/api/aiyh_guijiu/pojo/WorkflowConfigDTO.java @@ -0,0 +1,103 @@ + +package com.api.aiyh_guijiu.pojo; + + +public class WorkflowConfigDTO { + + private int id; + private int enable; + private int workflowType; + private String tablename; + private String startDateField; + private String startTimeField; + private String endDateField; + private String endTimeField; + private String hrmField; + + public int getWorkflowType() { + return workflowType; + } + + public void setWorkflowType(int workflowType) { + this.workflowType = workflowType; + } + + public String getHrmField() { + return hrmField; + } + + public void setHrmField(String hrmField) { + this.hrmField = hrmField; + } + + public void setId(int id){ + this.id = id; + } + + public void setEnable(int enable){ + this.enable = enable; + } + + public void setTablename(String tablename){ + this.tablename = tablename; + } + + public void setStartDateField(String startDateField){ + this.startDateField = startDateField; + } + + public void setStartTimeField(String startTimeField){ + this.startTimeField = startTimeField; + } + + public void setEndDateField(String endDateField){ + this.endDateField = endDateField; + } + + public void setEndTimeField(String endTimeField){ + this.endTimeField = endTimeField; + } + + public int getId(){ + return this.id; + } + + public int getEnable(){ + return this.enable; + } + + public String getTablename(){ + return this.tablename; + } + + public String getStartDateField(){ + return this.startDateField; + } + + public String getStartTimeField(){ + return this.startTimeField; + } + + public String getEndDateField(){ + return this.endDateField; + } + + public String getEndTimeField(){ + return this.endTimeField; + } + + @Override + public String toString() { + return "WorkflowConfigDTO{" + + "id=" + id + + ", enable=" + enable + + ", workflowType=" + workflowType + + ", tablename='" + tablename + '\'' + + ", startDateField='" + startDateField + '\'' + + ", startTimeField='" + startTimeField + '\'' + + ", endDateField='" + endDateField + '\'' + + ", endTimeField='" + endTimeField + '\'' + + ", hrmField='" + hrmField + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/com/api/aiyh_guijiu/service/WorkflowQueueService.java b/com/api/aiyh_guijiu/service/WorkflowQueueService.java new file mode 100644 index 0000000..2c3bfe4 --- /dev/null +++ b/com/api/aiyh_guijiu/service/WorkflowQueueService.java @@ -0,0 +1,464 @@ +package com.api.aiyh_guijiu.service; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import aiyh.utils.fileUtil.WatermarkPoint; +import aiyh.utils.fileUtil.WatermarkPointEnum; +import aiyh.utils.fileUtil.WritWatermark; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_guijiu.dao.ConflictWorkflowDao; +import com.api.aiyh_guijiu.pojo.WorkflowBaseInfoDTO; +import com.api.aiyh_guijiu.pojo.WorkflowConfigDTO; +import com.api.aiyh_guijiu.vo.ConfigInfoVo; +import com.api.aiyh_guijiu.vo.PicPsVO; +import com.api.workflow.constant.RequestAuthenticationConstant; +import com.drew.imaging.ImageMetadataReader; +import com.drew.imaging.ImageProcessingException; +import com.drew.metadata.Directory; +import com.drew.metadata.Metadata; +import com.drew.metadata.Tag; +import com.engine.workflow.biz.requestForm.FileBiz; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import org.h2.util.StringUtils; +import weaver.conn.RecordSet; +import weaver.docs.docs.DocManager; +import weaver.file.ImageFileManager; +import weaver.hrm.User; + +import java.awt.*; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.stream.Collectors; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/7 0007 12:43 + * workflow queue + */ + + +public class WorkflowQueueService { + ToolUtil toolUtil = new ToolUtil(); + ObjectMapper mapper = new ObjectMapper(); + ConflictWorkflowDao conflictWorkflowDao = new ConflictWorkflowDao(); + + + /** + * 查询ps配置参数 + * + * @return 配置信息 + */ + public String getPicIsPsConfig(String workflowId) { + ConfigInfoVo ufPsNodeConfig = conflictWorkflowDao.getConfigInfo("uf_ps__node_config", workflowId); + if (ufPsNodeConfig == null) { + return ApiResult.successNoData(); + } + return ApiResult.success(ufPsNodeConfig); +// String picPsWorkflowId = toolUtil.getSystemParamValue("PIC_PS_WORKFLOW_ID"); +// if (StringUtils.isNullOrEmpty(picPsWorkflowId)) { +// return ApiResult.successNoData(); +// } +// String nodeId = toolUtil.getSystemParamValue("PIC_PS_NODE_ID"); +// String fieldName = toolUtil.getSystemParamValue("PIC_PS_FIELD_NAME"); +// List watermarkConfig = conflictWorkflowDao.getWatermarkConfig(picPsWorkflowId); +// Map map = new HashMap<>(); +// map.put("workflowIds", watermarkConfig); +// map.put("nodeId", nodeId); +// map.put("fieldName", fieldName); +// return ApiResult.success(map); + } + + /** + * 查询图片是否经过ps + * + * @param imgIds 需要查询的图片的id + * @return 是否进行ps的分析结果 + */ + public String getPicIsPs(String imgIds) { +// 通过docId查询到物理文件的id + String query = "select imagefileid,imagefilename,docid from docimagefile where docid in ( " + imgIds + ")"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query); + List list = new ArrayList<>(); + while (rs.next()) { + int id = rs.getInt(1); + String name = rs.getString(2); + int docId = rs.getInt(3); + PicPsVO picPsVO = PicPsVO.PicPsVOBuilder.aPicPsVO() + .docId(docId) + .fileId(id) + .fileName(name) + .build(); +// 通过物理文件的id进行获取对应的输入流信息。 +// ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(id); + try { +// 获取媒体数据 + Metadata metadata = ImageMetadataReader.readMetadata(inputStreamById); +// 遍历Directory对象,每个对象里面包含标签 + for (Directory directory : metadata.getDirectories()) { + String directoryName = directory.getName(); + System.out.println(directory); + if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName) + || directoryName.contains("Adobe")) { + if (picPsVO.getScore() > 90) { + continue; + } + picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!"); + picPsVO.setScore(90); + } + String model = ""; + for (Tag tag : directory.getTags()) { + System.out.println(tag); + if (tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())) { + picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!"); + picPsVO.setScore(70); + if (picPsVO.getScore() > 70) { + continue; + } + } + if ("Software".equalsIgnoreCase(tag.getTagName())) { + if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase()) + || tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) { + picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!"); + picPsVO.setScore(100); + } else { + if (picPsVO.getScore() > 70) { + continue; + } + picPsVO.setDescribe("图片经过" + tag.getDescription() + "软件,注意审核!"); + picPsVO.setScore(70); + } + if (!StringUtils.isNullOrEmpty(model) && picPsVO.getDescribe().contains(model)) { + picPsVO.setDescribe(""); + picPsVO.setScore(-1); + } + } + if ("Model".equalsIgnoreCase(tag.getTagName())) { + model = tag.getDescription(); + if (!StringUtils.isNullOrEmpty(picPsVO.getDescribe())) { + if (picPsVO.getDescribe().contains(tag.getDescription())) { + picPsVO.setDescribe(""); + picPsVO.setScore(-1); + } + } + } + if ("User Comment".equalsIgnoreCase(tag.getTagName())) { + try { + if (picPsVO.getScore() > 80) { + continue; + } + com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription()); + picPsVO.setDescribe("图片经过手机端图片处理软件,软件未知!请注意审核!"); + picPsVO.setScore(80); + } catch (Exception e) { + if (picPsVO.getScore() > 40) { + continue; + } + picPsVO.setDescribe("图片可能经过未知软件!请注意审核!"); + picPsVO.setScore(40); + } + } + } + } + } catch (ImageProcessingException | IOException e) { + e.printStackTrace(); + } + list.add(picPsVO); + } + List collect = list.stream().filter(item -> item.getScore() > 0).collect(Collectors.toList()); + return ApiResult.success(collect); + } + + public String getWorkflowQueue(Map param) { + String workflowId = param.get("workflowId"); + String requestId = param.get("requestId"); + List watermarkConfig = conflictWorkflowDao.getWatermarkConfig(workflowId); + List workflowConfigDTOS = conflictWorkflowDao.queryConfig(workflowId); + if (workflowConfigDTOS == null || workflowConfigDTOS.size() == 0) { + return ApiResult.successNoData(); + } + WorkflowConfigDTO nowConfig = workflowConfigDTOS.stream().filter(item -> { + AtomicBoolean flag = new AtomicBoolean(false); + watermarkConfig.forEach(id -> { + if (id == item.getWorkflowType()) { + flag.set(true); + } + }); + return flag.get(); + }).collect(Collectors.toList()).get(0); + +// 获取当前流程填写的时间信息 + String startTime = param.get("startTime"); + String startDate = param.get("startDate"); + String endTime = param.get("endTime"); + String endDate = param.get("endDate"); + String hrmStr = param.get("hrmStr"); +// 如果当前的requestid不是创建节点,则查询数据库信息作为对比条件 + if (!"-1".equals(requestId)) { + String hrmField = Util.null2String(nowConfig.getHrmField()); + String query = "select * from " + nowConfig.getTablename() + " where requestid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, requestId); + rs.next(); + hrmStr = rs.getString(hrmField); + startDate = rs.getString(nowConfig.getStartDateField()); + startTime = rs.getString(nowConfig.getStartTimeField()); + endTime = rs.getString(nowConfig.getEndTimeField()); + endDate = rs.getString(nowConfig.getEndDateField()); + } + + List list = new ArrayList<>(); +// 循环查询流程中时间是否存在冲突 + for (WorkflowConfigDTO workflowConfigDTO : workflowConfigDTOS) { +// 查询冲突的流程数据 TODO 流程相关人 查询数据库 + toolUtil.writeErrorLog(hrmStr); + toolUtil.writeErrorLog(workflowConfigDTO.toString() + "\n"); + for (String hrmId : hrmStr.split(",")) { + List workflowBaseInfoDTOList = conflictWorkflowDao.queryConflict(workflowConfigDTO, startTime, + startDate, endTime, endDate, hrmId, requestId); + toolUtil.writeErrorLog(workflowBaseInfoDTOList + "\n"); + if (workflowBaseInfoDTOList != null) { +// toolUtil.writeErrorLog(workflowBaseInfoDTOList.toString()); + list.addAll(workflowBaseInfoDTOList); + } + } + } + if (list.size() == 0) { + return ApiResult.successNoData(); + } + ArrayList collect = list.stream().collect( + Collectors.collectingAndThen( + Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(WorkflowBaseInfoDTO::getRequestid))), ArrayList::new) + ); +// 将查询到的信息进行返回给前端 + return ApiResult.success(collect); + } + + + /** + * 给图片添加水印信息 + * + * @param user user对象 + * @param param 请求参数 + * @return 添加水印后的文档信息 + */ + public String addWaterMark(User user, Map param) { + String fileIds = param.get("fileIds"); + String location = param.get("location"); + String time = param.get("time"); + if (StringUtils.isNullOrEmpty(time)) { + time = Util.getTime("yyyy-MM-dd HH:mm:ss"); + } + String pressText = "地点:" + location + "\n" + "时间:" + time; + String watermarkColor = toolUtil.getSystemParamValue("WATERMARK_COLOR"); + if (StringUtils.isNullOrEmpty(watermarkColor)) { + watermarkColor = "0,0,0"; + } + // 处理文字水印的RGB颜色 + String[] RGBStr = watermarkColor.replace(",", ",").split(","); + int[] RGB = Arrays.stream(RGBStr).mapToInt(Integer::parseInt).toArray(); + if (RGB.length < 3) { + RGB = new int[]{0, 0, 0}; + } + int R = RGB[0]; + int G = RGB[1]; + int B = RGB[2]; + if (R < 0) { + R = 0; + } + if (R > 255) { + R = 255; + } + if (G < 0) { + G = 0; + } + if (G > 255) { + G = 255; + } + if (B < 0) { + B = 0; + } + if (B > 255) { + B = 255; + } + Color color = new Color(R, G, B); + String fontName = toolUtil.getSystemParamValue("FONT_NAME"); + if (StringUtils.isNullOrEmpty(fontName)) { + fontName = "Microsoft YaHei"; + } + int fontSize = Util.getIntValue(toolUtil.getSystemParamValue("FONT_SIZE"), 10); + StringBuilder newIds = new StringBuilder(); + int index = 0; + //根据fileId 查询物理文件 + String query = "select imagefileid from docimagefile where docid in ( " + fileIds + ")"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query); + + while (rs.next()) { + int id = rs.getInt(1); + int newId; + try { + newId = WritWatermark.addTextWatermarkById(id, pressText, color, fontName, Font.PLAIN, fontSize + , new WatermarkPoint(WatermarkPointEnum.RIGHT_BOTTOM), 0, 1, 1.3); + } catch (IOException e) { + return ApiResult.error("图片水印添加失败!"); + } + if (index == 0) { + newIds.append(newId); + } else { + newIds.append(",").append(newId); + } + index++; + } + //复制原图的权限信息等 + // 复制原来的文件信息,并将现有的信息进行绑定 + DocManager docManager = new DocManager(); + String[] picIdStrArr = fileIds.split(","); + String[] newImgArr = newIds.toString().split(","); + int[] picIdArr = Arrays.stream(picIdStrArr).mapToInt(Integer::parseInt).toArray(); + StringBuilder newDocIds = new StringBuilder(); + for (int i = 0; i < picIdArr.length; i++) { + docManager.setId(picIdArr[i]); +// 复制文件 + int newId = 0; + try { + newId = docManager.copyDoc(false); + } catch (Exception e) { + e.printStackTrace(); + toolUtil.writeErrorLog("file copy fail!"); + } + if (i == 0) { + newDocIds.append(newId); + } else { + newDocIds.append(",").append(newId); + } +// 替换复制出来的数据的物理文件关联关系 + PrepSqlResultImpl prepSqlResult = aiyh.utils.Util.createSqlBuilder().updateSql("docimagefile" + , ParaMap.create().put("imagefileid", newImgArr[i]) + , aiyh.utils.Util.createPrepWhereImpl().whereAnd("docid").whereEqual(newId)); + rs.executeUpdate(prepSqlResult.getSqlStr(), prepSqlResult.getArgs()); + } + + // 替换原来图片的字段 + String isSaveResource = toolUtil.getSystemParamValue("SAVE_RESOURCE"); + String sourceField = toolUtil.getSystemParamValue("RESOURCE_FIELD"); + if (StringUtils.isNullOrEmpty(isSaveResource)) { + isSaveResource = "0"; + } + String fieldName = param.get("fieldName"); + String tableName = param.get("tableName"); + String isWrite = param.get("isWrite"); +// String sourceField = param.get("sourceField"); + String requestId = param.get("requestId"); + if ("true".equals(isWrite)) { + if ("0".equals(isSaveResource)) { + // 不保存原来的图片 + String update = "update " + + tableName + + " set " + + fieldName + + " = " + + newDocIds + + " where " + + " requestid = ?"; + rs.executeUpdate(update, requestId); + } else { + String update = "update " + + tableName + + " set " + + fieldName + + " = " + + newDocIds + + " , " + + sourceField + + " = " + + fileIds + + " where " + + " requestid = ?"; + rs.executeUpdate(update, requestId); + } + } + // 查询新文件信息 + String listType = Util.null2String(String.valueOf(param.get("listType")), "list"); + int requestid = Util.getIntValue(Util.null2String(String.valueOf(param.get("requestid"))), -1); + int desrequestid = Util.getIntValue(Util.null2String(String.valueOf(param.get("desrequestid"))), -1); + int isprint = Util.getIntValue(Util.null2String(String.valueOf(param.get("isprint"))), 0); + int workflowid = Util.getIntValue(Util.null2String(String.valueOf(param.get("workflowid"))), 0); + String f_weaver_belongto_userid = Util.null2String(String.valueOf(param.get("f_weaver_belongto_userid"))); + String f_weaver_belongto_usertype = Util.null2String(String.valueOf(param.get("f_weaver_belongto_usertype"))); + String authStr = Util.null2String(String.valueOf(param.get(RequestAuthenticationConstant.AUTHORITY_STRING))); + String authSignatureStr = Util.null2String(String.valueOf(param.get(RequestAuthenticationConstant.AUTHORITY_SIGNATURESTRING))); + Map paramsMap = new HashMap<>(); + paramsMap.put("user", user); + Map retobj; + try { + retobj = FileBiz.getFileDatas(Util.null2String(newDocIds.toString()), listType, requestid, desrequestid, + isprint, f_weaver_belongto_userid, f_weaver_belongto_usertype, true, false, authStr, authSignatureStr, paramsMap); + } catch (Exception e) { + e.printStackTrace(); + return ApiResult.error("查询附件信息失败:" + e); + } + Map result = new HashMap<>(); + result.put("fileData", retobj); + result.put("fileIds", newDocIds.toString()); + return ApiResult.success(result); + } + + + /** + * 获取某个流程需要添加水印的字段和全版本的流程id + * + * @return 配置信息 + */ + public String getWatermarkConfig(String workflowId) { + ConfigInfoVo configInfo = conflictWorkflowDao.getConfigInfo("uf_watermark_cofig", workflowId); + if (configInfo == null) { + return ApiResult.successNoData(); + } + return ApiResult.success(configInfo); +// Map map = new HashMap<>(); +// String workflowId = toolUtil.getSystemParamValue("PIC_WATERMARK_WORKFLOW_ID"); +// List list = conflictWorkflowDao.getWatermarkConfig(workflowId); +// String picWatermarkField = toolUtil.getSystemParamValue("PIC_WATERMARK_FIELD_NAME"); +// String nodeId = toolUtil.getSystemParamValue("PIC_WATERMARK_NODE_ID"); +// map.put("fieldName", picWatermarkField); +// map.put("workflowIds", list); +// map.put("nodeId", nodeId); +// return ApiResult.success(map); + } + + /** + * 获取泛型的Collection Type + * + * @param collectionClass 泛型的Collection + * @param elementClasses 元素类 + * @return JavaType Java类型 + */ + public JavaType getCollectionType(Class collectionClass, Class... elementClasses) { + return mapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); + } + + + /** + * 查询需要排查流程时间片段冲突的配置信息 + * + * @param workflowId 流程id + * @return 配置信息 + */ + public String getWorkflowConflictConfig(String workflowId) { + Map map = new HashMap<>(); + List watermarkConfig = conflictWorkflowDao.getWatermarkConfig(workflowId); + WorkflowConfigDTO workflowConfig = conflictWorkflowDao.getWorkflowConfig(workflowId); + map.put("workflowIds", watermarkConfig); + map.put("workflowConfig", workflowConfig); + return ApiResult.success(map); + } +} diff --git a/com/api/aiyh_guijiu/vo/ConfigInfoVo.java b/com/api/aiyh_guijiu/vo/ConfigInfoVo.java new file mode 100644 index 0000000..b7c56cf --- /dev/null +++ b/com/api/aiyh_guijiu/vo/ConfigInfoVo.java @@ -0,0 +1,67 @@ +package com.api.aiyh_guijiu.vo; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/14 0014 21:28 + * peizhi xinxi Vo + */ + + +public class ConfigInfoVo { + int workflowType; + String workflowField; + String workflowNode; + int enable; + + public ConfigInfoVo() { + } + + public ConfigInfoVo(int workflowType, String workflowField, String workflowNode, int enable) { + this.workflowType = workflowType; + this.workflowField = workflowField; + this.workflowNode = workflowNode; + this.enable = enable; + } + + public int getWorkflowType() { + return workflowType; + } + + public void setWorkflowType(int workflowType) { + this.workflowType = workflowType; + } + + public String getWorkflowField() { + return workflowField; + } + + public void setWorkflowField(String workflowField) { + this.workflowField = workflowField; + } + + public String getWorkflowNode() { + return workflowNode; + } + + public void setWorkflowNode(String workflowNode) { + this.workflowNode = workflowNode; + } + + public int getEnable() { + return enable; + } + + public void setEnable(int enable) { + this.enable = enable; + } + + @Override + public String toString() { + return "ConfigInfoVo{" + + "workflowType=" + workflowType + + ", workflowField='" + workflowField + '\'' + + ", workflowNode='" + workflowNode + '\'' + + ", enable=" + enable + + '}'; + } +} diff --git a/com/api/aiyh_guijiu/vo/PicPsVO.java b/com/api/aiyh_guijiu/vo/PicPsVO.java new file mode 100644 index 0000000..e1b8c9c --- /dev/null +++ b/com/api/aiyh_guijiu/vo/PicPsVO.java @@ -0,0 +1,120 @@ +package com.api.aiyh_guijiu.vo; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/10 0010 16:50 + * pic ps vo + */ + + +public class PicPsVO { + private int docId; + private int fileId; + private String fileName; + private int score; + private String describe; + + public PicPsVO(int docId, int fileId, String fileName, int score, String describe) { + this.docId = docId; + this.fileId = fileId; + this.fileName = fileName; + this.score = score; + this.describe = describe; + } + + public int getDocId() { + return docId; + } + + public void setDocId(int docId) { + this.docId = docId; + } + + public int getFileId() { + return fileId; + } + + public void setFileId(int fileId) { + this.fileId = fileId; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public int getScore() { + return score; + } + + public void setScore(int score) { + this.score = score; + } + + public String getDescribe() { + return describe; + } + + public void setDescribe(String describe) { + this.describe = describe; + } + + + public static final class PicPsVOBuilder { + private int docId; + private int fileId; + private String fileName; + private int score; + private String describe; + + private PicPsVOBuilder() { + } + + public static PicPsVOBuilder aPicPsVO() { + return new PicPsVOBuilder(); + } + + public PicPsVOBuilder docId(int docId) { + this.docId = docId; + return this; + } + + public PicPsVOBuilder fileId(int fileId) { + this.fileId = fileId; + return this; + } + + public PicPsVOBuilder fileName(String fileName) { + this.fileName = fileName; + return this; + } + + public PicPsVOBuilder score(int score) { + this.score = score; + return this; + } + + public PicPsVOBuilder describe(String describe) { + this.describe = describe; + return this; + } + + public PicPsVO build() { + return new PicPsVO(docId, fileId, fileName, score, describe); + } + } + + @Override + public String toString() { + return "PicPsVO{" + + "docId=" + docId + + ", fileId=" + fileId + + ", fileName='" + fileName + '\'' + + ", score=" + score + + ", describe='" + describe + '\'' + + '}'; + } +} diff --git a/com/api/aiyh_guijiu/web/ConflictWorkflowController.java b/com/api/aiyh_guijiu/web/ConflictWorkflowController.java new file mode 100644 index 0000000..35f3546 --- /dev/null +++ b/com/api/aiyh_guijiu/web/ConflictWorkflowController.java @@ -0,0 +1,157 @@ +package com.api.aiyh_guijiu.web; + +import aiyh.utils.ApiResult; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_guijiu.service.WorkflowQueueService; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/3 0003 12:08 + * 查询同一时段内的指定流程 + */ + + +@Path("/change2Workflow") +public class ConflictWorkflowController { + + private final WorkflowQueueService workflowQueueService = new WorkflowQueueService(); + private final ToolUtil toolUtil = new ToolUtil(); + private final String className = "QueryWorkflow"; + + /** + * 查询需要前端判断添加水印的流程和流程字段 + * + * @return 前端必要的配置参数 + */ + @Path("/queryWatermark/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryWatermark(@PathParam("workflowId") String workflowId) { + try { + return workflowQueueService.getWatermarkConfig(workflowId); + }catch (Exception e){ + toolUtil.writeErrorLog(className + "======> queryWatermark",e.toString()); + return ApiResult.error(e.toString()); + } + } + + + /** + * 图片添加水印请求 + * + * @param request 请求体 + * @param response 响应对象 + * @param param 请求参数 + * @return 添加水印后的图片信息 + */ + @Path("/addWatermark") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String addWatermark(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody Map param) { + + User user = HrmUserVarify.getUser(request, response); + try { + return workflowQueueService.addWaterMark(user, param); + }catch (Exception e){ + toolUtil.writeErrorLog(className + "======> addWatermark",e.toString()); + return ApiResult.error(e.toString()); + } + } + + + /** + * 查询流程冲突前端需要拦截和必要的字段 + * + * @param workflowId 流程id + * @return 配置信息 + */ + @Path("/queryWorkflow/config/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryWorkflowConfig(@PathParam("workflowId") String workflowId) { + + try { + return workflowQueueService.getWorkflowConflictConfig(workflowId); + }catch (Exception e){ + toolUtil.writeErrorLog(className + "======> queryWorkflowConfig",e.toString()); + return ApiResult.error(e.toString()); + } + } + + /** + * 查询冲突流程 + * + * @param param 请求参数 + * @return 冲突流程的基本数据 + */ + @Path("/queryConflict") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryWorkflowQueue(@RequestBody Map param) { + + try { + return workflowQueueService.getWorkflowQueue(param); + }catch (Exception e){ + toolUtil.writeErrorLog(className + "======> queryWorkflowQueue",e.toString()); + e.printStackTrace(); + return ApiResult.error(e.toString()); + } + } + + /** + * 判断图片是否经过ps + * + * @param imgIds 需要判断的图片 + * @return 查询ps的结果 + */ + @Path("/picIsPs/{imgIds}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryPicIsPs(@PathParam("imgIds") String imgIds) { + try { + return workflowQueueService.getPicIsPs(imgIds); + }catch (Exception e){ + toolUtil.writeErrorLog(className + "======> queryPicIsPs",e.toString()); + return ApiResult.error(e.toString()); + } + } + + + + + /** + * 查询需要校验ps的节点等信息 + * + * @return 配置信息 + */ + @Path("/queryPicPsConfig/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryPicPsConfig(@PathParam("workflowId") String workflowId) { + try { + return workflowQueueService.getPicIsPsConfig(workflowId); + }catch (Exception e){ + toolUtil.writeErrorLog(className + "======> queryPicPsConfig",e.toString()); + return ApiResult.error(e.toString()); + } + + } + +} diff --git a/com/api/aiyh_kafang/dao/InvoiceMapping.java b/com/api/aiyh_kafang/dao/InvoiceMapping.java new file mode 100644 index 0000000..050dbba --- /dev/null +++ b/com/api/aiyh_kafang/dao/InvoiceMapping.java @@ -0,0 +1,103 @@ +package com.api.aiyh_kafang.dao; + +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_kafang.entity.UfInvoiceConfigDTO; +import weaver.conn.RecordSet; +import weaver.workflow.workflow.WorkflowVersion; + +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/9 0009 14:38 + */ + + +public class InvoiceMapping { + private RecordSet rs = new RecordSet(); + private ToolUtil toolUtil = new ToolUtil(); + private final String ModeTable = "uf_fpyzjb"; + private final String ModeDetailTable = "uf_fpyzjb_dt1"; + + public UfInvoiceConfigDTO getConfigInfo(String workflowId) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String query = "select ic.id,ic.invoice_browse,ic.workflow_nodes,ic.workflow_type, " + + "dtv.tablename invoice_detail_table,ftv.fieldname invoice_field,ftv1.fieldname invoice_price " + + "from uf_invoice_config ic " + + "left join workflow_detail_table_view dtv on ic.invoice_detail_table = dtv.id " + + "left join workflow_field_table_view ftv on ic.invoice_field = ftv.id " + + "left join workflow_field_table_view ftv1 on ic.invoice_price = ftv1.id " + + " where workflow_type in (" + workflowId + " )"; + rs.executeQuery(query); + UfInvoiceConfigDTO ufInvoiceConfigDTO = Util.recordeSet2Entity(rs, UfInvoiceConfigDTO.class, true); + if (ufInvoiceConfigDTO != null) { + ufInvoiceConfigDTO.setWorkflowType(versionStringByWfid); + } + return ufInvoiceConfigDTO; + } + + public void saveInvoiceInfo(int dataId, String tableName, String requestId) { +// 主表数据 + Map update = Util.createUtilHashMap() + .uPut("lc", requestId) + .uPut("sm", "发票扫描自动添加实体发票信息!"); + Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual(dataId); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(tableName, update, where); + toolUtil.writeErrorLog("SQL:" + sqlResult.getSqlStr() + " ---->参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + + public void saveInvoiceDetail(Map insert, String modeTable) { + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().insertSql(modeTable, insert); + toolUtil.writeErrorLog("SQL:" + sqlResult.getSqlStr() + " ---->参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + + public String getMainId(String requestId) { + String query = "select * from uf_fpyzjb where lc = ?"; + rs.executeQuery(query, requestId); + rs.next(); + return rs.getString("id"); + } + + public List> selectModeInfo(String mainId) { + RecordSet rs = new RecordSet(); + String query = "select * from " + ModeDetailTable + " where mainid = ?"; + rs.executeQuery(query, mainId); + return Util.recordSet2MapList(rs); + } + + + public List> selectWorkflowData(String workflowId, String requestId, UfInvoiceConfigDTO configInfo) { +// 根据流程id查询流程主表 + String mainTable = Util.getMainTable(workflowId); + String query = "select * from " + mainTable + " where requestid = ?"; + rs.executeQuery(query, requestId); + rs.next(); + String mainId = rs.getString("id"); +// 查询明细表数据 + RecordSet rs = new RecordSet(); + query = "select * from " + configInfo.getInvoiceDetailTable() + " where mainid = ?"; + rs.executeQuery(query, mainId); + return Util.recordSet2MapList(rs); + } + + public String getWorkflowCode(String workflowCodeId, String invoiceTable) { + String query = "select * from " + invoiceTable + " where id = ?"; + rs.executeQuery(query, workflowCodeId); + if (rs.next()) { + return rs.getString("invoicenumber"); + } else { + throw new RuntimeException("发票不存在!"); + } + } + + public boolean selectExist(String main, String number) { + rs.executeQuery("select * from " + ModeDetailTable + " where mainid = ? and fphm2 = ?",main,number); + return rs.next(); + } +} \ No newline at end of file diff --git a/com/api/aiyh_kafang/entity/UfInvoiceConfigDTO.java b/com/api/aiyh_kafang/entity/UfInvoiceConfigDTO.java new file mode 100644 index 0000000..46fa3d0 --- /dev/null +++ b/com/api/aiyh_kafang/entity/UfInvoiceConfigDTO.java @@ -0,0 +1,93 @@ + +package com.api.aiyh_kafang.entity; + + +public class UfInvoiceConfigDTO { + + private int id; + private int requestId; + private String workflowType; + private String workflowNodes; + private String invoiceField; + private String invoicePrice; + private int invoiceBrowse; + private String invoiceDetailTable; + + public void setId(int id) { + this.id = id; + } + + public void setRequestId(int requestId) { + this.requestId = requestId; + } + + public void setWorkflowType(String workflowType) { + this.workflowType = workflowType; + } + + public void setWorkflowNodes(String workflowNodes) { + this.workflowNodes = workflowNodes; + } + + public void setInvoiceField(String invoiceField) { + this.invoiceField = invoiceField; + } + + public void setInvoicePrice(String invoicePrice) { + this.invoicePrice = invoicePrice; + } + + public void setInvoiceBrowse(int invoiceBrowse) { + this.invoiceBrowse = invoiceBrowse; + } + + public void setInvoiceDetailTable(String invoiceDetailTable) { + this.invoiceDetailTable = invoiceDetailTable; + } + + public int getId() { + return this.id; + } + + public int getRequestId() { + return this.requestId; + } + + public String getWorkflowType() { + return this.workflowType; + } + + public String getWorkflowNodes() { + return this.workflowNodes; + } + + public String getInvoiceField() { + return this.invoiceField; + } + + public String getInvoicePrice() { + return this.invoicePrice; + } + + public int getInvoiceBrowse() { + return this.invoiceBrowse; + } + + public String getInvoiceDetailTable() { + return this.invoiceDetailTable; + } + + @Override + public String toString() { + return "UfInvoiceConfigDTO{" + + "id='" + id + '\'' + + ", requestId='" + requestId + '\'' + + ", workflowType='" + workflowType + '\'' + + ", workflowNodes='" + workflowNodes + '\'' + + ", invoiceField='" + invoiceField + '\'' + + ", invoicePrice='" + invoicePrice + '\'' + + ", invoiceBrowse='" + invoiceBrowse + '\'' + + ", invoiceDetailTable='" + invoiceDetailTable + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/com/api/aiyh_kafang/service/InvoiceService.java b/com/api/aiyh_kafang/service/InvoiceService.java new file mode 100644 index 0000000..e18fb48 --- /dev/null +++ b/com/api/aiyh_kafang/service/InvoiceService.java @@ -0,0 +1,284 @@ +package com.api.aiyh_kafang.service; + +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_kafang.dao.InvoiceMapping; +import com.api.aiyh_kafang.entity.UfInvoiceConfigDTO; +import com.engine.fna.util.FnaInvoiceUploadUtil; +import com.weaver.general.TimeUtil; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.apache.commons.io.IOUtils; +import org.h2.util.StringUtils; +import weaver.conn.RecordSet; +import weaver.file.ImageFileManager; +import weaver.fna.invoice.utils.HttpUtil; +import weaver.fna.invoice.utils.ImageUtil; +import weaver.formmode.data.ModeDataIdUpdate; +import weaver.formmode.setup.ModeRightInfo; +import weaver.hrm.User; + +import java.io.IOException; +import java.io.InputStream; +import java.util.*; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/2 0002 15:17 + * 检查发票 + */ + + +public class InvoiceService { + + private final InvoiceMapping invoiceMapping = new InvoiceMapping(); + private final ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance(); + private final RecordSet rs = new RecordSet(); + private final ToolUtil toolUtil = new ToolUtil(); + private final String ModeTable = "uf_fpyzjb"; + private final String ModeDetailTable = "uf_fpyzjb_dt1"; + private final String ModeDetailTableErr = "uf_fpyzjb_dt3"; + private String formModeId = "17"; + private final String invoiceTable = "fnainvoiceledger"; + + public InvoiceService() { + String formModeId = toolUtil.getSystemParamValue("formModeId"); + if(!StringUtils.isNullOrEmpty(formModeId)){ + this.formModeId = formModeId; + } + } + + /** + * 查询发票信息,OCR识别 + * + * @param user + * @param fileId + * @return + * @throws IOException + */ + public JSONObject getInvoiceInfo(User user, int fileId) throws Exception { +// InputStream inputStreamById = ImageFileManager.getInputStreamById(fileId); +// byte[] bytes; +// bytes = IOUtils.toByteArray(inputStreamById); + String fileData = FnaInvoiceUploadUtil.changeFileTobase64(fileId); + byte[] imageBytes = ImageUtil.transformImage(fileData); + JSONObject jsonObject = HttpUtil.postImage(imageBytes, user); + toolUtil.writeErrorLog(jsonObject.toString()); + return jsonObject; + } + + /** + * 对比合同信息 + */ + public Map contrastInvoiceInfo(Map params) { +// 获取到流程表中的明细数据,对比建模表中的发票信息,查验数量是否一致以及发票的钱 +// List fileIdList = (List) params.get("fileIdList"); + String requestId = Util.null2String(params.get("requestId")); + String workflowId = Util.null2String(params.get("workflowId")); +// 查询建模表数据 + String mainId = invoiceMapping.getMainId(requestId); + List> modeData = invoiceMapping.selectModeInfo(mainId); +// 查询配置表信息 + UfInvoiceConfigDTO configInfo = invoiceMapping.getConfigInfo(workflowId); +// 查询流程中的发票数据 + List> workflowData = invoiceMapping.selectWorkflowData(workflowId, requestId, configInfo); +// 对比合同信息,查询出相差的发票 + List> priceNotEqual = new ArrayList<>(); + List> workflowDataRm = new ArrayList<>(); + List> modeDataRm = new ArrayList<>(); + if (configInfo.getInvoiceBrowse() == 1) { +// 属于浏览框 + for (Map workflowDatum : workflowData) { + String workflowCodeId = Util.null2String(workflowDatum.get(configInfo.getInvoiceField())); + String workflowCode = ""; + String workflowInvoicePrice = Util.null2String(workflowDatum.get(configInfo.getInvoicePrice())); + try { + workflowCode = invoiceMapping.getWorkflowCode(workflowCodeId, invoiceTable); + workflowDatum.put(configInfo.getInvoiceField(),workflowCode); + workflowDatum.put("fphm2",workflowCode); + } catch (Exception e) { + e.printStackTrace(); + toolUtil.writeErrorLog("发票不存在:" + e); + } + for (Map modeDatum : modeData) { + String modeCode = Util.null2String(modeDatum.get("fphm2")); + String modePrice = Util.null2String(modeDatum.get("fpje")); + if (workflowCode.equals(modeCode)) { +// 发票号码相等,校验发票金额 + if (!workflowInvoicePrice.equals(modePrice)) { +// 金额不相等 +// 添加校验失败数据到数组中 + priceNotEqual.add(modeDatum); + } +// 求差集 + workflowDataRm.add(workflowDatum); + modeDataRm.add(modeDatum); + break; + } + } + } +// 求差 +// 建模表中多余的发票信息 + modeData.removeAll(modeDataRm); +// 流程中有但是建模表中没有的发票信息 + workflowData.removeAll(workflowDataRm); + + } else { +// 不属于浏览框 + for (Map workflowDatum : workflowData) { + String workflowCode = Util.null2String(workflowDatum.get(configInfo.getInvoiceField())); + String workflowInvoicePrice = Util.null2String(workflowDatum.get(configInfo.getInvoicePrice())); + for (Map modeDatum : modeData) { + String modeCode = Util.null2String(modeDatum.get("fphm2")); + String modePrice = Util.null2String(modeDatum.get("fpje")); + if (workflowCode.equals(modeCode)) { +// 发票号码相等,校验发票金额 + if (!workflowInvoicePrice.equals(modePrice)) { +// 金额不相等 +// 添加校验失败数据到数组中 + priceNotEqual.add(modeDatum); + } +// 求差集 + workflowDataRm.add(workflowDatum); + modeDataRm.add(modeDatum); + break; + } + } + } +// 求差 +// 建模表中多余的发票信息 + modeData.removeAll(modeDataRm); +// 流程中有但是建模表中没有的发票信息 + workflowData.removeAll(workflowDataRm); + } + + List> insertList = new ArrayList<>(); +// 将价格不一样的数据保存到建模表明细3中,并标识错误原因为价格不一致 + for (Map map : priceNotEqual) { + LinkedHashMap data = new LinkedHashMap<>(); + data.put("fphm1", map.get("fphm2")); + data.put("sbyy","流程发票明细信息表中的发票与扫描识别发票的发票金额不一致!"); + data.put("mainid", mainId); + insertList.add(data); + } +// 将建模表多的发票保存到建模表明细3中,并标识错误原因为流程中不存在改发票信息 + for (Map map : modeData) { + LinkedHashMap data = new LinkedHashMap<>(); + data.put("fphm1", map.get("fphm2")); + data.put("sbyy", "流程中不存在该发票信息,但扫描发票中存在改发票!"); + data.put("mainid", mainId); + insertList.add(data); + } +// 将流程中多的发票保存到建模表明细3中,并标识错误原因为,扫描发票中不存在改发票信息 + for (Map map : workflowData) { + LinkedHashMap data = new LinkedHashMap<>(); + data.put("fphm1", Util.null2String(map.get(configInfo.getInvoiceField()))); + data.put("sbyy", "流程中存在改发票,但是扫描发票中没有发现该发票信息!"); + data.put("mainid", mainId); + insertList.add(data); + } + RecordSet rs = new RecordSet(); + BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().insertBatchSql(ModeDetailTableErr, insertList); + toolUtil.writeErrorLog("SQL:" + batchSqlResult.getSqlStr() + " ---->参数:" + batchSqlResult.getBatchList()); + System.out.println("SQL:" + batchSqlResult.getSqlStr() + " ---->参数:" + batchSqlResult.getBatchList()); +/* for (List list : batchSqlResult.getBatchList()) { + rs.executeUpdate(batchSqlResult.getSqlStr(),list); + }*/ + try{ + rs.executeBatchSql(batchSqlResult.getSqlStr(), batchSqlResult.getBatchList()); + }catch(Exception e){ + e.printStackTrace(); + } + Map result = new HashMap<>(); + result.put("priceNotEqual", priceNotEqual); + result.put("workflowData", workflowData); + result.put("modeData", modeData); + return result; + } + + /** + * 获取配置信息 + * + * @param workflowId + * @return + */ + public UfInvoiceConfigDTO getConfigInfo(String workflowId) { + return invoiceMapping.getConfigInfo(workflowId); + } + + /** + * 保存合同信息 + * + * @param invoiceInfo + * @param requestId + */ + public void saveInvoiceInfo(JSONObject invoiceInfo, String requestId) { +// TODO 查询是否已经存在,不存在则新增,存在则更新 + String query = "select * from " + ModeTable + " where lc = ?"; + rs.executeQuery(query, requestId); + if (rs.next()) { +// 存在,往明细表中添加数据 + saveInvoiceDetail(invoiceInfo, requestId, rs.getString("id")); + return; + } +// 添加主表数据,并且添加明细 + int dataId = mdu.getModeDataNewId(ModeTable, + Util.getIntValue(formModeId, -1), + 1, 0, TimeUtil.getCurrentDateString(), + TimeUtil.getOnlyCurrentTimeString()); +// TODO 插入数据库信息 + invoiceMapping.saveInvoiceInfo(dataId, ModeTable, requestId); + saveInvoiceDetail(invoiceInfo, requestId, String.valueOf(dataId)); + ModeRightInfo mri = new ModeRightInfo(); + mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), dataId); + } + + /** + * 保存发票信息到建模明细表 + * + * @param invoiceInfo + * @param requestId + * @param mainId + */ + public void saveInvoiceDetail(JSONObject invoiceInfo, String requestId, String mainId) { + String main = mainId; + if (StringUtils.isNullOrEmpty(main)) { +// 查询主表数据 + String query = "select * from " + ModeTable + " where lc = ?"; + rs.executeQuery(query, requestId); + rs.next(); + main = rs.getString("id"); + } +// 保存明细表数据 + JSONObject returnInfo = (JSONObject) invoiceInfo.get("returnInfo"); + toolUtil.writeErrorLog("returnInfo:" + returnInfo); + if(returnInfo == null){ + throw new RuntimeException("发票数据获取失败:" + invoiceInfo); + } + JSONObject response = (JSONObject) returnInfo.get("response"); + JSONObject data = (JSONObject) response.get("data"); + JSONArray identifyResults = (JSONArray) data.get("identify_results"); + for (int i = 0; i < identifyResults.size(); i++) { + JSONObject item = (JSONObject) identifyResults.get(i); + JSONObject details = (JSONObject) item.get("details"); +// 查询是否存在该发票,不存在则添加 + if(invoiceMapping.selectExist(main,Util.null2String(details.get("number")))){ + return; + } + // 明细表数据 + Map insert = Util.createUtilHashMap() +// 发票号码 + .uPut("fphm2", details.get("number")) +// 费用日期 + .uPut("fyrq", details.get("date")) +// 服务内容 + .uPut("fwnr", details.get("item_names")) +// 发票金额 + .uPut("fpje", details.get("total")) + .uPut("mainid", main); + toolUtil.writeErrorLog("insert:" + insert); + invoiceMapping.saveInvoiceDetail(insert, ModeDetailTable); + } + } +} diff --git a/com/api/aiyh_kafang/service/UploadByBase64Service.java b/com/api/aiyh_kafang/service/UploadByBase64Service.java new file mode 100644 index 0000000..cb350e7 --- /dev/null +++ b/com/api/aiyh_kafang/service/UploadByBase64Service.java @@ -0,0 +1,32 @@ +package com.api.aiyh_kafang.service; + + +import aiyh.utils.zwl.common.ToolUtil; +import org.apache.axiom.util.base64.Base64Utils; +import weaver.file.ImageFileManager; + +import java.util.Map; +import java.util.UUID; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/8 0008 13:36 + * 业务逻辑处理 + */ + + +public class UploadByBase64Service { + public int uploadImage(Map param) { + ToolUtil toolUtil = new ToolUtil(); + String base64 = String.valueOf(param.get("base64")); + ImageFileManager fileManager = new ImageFileManager(); + byte[] data = null; + data = Base64Utils.decode(base64); + fileManager.setData(data); + String fileName = "" + System.currentTimeMillis() + UUID.randomUUID() + ".jpg"; + fileManager.setImagFileName(fileName); + int i = fileManager.saveImageFile(); + toolUtil.writeErrorLog("生成的图片的id:" + i); + return i; + } +} diff --git a/com/api/aiyh_kafang/web/InvoiceController.java b/com/api/aiyh_kafang/web/InvoiceController.java new file mode 100644 index 0000000..7d1b380 --- /dev/null +++ b/com/api/aiyh_kafang/web/InvoiceController.java @@ -0,0 +1,36 @@ +package com.api.aiyh_kafang.web; + +import aiyh.utils.ApiResult; +import com.api.aiyh_kafang.service.InvoiceService; +import io.swagger.v3.oas.annotations.parameters.RequestBody; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/27 0027 10:29 + * 发票相关控制器 + */ + +@Path("/kafang/invoiceCheck") +public class InvoiceController { + private InvoiceService invoiceService = new InvoiceService(); + + @Path("/check/contrast") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String check(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody Map params) { + Map result = invoiceService.contrastInvoiceInfo(params); + return ApiResult.success(result); + } +} diff --git a/com/api/aiyh_kafang/web/UploadByBase64.java b/com/api/aiyh_kafang/web/UploadByBase64.java new file mode 100644 index 0000000..a148a70 --- /dev/null +++ b/com/api/aiyh_kafang/web/UploadByBase64.java @@ -0,0 +1,109 @@ +package com.api.aiyh_kafang.web; + +import aiyh.utils.ApiResult; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_kafang.entity.UfInvoiceConfigDTO; +import com.api.aiyh_kafang.service.InvoiceService; +import com.api.aiyh_kafang.service.UploadByBase64Service; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import net.sf.json.JSONObject; +import org.apache.commons.io.IOUtils; +import weaver.file.ImageFileManager; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/27 0027 14:13 + * upload invoice by base64 arr + */ + + +@Path("/kafang/upload") +public class UploadByBase64 { + private final ToolUtil toolUtil = new ToolUtil(); + private final UploadByBase64Service uploadByBase64Service = new UploadByBase64Service(); + private final InvoiceService invoiceService = new InvoiceService(); + + @Path("/uploadImage/byBase64") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String uploadImage(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody Map base64Map) { + int i = uploadByBase64Service.uploadImage(base64Map); +// TODO 上传完成过后,调用发票识别接口,将数据保存到建模表中 + User user = HrmUserVarify.getUser(request, response); + JSONObject invoiceInfo = null; + try { + invoiceInfo = invoiceService.getInvoiceInfo(user, i); + if (invoiceInfo == null || "1".equals(String.valueOf(invoiceInfo.get("status")))) { + throw new RuntimeException(invoiceInfo == null ? "识别数据为空!" : invoiceInfo.toString()); + } + } catch (Exception e) { + e.printStackTrace(); + toolUtil.writeErrorLog("发票识别失败!" + e); + return ApiResult.error("发票识别失败!"); + } + try { + invoiceService.saveInvoiceInfo(invoiceInfo, base64Map.get("requestId")); + } catch (Exception e) { + e.printStackTrace(); + toolUtil.writeErrorLog("发票保存失败!" + e); + return ApiResult.error("发票保存失败!"); + } + return ApiResult.success(i); + } + + @Path("/getConfigInfo/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String getWorkflowId(@PathParam("workflowId") String workflowId) { + UfInvoiceConfigDTO configInfo = invoiceService.getConfigInfo(workflowId); + return ApiResult.success(configInfo); + } + + + @Path("/download/img/{fileId}") + @GET + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response downloadFile(@PathParam("fileId") int fileId) throws IOException { + try { + InputStream inputStreamById = ImageFileManager.getInputStreamById(fileId); + byte[] bytes = IOUtils.toByteArray(inputStreamById); + StreamingOutput output = new StreamingOutput() { + @Override + public void write(OutputStream outputStream) throws IOException, WebApplicationException { + outputStream.write(bytes); +// byte[] buffer = new byte[1024*10]; +// int len = 0; +// while ((len = inputStreamById.read(buffer)) != -1) { +// outputStream.write(buffer, 0, len); +// } + outputStream.flush(); + outputStream.close(); + } + }; + Response.ResponseBuilder header = Response.ok(output, MediaType.APPLICATION_OCTET_STREAM) + .header("Content-Disposition", + "attachment; filename=image_from_server.jpg"); + return header.build(); + } catch (Exception e) { + return Response.ok(ApiResult.error("异常" + e), MediaType.APPLICATION_JSON).build(); + } +// return ApiResult.success("成功"); + } +} diff --git a/com/api/aiyh_pcn/async_organization/ExportExcel.java b/com/api/aiyh_pcn/async_organization/ExportExcel.java new file mode 100644 index 0000000..d12277e --- /dev/null +++ b/com/api/aiyh_pcn/async_organization/ExportExcel.java @@ -0,0 +1,147 @@ +package com.api.aiyh_pcn.async_organization; + +import com.ibm.icu.text.SimpleDateFormat; +import km.org.apache.poi.hssf.usermodel.HSSFCellStyle; +import km.org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import weaver.aiyh_pcn.async_organization.model.Department; +import weaver.aiyh_pcn.async_organization.model.Employee; +import weaver.aiyh_pcn.async_organization.model.Position; +import weaver.aiyh_pcn.async_organization.result.GetOrganizationResult; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.util.Date; +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/8 0008 16:06 + * 导出api请求数据的表格 + */ + +@Path("/asyncOrganization") +public class ExportExcel { + + @GET + @Path("/exportExcel") + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response exportExcel(@Context HttpServletRequest request, @Context HttpServletResponse response) { + GetOrganizationResult getOrganizationResult = new GetOrganizationResult(); + List employeeList = getOrganizationResult.getEmployeeList(); + SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook(); + CellStyle cellStyle = sxssfWorkbook.createCellStyle(); + // 设置单元格居中对齐 + cellStyle.setAlignment(HorizontalAlignment.forInt(HSSFCellStyle.ALIGN_CENTER)); + Font font = sxssfWorkbook.createFont(); + font.setColor(HSSFColor.RED.index); + cellStyle.setFont(font); + Sheet sheet = sxssfWorkbook.createSheet("人员信息"); + Row desc = sheet.createRow(0); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 13)); + Cell cell2 = desc.createCell(0); + cell2.setCellValue("员工信息表,同步数据时,按照岗位id进行排序同步!"); + cell2.setCellStyle(cellStyle); + Row th = sheet.createRow(1); + th.createCell(0).setCellValue("员工ID"); + th.createCell(1).setCellValue("名(英文)"); + th.createCell(2).setCellValue("姓(英文)"); + th.createCell(3).setCellValue("中文姓名"); + th.createCell(4).setCellValue("英文名"); + th.createCell(5).setCellValue("员工编号"); + th.createCell(6).setCellValue("岗位ID"); + th.createCell(7).setCellValue("部门ID"); + th.createCell(8).setCellValue("部门名称"); + th.createCell(9).setCellValue("成本中心编码"); + th.createCell(10).setCellValue("邮箱"); + th.createCell(11).setCellValue("公司实体"); + th.createCell(12).setCellValue("电话号"); + th.createCell(13).setCellValue("座机号"); + for (int i = 0; i < employeeList.size(); i++) { + Employee e = employeeList.get(i); + Row row = sheet.createRow(i + 2); + row.createCell(0).setCellValue(e.getUserID()); + row.createCell(1).setCellValue(e.getFIRSTNAMEEN()); + row.createCell(2).setCellValue(e.getLASTNAMEEN()); + row.createCell(3).setCellValue(e.getUSERNAMECN()); + row.createCell(4).setCellValue(e.getPreferred_Name()); + row.createCell(5).setCellValue(e.getUSERCODE()); + row.createCell(6).setCellValue(e.getJOBCODEID()); + row.createCell(7).setCellValue(e.getDEPARTMENTID()); + row.createCell(8).setCellValue(e.getDEPARTMENTNAME()); + row.createCell(9).setCellValue(e.getCOSTCENTERCODE()); + row.createCell(10).setCellValue(e.getEMAIL()); + row.createCell(11).setCellValue(e.getORGANIZATION()); + row.createCell(12).setCellValue(e.getMOBILENO()); + row.createCell(13).setCellValue(e.getTEL()); + } + + List departmentList = getOrganizationResult.getDepartmentList(); + Sheet depSheet = sxssfWorkbook.createSheet("部门信息"); + Row depdesc = depSheet.createRow(0); + depSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 2)); + Cell cell1 = depdesc.createCell(0); + cell1.setCellValue("部门信息表,同步数据时按照该上级部门id进行排序同步!红色字体为根部门!"); + cell1.setCellStyle(cellStyle); + Row depTh = depSheet.createRow(1); + depTh.createCell(0).setCellValue("部门ID"); + depTh.createCell(1).setCellValue("部门名称"); + depTh.createCell(2).setCellValue("上级部门"); + for (int i = 0; i < departmentList.size(); i++) { + Row row = depSheet.createRow(i + 2); + Department d = departmentList.get(i); + row.createCell(0).setCellValue(d.getDEPARTMENTID()); + row.createCell(1).setCellValue(d.getDEPARTMENTNAME()); + Cell cell = row.createCell(2); + cell.setCellValue(d.getPARENTDEPARTMENDID()); + if (d.getPARENTDEPARTMENDID() == 0) { + cell.setCellStyle(cellStyle); + } + } + + List positionList = getOrganizationResult.getPositionList(); + Sheet posSheet = sxssfWorkbook.createSheet("职位信息"); + Row posdesc = posSheet.createRow(0); + posSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 3)); + Cell cell3 = posdesc.createCell(0); + cell3.setCellValue("职位信息表,职位同步过程中以上级岗位id升序排序进行同步!"); + cell3.setCellStyle(cellStyle); + Row posTh = posSheet.createRow(1); + posTh.createCell(0).setCellValue("岗位编号"); + posTh.createCell(1).setCellValue("岗位编号"); + posTh.createCell(2).setCellValue("岗位描述"); + posTh.createCell(3).setCellValue("上级岗位ID"); + for (int i = 0; i < positionList.size(); i++) { + Row row = posSheet.createRow(i + 2); + Position p = positionList.get(i); + row.createCell(0).setCellValue(p.getJOBCODEID()); + row.createCell(1).setCellValue(p.getJOBCODE()); + row.createCell(2).setCellValue(p.getJOBFUNCTION()); + row.createCell(3).setCellValue(p.getSUPERIORJOBCODEID()); + } + SimpleDateFormat newsdf = new SimpleDateFormat("yyyy-MM-dd-HHmmss"); + String date = newsdf.format(new Date()); + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + try { + sxssfWorkbook.write(bos); + return Response.ok(bos.toByteArray(), "application/msexcel;charset=UTF-8") + .header("Content-Disposition", "attachment;filename=\"" + + new String(("CMS人员同步接口数据" + date + ".xlsx").getBytes("GBK"), + "ISO8859_1") + "\"") + .build(); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } +} diff --git a/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java b/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java new file mode 100644 index 0000000..b41efc1 --- /dev/null +++ b/com/api/aiyh_pcn/copy_attachment/dao/ConfigTableData.java @@ -0,0 +1,104 @@ +package com.api.aiyh_pcn.copy_attachment.dao; + +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.copy_attachment.model.ConfigEmpty; +import weaver.conn.RecordSet; +import weaver.general.Util; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/26 0026 18:21 + * config + */ + + +public class ConfigTableData { + + public static ConfigEmpty getConfig(String workflowId) { + ToolUtil toolUtil = new ToolUtil(); + RecordSet rs = new RecordSet(); +// 查询配置表,获取配置数据 + String querySql = "select ufta.id,ufta.workflow_type,wftva.fieldname as template_field, " + + "wftvb.fieldname as attachment_field,wftv.fieldname as show_field, wftvb.id as attachment_field_id, " + + "ufta.is_template_show,ufta.model_table_name, ufta.model_field,wsl.selectvalue as show_value, " + + "wftv.tablename as show_table_name,wftva.tablename as template_table_name,wftvb.tablename as attachment_table_name, " + + "wsla.selectvalue as hidden_value from uf_temp_attachment as ufta " + + "left join workflow_selectitem as wsl on wsl.id = ufta.show_value " + + "left join workflow_selectitem as wsla on wsla.id = ufta.hidden_value " + + "left join workflow_field_table_view as wftv on wftv.id = ufta.show_field " + + "left join workflow_field_table_view as wftva on wftva.id = ufta.template_field " + + "left join workflow_field_table_view as wftvb on wftvb.id = ufta.attachment_field " + + "where workflow_type in " + + "(select id from workflow_base where activeVersionID in " + + "(select activeVersionID from workflow_base where id = ?) or id = ?) and attachment_type = ?"; + rs.executeQuery(querySql, workflowId, workflowId,0); + if(rs.next()){ +// id + int id = Util.getIntValue(rs.getString("id")); +// 显示值 + int showValue = Util.getIntValue(rs.getString("show_value")); +// 隐藏值 + int hiddenValue = Util.getIntValue(rs.getString("hidden_value")); +// 流程id + String workflowType = rs.getString("workflow_type"); +// 模板字段 + String templateField = rs.getString("template_field"); +// 附件字段 + String attachmentField = rs.getString("attachment_field"); +// 是否用字段控制模板 + String isTemplateShow = rs.getString("is_template_show"); +// 模板建模表表名 + String modelTableName = rs.getString("model_table_name"); +// 控制模板显示与否的字段 + String showField = rs.getString("show_field"); +// 建模表福建模板字段 + String modelField = rs.getString("model_field"); +// 控制显示所在表 + String showTableName = rs.getString("show_table_name"); +// 模板字段所在表 + String templateTableName = rs.getString("template_table_name"); +// 附件字段所在表 + String attachmentTableName = rs.getString("attachment_table_name"); +// 附件字段id + String attachmentFieldId = rs.getString("attachment_field_id"); + toolUtil.writeDebuggerLog("已经查询到数据!"); + return ConfigEmpty.create() + .id(id) + .showValue(showValue) + .hiddenValue(hiddenValue) + .workflowType(workflowType) + .templateField(templateField) + .attachmentField(attachmentField) + .isTemplateShow(isTemplateShow) + .modelTableName(modelTableName) + .showField(showField) + .modelField(modelField) + .showTableName(showTableName) + .templateTableName(templateTableName) + .attachmentTableName(attachmentTableName) + .attachmentFieldId(attachmentFieldId) + .builder(); + } + return null; + } + + + public static String[] getTemplateData(String tableName, String fieldName, String configId){ + RecordSet rs = new RecordSet(); + String queryBuilder = "select " + fieldName + + " from " + + tableName + + " where id = ?"; + ToolUtil toolUtil = new ToolUtil(); + toolUtil.writeDebuggerLog("接收到参数tableName{" + tableName + "},fieldName{" + fieldName + "}configId{" + configId); + toolUtil.writeDebuggerLog("sql:" + queryBuilder); + rs.executeQuery(queryBuilder,configId); + if(rs.next()){ + String docIds = Util.null2String(rs.getString(1)); + toolUtil.writeDebuggerLog("查询到数据:" + docIds); + return docIds.split(","); + } + return new String[0]; + } + +} diff --git a/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java b/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java new file mode 100644 index 0000000..01470de --- /dev/null +++ b/com/api/aiyh_pcn/copy_attachment/dao/DocTemplateDao.java @@ -0,0 +1,121 @@ +package com.api.aiyh_pcn.copy_attachment.dao; + +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.zwl.common.ToolUtil; +import weaver.conn.RecordSet; +import weaver.docs.docs.DocManager; +import weaver.hrm.resource.ResourceComInfo; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/26 0026 11:14 + * copy dao + */ + + +public class DocTemplateDao { + ToolUtil toolUtil = new ToolUtil(); + private int userId; + + public int[] copyFile(int userId, String tableName, String fieldName, String configId) { + this.userId = userId; + String[] templateData = ConfigTableData.getTemplateData(tableName, fieldName, configId); + this.toolUtil.writeDebuggerLog("模板数据:" + Arrays.toString(templateData)); + int[] array = Arrays.stream(templateData).mapToInt(Integer::parseInt).toArray(); + return this.copyFile(array); + } + + private int[] copyFile(int... ids) { + RecordSet rs = new RecordSet(); +// 传入需要拷贝的附件的id + DocManager docManager = new DocManager(); + int[] docIds = new int[ids.length]; + try { + for (int i = 0; i < ids.length; i++) { + // 设置需要拷贝的附件的id + docManager.setId(ids[i]); + // 进行附件的拷贝 + docManager.copyDocNew(); + // 获取到新拷贝的附件的id + docIds[i] = docManager.getId(); +// 对新文档进行权限重置 + rs.executeProc("DocSecCategoryShare_SBySecCate", String.valueOf(docManager.getId())); + } + return docIds; + } catch (Exception e) { + this.toolUtil.writeErrorLog("复制错误" + e); + return null; + } + } + + public boolean updateFileInfo(String workflowId, String fileFieldId, int... ids) { + RecordSet rs = new RecordSet(); +// 通过流程查询到该流程对应的目录 + String query = "select catelogType, (case when catelogType = 9 then " + + "(select docCategory from workflow_base where id = ?) else docCategory end )" + + " as docCategory from workflow_fileupload " + + "where workflowid = ? and fieldid = ?"; + + rs.executeQuery(query, workflowId, workflowId, fileFieldId); + String catelogType = ""; + String docCategory = ""; + if (rs.next()) { + catelogType = rs.getString("catelogType"); + docCategory = rs.getString("docCategory"); + } + this.toolUtil.writeDebuggerLog(catelogType + "," + docCategory); + if (!"1".equals(catelogType)) { + List list = new ArrayList<>(); + for (int id : ids) { + list.add(id); + } + ResourceComInfo resourceComInfo = null; + try { + resourceComInfo = new ResourceComInfo(); + } catch (Exception e) { + e.printStackTrace(); + } + String departmentID = resourceComInfo.getDepartmentID(String.valueOf(this.userId)); +// 附件目录不为自己选择,更新文件的目录信息和其他信息 + Map updateMap = Util.createUtilHashMap().uPut("ownerid", this.userId) + .uPut("maincategory", 0) + .uPut("subcategory", 0) + .uPut("docstatus", 0) + .uPut("shareroleid", this.userId) + .uPut("doccreaterid", this.userId) + .uPut("doclastmoduserid", this.userId) + .uPut("docdepartmentid", departmentID) + .uPut("doclastmoddate", Util.getTime("yyyy-MM-dd")) + .uPut("doccreatedate", Util.getTime("yyyy-MM-dd")) + .uPut("doclastmodtime", Util.getTime("HH:mm:ss")) + .uPut("doccreatetime", Util.getTime("HH:mm:ss")) + .uPut("seccategory", docCategory.split(",")[docCategory.split(",").length - 1]); + Where whereIn = Util.createPrepWhereImpl().whereAnd("id").whereInList(list); + PrepSqlResultImpl updateResult = Util.createSqlBuilder().updateSql("docdetail", updateMap, whereIn); + this.toolUtil.writeDebuggerLog(updateResult.getSqlStr() + " : " + updateResult.getArgs()); + return rs.executeUpdate(updateResult.getSqlStr(), updateResult.getArgs()); + } + return false; + } + + public boolean deleteFile(int... ids) throws Exception { + DocManager docManager = new DocManager(); + for (int id : ids) { + try { + docManager.setId(id); + docManager.DeleteDocInfo(); + } catch (Exception e) { + e.printStackTrace(); + throw e; + } + } + return true; + } +} diff --git a/com/api/aiyh_pcn/copy_attachment/model/ConfigEmpty.java b/com/api/aiyh_pcn/copy_attachment/model/ConfigEmpty.java new file mode 100644 index 0000000..12e9248 --- /dev/null +++ b/com/api/aiyh_pcn/copy_attachment/model/ConfigEmpty.java @@ -0,0 +1,255 @@ +package com.api.aiyh_pcn.copy_attachment.model; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/26 0026 19:48 + */ + + +public class ConfigEmpty { + /** + * id + */ + private int id; + /** + * 流程id + */ + private String workflowType; + /** + * 模板字段 + */ + private String templateField; + /** + * 附件字段 + */ + private String attachmentField; + /** + * 是否控制模板字段 + */ + private String isTemplateShow; + /** + * 控制模板字段字段 + */ + private String showField; + /** + * 显示模板值 + */ + private int showValue; + /** + * 隐藏模板值 + */ + private int hiddenValue; + /** + * 模板表表名 + */ + private String modelTableName; + /** + * 模板表附件字段 + */ + private String modelField; + /** + * 控制模板字段字段所在表 + */ + private String showTableName; + /** + * 模板字段所在表 + */ + private String templateTableName; + /** + * 附件字段所在表 + */ + private String attachmentTableName; + /** + * 附件字段id + */ + private String attachmentFieldId; + + public ConfigEmpty(Builder builder) { + this.id = builder.id; + this.workflowType = builder.workflowType; + this.templateField = builder.templateField; + this.attachmentField = builder.attachmentField; + this.isTemplateShow = builder.isTemplateShow; + this.showField = builder.showField; + this.showValue = builder.showValue; + this.hiddenValue = builder.hiddenValue; + this.modelTableName = builder.modelTableName; + this.modelField = builder.modelField; + this.showTableName = builder.showTableName; + this.templateTableName = builder.templateTableName; + this.attachmentTableName = builder.attachmentTableName; + this.attachmentFieldId = builder.attachmentFieldId; + } + + @Override + public String toString() { + return "ConfigEmpty{" + + "id=" + id + + ", workflowType='" + workflowType + '\'' + + ", templetField='" + templateField + '\'' + + ", attachmentField='" + attachmentField + '\'' + + ", isTempletShow='" + isTemplateShow + '\'' + + ", showField='" + showField + '\'' + + ", showValue=" + showValue + + ", hiddenValue=" + hiddenValue + + ", modelTableName='" + modelTableName + '\'' + + ", modelField='" + modelField + '\'' + + ", showTableName='" + showTableName + '\'' + + ", templateTableName='" + templateTableName + '\'' + + ", attachmentTableName='" + attachmentTableName + '\'' + + ", attachmentFieldId='" + attachmentFieldId + '\'' + + '}'; + } + + public String getAttachmentFieldId() { + return attachmentFieldId; + } + + public int getId() { + return id; + } + + public String getWorkflowType() { + return workflowType; + } + + public String getTemplateField() { + return templateField; + } + + public String getAttachmentField() { + return attachmentField; + } + + public String getIsTemplateShow() { + return isTemplateShow; + } + + public String getShowField() { + return showField; + } + + public int getShowValue() { + return showValue; + } + + public int getHiddenValue() { + return hiddenValue; + } + + public String getModelTableName() { + return modelTableName; + } + + public String getModelField() { + return modelField; + } + + public String getShowTableName() { + return showTableName; + } + + public String attachmentFieldId() { + return attachmentFieldId; + } + + public String getTemplateTableName() { + return templateTableName; + } + + public String getAttachmentTableName() { + return attachmentTableName; + } + + public static Builder create(){ + return new Builder(); + } + + public static class Builder{ + private int id; + private String workflowType; + private String templateField; + private String attachmentField; + private String isTemplateShow; + private String showField; + private int showValue; + private int hiddenValue; + private String modelTableName; + private String modelField; + String showTableName; + String templateTableName; + String attachmentTableName; + String attachmentFieldId; + + public ConfigEmpty builder(){ + return new ConfigEmpty(this); + } + + public Builder id(int id) { + this.id = id; + return this; + } + public Builder showTableName(String showTableName) { + this.showTableName = showTableName; + return this; + } + public Builder templateTableName(String templateTableName) { + this.templateTableName = templateTableName; + return this; + } + public Builder attachmentTableName(String attachmentTableName) { + this.attachmentTableName = attachmentTableName; + return this; + } + + public Builder attachmentFieldId(String attachmentFieldId) { + this.attachmentFieldId = attachmentFieldId; + return this; + } + + public Builder workflowType(String workflowType) { + this.workflowType = workflowType; + return this; + } + + public Builder templateField(String templateField) { + this.templateField = templateField; + return this; + } + + public Builder attachmentField(String attachmentField) { + this.attachmentField = attachmentField; + return this; + } + + public Builder isTemplateShow(String isTemplateShow) { + this.isTemplateShow = isTemplateShow; + return this; + } + + public Builder showField(String showField) { + this.showField = showField; + return this; + } + + public Builder showValue(int showValue) { + this.showValue = showValue; + return this; + } + + public Builder hiddenValue(int hiddenValue) { + this.hiddenValue = hiddenValue; + return this; + } + + public Builder modelTableName(String modelTableName) { + this.modelTableName = modelTableName; + return this; + } + + public Builder modelField(String modelField) { + this.modelField = modelField; + return this; + } + } +} diff --git a/com/api/aiyh_pcn/copy_attachment/service/CopyAttachmentService.java b/com/api/aiyh_pcn/copy_attachment/service/CopyAttachmentService.java new file mode 100644 index 0000000..aa02dc2 --- /dev/null +++ b/com/api/aiyh_pcn/copy_attachment/service/CopyAttachmentService.java @@ -0,0 +1,97 @@ +package com.api.aiyh_pcn.copy_attachment.service; + +import aiyh.utils.zwl.common.ToolUtil; +import com.api.workflow.constant.RequestAuthenticationConstant; +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.hrm.User; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/27 0027 14:52 + * copyservice + */ + + +public class CopyAttachmentService { + public static String copyFile(User user, Map params){ + ToolUtil toolUtil = new ToolUtil(); +// 建模表名称 + String tableName = String.valueOf(params.get("tableName")); +// 建模字段名 + String fieldName = String.valueOf(params.get("fieldName")); +// 附件字段id + String fileFieldId = String.valueOf(params.get("fileFieldId")); +// 配置id + String configId = String.valueOf(params.get("configId")); +// 流程id + String workflowId = String.valueOf(params.get("workflowId")); + DocTemplateDao docTemplateDao = new DocTemplateDao(); + int[] docIds = null; + try{ + docIds = docTemplateDao.copyFile(user.getUID(), tableName, fieldName, configId); + }catch(Exception e){ + toolUtil.writeErrorLog("复制文件出错: " + e); + return null; + } + if(docIds == null){ + return ApiResult.error("未查询到附件模板!"); + } + try{ + docTemplateDao.updateFileInfo(workflowId,fileFieldId,docIds); + }catch(Exception e){ + toolUtil.writeErrorLog("复制文件更新权限和目录出错: " + e); + return null; + } + toolUtil.writeDebuggerLog("数据更新成功!" + Arrays.toString(docIds)); + return ApiResult.success(docIds); + } + + public static String deleteFile(String docIdStr) { + String[] docIds = docIdStr.split(","); + DocTemplateDao docTemplateDao = new DocTemplateDao(); + int[] array = Arrays.stream(docIds).mapToInt(Integer::parseInt).toArray(); + try { + docTemplateDao.deleteFile(array); + } catch (Exception e) { + e.printStackTrace(); + return ApiResult.error("删除失败!"); + } + return ApiResult.success(array,"删除成功!"); + } + + /** + * 查询文档信息 + * @param user user对象 + * @param params 前端参数 + * @return 文档信息 + */ + public static String queryFilesData(User user, Map params){ + String listType = Util.null2String(String.valueOf(params.get("listType")),"list"); + 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 isprint = Util.getIntValue(Util.null2String(String.valueOf(params.get("isprint"))), 0); + int workflowid = Util.getIntValue(Util.null2String(String.valueOf(params.get("workflowid"))), 0); + String f_weaver_belongto_userid = Util.null2String(String.valueOf(params.get("f_weaver_belongto_userid"))); + 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 authSignatureStr = Util.null2String(String.valueOf(params.get(RequestAuthenticationConstant.AUTHORITY_SIGNATURESTRING))); + Map paramsMap = new HashMap<>(); + paramsMap.put("user",user); + Map retobj; + try { + 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); + } catch (Exception e) { + e.printStackTrace(); + return ApiResult.error("查询附件信息失败:" + e); + } + return ApiResult.success(retobj); + } +} diff --git a/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java b/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java new file mode 100644 index 0000000..95106c1 --- /dev/null +++ b/com/api/aiyh_pcn/copy_attachment/web/CopyAttachment.java @@ -0,0 +1,71 @@ +package com.api.aiyh_pcn.copy_attachment.web; + + +import aiyh.utils.ApiResult; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.copy_attachment.service.CopyAttachmentService; +import com.api.aiyh_pcn.copy_attachment.dao.ConfigTableData; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/26 0026 10:16 + * copy ttachment to workflow + */ + + +@Path("/copyAttachment") +public class CopyAttachment { + + ToolUtil toolUtil = new ToolUtil(); + + @POST + @Path("/copy") + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String copyAttachment(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody Map params) { + this.toolUtil.writeDebuggerLog("文件拷贝,接收参数:" + params); + User user = HrmUserVarify.getUser(request, response); + return CopyAttachmentService.copyFile(user,params); + } + + @Path("/deleteFile/{docIds}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String deleteFile(@Context HttpServletRequest request, @Context HttpServletResponse response, + @PathParam("docIds") String docIds) { + this.toolUtil.writeDebuggerLog("文件删除,接收参数:" + docIds); + return CopyAttachmentService.deleteFile(docIds); + } + + @Path("/queryConfig/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryConfig(@PathParam("workflowId") String workflowId) { + this.toolUtil.writeDebuggerLog("获取配置参数,接收参数为: " + workflowId); + return ApiResult.success(ConfigTableData.getConfig(workflowId)); + } + + @Path("/queryFilesData") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String queryFilesData(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody Map params){ + this.toolUtil.writeDebuggerLog("查看文件信息,接收参数:" + params); + User user = HrmUserVarify.getUser(request, response); + return CopyAttachmentService.queryFilesData(user, params); + } +} diff --git a/com/api/aiyh_pcn/fadada/dao/FaDDContractMapping.java b/com/api/aiyh_pcn/fadada/dao/FaDDContractMapping.java new file mode 100644 index 0000000..e086da0 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/dao/FaDDContractMapping.java @@ -0,0 +1,176 @@ +package com.api.aiyh_pcn.fadada.dao; + +import aiyh.utils.Util; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO; +import weaver.aiyh_pcn.fadada.entity.FileInfo; +import weaver.conn.RecordSet; +import weaver.workflow.workflow.WorkflowVersion; + +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/3 0003 14:56 + */ + + +public class FaDDContractMapping { + private final RecordSet rs = new RecordSet(); + private final ToolUtil toolUtil = new ToolUtil(); + + /** + * 查询合同相关的配置信息 + * + * @param workflowId 流程id + * @param type 配置的类型 + * @return 配置信息 + */ + public FaDaDaConfigDTO queryConfig(String workflowId, int type) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String query = "select main.id,main.workflow_type,main.api_type, main.params_config, " + + "wf.fieldname field_control, wf1.fieldname contract_doc, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " + + "where FIND_IN_SET(id,main.check_personal)) check_personal, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem " + + "where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " + + "main.check_source_type,wdt.tablename check_source " + + "from uf_contract_config main " + + "left join workflow_field_table_view wf on wf.id = main.field_control " + + "left join workflow_field_table_view wf1 on wf1.id = main.contract_doc " + + "left join workflow_detail_table_view wdt on wdt.id = main.check_source and " + + "wdt.workflow_id = main.workflow_type " + + "where main.workflow_type in ( " + versionStringByWfid + ") and api_type = ?"; + rs.executeQuery(query, type); + return Util.recordeSet2Entity(rs, FaDaDaConfigDTO.class, true); + } + + + /** + * 获取全版本的workflowId + * + * @param versionStringByWfid 全版本的workflowId + * @return + */ + public String getAllVersion(String versionStringByWfid) { + String query = "select distinct workflow_type from uf_contract_config where workflow_type in (" + versionStringByWfid + ")"; + rs.executeQuery(query); + rs.next(); + return rs.getString(1); + } + + /** + * 获取节点信息 + * + * @param versionStringByWfid 全版本的流程 + * @param markOnly 获取配置的节点信息 + * @return + */ + public String getNodes(String versionStringByWfid, String markOnly) { + String query = "select workflow_nodes from uf_node_config where workflow_type in (" + versionStringByWfid + ") and mark_only = ?"; + rs.executeQuery(query, markOnly); + rs.next(); + return rs.getString(1); + } + + /** + * 获取流程主表 + * + * @param workflowId + * @return + */ + public String getMainTable(String workflowId) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String query = "select tablename from workflow_bill " + + " where id in (select formid from workflow_base " + + " where id in (" + versionStringByWfid + ") )"; + rs.executeQuery(query); + rs.next(); + String mainTable = rs.getString(1); + toolUtil.writeErrorLog("mainTable:" + mainTable); + return mainTable; + } + + /** + * 获取配置的明细表 + * + * @param workflowId + * @param type + * @return + */ + public String getDetailTable(String workflowId, int type) { + FaDaDaConfigDTO faDaDaConfigDTO = this.queryConfig(workflowId, type); + String detailTable = faDaDaConfigDTO.getCheckSource(); + toolUtil.writeErrorLog("detailTable:" + detailTable); + return detailTable; + } + + /** + * 根据主表和请求id查询主表数据 + * + * @param requestId 请求id + * @param mainTableName 主表表名 + * @return + */ + public Map queryMainMap(String requestId, String mainTableName) { + String query = "select * from " + mainTableName + " where requestid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, requestId); + return Util.recordSet2Map(rs); + } + + /** + * 查询明细数据 + * + * @param mainId 主表id + * @param tableName 明细表表名 + * @return + */ + public List> queryDetailMaps(String mainId, String tableName) { + String query = "select * from " + tableName + " where mainid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, mainId); + return Util.recordSet2MapList(rs); + } + + + /** + * 查询合同的配置信息 + * + * @param workflowId + * @return + */ +/* public Map queryContractConfig(String workflowId) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + RecordSet rs = new RecordSet(); + rs.executeQuery("select * from uf_contract_config where workflow_type in ( " + versionStringByWfid + " ) and api_type = ?", 2); + return Util.recordSet2Map(rs); + }*/ + + /** + * 根据文件的id查询物理文件的id + * @param fileIds + * @return + */ + public List queryImgFileIdByDocIds(String fileIds) { + String query = "select imagefileid,imagefilename from docimagefile where docid in ( " + fileIds + " )"; + rs.executeQuery(query); + return Util.recordeSet2Array(rs, FileInfo.class); + } + + public UfContractInfoDTO queryContractInfo(String contractNo) { + String query = "select * from uf_contract_info where contract_no = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query,contractNo); + return Util.recordeSet2Entity(rs,UfContractInfoDTO.class,true); + } + + public UfContractInfoDTO queryContractInfoByRequestId(String requestId) { + String query = "select * from uf_contract_info where workflow_request_id = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query,requestId); + return Util.recordeSet2Entity(rs,UfContractInfoDTO.class,true); + } +} diff --git a/com/api/aiyh_pcn/fadada/dao/FaDDServiceMapping.java b/com/api/aiyh_pcn/fadada/dao/FaDDServiceMapping.java new file mode 100644 index 0000000..22e6894 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/dao/FaDDServiceMapping.java @@ -0,0 +1,173 @@ +package com.api.aiyh_pcn.fadada.dao; + +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import weaver.aiyh_pcn.fadada.entity.FileInfo; +import weaver.conn.RecordSet; +import weaver.workflow.workflow.WorkflowVersion; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/30 0030 11:18 + * 数据 + */ + + +public class FaDDServiceMapping { + private final RecordSet rs = new RecordSet(); + private final ToolUtil toolUtil = new ToolUtil(); + +// private final String MAIN_TABLE = "formtable_main_17"; +// private final String DETAIL_TABLE = "formtable_main_17_dt1"; + + public FaDaDaConfigDTO queryConfig(String workflowId, int type) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String query = "select main.id,main.workflow_type,main.api_type, main.params_config, " + + "wf.fieldname field_control, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_personal)) check_personal, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " + + "main.check_source_type,wdt.tablename check_source " + + "from uf_contract_config main " + + "left join workflow_field_table_view wf on wf.id = main.field_control " + + "left join workflow_detail_table_view wdt on wdt.id = main.check_source and wdt.workflow_id = main.workflow_type " + + "where main.workflow_type in ( " + versionStringByWfid + ") and api_type = ?"; + rs.executeQuery(query, type); + return Util.recordeSet2Entity(rs, FaDaDaConfigDTO.class, true); + } + + public List queryImgFileIdByDocIds(String fileIds) { + String query = "select imagefileid,imagefilename from docimagefile where docid in ( " + fileIds + " )"; + rs.executeQuery(query); + return Util.recordeSet2Array(rs, FileInfo.class); + } + + public List> queryDetailInfo(String requestId,String workflowId,int type) { + + String mainTable = this.getMainTable(workflowId); + toolUtil.writeErrorLog("进入查询数据库方法"); + String query = "select id from " + mainTable + " where requestid = ?"; + rs.executeQuery(query, requestId); + rs.next(); + String mainId = rs.getString("id"); + String detailTable = this.getDetailTable(workflowId, type); + query = "select * from " + detailTable + " where mainid = ? and ( contract_status in (1,6) or contract_status is null) "; + this.toolUtil.writeErrorLog(query); + RecordSet rs = new RecordSet(); + rs.executeQuery(query, mainId); + List> maps = null; + try { + maps = Util.recordSet2MapList(rs); + toolUtil.writeErrorLog("查询到状态:" + maps); + } catch (Exception e) { + e.printStackTrace(); + toolUtil.writeErrorLog("工具类出现异常:" + e); + } + return maps == null ? new ArrayList<>() : maps; + } + + public List> queryDetailDownInfo(String requestId,String workflowId,int type) { + + String mainTable = this.getMainTable(workflowId); + toolUtil.writeErrorLog("进入查询数据库方法"); + String query = "select id from " + mainTable + " where requestid = ?"; + rs.executeQuery(query, requestId); + rs.next(); + String mainId = rs.getString("id"); + String detailTable = this.getDetailTable(workflowId, type); + query = "select * from " + detailTable + " where mainid = ?"; + this.toolUtil.writeErrorLog(query); + RecordSet rs = new RecordSet(); + rs.executeQuery(query, mainId); + List> maps = null; + try { + maps = Util.recordSet2MapList(rs); + toolUtil.writeErrorLog("查询到状态:" + maps); + } catch (Exception e) { + e.printStackTrace(); + toolUtil.writeErrorLog("工具类出现异常:" + e); + } + return maps == null ? new ArrayList<>() : maps; + } + + + public List> querySignedInfo(String requestId, String workflowId) { + String mainTable = this.getMainTable(workflowId); + String query = "select id from " + mainTable + " where requestid = ? and signed_oneself = 1"; + rs.executeQuery(query, requestId); + return Util.recordSet2MapList(rs); + } + + public void updateContractStatus(Map map,String workflowId,int type) { + String detailTable = this.getDetailTable(workflowId,type); + Map updateData = new HashMap<>(); + updateData.put("contract_status", map.get("contract_status")); + Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual(map.get("id")); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(detailTable, updateData, where); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + + public String getAllVersion(String versionStringByWfid) { + String query = "select distinct workflow_type from uf_contract_config where workflow_type in (" + versionStringByWfid + ")"; + rs.executeQuery(query); + rs.next(); + return rs.getString(1); + } + + public String getMainTable(String workflowId){ + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String query = "select tablename from workflow_bill " + + " where id in (select formid from workflow_base " + + " where id in (" + versionStringByWfid + ") )"; + rs.executeQuery(query); + rs.next(); + String mainTable = rs.getString(1); + toolUtil.writeErrorLog("mainTable:" + mainTable); + return mainTable; + } + + public String getDetailTable(String workflowId, int type){ + FaDaDaConfigDTO faDaDaConfigDTO = this.queryConfig(workflowId, type); + String detailTable = faDaDaConfigDTO.getCheckSource(); + toolUtil.writeErrorLog("detailTable:" + detailTable); + return detailTable; + } + + public String getNodes(String versionStringByWfid, String markOnly) { + String query = "select workflow_nodes from uf_node_config where workflow_type in (" + versionStringByWfid + ") and mark_only = ?"; + rs.executeQuery(query,markOnly); + rs.next(); + return rs.getString(1); + } + +/* public FaDDConfigMainDTO getConfigParam(String workflowId) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + System.out.println(versionStringByWfid); + String query = "select main.id,main.workflow_type, wf.fieldname field_control, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_personal)) check_personal, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " + + "main.check_source_type,wdt.tablename check_source " + + "from uf_attestation_conf main " + + "left join workflow_field_table_view wf on wf.id = main.field_control " + + "left join workflow_detail_table_view wdt on wdt.id = main.check_source and wdt.workflow_id = main.workflow_type " + + "where main.workflow_type in ( " + versionStringByWfid + ")"; + rs.executeQuery(query); + FaDDConfigMainDTO faDDConfigMainDTO = Util.recordeSet2Entity(rs, FaDDConfigMainDTO.class, true); + query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " + + "dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql,dt.api_type " + + "from uf_attestation_conf_dt1 dt " + + "left join workflow_field_table_view wf on wf.id = dt.workflow_field " + + "where dt.mainid = ?"; + rs.executeQuery(query, faDDConfigMainDTO.getId()); + List faDDConfigDetailDTOS = Util.recordeSet2Array(rs, FaDDConfigDetailDTO.class, true); + faDDConfigMainDTO.setList(faDDConfigDetailDTOS); + return faDDConfigMainDTO; + }*/ +} diff --git a/com/api/aiyh_pcn/fadada/entity/FaDaDaConfigDTO.java b/com/api/aiyh_pcn/fadada/entity/FaDaDaConfigDTO.java new file mode 100644 index 0000000..ec0c17f --- /dev/null +++ b/com/api/aiyh_pcn/fadada/entity/FaDaDaConfigDTO.java @@ -0,0 +1,93 @@ + +package com.api.aiyh_pcn.fadada.entity; + + +public class FaDaDaConfigDTO { + + private int id; + private int workflowType; + private int apiType; + private String paramsConfig; + private String fieldControl; + private int checkSourceType; + private String checkSource; + private String contractDoc; + + public void setId(int id){ + this.id = id; + } + + public void setWorkflowType(int workflowType){ + this.workflowType = workflowType; + } + + public void setApiType(int apiType){ + this.apiType = apiType; + } + + public void setParamsConfig(String paramsConfig){ + this.paramsConfig = paramsConfig; + } + + public void setFieldControl(String fieldControl){ + this.fieldControl = fieldControl; + } + + public void setCheckSourceType(int checkSourceType){ + this.checkSourceType = checkSourceType; + } + + public void setCheckSource(String checkSource){ + this.checkSource = checkSource; + } + + public int getId(){ + return this.id; + } + + public int getWorkflowType(){ + return this.workflowType; + } + + public int getApiType(){ + return this.apiType; + } + + public String getParamsConfig(){ + return this.paramsConfig; + } + + public String getFieldControl(){ + return this.fieldControl; + } + + public int getCheckSourceType(){ + return this.checkSourceType; + } + + public String getCheckSource(){ + return this.checkSource; + } + + public String getContractDoc() { + return contractDoc; + } + + public void setContractDoc(String contractDoc) { + this.contractDoc = contractDoc; + } + + @Override + public String toString() { + return "FaDaDaConfigDTO{" + + "id=" + id + + ", workflowType=" + workflowType + + ", apiType=" + apiType + + ", paramsConfig='" + paramsConfig + '\'' + + ", fieldControl='" + fieldControl + '\'' + + ", checkSourceType=" + checkSourceType + + ", checkSource='" + checkSource + '\'' + + ", contractDoc='" + contractDoc + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/com/api/aiyh_pcn/fadada/entity/TreeEntity.java b/com/api/aiyh_pcn/fadada/entity/TreeEntity.java new file mode 100644 index 0000000..ff3e6f2 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/entity/TreeEntity.java @@ -0,0 +1,29 @@ +package com.api.aiyh_pcn.fadada.entity; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/12 0012 11:16 + * 树形结构 + */ + + +public class TreeEntity { + private List children; + + public List getChildren() { + return children; + } + + public void setChildren(List children) { + this.children = children; + } + + @Override + public String toString() { + return "TreeEntity{" + + "children=" + children + + '}'; + } +} diff --git a/com/api/aiyh_pcn/fadada/entity/UfContractInfoDTO.java b/com/api/aiyh_pcn/fadada/entity/UfContractInfoDTO.java new file mode 100644 index 0000000..839c99f --- /dev/null +++ b/com/api/aiyh_pcn/fadada/entity/UfContractInfoDTO.java @@ -0,0 +1,193 @@ + +package com.api.aiyh_pcn.fadada.entity; + + +public class UfContractInfoDTO { + + private int id; + private int requestId; + private int workflowType; + private String contractNo; + private String fileNo; + private String fileName; + private int signedNum; + private int shouldSignedNum; + private int contractStatus; + private String contractViewUrl; + private String contractDownUrl; + private String workflowMainTable; + private int queueSigned; + private int singleContractFileNum; + private int singleSignedNum; + private String workflowRequestId; + private String workflowDetailTable; + private int mainId; + + public void setId(int id){ + this.id = id; + } + + public void setRequestId(int requestId){ + this.requestId = requestId; + } + + public void setWorkflowType(int workflowType){ + this.workflowType = workflowType; + } + + public void setContractNo(String contractNo){ + this.contractNo = contractNo; + } + + public void setFileNo(String fileNo){ + this.fileNo = fileNo; + } + + public void setFileName(String fileName){ + this.fileName = fileName; + } + + public void setSignedNum(int signedNum){ + this.signedNum = signedNum; + } + + public void setShouldSignedNum(int shouldSignedNum){ + this.shouldSignedNum = shouldSignedNum; + } + + public void setContractStatus(int contractStatus){ + this.contractStatus = contractStatus; + } + + public void setContractViewUrl(String contractViewUrl){ + this.contractViewUrl = contractViewUrl; + } + + public void setContractDownUrl(String contractDownUrl){ + this.contractDownUrl = contractDownUrl; + } + + public void setWorkflowMainTable(String workflowMainTable){ + this.workflowMainTable = workflowMainTable; + } + + public void setQueueSigned(int queueSigned){ + this.queueSigned = queueSigned; + } + + public void setSingleContractFileNum(int singleContractFileNum){ + this.singleContractFileNum = singleContractFileNum; + } + + public void setSingleSignedNum(int singleSignedNum){ + this.singleSignedNum = singleSignedNum; + } + + public void setWorkflowRequestId(String workflowRequestId){ + this.workflowRequestId = workflowRequestId; + } + + public void setWorkflowDetailTable(String workflowDetailTable){ + this.workflowDetailTable = workflowDetailTable; + } + + public void setMainId(int mainId){ + this.mainId = mainId; + } + + public int getId(){ + return this.id; + } + + public int getRequestId(){ + return this.requestId; + } + + public int getWorkflowType(){ + return this.workflowType; + } + + public String getContractNo(){ + return this.contractNo; + } + + public String getFileNo(){ + return this.fileNo; + } + + public String getFileName(){ + return this.fileName; + } + + public int getSignedNum(){ + return this.signedNum; + } + + public int getShouldSignedNum(){ + return this.shouldSignedNum; + } + + public int getContractStatus(){ + return this.contractStatus; + } + + public String getContractViewUrl(){ + return this.contractViewUrl; + } + + public String getContractDownUrl(){ + return this.contractDownUrl; + } + + public String getWorkflowMainTable(){ + return this.workflowMainTable; + } + + public int getQueueSigned(){ + return this.queueSigned; + } + + public int getSingleContractFileNum(){ + return this.singleContractFileNum; + } + + public int getSingleSignedNum(){ + return this.singleSignedNum; + } + + public String getWorkflowRequestId(){ + return this.workflowRequestId; + } + + public String getWorkflowDetailTable(){ + return this.workflowDetailTable; + } + + public int getMainId(){ + return this.mainId; + } + + @Override + public String toString() { + return "UfContractInfoDTO{" + + "id='" + id + '\'' + + ", requestId='" + requestId + '\'' + + ", workflowType='" + workflowType + '\'' + + ", contractNo='" + contractNo + '\'' + + ", fileNo='" + fileNo + '\'' + + ", fileName='" + fileName + '\'' + + ", signedNum='" + signedNum + '\'' + + ", shouldSignedNum='" + shouldSignedNum + '\'' + + ", contractStatus='" + contractStatus + '\'' + + ", contractViewUrl='" + contractViewUrl + '\'' + + ", contractDownUrl='" + contractDownUrl + '\'' + + ", workflowMainTable='" + workflowMainTable + '\'' + + ", queueSigned='" + queueSigned + '\'' + + ", singleContractFileNum='" + singleContractFileNum + '\'' + + ", singleSignedNum='" + singleSignedNum + '\'' + + ", workflowRequestId='" + workflowRequestId + '\'' + + ", workflowDetailTable='" + workflowDetailTable + '\'' + + ", mainId='" + mainId + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/com/api/aiyh_pcn/fadada/service/IFaDDService.java b/com/api/aiyh_pcn/fadada/service/IFaDDService.java new file mode 100644 index 0000000..ffa3d57 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/service/IFaDDService.java @@ -0,0 +1,17 @@ +package com.api.aiyh_pcn.fadada.service; + +import com.api.aiyh_pcn.fadada.vo.TableFieldMappingVO; + +import java.util.List; +import java.util.Map; + +/** + * @author @author EBU7-dev1-ay + * @create 2021/9/30 0030 11:19 + * 接口 + */ + +public interface IFaDDService { + Map getConfigParam(String workflowId); + Map checkCertification(Map params); +} diff --git a/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java b/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java new file mode 100644 index 0000000..67a78b0 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/service/impl/FaDDContractService.java @@ -0,0 +1,716 @@ +package com.api.aiyh_pcn.fadada.service.impl; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigDetailDTO; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSON; +import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO; +import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.apache.axiom.util.base64.Base64Utils; +import org.apache.http.HttpEntity; +import org.h2.util.StringUtils; +import weaver.conn.RecordSet; +import weaver.general.xcommon.IOUtils; +import weaver.hrm.User; +import weaver.soa.workflow.FileProcessor; +import weaver.workflow.workflow.WorkflowVersion; + +import javax.ws.rs.WebApplicationException; +import javax.ws.rs.core.StreamingOutput; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/3 0003 14:51 + */ + + +public class FaDDContractService { + private final ToolUtil toolUtil = new ToolUtil(); + private final String contractInfoTable = "uf_contract_info"; + private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping(); + + + /** + * 获取全版本的流程id,节点id + * + * @param workflowId + * @param markOnly + * @return + */ + public Map getAllVersion(String workflowId, String markOnly) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String newWorkflowId = faDDContractMapping.getAllVersion(versionStringByWfid); + String allVersion = WorkflowVersion.getVersionStringByWfid(newWorkflowId); + if (allVersion == null) { + allVersion = ""; + } + String[] split = allVersion.split(","); + Map data = new HashMap<>(); + String[] nodes = this.getNodes(workflowId, markOnly); + data.put("workflowIds", split); + data.put("nodeIds", nodes); + return data; + } + + /** + * 获取节点id + * + * @param workflowId + * @param markOnly + * @return + */ + public String[] getNodes(String workflowId, String markOnly) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String nods = faDDContractMapping.getNodes(versionStringByWfid, markOnly); + if (nods == null) { + nods = ""; + } + return nods.split(","); + } + + + /** + * 获取替换SQL的数据 + * + * @param requestId + * @param workflowId + * @param mainTableName + * @param tableName + * @return + */ + public List> getDataArr(String requestId, String workflowId, String mainTableName, String tableName) { + Map mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName); + String mainId = Util.null2String(mainMap.get("id")); + List> detailMaps = faDDContractMapping.queryDetailMaps(mainId, tableName); + return getDataArr(requestId, workflowId, tableName, mainMap, detailMaps); + } + + public List> getDataArr(String requestId, String workflowId, String mainTableName, String tableName, List> detailMaps) { + Map mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName); + String mainId = Util.null2String(mainMap.get("id")); + return getDataArr(requestId, workflowId, tableName, mainMap, detailMaps); + } + + public List> getDataArr(String requestId, String workflowId, String tableName, + Map mainMap, List> detailMaps) { + List> dataArr = new ArrayList<>(); + String dt = tableName.substring(tableName.indexOf("_dt") + 3); + String main = "main."; + String detail = "detail_" + dt + "."; + for (Map detailMap : detailMaps) { + Map data = new HashMap<>(); + for (Map.Entry entry : mainMap.entrySet()) { + data.put(main + entry.getKey(), entry.getValue()); + } + for (Map.Entry entry : detailMap.entrySet()) { + data.put(detail + entry.getKey(), entry.getValue()); + } + data.put("requestId", requestId); + data.put("workflowId", workflowId); + dataArr.add(data); + } + return dataArr; + } + + /** + * 获取处理object和List类型后的参数 + * + * @param treeList + * @param dataArr + * @return + */ + public List> objectAndListHandle(List treeList, List> dataArr) { + List> params = new ArrayList<>(); + for (Map dataMap : dataArr) { + Map param = new HashMap<>(); + for (ApiConfigDetailDTO apiConfigDetailDTO : treeList) { + Object value; + if (apiConfigDetailDTO.getParamType() == 3) { + Map map = new HashMap<>(); +// object类型 + for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) { + if (child.getChildren() == null || child.getChildren().size() == 0) { +// handleChild(child.getChildren(), dataMap) + map.put(child.getParamName(), changeRuleHandle(child, dataMap)); + } else { + map.put(child.getParamName(), handleChild(child.getChildren(), dataMap)); + } + } + value = map; + } else if (apiConfigDetailDTO.getParamType() == 4) { + String sql = apiConfigDetailDTO.getArraySql(); + String parsingSq = aiyh.utils.Util.parsingSq(sql, dataMap); +// list类型 + if (parsingSq.contains("delete") || parsingSq.contains("update") || + parsingSq.contains("exec") || parsingSq.contains("drop") || + parsingSq.contains("truncate")) { + value = new ArrayList<>(); + } else { + RecordSet rs = new RecordSet(); + String replace = parsingSq.replace("select ", "select ") + .replaceAll(" and ", " and ") + .replaceAll(" or ", " or ") + .replaceAll(" join ", " join ") + .replaceAll(" in ", " in "); + rs.executeQuery(replace); + value = aiyh.utils.Util.recordeSet2Array(rs, String.class); + } + } else { + value = changeRuleHandle(apiConfigDetailDTO, dataMap); + } + param.put(apiConfigDetailDTO.getParamName(), value); + } + params.add(param); + } + return params; + } + + /** + * 处理子类 + * + * @param children + * @param dataMap + * @return + */ + private Object handleChild(List children, Map dataMap) { + Map params = new HashMap<>(); + for (ApiConfigDetailDTO child : children) { + Object value; + if (child.getChildren() != null) { + value = handleChild(child.getChildren(), dataMap); + } else { + value = changeRuleHandle(child, dataMap); + } + params.put(child.getParamName(), value); + } + return params; + } + + /** + * 根据转换规则生成对应的参数值 + * + * @param apiConfigDetailDTO + * @param dataMap + * @return + */ + private Object changeRuleHandle(ApiConfigDetailDTO apiConfigDetailDTO, Map dataMap) { + Object value; + String tableName; + String table; + String sql; + String resultSql; +// 判断参数的转换规则 + switch (apiConfigDetailDTO.getChangeRule()) { + case 0: +// 不转换 + case 2: +// 流程字段值 + table = apiConfigDetailDTO.getTablename(); + if (!table.contains("_dt")) { +// 表示字段属于主表 + tableName = "main"; + } else { +// 字段属于明细表 + String dt = table.substring(table.indexOf("_dt") + 3); + tableName = "detail_" + dt; + } + value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField()); + break; + case 1: +// 固定值 + value = apiConfigDetailDTO.getParamValue(); + break; + case 3: +// 系统日期 + value = aiyh.utils.Util.getTime("yyyy-MM-dd"); + break; + case 4: +// 系统时间 + value = aiyh.utils.Util.getTime("HH:mm:ss"); + break; + case 5: +// 系统日期-时间 + value = aiyh.utils.Util.getTime("yyyy-MM-dd HH:mm:ss"); + break; + case 6: +// 自定义SQL + case 7: +// 流程字段转SQL + sql = apiConfigDetailDTO.getParamValue(); + resultSql = aiyh.utils.Util.parsingSq(sql, dataMap); + if (resultSql.contains("delete ") || resultSql.contains("update ") || + resultSql.contains("exec ") || resultSql.contains("drop ") || + resultSql.contains("truncate ")) { + value = null; + } else { + RecordSet rs = new RecordSet(); + String replace = resultSql.replace("select ", "select ") + .replaceAll(" and ", " and ") + .replaceAll(" or ", " or ") + .replaceAll(" join ", " join ") + .replaceAll(" in ", " in "); + rs.executeQuery(replace); + rs.next(); + value = aiyh.utils.Util.null2String(rs.getString(1)); + } + break; + case 8: +// TODO +// 流程名称 + value = aiyh.utils.Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid"))); + break; + case 9: +// TODO +// 请求标题 + value = aiyh.utils.Util.getRequestTitleById(String.valueOf(dataMap.get("requestid"))); + break; + case 10: +// 流程requestId + value = dataMap.get("requestid"); + break; + default: + value = null; + break; + } + if (apiConfigDetailDTO.getParamType() == 1) { +// Integer + value = Integer.parseInt(String.valueOf(value)); + } else if (apiConfigDetailDTO.getParamType() == 2) { +// Boolean + value = Boolean.parseBoolean(String.valueOf(value)); + } + return value; + } + + /** + * 合同签署回调逻辑处理 + * + * @param contractNo + */ + public void signedCallBack(String contractNo) { +// 查询合同信息表中的数据 + UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfo(contractNo); + Map update = new HashMap<>(); + if (ufContractInfoDTO.getQueueSigned() == 1) { +// 属于顺序签署合同,更新单份合同已签蜀几个文件 + update.put("single_signed_num", ufContractInfoDTO.getSingleSignedNum() + 1); +// 如果单份合同签署数量等于合同文件数量,表示已经签署完成 + if (ufContractInfoDTO.getSingleSignedNum() + 1 == ufContractInfoDTO.getSingleContractFileNum()) { + update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1); +// 查询下一位合同方并发起签署 + nextContractSigned(ufContractInfoDTO); + } +// 如果合同已签数量和应签数量相同,则状态为本方待签 + if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum()) { + update.put("contract_status", 3); + } + } else { +// 全部合同一起发送的签署信息 +// 直接合同已签署+1 + update.put("signed_num", ufContractInfoDTO.getSignedNum() + 1); +// 如果已签文件数等于需要签署的合同数乘以合同文件数相等,则代表对方已经签署完毕 + if (ufContractInfoDTO.getSignedNum() + 1 == ufContractInfoDTO.getShouldSignedNum() * ufContractInfoDTO.getSingleContractFileNum()) { + update.put("contract_status", 3); + } + } +// 更新状态 + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("uf_contract_info", update, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getId())); + RecordSet rs = new RecordSet(); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); +// 查询合同状态,更新明细表 + /* Map data = new HashMap<>(); + data.put("contractNo","6a265befb3944d93a7a8b32b8d5ca33d"); + Map faResult = null; + try { + faResult = FaDDRequestUtils.queryDetailContractStatus(data); + String code = Util.null2String(faResult.get("code")); + if(!"200".equals(code)){ + throw new RuntimeException("查询合同失败,失败原因:" + faResult); + } + Map resultData = (Map) faResult.get("data"); + List> contractSignerList = (List>) resultData.get("contractSignerList"); + for (Map signer : contractSignerList) { + if("-1".equals(signer.get("isSender"))){ + continue; + } + String customerId = Util.null2String(signer.get("customerId")); + String signStatus = Util.null2String(signer.get("signStatus")); + if(!"1".equals(signStatus)){ + continue; + } +// 更新数据库 + update.clear(); + update.put("signed_status",2); +// 查询明细表id + } + } catch (JsonProcessingException e) { + e.printStackTrace(); + toolUtil.writeErrorLog("查询合同失败,失败原因:" + e); + }*/ + } + + /** + * 查询下一个合同方并发起合同签署 + * + * @param ufContractInfoDTO + */ + private void nextContractSigned(UfContractInfoDTO ufContractInfoDTO) { + String query = "select * from " + ufContractInfoDTO.getWorkflowDetailTable() + " where mainid = ? and signed_status is null"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, ufContractInfoDTO.getMainId()); + List> detailMaps = Util.recordSet2MapList(rs); +// 获取配置表信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 3); +// 查询接口配置树形结构 + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); + // 查询签署数据 + List> dataArr = getDataArr(ufContractInfoDTO.getWorkflowRequestId(), + String.valueOf(ufContractInfoDTO.getWorkflowType()), ufContractInfoDTO.getWorkflowMainTable(), + ufContractInfoDTO.getWorkflowDetailTable(), detailMaps); +// 处理数据 + List> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + if (maps == null) { + toolUtil.writeErrorLog("service签署合同错误,错误原因:maps为null!"); + throw new RuntimeException("service签署合同错误,错误原因:maps为null!"); + } + if (maps.size() == 0) { + return; + } + Map updateData = new HashMap<>(); + Map map = maps.get(0); + signedRequest(map, apiConfigMainDTO); +// 将合同签署信息更新到合同信息表中 + updateData.put("single_signed_num", 0); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateData, + Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(ufContractInfoDTO.getWorkflowRequestId())); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + updateData.clear(); +// 更新明细表合同信息 TODO 明细表添加字段,signed_status(合同方签署状态) +// 签署状态,1 已发送待签署,2 已签蜀 + updateData.put("signed_status", 1); + sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowDetailTable(), updateData, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(map.get("id")))); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + + /** + * 合同签署发送请求 + * + * @param map + * @param apiConfigMainDTO + */ + private void signedRequest(Map map, ApiConfigMainDTO apiConfigMainDTO) { + String contractNos = Util.null2String(map.get("contractNo")); + String[] split = contractNos.split(","); +// RecordSet rs = new RecordSet(); + for (String s : split) { + map.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl()); + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { + toolUtil.writeErrorLog("法大大接口签署合同失败!"); + throw new RuntimeException("法大大接口签署合同失败!"); + } + } + } + + /** + * 查询合同的状态信息 + * + * @param requestId + * @return + */ + public Map querySignedStatus(String requestId) { +// 查询合同状态 + String query = "select * from " + contractInfoTable + " where workflow_request_id = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, requestId); + Map result = Util.recordSet2Map(rs); + this.toolUtil.writeErrorLog(result.toString()); + boolean isAllSinged = false; + boolean isSingedOneself = false; + if (result == null) { + toolUtil.writeErrorLog("查询到状态为null;sql:" + query + " ---> " + requestId); + return ParaMap.create().put("isAllSinged", false) + .put("isSingedOneself", false); + } +// 等待对方签署 +/* if("2".equals(result.get("contract_status"))){ + isAllSinged = false; + }*/ +// 等待我方签署 + if ("3".equals(Util.null2String(result.get("contract_status")))) { + isAllSinged = true; + } +// 签署完毕 + if ("4".equals(Util.null2String(result.get("contract_status")))) { + isAllSinged = true; + isSingedOneself = true; + } + return ParaMap.create().put("isAllSinged", isAllSinged) + .put("isSingedOneself", isSingedOneself); + } + + public void signedContractOwn(String requestId, User user) { +// 查询合同信息 + UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); +// 获取配置表信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 4); +// 查询接口配置树形结构 + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); + // 查询签署数据 + List> dataArr = getDataArr(ufContractInfoDTO.getWorkflowRequestId(), + String.valueOf(ufContractInfoDTO.getWorkflowType()), ufContractInfoDTO.getWorkflowMainTable(), + ufContractInfoDTO.getWorkflowDetailTable()); +// 处理数据 + List> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + if (maps == null) { + toolUtil.writeErrorLog("service签署合同错误,错误原因:maps为null!"); + throw new RuntimeException("service签署合同错误,错误原因:maps为null!"); + } + if (maps.size() == 0) { + return; + } + Map data = maps.get(0); + String contractNos = String.valueOf(data.get("contractNo")); + String[] split = contractNos.split(","); + List downloadUrlList = new ArrayList<>(); + List viewUrlList = new ArrayList<>(); + for (String s : split) { + data.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(data, apiConfigMainDTO.getApiUrl()); + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { + this.toolUtil.writeErrorLog("签署参数:" + responeVo.getEntityString()); + throw new RuntimeException("本方签署失败!法大大请求接口错误!"); + }else{ + Map result = (Map) response.get("data"); + downloadUrlList.add(Util.null2String(result.get("downloadUrl"))); + viewUrlList.add(Util.null2String(result.get("viewUrl"))); + } + } +// 更新合同状态 + RecordSet rs = new RecordSet(); + Map update = new HashMap<>(); + update.put("contract_status", 4); + update.put("contract_view_url", String.join(";",viewUrlList)); + update.put("contract_down_url", String.join(";",downloadUrlList)); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, + Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); + toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); +// 获取流程中的合同字段的文档目录id + rs.executeQuery("select formid from workflow_base where id = ?",ufContractInfoDTO.getWorkflowType()); + 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 = ?)"; + rs.executeQuery(query,faDaDaConfigDTO.getContractDoc(),formId); + String docCategorys =Util.null2String(Util.recordeSet2Entity(rs, String.class)); + if(StringUtils.isNullOrEmpty(docCategorys)){ + query = "select doccategory from workflow_base where id = ?"; + rs.executeQuery(query,ufContractInfoDTO.getWorkflowType()); + rs.next(); + docCategorys = Util.null2String(rs.getString(1)); + } + if(StringUtils.isNullOrEmpty(docCategorys)){ + docCategorys = ",,1"; + } +// String[] docSplit = docCategorys.split(","); +// String category = docSplit[docSplit.length - 1]; +// 下载合同到文件服务器中 + String docIds = ""; + try { + docIds = downloadContract2FileSystem(ufContractInfoDTO, docCategorys, user); + }catch (Exception e){ + toolUtil.writeErrorLog("创建文档发生错误:" + e); + } + toolUtil.writeErrorLog("生成的文档的id:" + docIds); +// 将id保存到流程字段中 + sqlResult = Util.createSqlBuilder().updateSql(ufContractInfoDTO.getWorkflowMainTable(), + ParaMap.create().put(faDaDaConfigDTO.getContractDoc(), docIds), + Util.createPrepWhereImpl().whereAnd("id").whereEqual(ufContractInfoDTO.getMainId())); + toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + } + + public String downloadContract2FileSystem(UfContractInfoDTO ufContractInfoDTO, String category, User user) { + + /* ImageFileManager fileManager = new ImageFileManager(); + int fileId = fileManager.saveImageFileByInputStream(downloadContract(ufContractInfoDTO.getContractNo(), + String.valueOf(ufContractInfoDTO.getWorkflowType())), ufContractInfoDTO.getFileName());*/ + // 获取配置表信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); + String contractNos = Util.null2String(ufContractInfoDTO.getContractNo()); + String[] split = contractNos.split(","); + List docIds = new ArrayList<>(); + for (String contractNo : split) { +// InputStream inputStream = downloadContract(s, String.valueOf(ufContractInfoDTO.getWorkflowType())); + Map data = new HashMap<>(); + data.put("contractNo", contractNo); + AtomicReference content = new AtomicReference<>(); + FaDDRequestUtils.downContract(data, response -> { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("法大大请求接口错误!"); + } + try { + content.set(entity.getContent()); + } catch (IOException e) { + e.printStackTrace(); + } + byte[] byteArray = null; + try { + byteArray = IOUtils.toByteArray(content.get()); + } catch (IOException e) { + e.printStackTrace(); + toolUtil.writeErrorLog("文件流处理错误,将inputStream转换为byte数组出错:" + e); + } + this.toolUtil.writeErrorLog(ufContractInfoDTO.toString()); + String base64 = Base64Utils.encode(byteArray); + FileProcessor fileProcessor = new FileProcessor(); + toolUtil.writeErrorLog("base64:" + "base64:" + base64); + toolUtil.writeErrorLog("category:" + category); + toolUtil.writeErrorLog("user:" + JSON.toJSONString(user)); + toolUtil.writeErrorLog("fileName:" + ufContractInfoDTO.getFileName()); + docIds.add(String.valueOf(fileProcessor.Process("base64:" + base64, category, user, ufContractInfoDTO.getFileName()))); + }, apiConfigMainDTO.getApiUrl()); + } + return String.join(",", docIds); + } + + public InputStream downloadContract(String contractNo, String workflowId) { +// 获取配置表信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 5); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); + Map data = new HashMap<>(); + data.put("contractNo", contractNo); + AtomicReference content = new AtomicReference<>(); + FaDDRequestUtils.downContract(data, response -> { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("法大大请求接口错误!"); + } + try { + content.set(entity.getContent()); + } catch (IOException e) { + e.printStackTrace(); + } + }, apiConfigMainDTO.getApiUrl()); + return content.get(); + } + + /** + * 直接从法大大系统下载文件 + * @param ufContractInfoDTO 合同相关信息 + * @return + */ + public StreamingOutput download4mFDD(UfContractInfoDTO ufContractInfoDTO){ + // 获取配置表信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(String.valueOf(ufContractInfoDTO.getWorkflowType()), 5); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); + // 查询合同信息 +// UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); + String contractNos = Util.null2String(ufContractInfoDTO.getContractNo()); + String fileNames = Util.null2String(ufContractInfoDTO.getFileName()); + String[] contractNoArr = contractNos.split(","); + String[] fileNameArr = fileNames.split(","); + toolUtil.writeErrorLog("下载合同download4mFDD!"); + if(contractNoArr.length >= 2){ +// 多个文件,需要下载压缩包 + return outputStream -> { + ZipOutputStream zipOut = new ZipOutputStream(outputStream); + int catchLen = 10 * 1024; + for (int i = 0; i < contractNoArr.length; i++) { +// InputStream inputStream = downloadContract(contractNoArr[i], String.valueOf(ufContractInfoDTO.getWorkflowType())); + Map data = new HashMap<>(); + data.put("contractNo", contractNoArr[i]); + AtomicReference content = new AtomicReference<>(); + int finalI = i; + FaDDRequestUtils.downContract(data, response -> { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("法大大请求接口错误!"); + } + try { + content.set(entity.getContent()); + zipOut.putNextEntry(new ZipEntry(fileNameArr[finalI])); + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = content.get().read(buffer)) != -1) { + zipOut.write(buffer, 0, len); + } + content.get().close(); + zipOut.closeEntry(); + } catch (IOException e) { + e.printStackTrace(); + toolUtil.writeErrorLog("文件压缩处理出现问题!" + e); + } + }, apiConfigMainDTO.getApiUrl()); + + } + zipOut.flush(); + zipOut.close(); + outputStream.flush(); + outputStream.close(); + }; + } + return outputStream->{ + toolUtil.writeErrorLog("download4mFDD单文件下载!"); +// InputStream inputStream = downloadContract(contractNos,String.valueOf(ufContractInfoDTO.getWorkflowType())); + Map data = new HashMap<>(); + data.put("contractNo", contractNos); + AtomicReference content = new AtomicReference<>(); + FaDDRequestUtils.downContract(data, response -> { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("法大大请求接口错误!"); + } + try { + content.set(entity.getContent()); + int catchLen = 10 * 1024; + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = content.get().read(buffer)) != -1) { + outputStream.write(buffer, 0, len); + } + content.get().close(); + outputStream.flush(); + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + toolUtil.writeErrorLog("单文件下载处理出现问题!" + e); + } + }, apiConfigMainDTO.getApiUrl()); + }; + + } +} diff --git a/com/api/aiyh_pcn/fadada/service/impl/FaDDServiceImpl.java b/com/api/aiyh_pcn/fadada/service/impl/FaDDServiceImpl.java new file mode 100644 index 0000000..fa51825 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/service/impl/FaDDServiceImpl.java @@ -0,0 +1,595 @@ +package com.api.aiyh_pcn.fadada.service.impl; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigDetailDTO; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSONObject; +import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import com.api.aiyh_pcn.fadada.service.IFaDDService; +import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils; +import com.api.aiyh_pcn.fadada.vo.TableFieldMappingVO; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.apache.http.Header; +import org.apache.http.HeaderElement; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import weaver.conn.RecordSet; +import weaver.workflow.workflow.WorkflowVersion; + +import javax.ws.rs.core.StreamingOutput; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/30 0030 11:12 + * service + */ + + +public class FaDDServiceImpl implements IFaDDService { + private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); + private final ToolUtil toolUtil = new ToolUtil(); +// private final String MAIN_TABLE = "formtable_main_17"; + + + @Override + public Map getConfigParam(String workflowId) { + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 0); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); + List tableFieldMappingVOS = new ArrayList<>(); + List details = apiConfigMainDTO.getDetails(); + for (ApiConfigDetailDTO detail : details) { + TableFieldMappingVO tableFieldMappingVO = new TableFieldMappingVO(); + String tableName = ""; + String fieldName = ""; + int id = detail.getId(); + String table = detail.getTablename(); + if (!table.contains("_dt")) { +// 表示字段属于主表 + tableName = "main"; + } else { +// 字段属于明细表 + String dt = table.substring(table.indexOf("_dt") + 3); + tableName = "detail_" + dt; + } + tableFieldMappingVO.setTableName(tableName); + tableFieldMappingVO.setId(id); + int changeRule = detail.getChangeRule(); + if (changeRule == 0) { +// 不转换,需要获取到流程字段,前端获取流程字段对应的值 + fieldName = detail.getWorkflowField(); + tableFieldMappingVO.setField(fieldName); + tableFieldMappingVOS.add(tableFieldMappingVO); + } else if (changeRule == 2) { +// 流程字段值,与不转换一至 + fieldName = detail.getWorkflowField(); + tableFieldMappingVO.setField(fieldName); + tableFieldMappingVOS.add(tableFieldMappingVO); + } + if (changeRule == 7 || changeRule == 6) { +// 7 自定义SQL,与流程转SQL一样 + List tableFieldMappingVOList = new ArrayList<>(); +// 6 流程字段转SQL,需要获取SQL中的字段变量,前端通过字段变量获取值 +// 解析SQL + Map> result = Util.parsingSq2Map(detail.getParamValue()); + for (Map.Entry> entry : result.entrySet()) { + for (String field : entry.getValue()) { + TableFieldMappingVO tf = new TableFieldMappingVO(); + tf.setTableName(entry.getKey()); + tf.setField(field); + tf.setId(id); + tableFieldMappingVOList.add(tf); + } + } + tableFieldMappingVOS.addAll(tableFieldMappingVOList); + } + if (detail.getParamType() == 4) { +// 数组类型的,需要解析数组sql + List tableFieldMappingVOList = new ArrayList<>(); + Map> result = Util.parsingSq2Map(detail.getArraySql()); + for (Map.Entry> entry : result.entrySet()) { + for (String field : entry.getValue()) { + TableFieldMappingVO tf = new TableFieldMappingVO(); + tf.setTableName(entry.getKey()); + tf.setField(field); + tf.setId(id); + tableFieldMappingVOList.add(tf); + } + } + tableFieldMappingVOS.addAll(tableFieldMappingVOList); + } + } + List doDeWeight = Util.deWeight(tableFieldMappingVOS, e -> e.getTableName() + e.getField()); + Map map = new HashMap<>(); + map.put("tableFieldMappings", doDeWeight); + String checkSource = faDaDaConfigDTO.getCheckSource(); + String sourceTable; + if (!checkSource.contains("_dt")) { +// 表示字段属于主表 + sourceTable = "main"; + map.put("isMain", true); + } else { +// 字段属于明细表 + String dt = checkSource.substring(checkSource.indexOf("_dt") + 3); + sourceTable = "detail_" + dt; + map.put("isMain", false); + } + map.put("sourceTable", sourceTable); + return map; + } + + @Override + public Map checkCertification(Map params) { + Map resultMap = new HashMap<>(); + String workflowId = String.valueOf(params.get("workflowId")); + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 0); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); + List> dataArr = (List>) params.get("dataArr"); + List details = apiConfigMainDTO.getDetails(); + List> datas = objectAndListHandle(details, dataArr); + List> errorList = new ArrayList<>(); + List> nonsupportList = new ArrayList<>(); + for (Map data : datas) { + System.out.println(JSONObject.toJSONString(data)); + Map result = FaDDRequestUtils.checkCompanyInfo(data); + if (result == null) { +// 未查询到数据 + errorList.add(data); + } else { + if ("1001005".equals(String.valueOf(result.get("code"))) || !"200".equals(String.valueOf(result.get("code")))) { +// 企业信息不存在或者未认证 + nonsupportList.add(data); + } + } + } + if (errorList.size() == 0 && nonsupportList.size() == 0) { +// 所有的都通过 + resultMap.put("allPass", true); + } else { + resultMap.put("allPass", false); + resultMap.put("errorList", errorList); + resultMap.put("nonsupportList", nonsupportList); + } + return resultMap; + } + + private List> objectAndListHandle(List treeList, List> dataArr) { + List> params = new ArrayList<>(); + for (Map dataMap : dataArr) { + Map param = new HashMap<>(); + for (ApiConfigDetailDTO apiConfigDetailDTO : treeList) { + Object value; + if (apiConfigDetailDTO.getParamType() == 3) { + Map map = new HashMap<>(); +// object类型 + for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) { + if (child.getChildren() == null || child.getChildren().size() == 0) { +// handleChild(child.getChildren(), dataMap) + map.put(child.getParamName(), changeRuleHandle(child, dataMap)); + } else { + map.put(child.getParamName(), handleChild(child.getChildren(), dataMap)); + } + } + value = map; + } else if (apiConfigDetailDTO.getParamType() == 4) { + String sql = apiConfigDetailDTO.getArraySql(); + String parsingSq = Util.parsingSq(sql, dataMap); +// list类型 + if (parsingSq.contains("delete") || parsingSq.contains("update") || + parsingSq.contains("exec") || parsingSq.contains("drop") || + parsingSq.contains("truncate")) { + value = new ArrayList<>(); + } else { + RecordSet rs = new RecordSet(); + rs.executeQuery(parsingSq.replace("select", "select")); + value = Util.recordeSet2Array(rs, String.class); + } + } else { + value = changeRuleHandle(apiConfigDetailDTO, dataMap); + } + param.put(apiConfigDetailDTO.getParamName(), value); + } + params.add(param); + } + return params; + } + + private Object handleChild(List children, Map dataMap) { + Map params = new HashMap<>(); + for (ApiConfigDetailDTO child : children) { + Object value; + if (child.getChildren() != null) { + value = handleChild(child.getChildren(), dataMap); + } else { + value = changeRuleHandle(child, dataMap); + } + params.put(child.getParamName(), value); + } + return params; + } + + private Object changeRuleHandle(ApiConfigDetailDTO apiConfigDetailDTO, Map dataMap) { + Object value; + String tableName; + String table; + String sql; + String resultSql; +// 判断参数的转换规则 + switch (apiConfigDetailDTO.getChangeRule()) { + case 0: +// 不转换 + case 2: +// 流程字段值 + table = apiConfigDetailDTO.getTablename(); + if (!table.contains("_dt")) { +// 表示字段属于主表 + tableName = "main"; + } else { +// 字段属于明细表 + String dt = table.substring(table.indexOf("_dt") + 3); + tableName = "detail_" + dt; + } + value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField()); + break; + case 1: +// 固定值 + value = apiConfigDetailDTO.getParamValue(); + break; + case 3: +// 系统日期 + value = Util.getTime("yyyy-MM-dd"); + break; + case 4: +// 系统时间 + value = Util.getTime("HH:mm:ss"); + break; + case 5: +// 系统日期-时间 + value = Util.getTime("yyyy-MM-dd HH:mm:ss"); + break; + case 6: +// 自定义SQL + case 7: +// 流程字段转SQL + sql = apiConfigDetailDTO.getParamValue(); + resultSql = Util.parsingSq(sql, dataMap); + toolUtil.writeErrorLog(dataMap.toString()); + if (resultSql.contains("delete ") || resultSql.contains("update ") || + resultSql.contains("exec ") || resultSql.contains("drop ") || + resultSql.contains("truncate ")) { + value = null; + } else { + RecordSet rs = new RecordSet(); + rs.executeQuery(resultSql.replace("select", "select")); + rs.next(); + value = Util.null2String(rs.getString(1)); + toolUtil.writeErrorLog("转换值:" + value); + toolUtil.writeErrorLog("转换SQL:" + resultSql.replace("select", "select")); + } + break; + case 8: +// TODO +// 流程名称 + value = Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid"))); + break; + case 9: +// TODO +// 请求标题 + value = Util.getRequestTitleById(String.valueOf(dataMap.get("requestid"))); + break; + case 10: +// TODO +// 流程requestId + value = dataMap.get("requestid"); + break; + default: + value = null; + break; + } + if (apiConfigDetailDTO.getParamType() == 1) { +// Integer + value = Integer.parseInt(String.valueOf(value)); + } else if (apiConfigDetailDTO.getParamType() == 2) { +// Boolean + value = Boolean.parseBoolean(String.valueOf(value)); + } + return value; + } + + + public void queryContractStatus(String workflowId, String requestId, int type) { + List> maps = faDDServiceMapping.queryDetailInfo(requestId, workflowId, 2); + toolUtil.writeErrorLog("maps+:" + maps); + List> notSignedContracts = new ArrayList<>(); +// 查询是是否签署 + for (Map map : maps) { +// 发送请求查询合同信息 + Map data = new HashMap<>(); + String contracts = String.valueOf(map.get("contract_no")); + if (contracts == null) { + contracts = ""; + } + String[] split = contracts.split(","); + for (String s : split) { + toolUtil.writeErrorLog(s); + data.put("contractNo", s); + Map result = null; +// List statusList = new ArrayList<>(); + try { + Map response = FaDDRequestUtils.queryContractStatus(data); + if (!"200".equals(response.get("code"))) { + throw new RuntimeException("法大大请求接口错误!"); + } + result = (Map) response.get("data"); + this.toolUtil.writeErrorLog("催一催:" + result); + } catch (RuntimeException e) { + e.printStackTrace(); + throw e; + } catch (JsonProcessingException e) { + toolUtil.writeDebuggerLog("转换错误:" + e); + } + if ("1".equals(String.valueOf(result.get("status"))) || "6".equals(String.valueOf(result.get("status")))) { +// 发送请求催一下 TODO 签署合同 + notSignedContracts.add(map); + } else { +// 合同状态发生改变,需要修改数据库中的状态信息 TODO 百分百会出问题 + map.put("contract_status", result.get("status")); +// statusList.add() + faDDServiceMapping.updateContractStatus(map, workflowId, 3); + } + } + + } + if (type == 0) { + signedContract(workflowId, requestId, notSignedContracts); + } + } + + public void signedContract(String workflowId, String requestId, List> detailMaps) { + String mainTable = faDDServiceMapping.getMainTable(workflowId); + RecordSet rs = new RecordSet(); + String query = "select * from " + mainTable + " where requestid = ?"; + rs.executeQuery(query, requestId); + Map mainMap; + mainMap = Util.recordSet2Map(rs); + String mainId = ""; + if (mainMap != null) { + mainId = String.valueOf(mainMap.get("id")); + } else { + toolUtil.writeErrorLog("没有查询到相关的请求id的数据!"); + } + String detailTable1 = faDDServiceMapping.getDetailTable(workflowId, 3); + query = "select * from " + detailTable1 + " where mainid = ?"; + rs.executeQuery(query, mainId); + /*List> detailMaps; + detailMaps = Util.recordSet2MapList(rs); + if (detailMaps == null) { + toolUtil.writeErrorLog("查询明细失败!maps为null"); + return; + }*/ + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 3); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); + List> dataArr = new ArrayList<>(); + String detailTable; + String dt = detailTable1.substring(detailTable1.indexOf("_dt") + 3); + detailTable = "detail_" + dt; + for (Map detailMap : detailMaps) { + Map dataMap = new HashMap<>(); + for (Map.Entry entry : detailMap.entrySet()) { + dataMap.put(detailTable + "." + entry.getKey(), entry.getValue()); + } + for (Map.Entry entry : mainMap.entrySet()) { + dataMap.put("main" + "." + entry.getKey(), entry.getValue()); + } + dataArr.add(dataMap); + } + List> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + for (Map map : maps) { + toolUtil.writeErrorLog(map.toString()); + String contractNos = Util.null2String(map.get("contractNo")); + String[] split = contractNos.split(","); + for (String s : split) { + map.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl()); + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { + throw new RuntimeException("法大大请求接口错误!"); + } + } + } + } + + public StreamingOutput contractDownload(String requestId, String workflowId) { + toolUtil.writeErrorLog("进入service方法!"); + List> maps = null; +// 查询合同信息 + try { + maps = faDDServiceMapping.queryDetailDownInfo(requestId, workflowId, 2); + } catch (Exception e) { + toolUtil.writeErrorLog(String.valueOf(faDDServiceMapping)); + toolUtil.writeErrorLog("调用错误" + e); + } + toolUtil.writeErrorLog(String.valueOf(maps)); + toolUtil.writeErrorLog(JSONObject.toJSONString(maps)); + List> finalMaps = maps; + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + RecordSet rs = new RecordSet(); + rs.executeQuery("select * from uf_contract_config where workflow_type in ( " + versionStringByWfid + " ) and api_type = ?", 5); + rs.next(); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(rs.getString("params_config")); + return outputStream -> { + ZipOutputStream zipOut = new ZipOutputStream(outputStream); + toolUtil.writeErrorLog("进入方法!"); + int catchLen = 10 * 1024; + String base = ""; + for (Map map : finalMaps) { + base = base + map.get("gyshtfmczw") + "/"; +// 获取合同id + String contractNoStr = String.valueOf(map.get("contract_no")); + String contractNameStr = String.valueOf(map.get("file_name")); + String[] contractNos = contractNoStr.split(","); + String[] contractNames = contractNameStr.split(","); + for (int i = 0; i < contractNos.length; i++) { + String contractNo = contractNos[i]; + String contractName = contractNames[i]; + Map data = new HashMap<>(); + data.put("contractNo", contractNo); +// 下载合同 + String finalBase = base; + FaDDRequestUtils.downContract(data, response -> { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("法大大请求接口错误!"); + } + InputStream content = null; + try { + content = entity.getContent(); + Header contentHeader = response.getFirstHeader("Content-disposition"); + String filename = contractName.substring(0, contractName.indexOf(".")) + ".pdf"; + if (contentHeader != null) { + HeaderElement[] values = contentHeader.getElements(); + NameValuePair param = values[0].getParameterByName("filename"); + filename = param.getValue(); + } + zipOut.putNextEntry(new ZipEntry(finalBase + filename)); + byte[] buffer = new byte[catchLen]; + int len = 0; + while ((len = content.read(buffer)) != -1) { + zipOut.write(buffer, 0, len); + } + zipOut.closeEntry(); + } catch (IOException e) { + e.printStackTrace(); + toolUtil.writeErrorLog("压缩错误!" + e + "\n"); + } + },apiConfigMainDTO.getApiUrl()); + } + } + zipOut.flush(); + zipOut.close(); + }; + } + + + public boolean isAllSinged(String requestId, String workflowId) { + List> maps = faDDServiceMapping.queryDetailInfo(requestId, workflowId, 2); + if (maps == null || maps.size() == 0) { + return true; + } + return false; + } + + public boolean isSingedOneself(String requestId, String workflowId) { + List> maps = faDDServiceMapping.querySignedInfo(requestId, workflowId); + if (maps == null || maps.size() == 0) { + return false; + } + return true; + } + + public void signedContractOwn(String workflowId, String requestId) { + String mainTable = faDDServiceMapping.getMainTable(workflowId); + RecordSet rs = new RecordSet(); + String query = "select * from " + mainTable + " where requestid = ?"; + rs.executeQuery(query, requestId); + Map mainMap; + mainMap = Util.recordSet2Map(rs); + String mainId = ""; + if (mainMap != null) { + mainId = String.valueOf(mainMap.get("id")); + } else { + toolUtil.writeErrorLog("没有查询到相关的请求id的数据!"); + } + String detailTable1 = faDDServiceMapping.getDetailTable(workflowId, 4); + query = "select * from " + detailTable1 + " where mainid = ?"; + rs.executeQuery(query, mainId); + List> detailMaps; + detailMaps = Util.recordSet2MapList(rs); + this.toolUtil.writeErrorLog("查询到的数据:" + detailMaps.toString()); + if (detailMaps == null) { + toolUtil.writeErrorLog("查询明细失败!maps为null"); + return; + } + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 4); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); + List> dataArr = new ArrayList<>(); + String detailTable; + String dt = detailTable1.substring(detailTable1.indexOf("_dt") + 3); + detailTable = "detail_" + dt; + toolUtil.writeErrorLog("明细表:" + detailTable); + for (Map detailMap : detailMaps) { + Map dataMap = new HashMap<>(); + for (Map.Entry entry : detailMap.entrySet()) { + dataMap.put(detailTable + "." + entry.getKey(), entry.getValue()); + } + for (Map.Entry entry : mainMap.entrySet()) { + dataMap.put("main" + "." + entry.getKey(), entry.getValue()); + } + dataArr.add(dataMap); + } + toolUtil.writeErrorLog("替换参数值:" + dataArr.toString()); + List> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + for (Map map : maps) { + this.toolUtil.writeErrorLog("签署参数:" + map.toString()); + String contractNos = Util.null2String(map.get("contractNo")); + String[] split = contractNos.split(","); + for (String s : split) { + map.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(map,apiConfigMainDTO.getApiUrl()); + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { +// throw new RuntimeException("法大大请求接口错误!"); + this.toolUtil.writeErrorLog("签署参数:" + responeVo.getEntityString()); + } + } + } + } + + public Map getAllVersion(String workflowId, String markOnly) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String newWorkflowId = faDDServiceMapping.getAllVersion(versionStringByWfid); + String allVersion = WorkflowVersion.getVersionStringByWfid(newWorkflowId); + if (allVersion == null) { + allVersion = ""; + } + String[] split = allVersion.split(","); + Map data = new HashMap<>(); + String[] nodes = this.getNodes(workflowId, markOnly); + data.put("workflowIds", split); + data.put("nodeIds", nodes); + return data; + } + + public String[] getNodes(String workflowId, String markOnly) { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + String nods = faDDServiceMapping.getNodes(versionStringByWfid, markOnly); + if (nods == null) { + nods = ""; + } + return nods.split(","); + } +} + + + + diff --git a/com/api/aiyh_pcn/fadada/util/FaDDRequestUtils.java b/com/api/aiyh_pcn/fadada/util/FaDDRequestUtils.java new file mode 100644 index 0000000..73ead3b --- /dev/null +++ b/com/api/aiyh_pcn/fadada/util/FaDDRequestUtils.java @@ -0,0 +1,195 @@ +package com.api.aiyh_pcn.fadada.util; + +import aiyh.utils.Util; +import aiyh.utils.httpUtil.HttpArgsType; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.util.HttpUtils; +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSONObject; +import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.apache.commons.codec.binary.Hex; +import org.apache.http.client.methods.CloseableHttpResponse; +import weaver.aiyh_pcn.fadada.entity.FileInfo; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; +import java.util.function.Consumer; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/13 0013 11:46 + * 法大大请求方法 + */ + + +public class FaDDRequestUtils { + private final static HttpUtils httpUtils = new HttpUtils(); + private final static Map header = httpUtils.getGlobalCache().header; + private final static FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); + private final static ToolUtil TOOL_UTIL = new ToolUtil(); + + static { + header.put("appId", "100001"); + header.put("signType", "SHA256"); + header.put("apikey", "TulQxnZSRKeHoQfmeZzOUzGn6KpTDkDK"); + header.put("Content-Type", HttpArgsType.APPLICATION_JSON); + } + + // 查询企业认证状态 + public static Map checkCompanyInfo(Map data) { + header.put("sign", builderSign(data)); + try { + ResponeVo responeVo = httpUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/account/company/info", + data, null); + TOOL_UTIL.writeDebuggerLog("查询企业认真状态:" + JSONObject.toJSONString(data)); + TOOL_UTIL.writeDebuggerLog(responeVo.getEntityString() + "\n"); +// System.out.println(responeVo.getEntityString()); + if (responeVo.getCode() != 200) { + return null; + } + return responeVo.getEntityMap(); + } catch (IOException e) { + e.printStackTrace(); + return null; + } + } + + + // 创建合同 + public static ResponeVo createContract(FileInfo fileInfo,String url) { + Map data = new HashMap<>(); + data.put("contractExtension", fileInfo.getContractExtension()); + data.put("contractTitle", fileInfo.getContractTitle()); + data.put("uploadType", fileInfo.getUploadType()); + data.put("customerNo", fileInfo.getCustomerNo()); + header.put("sign", builderSign(data)); + header.put("Content-Type", "multipart/form-data"); +// System.out.println(JSONObject.toJSONString(data)); + ResponeVo responeVo = null; + try { + responeVo = httpUtils.apiUploadFile(url, + fileInfo.getFile(), "file", fileInfo.getImagefilename(), data, null); + TOOL_UTIL.writeDebuggerLog("创建合同:" + JSONObject.toJSONString(data)); + TOOL_UTIL.writeDebuggerLog(responeVo.getEntityString() + "\n"); + } catch (IOException e) { + e.printStackTrace(); + TOOL_UTIL.writeErrorLog(e.toString()); + } +// System.out.println(JSONObject.toJSONString(responeVo)); + return responeVo; + } + + + // 签署合同 + public static ResponeVo signedContract(Map data, String url) { + header.put("sign", builderSign(data)); + header.put("Content-Type", "application/json"); +// System.out.println(JSONObject.toJSONString(data)); + ResponeVo responeVo = null; + try { +// http://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/sign + responeVo = httpUtils.apiPost(url, + data, null); + TOOL_UTIL.writeDebuggerLog("签署合同:" + JSONObject.toJSONString(data)); + TOOL_UTIL.writeDebuggerLog(responeVo.getEntityString() + "\n"); +// System.out.println(JSONObject.toJSONString(responeVo)); + } catch (IOException e) { + e.printStackTrace(); + } + return responeVo; + } + + public static void downContract(Map data, Consumer consumer,String url) { + header.put("sign", builderSign(data)); + header.put("Content-Type", "application/json"); + System.out.println(JSONObject.toJSONString(data)); + try { + httpUtils.apiPost(url, + data, null, consumer); + TOOL_UTIL.writeDebuggerLog("下载合同文件:" + JSONObject.toJSONString(data)); + } catch (IOException e) { + e.printStackTrace(); + } + } + + public static Map queryContractStatus(Map data) throws JsonProcessingException { + header.put("sign", builderSign(data)); + ResponeVo responeVo = null; + try { + responeVo = httpUtils.apiPost("https://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/sign/status/view", + data, null); + TOOL_UTIL.writeDebuggerLog("查询合同状态:" + JSONObject.toJSONString(data)); + TOOL_UTIL.writeDebuggerLog(responeVo.getEntityString() + "\n"); + } catch (IOException e) { + e.printStackTrace(); + } +// System.out.println(JSONObject.toJSONString(responeVo)); + return responeVo.getEntityMap(); + } + + public static Map queryDetailContractStatus(Map data) throws JsonProcessingException { + header.put("sign", builderSign(data)); + ResponeVo responeVo = null; + try { + responeVo = httpUtils.apiPost("https://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/sign/detail/view", + data, null); + TOOL_UTIL.writeDebuggerLog("查询合同状态:" + JSONObject.toJSONString(data)); + TOOL_UTIL.writeDebuggerLog(responeVo.getEntityString() + "\n"); + } catch (IOException e) { + e.printStackTrace(); + } +// System.out.println(JSONObject.toJSONString(responeVo)); + return responeVo.getEntityMap(); + } + + + private static String builderSign(Map data) { + header.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss")); + header.put("bizContent", builderBizContent(data)); + String signStr = "appId=" + header.get("appId") + + "&bizContent=" + header.get("bizContent") + + "&signType=" + header.get("signType") + + "×tamp=" + header.get("timestamp"); + System.out.println(signStr); + String appKey = "L7P59oqA2An0XgJ1LeMN0fRu1"; + String sha256 = string2SHA256(signStr) + appKey; + String sign = Base64.getEncoder().encodeToString(string2SHA256(sha256).getBytes(StandardCharsets.UTF_8)); +// System.out.println(sign); + return sign; + } + + public static String builderBizContent(Map data) { + String jsonString = JSONObject.toJSONString(data); + String encode = null; + try { + encode = URLEncoder.encode(jsonString, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + return null; + } + return Base64.getEncoder().encodeToString(encode.getBytes(StandardCharsets.UTF_8)); + } + + private static String string2SHA256(String str) { + MessageDigest messageDigest; + String encdeStr = ""; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + byte[] hash = messageDigest.digest(str.getBytes(StandardCharsets.UTF_8)); + encdeStr = Hex.encodeHexString(hash); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return encdeStr.toUpperCase(); + } + +} + diff --git a/com/api/aiyh_pcn/fadada/vo/TableFieldMappingVO.java b/com/api/aiyh_pcn/fadada/vo/TableFieldMappingVO.java new file mode 100644 index 0000000..e285df5 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/vo/TableFieldMappingVO.java @@ -0,0 +1,47 @@ +package com.api.aiyh_pcn.fadada.vo; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/11 0011 15:11 + * 表名和表映射、 + */ + + +public class TableFieldMappingVO { + private String tableName; + private String field; + private int id; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + public String getField() { + return field; + } + + public void setField(String field) { + this.field = field; + } + + @Override + public String toString() { + return "TableFieldMappingVO{" + + "tableName='" + tableName + '\'' + + ", field='" + field + '\'' + + ", id=" + id + + '}'; + } +} diff --git a/com/api/aiyh_pcn/fadada/web/FaDDContractController.java b/com/api/aiyh_pcn/fadada/web/FaDDContractController.java new file mode 100644 index 0000000..5f9cc4a --- /dev/null +++ b/com/api/aiyh_pcn/fadada/web/FaDDContractController.java @@ -0,0 +1,175 @@ +package com.api.aiyh_pcn.fadada.web; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSON; +import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping; +import com.api.aiyh_pcn.fadada.entity.UfContractInfoDTO; +import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.h2.util.StringUtils; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/3 0003 14:49 + * fadada + */ + +@Path("/v2/fadada") +public class FaDDContractController { + private final FaDDContractService faDDService = new FaDDContractService(); + private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping(); + private final ToolUtil toolUtil = new ToolUtil(); + + + /** + * 获取流程全版本 + * + * @param workflowId 流程id + * @return 流程全版本id + */ + @Path("/getAllVersion/{workflowId}/{markOnly}") + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) { + try { + Map allVersion = faDDService.getAllVersion(workflowId, markOnly); + return ApiResult.success(allVersion); + } catch (Exception e) { + toolUtil.writeErrorLog("错误:" + e.toString()); + return ApiResult.error(e.toString()); + } + } + + + /** + * 合同签署回调 + * @param params + * @return + */ + @Path("/callback/signed") + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String signedCallBack(@RequestBody Map params) { + Map result = new HashMap<>(); + result.put("code", 200); + result.put("msg", "操作成功!"); + String resultCode = String.valueOf(params.get("resultCode")); + if(!"1".equals(resultCode)){ +// 签署失败 + toolUtil.writeErrorLog("合同回调:签署失败,失败信息:" + JSON.toJSONString(params)); + return JSON.toJSONString(result); + } + String contractNo = String.valueOf(params.get("docNo")); + faDDService.signedCallBack(contractNo); + return JSON.toJSONString(result); + } + + + /** + * 是否签署完毕 + * @param requestId + * @param workflowId + * @return + */ + @Path("/isAllSigned/{workflowId}/{requestId}") + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String querySignedStatus(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId){ + Map result = faDDService.querySignedStatus(requestId); + return ApiResult.success(result); + } + + + /** + * 本方签署 + * + * @param workflowId 流程id + * @param requestId 请求id + * @return 本方签署结果 + */ + @Path("/signedContract/own/{requestId}/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response, + @PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId) { +// TODO 更换labelIndex + User user = HrmUserVarify.getUser(request, response); + try { + faDDService.signedContractOwn(requestId, user); + }catch (Exception e){ + return ApiResult.error(Util.getHtmlLabelName(-87658,user.getLanguage(),"合同签署失败!")); + } + return ApiResult.success(Util.getHtmlLabelName(-87657,user.getLanguage(),"本方签署成功!")); + } + + + /** + * 催一催 + * + * @param requestId 请求id + * @return 催一催 + */ + @Path("/signedContract/{requestId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String signedContract(@Context HttpServletRequest request, @Context HttpServletResponse response, + @PathParam("requestId") String requestId) { + return ApiResult.success("没有催一催接口还点!淦!等法大大调整,额。。。具体啥时候好我也不知道,反正不关我的事!"); + } + + + /** + * 合同下载 + * + * @param requestId 请求id + * @return 合同问价压缩包 + */ + @Path("/contract/download/{requestId}") + @GET + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response contractDownload(@PathParam("requestId") String requestId) { + toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId); + try { + UfContractInfoDTO ufContractInfoDTO = faDDContractMapping.queryContractInfoByRequestId(requestId); + StreamingOutput contractZipStream = faDDService.download4mFDD(ufContractInfoDTO); + String requestTitle = Util.null2String(Util.getRequestTitleById(String.valueOf(requestId))); + if(StringUtils.isNullOrEmpty(requestTitle)){ + requestTitle = "contracts"; + } + if(Util.null2String(ufContractInfoDTO.getContractNo()).split(",").length >= 2){ +// 多文件 + return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM) + .type("application/zip") + .header("Content-Disposition", "attachment;filename=" + requestTitle + ".zip").build(); + }else{ +// 单文件 + return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM) + .type("application/pdf") + .header("Content-Disposition", "attachment;filename=" + requestTitle + ".pdf").build(); + } + } catch (Exception e) { + toolUtil.writeErrorLog("文件流转换失败," + e); + return Response.ok(ApiResult.error("出现错误,错误原因: " + e), MediaType.TEXT_PLAIN).build(); + } + } +} diff --git a/com/api/aiyh_pcn/fadada/web/FaDDController.java b/com/api/aiyh_pcn/fadada/web/FaDDController.java new file mode 100644 index 0000000..a60a323 --- /dev/null +++ b/com/api/aiyh_pcn/fadada/web/FaDDController.java @@ -0,0 +1,257 @@ +package com.api.aiyh_pcn.fadada.web; + +import aiyh.utils.ApiResult; +import aiyh.utils.Util; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping; +import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl; +import io.swagger.v3.oas.annotations.parameters.RequestBody; +import org.h2.util.StringUtils; +import weaver.conn.RecordSet; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.*; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import javax.ws.rs.core.Response; +import javax.ws.rs.core.StreamingOutput; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/28 0028 16:05 + * 法大大相关接口 + */ + + +@Path("/fadada") +public class FaDDController { + private final FaDDServiceImpl faDDService = new FaDDServiceImpl(); + private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); + private final ToolUtil toolUtil = new ToolUtil(); + + /** + * 查询配置信息 + * + * @param workflowId 流程id + * @return 配置信息 + */ + @GET + @Path("/getConfig/{workflowId}") + public String getConfig(@PathParam("workflowId") String workflowId) { + try { + Map configParam = faDDService.getConfigParam(workflowId); + return ApiResult.success(configParam); + } catch (Exception e) { + return ApiResult.error(e.toString()); + } + } + + /** + * 验证企业签署状态 + * + * @param params 查验参数 + * @return 企业验证的状态 + */ + @Path("/signature") + @POST + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String checkCertification(@RequestBody Map params) { + try { + Map certificationResult = faDDService.checkCertification(params); + return ApiResult.success(certificationResult); + } catch (Exception e) { + return ApiResult.error(e.toString()); + } + } + + /** + * 催一催 + * + * @param workflowId 流程id + * @param requestId 请求id + * @return 催一催 + */ + @Path("/signedContract/{languageGroupId}/{requestId}/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String signedContract(@Context HttpServletRequest request, @Context HttpServletResponse response, + @PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId, + @PathParam("languageGroupId") int languageGroupId) { + User user = HrmUserVarify.getUser(request, response); + try { + faDDService.queryContractStatus(workflowId, requestId,0); + Map language = Util.queryLanguage(languageGroupId, user.getLanguage()); + String info = language.get("rushInfo"); + return ApiResult.success(info); + } catch (Exception e) { + toolUtil.writeErrorLog("错误:" + e); + return ApiResult.error(e.toString()); + } + } + + /** + * 本方签署 + * + * @param workflowId 流程id + * @param requestId 请求id + * @return 本方签署结果 + */ + @Path("/signedContract/own/{languageGroupId}/{requestId}/{workflowId}") + @GET + @Consumes(MediaType.APPLICATION_JSON) + @Produces(MediaType.APPLICATION_JSON) + public String signedContractOwn(@Context HttpServletRequest request, @Context HttpServletResponse response, + @PathParam("workflowId") String workflowId, @PathParam("requestId") String requestId, + @PathParam("languageGroupId") int languageGroupId) { + User user = HrmUserVarify.getUser(request, response); + try { + faDDService.signedContractOwn(workflowId, requestId); + String mainTable = faDDServiceMapping.getMainTable(workflowId); +// TODO 更新本方签署 + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(mainTable, ParaMap.create() + .put("signed_oneself", 1), Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId)); + RecordSet rs = new RecordSet(); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + Map language = Util.queryLanguage(languageGroupId, user.getLanguage()); + String info = language.get("contractSignedInfo"); + return ApiResult.success(info); + } catch (Exception e) { + toolUtil.writeErrorLog("错误:" + e.toString()); + return ApiResult.error(e.toString()); + } + } + + /** + * 合同下载 + * + * @param requestId 请求id + * @return 合同问价压缩包 + */ + @Path("/contract/download/{workflowId}/{requestId}") + @GET + @Produces(MediaType.APPLICATION_OCTET_STREAM) + public Response contractDownload(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) { + toolUtil.writeErrorLog("进入请求方法,获取到请求id:" + requestId); + try { + StreamingOutput contractZipStream = faDDService.contractDownload(requestId, workflowId); + return Response.ok(contractZipStream, MediaType.APPLICATION_OCTET_STREAM) + .type("application/zip") + .header("Content-Disposition", "attachment;filename=contracts.zip").build(); + } catch (Exception e) { + toolUtil.writeErrorLog("转换失败," + e.toString()); + return Response.ok(ApiResult.error("出现错误,错误原因: " + e),MediaType.APPLICATION_JSON).build(); + } + } + + /** + * 获取流程全版本 + * + * @param workflowId 流程id + * @return 流程全版本id + */ + @Path("/getAllVersion/{workflowId}/{markOnly}") + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String getAllVersion(@PathParam("workflowId") String workflowId, @PathParam("markOnly") String markOnly) { + try { + Map allVersion = faDDService.getAllVersion(workflowId, markOnly); + return ApiResult.success(allVersion); + } catch (Exception e) { + toolUtil.writeErrorLog("错误:" + e.toString()); + return ApiResult.error(e.toString()); + } + } + + + /** + * 查验是否全部签订完毕 + * + * @param requestId 请求id + * @return 查验结果 + */ + @Path("/isAllSigned/{workflowId}/{requestId}") + @GET + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String isAllSinged(@PathParam("requestId") String requestId, @PathParam("workflowId") String workflowId) { + try { + faDDService.queryContractStatus(workflowId,requestId,1); + boolean isAllSinged = faDDService.isAllSinged(requestId, workflowId); + boolean isSingedOneself = faDDService.isSingedOneself(requestId, workflowId); + Map result = ParaMap.create().put("isAllSinged", isAllSinged) + .put("isSingedOneself", isSingedOneself); + return ApiResult.success(result); + } catch (Exception e) { + toolUtil.writeErrorLog("错误:" + e); + return ApiResult.error(e.toString()); + } + } + + + @Path("/getLanguage/{languageGroupId}") + @GET + @Produces(MediaType.APPLICATION_JSON) + public String getLanguage(@Context HttpServletRequest request, @Context HttpServletResponse response, + @PathParam("languageGroupId") int languageGroupId) { + User user = HrmUserVarify.getUser(request, response); + Map map = Util.queryLanguage(languageGroupId, user.getLanguage()); + return ApiResult.success(map); + } + + @Path("/callback/signed") + @POST + @Produces(MediaType.APPLICATION_JSON) + @Consumes(MediaType.APPLICATION_JSON) + public String callBackSigned(@RequestBody Map params){ + toolUtil.writeErrorLog("回调方法:" + JSONObject.toJSONString(params)); + Map result = new HashMap<>(); + String bizContent = String.valueOf(params.get("bizContent")); + if(StringUtils.isNullOrEmpty(bizContent)){ + toolUtil.writeErrorLog("参数没获取到!"); + result.put("code","200"); + result.put("msg","操作失败!"); + return JSONObject.toJSONString(result); + } + byte[] decode = Base64.getDecoder().decode(bizContent.getBytes(StandardCharsets.UTF_8)); + String decodeStr = null; + try { + decodeStr = new String(decode,"UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + String jsonStr = null; + try { + jsonStr = URLDecoder.decode(decodeStr, "UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + JSONObject jsonObject = JSON.parseObject(jsonStr); + String resultCode = String.valueOf(jsonObject.getString("resultCode")); + String docNo = String.valueOf(jsonObject.getString("docNo")); + if(!"1".equals(resultCode)){ + toolUtil.writeErrorLog("重复签署合同!" + docNo); + } +// Util.createSqlBuilder().updateSql() + + this.toolUtil.writeErrorLog(jsonObject.toJSONString()); + result.put("code","200"); + result.put("msg","操作成功!"); + return JSONObject.toJSONString(result); + } +} diff --git a/com/api/aiyh_quanshi/service/Impl/CancelMetingServiceImpl.java b/com/api/aiyh_quanshi/service/Impl/CancelMetingServiceImpl.java new file mode 100644 index 0000000..87e48e5 --- /dev/null +++ b/com/api/aiyh_quanshi/service/Impl/CancelMetingServiceImpl.java @@ -0,0 +1,74 @@ +package com.api.aiyh_quanshi.service.Impl; + +import aiyh.utils.zwl.common.ToolUtil; +import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam; +import weaver.aiyh_quanshi.RequestApi; +import weaver.aiyh_quanshi.entity.QsResponse; +import weaver.conn.RecordSet; + +import java.util.Map; + +/** + * 如不标注名称,则按类的全路径注入 + */ +@WeaIocReplaceComponent("cancelMetingService") +public class CancelMetingServiceImpl { + ToolUtil toolUtil = new ToolUtil(); + RequestApi requestApi = new RequestApi(); + boolean flag = true; + + /** + * 这是接口前置方法,这个方法会在接口执行前执行 + * 前值方法必须用@WeaReplaceBefore,这里面有两个参数,第一个叫value,是你的api地址 + * 第二个参数叫order,如果你有很多方法拦截的是一个api,那么这个就决定了执行顺序 + * 前置方法的参数为WeaBeforeReplaceParam 这个类,里面有四个参数,request,response,请求参数的map,api的地址 + */ + @WeaReplaceBefore(value = "/api/meeting/base/cancelMeeting", order = 1, description = "会议接口前拦截") + public void before(WeaBeforeReplaceParam weaBeforeReplaceParam) { +// 获取会议id + Map paramMap = weaBeforeReplaceParam.getParamMap(); + String id = String.valueOf(paramMap.get("meetingid")); +// 通过会议id获取全时会议id + String query = "select * from meeting where id = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, id); + rs.next(); + String quanShiId = rs.getString("quan_shi_id"); + String hrmId = rs.getString("contacter"); + query = "select * from hrmresource where id = ?"; + rs.executeQuery(query, hrmId); + rs.next(); + String creatorEmail = rs.getString("email"); +// 通过全时会议id对会议进行取消 + QsResponse qsResponse = requestApi.cancelConference(quanShiId, creatorEmail); + if(!"0".equals(qsResponse.getStatus())){ +// 取消失败 + flag = false; + } + + } + + /** + * 这个是接口后置方法,大概的用法跟前置方法差不多,稍有差别 + * 注解名称为WeaReplaceAfter + * 返回类型必须为String + * 参数叫WeaAfterReplaceParam,这个类前四个参数跟前置方法的那个相同,不同的是多了一个叫data的String,这个是那个接口执行完返回的报文 + * 你可以对那个报文进行操作,然后在这个方法里return回去 + */ + @WeaReplaceAfter(value = "/api/meeting/base/cancelMeeting", order = 1) + public String after(WeaAfterReplaceParam weaAfterReplaceParam) { + //这个就是接口执行完的报文 + String data = weaAfterReplaceParam.getData(); + if(!flag){ +// 取消会议失败 + }else{ + + } + + return data; + } +} \ No newline at end of file diff --git a/com/api/aiyh_quanshi/service/Impl/DeleteMetingServiceImpl.java b/com/api/aiyh_quanshi/service/Impl/DeleteMetingServiceImpl.java new file mode 100644 index 0000000..2e0ee06 --- /dev/null +++ b/com/api/aiyh_quanshi/service/Impl/DeleteMetingServiceImpl.java @@ -0,0 +1,72 @@ +package com.api.aiyh_quanshi.service.Impl; + +import aiyh.utils.zwl.common.ToolUtil; +import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam; +import weaver.aiyh_quanshi.RequestApi; +import weaver.aiyh_quanshi.entity.QsResponse; +import weaver.conn.RecordSet; + +import java.util.Map; + +/** + * 如不标注名称,则按类的全路径注入 + */ +@WeaIocReplaceComponent("deleteMetingService") +public class DeleteMetingServiceImpl { + ToolUtil toolUtil = new ToolUtil(); + RequestApi requestApi = new RequestApi(); + boolean flag = true; + + /** + * 这是接口前置方法,这个方法会在接口执行前执行 + * 前值方法必须用@WeaReplaceBefore,这里面有两个参数,第一个叫value,是你的api地址 + * 第二个参数叫order,如果你有很多方法拦截的是一个api,那么这个就决定了执行顺序 + * 前置方法的参数为WeaBeforeReplaceParam 这个类,里面有四个参数,request,response,请求参数的map,api的地址 + */ + @WeaReplaceBefore(value = "/api/meeting/monitor/delete", order = 1, description = "会议接口前拦截") + public void before(WeaBeforeReplaceParam weaBeforeReplaceParam) { +// 获取会议id + Map paramMap = weaBeforeReplaceParam.getParamMap(); + String ids = String.valueOf(paramMap.get("meetingids")); +// 通过会议id获取全时会议id + String query = "select * from meeting where id in (" + ids + ") and cancel != 1 and meetingstatus not in (2,4)"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query); +// 获取删除的会议的所有对应的全时id以及创建人 + while (rs.next()) { + String quanShiId = rs.getString("quan_shi_id"); + String hrmId = rs.getString("contacter"); + query = "select * from hrmresource where id = ?"; + rs.executeQuery(query, hrmId); + rs.next(); + String creatorEmail = rs.getString("email"); + QsResponse qsResponse = requestApi.cancelConference(quanShiId, creatorEmail); +// 通过全时会议id对会议进行取消 + if (!"0".equals(qsResponse.getStatus())) { +// 取消失败 + flag = false; + } + } + } + + /** + * 这个是接口后置方法,大概的用法跟前置方法差不多,稍有差别 + * 注解名称为WeaReplaceAfter + * 返回类型必须为String + * 参数叫WeaAfterReplaceParam,这个类前四个参数跟前置方法的那个相同,不同的是多了一个叫data的String,这个是那个接口执行完返回的报文 + * 你可以对那个报文进行操作,然后在这个方法里return回去 + */ + @WeaReplaceAfter(value = "/api/meeting/monitor/delete", order = 1) + public String after(WeaAfterReplaceParam weaAfterReplaceParam) { + //这个就是接口执行完的报文 + String data = weaAfterReplaceParam.getData(); + if (!flag) { +// 取消会议失败 + } + return data; + } +} \ No newline at end of file diff --git a/com/api/aiyh_quanshi/service/Impl/NewMetingServiceImpl.java b/com/api/aiyh_quanshi/service/Impl/NewMetingServiceImpl.java new file mode 100644 index 0000000..42d657b --- /dev/null +++ b/com/api/aiyh_quanshi/service/Impl/NewMetingServiceImpl.java @@ -0,0 +1,186 @@ +package com.api.aiyh_quanshi.service.Impl; + +import aiyh.utils.httpUtil.staticUtil.HttpStaticUtils; +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.weaverboot.frame.ioc.anno.classAnno.WeaIocReplaceComponent; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceAfter; +import com.weaverboot.frame.ioc.anno.methodAnno.WeaReplaceBefore; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaAfterReplaceParam; +import com.weaverboot.frame.ioc.handler.replace.weaReplaceParam.impl.WeaBeforeReplaceParam; +import weaver.aiyh_quanshi.RequestApi; +import weaver.aiyh_quanshi.entity.QsConfParty; +import weaver.aiyh_quanshi.entity.QsResponse; +import weaver.conn.RecordSet; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 如不标注名称,则按类的全路径注入 + */ +@WeaIocReplaceComponent("newMetingService") +public class NewMetingServiceImpl { + ToolUtil toolUtil = new ToolUtil(); + RequestApi requestApi = new RequestApi(); + SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); + QsResponse meting = null; + private final Lock lock = new ReentrantLock(); + + + /** + * 这是接口前置方法,这个方法会在接口执行前执行 + * 前值方法必须用@WeaReplaceBefore,这里面有两个参数,第一个叫value,是你的api地址 + * 第二个参数叫order,如果你有很多方法拦截的是一个api,那么这个就决定了执行顺序 + * 前置方法的参数为WeaBeforeReplaceParam 这个类,里面有四个参数,request,response,请求参数的map,api的地址 + */ + @WeaReplaceBefore(value = "/api/meeting/base/newMeeting", order = 1, description = "会议接口前拦截") + public void before(WeaBeforeReplaceParam weaBeforeReplaceParam) { + try { +// 加锁 + lock.lock(); + RecordSet rs = new RecordSet(); + String query; + // 同步会议到全时 +// String path = Objects.requireNonNull(this.getClass().getResource("")).getPath(); +// 获取请求参数 + Map paramMap = weaBeforeReplaceParam.getParamMap(); +// 获取会议标题 + String title = String.valueOf(paramMap.get("name")); +// 会议内容 + String desc_n = String.valueOf(paramMap.get("desc_n")); +// 获取会议创建人 + String creator = String.valueOf(paramMap.get("contacter")); +// 获取会议创建人邮件 + query = "select * from hrmresource where id = ?"; + rs.executeQuery(query, creator); + rs.next(); + String creatorEmail = rs.getString("email"); +// 获取会议开始日期 + String startDate = String.valueOf(paramMap.get("begindate")); +// 获取会议开始时间 + String startTime = String.valueOf(paramMap.get("begintime")); + Date start = simpleFormat.parse(startDate + " " + startTime); + +// 获取会议结束日期 + String endDate = String.valueOf(paramMap.get("enddate")); +// 获取会议结束时间 + String endTime = String.valueOf(paramMap.get("endtime")); + Date end = simpleFormat.parse(endDate + " " + endTime); + +// 计算会议时长 + int length = new Long((end.getTime() - start.getTime()) / (1000 * 60)).intValue(); +// 获取会议参与人 + String hrmStr = String.valueOf(paramMap.get("hrmmembers")); +// 处理会议参与人 + List list = new ArrayList<>(); + query = "select * from hrmresource where id in ( " + hrmStr + ")"; + rs.executeQuery(query); + while (rs.next()) { + QsConfParty qsConfParty = new QsConfParty(); + qsConfParty.setEmail(rs.getString("email")); + list.add(qsConfParty); + } + toolUtil.writeErrorLog(list.toString()); + toolUtil.writeErrorLog(String.valueOf(length)); +// 调取接口 + meting = requestApi.createMeting(creatorEmail, title, length, startDate + " " + startTime + ":00 ", list); + toolUtil.writeErrorLog(meting.toString()); + if (meting != null) { +// 请求失败 + if (!"0".equals(meting.getStatus())) { + meting = null; + } + } + } catch (Exception e) { + toolUtil.writeErrorLog(e.toString()); + } finally { + HttpStaticUtils.executorService.execute(() -> { + try { + Thread.sleep(20 * 1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } finally { + try { + lock.unlock(); + } catch (IllegalMonitorStateException e) { +// 锁已经被释放 + } + } + }); + + } +// TODO 在after方法中更新会议id进入meting表中 + } + + /** + * apiCost: 688 + * api_status: true + * meetingid: "8" + * retstatus: true + * status: true + * 这个是接口后置方法,大概的用法跟前置方法差不多,稍有差别 + * 注解名称为WeaReplaceAfter + * 返回类型必须为String + * 参数叫WeaAfterReplaceParam,这个类前四个参数跟前置方法的那个相同,不同的是多了一个叫data的String,这个是那个接口执行完返回的报文 + * 你可以对那个报文进行操作,然后在这个方法里return回去 + */ + @WeaReplaceAfter(value = "/api/meeting/base/newMeeting", order = 1) + public String after(WeaAfterReplaceParam weaAfterReplaceParam) { + String data = weaAfterReplaceParam.getData(); + HttpServletRequest request = weaAfterReplaceParam.getRequest(); + HttpServletResponse response = weaAfterReplaceParam.getResponse(); + User user = HrmUserVarify.getUser(request, response); + + + Map jsonObject = new HashMap<>(); + try { + ObjectMapper mapper = new ObjectMapper(); + Map map = mapper.readValue(data, Map.class); + + if (map == null) { + lock.unlock(); +// 转换失败或数据为空 + return data; + } + if (Boolean.parseBoolean(String.valueOf(map.get("status")))) { +// 添加成功 + if (meting != null) { +// 更新全时会议id进入meting表中 + String update = "update meeting set quan_shi_id = ? where id = ?"; + RecordSet rs = new RecordSet(); + Map resultMap; + resultMap = mapper.readValue(meting.getResult(), Map.class); + rs.executeUpdate(update, String.valueOf(resultMap.get("conferenceId")), String.valueOf(map.get("meetingid"))); + toolUtil.writeErrorLog(resultMap.get("conferenceId") + " -:- " + + resultMap.get("pcode1") + " -:- " + resultMap.get("pcode2") + " -:- " + map.get("meetingid")); + } else { +// 添加失败 + toolUtil.writeErrorLog("添加失败!"); + jsonObject.put("api_status", false); + jsonObject.put("api_errormsg", "全时会议添加失败!"); + lock.unlock(); + toolUtil.writeErrorLog(jsonObject.toString()); + return JSONObject.toJSONString(jsonObject); + } + } + return jsonObject.toString(); + } catch (Exception e) { + toolUtil.writeErrorLog(e.toString()); + jsonObject.put("api_status", false); + jsonObject.put("api_errormsg", e.toString()); + return JSONObject.toJSONString(jsonObject); + } finally { + // 释放锁 + lock.unlock(); + toolUtil.writeErrorLog(data); + } + } +} \ No newline at end of file diff --git a/com/api/doc/search/util/DocListUtil.java b/com/api/doc/search/util/DocListUtil.java new file mode 100644 index 0000000..dc37b5d --- /dev/null +++ b/com/api/doc/search/util/DocListUtil.java @@ -0,0 +1,800 @@ +package com.api.doc.search.util; + +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Date; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import com.api.browser.bean.SearchConditionOption; +import com.api.browser.util.ConditionType; +import com.engine.doc.util.CheckPermission; +import com.engine.doc.util.TimeZoneUtil; +import com.engine.hrm.biz.HrmClassifiedProtectionBiz; + +import weaver.docs.docs.DocManager; +import weaver.general.BaseBean; +import weaver.general.TimeUtil; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.systeminfo.setting.HrmUserSettingComInfo; + +/** + * sqlwhere条件拼装 + * + * @author wangqs + */ +public class DocListUtil { + + private String sqlWhere = " t1.id=t2.sourceid "; + private boolean needRight = true; + + public DocListUtil(HttpServletRequest request, User user, DocTableType docTableType) { + this.packageCondition(request, user, docTableType); + } + + public DocListUtil( + HttpServletRequest request, User user, DocTableType docTableType, boolean needRight) { + if (!needRight || user == null) { // user为null,登录前门户元素more页面 + sqlWhere = ""; + this.needRight = false; + } + this.packageCondition(request, user, docTableType); + } + + /** 封装查询条件 */ + private void packageCondition(HttpServletRequest request, User user, DocTableType docTableType) { + + String belongtoids = ""; + if (needRight) { + HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo(); + String belongtoshow = userSetting.getBelongtoshowByUserId(user.getUID() + ""); + belongtoids = user.getBelongtoids(); + if ("1".equals(belongtoshow) && "0".equals(user.getAccount_type()) && !"".equals(belongtoids)) + belongtoids += "," + user.getUID(); + else belongtoids = ""; + } + + Enumeration paramNames = request.getParameterNames(); + + String docstatus = ""; + String customSql = ""; + if (docTableType == DocTableType.DOC_COPYMOVE) { + sqlWhere = " t1.seccategory = " + request.getParameter("sourceId"); + } + while (paramNames.hasMoreElements()) { + String paramName = (String) paramNames.nextElement(); + String paramValue = Util.null2String(request.getParameter(paramName)); + + boolean isCustom = true; // 是否是自定义字段 + + for (DocCondition condition : DocCondition.values()) { + if (paramValue.isEmpty()) continue; + + if (condition.getConditionType() == ConditionType.DATE) { + if (paramName.equals(condition.getName() + ConditionUtil.DATE_SELECT) + && !"6".equals(paramValue)) { // 只有6-时间范围,页面才传开始到结束时间,这里需要自己处理 + sqlWhere += packDateType(condition.getName(), paramValue, condition); + } else if (paramName.equals(condition.getName() + ConditionUtil.DATE_FROM)) { + // if(paramValue.equals(request.getParameter(condition.getName() + + // ConditionUtil.DATE_TO))){ //开始日期==结束日期 + // paramValue = TimeZoneUtil.getServerDate1(paramValue,"begin"); + // sqlWhere += " and " + condition.getName() + "='" + paramValue + "'"; + // }else{ + String time_paramValue = TimeZoneUtil.getServerDate1(paramValue, "begin"); + // if(!paramValue.equals(time_paramValue)){ + // time_paramValue = paramValue; + // } + if ("doclastmoddate".equals(condition.getName()) + || "doccreatedate".equals(condition.getName())) { + String doclastmodtime = TimeZoneUtil.getServertime1(paramValue, "begin"); + sqlWhere += + TimeZoneUtil.handDateCondition( + "6", paramValue, "", condition.getName(), "", false); + } else { + sqlWhere += + " and " + + condition.getName() + + ">='" + + time_paramValue + + "'"; // + " and " + condition.getName() + "=" + paramValue; + } + + // } + } else if (paramName.equals(condition.getName() + ConditionUtil.DATE_TO)) { + // if(!paramValue.equals(request.getParameter(condition.getName() + + // ConditionUtil.DATE_FROM))){ //开始日期!=结束日期 + // paramValue = TimeZoneUtil.getServerDate1(paramValue,"end"); + String time_paramValue = TimeZoneUtil.getServerDate1(paramValue, "end"); + // if(!paramValue.equals(time_paramValue)){ + // time_paramValue = paramValue; + // } + if ("doclastmoddate".equals(condition.getName()) + || "doccreatedate".equals(condition.getName())) { + String doclastmodtime = TimeZoneUtil.getServertime1(paramValue, "end"); + sqlWhere += + TimeZoneUtil.handDateCondition( + "6", "", paramValue, condition.getName(), "", false); + // sqlWhere += " and (" + condition.getName() + "<='" + time_paramValue + "'" + // + " and " + "doclastmodtime<='"+ doclastmodtime +"')"; + } else { + sqlWhere += + " and " + + condition.getName() + + "<='" + + time_paramValue + + "'"; // + " and " + condition.getName() + "=" + paramValue; + } + // sqlWhere += " and " + condition.getName() + "<='" + time_paramValue + "'"; + // } + } + continue; + } + + if (condition.getConditionType() == ConditionType.SCOPE) { + if (paramName.equals(DocCondition.REPLAY_DOC_COUNT + ConditionUtil.INTERVAL_FROM)) { + String _val = Util.getIntValue(paramValue, 0) + ""; + if (condition.getDbType() != DbType.INT) { + _val = "'" + _val.replace("'", "'") + "'"; + } + sqlWhere += " and " + condition.getName() + " >= " + _val; + } else if (paramName.equals(DocCondition.REPLAY_DOC_COUNT + ConditionUtil.INTERVAL_TO)) { + String _val = Util.getIntValue(paramValue, 0) + ""; + if (condition.getDbType() != DbType.INT) { + _val = "'" + _val.replace("'", "'") + "'"; + } + sqlWhere += " and " + condition.getName() + " <= " + _val; + } + } + + if (condition.getName().equals(paramName)) { + isCustom = false; + if (condition.getLogic() == LogicOperation.CUSTOM) { + if (paramName.equals(DocCondition.DOC_SUBJECT.getName())) { // 标题 + sqlWhere += " and " + getDocSubjectSql(paramValue); + } else if (paramName.equals(DocCondition.KEYWORD.getName())) { // 关键字 + sqlWhere += " and " + getKeyWordSql(paramValue); + } else if (paramName.equals(DocCondition.DEPARTMENT_ID.getName())) { // 创建部门 + sqlWhere += + " and exists(select 1 from HrmResource where departmentid=" + + paramValue + + " and id=t1.doccreaterid)"; + } else if (paramName.equals(DocCondition.CREATER_SUBCOMPANY_ID.getName())) { // 创建人分部 + sqlWhere += + " and exists(select 1 from HrmResource where subcompanyid1=" + + paramValue + + " and id=t1.doccreaterid)"; + } else if (paramName.equals(DocCondition.OWNER_DEPARTMENT_ID.getName())) { // 所有者部门 + sqlWhere += + " and exists(select 1 from HrmResource where departmentid=" + + paramValue + + " and id=t1.ownerid)"; + } else if (paramName.equals(DocCondition.OWNER_SUBCOMPANY_ID.getName())) { // 所有者分部 + sqlWhere += + " and exists(select 1 from HrmResource where subcompanyid1=" + + paramValue + + " and id=t1.ownerid)"; + } else if (paramName.equals(DocCondition.DATE2DURING.getName())) { // 修改期间 + if (Util.getIntValue(paramValue, 0) > 36 + || Util.getIntValue(paramValue, 0) < 1) { // 表示全部 + continue; + } + sqlWhere += + " and t1.doclastmoddate>='" + + getDate2During(Util.getIntValue(paramValue, 0)) + + "'"; + } else if (paramName.equals(DocCondition.DOC_STATUS.getName())) { // 文档状态 + docstatus = paramValue; + } else if (paramName.equals(DocCondition.TREE_DOC_FIELD_ID.getName())) { // 虚拟目录 + paramValue = paramValue.startsWith(",") ? paramValue.substring(1) : paramValue; + paramValue = + paramValue.endsWith(",") + ? paramValue.substring(0, paramValue.length() - 1) + : paramValue; + + paramValue = + paramValue.indexOf(",") == -1 + ? (" = " + paramValue) + : (" in (" + paramValue + ")"); + + sqlWhere += + " and exists(select 1 from DocDummyDetail where docid=t1.id and catelogid " + + paramValue + + ")"; + } + + } else if (condition.getLogic() == LogicOperation.EQ_OR_IN) { + paramValue = paramValue.startsWith(",") ? paramValue.substring(1) : paramValue; + paramValue = + paramValue.endsWith(",") + ? paramValue.substring(0, paramValue.length() - 1) + : paramValue; + // 分为文档订阅部分的高级搜索条件拼接 + if (paramValue.indexOf(",") == -1) { + if (condition.getDbType() == DbType.VARCHAR) + paramValue = "'" + paramValue.replace("'", "''") + "'"; + paramValue = " = " + paramValue; + } else { + if (condition.getDbType() == DbType.VARCHAR) + paramValue = "'" + paramValue.replace("'", "''").replace(",", "','") + "'"; + paramValue = " in (" + paramValue + ")"; + } + + if (condition == DocCondition.SUBSCRIPTION_APPROVE_DATE + || condition == DocCondition.SUBSCRIPTION_DATE + || condition == DocCondition.SUBSCRIPTION_STATE) { + sqlWhere += " and ds." + paramName + paramValue; + } else { + + sqlWhere += " and t1." + paramName + paramValue; + } + + } else if (condition.getLogic() != null) { // 分为文档订阅部分的高级搜索条件拼接 + String _code = condition.getLogic().getCode(); + if (_code == null) continue; + + if (condition.getDbType() == DbType.VARCHAR) { + if (_code.indexOf("{#}") > -1) { + paramValue = paramValue.replace("'", "''"); + } else { + paramValue = "'" + paramValue.replace("'", "''") + "'"; + } + } + if (condition == DocCondition.SUBSCRIPTION_APPROVE_DATE + || condition == DocCondition.SUBSCRIPTION_DATE + || condition == DocCondition.SUBSCRIPTION_STATE) { + sqlWhere += + " and ds." + + paramName + + (_code.indexOf("{#}") > -1 + ? _code.replace("{#}", paramValue) + : (_code + paramValue)); + } else { + sqlWhere += + " and t1." + + paramName + + (_code.indexOf("{#}") > -1 + ? _code.replace("{#}", paramValue) + : (_code + paramValue)); + } + } + break; + } + } + + // 处理自定义字段 + // 如果开启了自定义查询,当前的条件是自定义字段中的值,则进行检查 + if (isCustom + && ConditionUtil.isCustomParamNameNew(paramName) + && ConditionUtil.isCustomParamValue(paramName)) { + String id = ConditionUtil.getCustomIdNew(paramName); + + int secid = Util.getIntValue(Util.null2String(request.getParameter("seccategory"))); + if (docTableType == DocTableType.DOC_COPYMOVE) { + sqlWhere = " t1.seccategory = " + request.getParameter("sourceId"); + } + + String fieldValue = paramValue; + String fieldOpt = + Util.null2String( + request.getParameter( + ConditionUtil.CUSTOM_KEY_PREV + id + ConditionUtil.CUSTOM_KEY_OPT), + "-1"); + + String customSqlWhere = ConditionUtil.getCustomSql(id, secid, user, fieldValue, fieldOpt); + if (!customSqlWhere.isEmpty()) { + customSql += " and " + customSqlWhere; + } + } + } + + String eqOrInBelongtoidsForSql = + needRight + ? (belongtoids.isEmpty() ? (" = " + user.getUID()) : (" in (" + belongtoids + ")")) + : ""; + + // 处理特殊字段 + docstatus = docstatus.startsWith(",") ? docstatus.substring(1) : docstatus; + docstatus = + docstatus.endsWith(",") ? docstatus.substring(0, docstatus.length() - 1) : docstatus; + if (docTableType == DocTableType.MY_DOC_TABLE) { // 我的文档 + if (docstatus.isEmpty()) { + sqlWhere += " and t1.docstatus != 8 and t1.docstatus != 9 and t1.docstatus <=9"; + } else { + sqlWhere += + " and t1.docstatus " + + (docstatus.indexOf(",") > -1 ? ("in (" + docstatus + ")") : ("=" + docstatus)); + } + + sqlWhere += + " and (t1.doccreaterid " + + eqOrInBelongtoidsForSql + + " or t1.ownerid " + + eqOrInBelongtoidsForSql + + ")"; + } else if (docTableType == DocTableType.DOC_BATCHSHARE) { // 批量共享 + if (needRight) { + // sqlWhere += " and (t1.docstatus in(1,2,5) or (t1.docstatus=7 and (sharelevel>1 or + // (t1.doccreaterid="+user.getUID()+" or t1.ownerid="+user.getUID()+"))))"; + sqlWhere += + " and (t1.docstatus in(1,2,5) or (t1.docstatus=7 and (t1.doccreaterid=" + + user.getUID() + + " or t1.ownerid=" + + user.getUID() + + ")))"; + } else { + sqlWhere += " and t1.docstatus in(1,2,5,7) "; + } + } else if (docTableType == DocTableType.DOC_COPYMOVE + || docTableType == DocTableType.ENGINE_DOC_BATCHSHARE) { // 复制、移动 后台批量调整共享 + if (docstatus.isEmpty()) { + sqlWhere += " and t1.docstatus in(1,2,5,7)"; + } else { + docstatus = docstatus.equals("1") ? "1,2" : docstatus; // 页面查询条件1表示 同时查询 正常、生效两种状态 + sqlWhere += + " and t1.docstatus " + + (docstatus.indexOf(",") > -1 ? ("in (" + docstatus + ")") : ("=" + docstatus)); + } + } else if (docTableType == DocTableType.DOC_RECYCLE) { // 文档回收站 + if (!docstatus.isEmpty()) { + docstatus = docstatus.equals("1") ? "1,2" : docstatus; // 页面查询条件1表示 同时查询 正常、生效两种状态 + sqlWhere += + " and t1.docstatus " + + (docstatus.indexOf(",") > -1 ? ("in (" + docstatus + ")") : ("=" + docstatus)); + } + } else if (docTableType == DocTableType.ENGINE_DOC_RECYCLE) { // 文档回收(后台) + if (!docstatus.isEmpty()) { + docstatus = docstatus.equals("1") ? "1,2" : docstatus; // 页面查询条件1表示 同时查询 正常、生效两种状态 + sqlWhere += + " and t1.docstatus " + + (docstatus.indexOf(",") > -1 ? ("in (" + docstatus + ")") : ("=" + docstatus)); + } + } else if (docTableType == DocTableType.DOC_SUBSCRIPTION_HISTORY) { // 文档订阅历史 + if (docstatus.isEmpty()) { + // sqlWhere += " and t1.docstatus in(1,2,5) "; + if (needRight) { + // sqlWhere += " and (t1.docstatus in(1,2,5) or (t1.docstatus=7 and (sharelevel>1 or + // (t1.doccreaterid="+user.getUID()+" or t1.ownerid="+user.getUID()+"))))"; + // ayh 默认可以查看全部文档,包括非正常状态的文档 + + /* sqlWhere += + " and (t1.docstatus in(1,2,5) or (t1.docstatus=7 and (t1.doccreaterid=" + + user.getUID() + + " or t1.ownerid=" + + user.getUID() + + ")))";*/ + sqlWhere += + " and (t1.docstatus in(1,2,3,4,5,6,7,8,9) or (t1.docstatus=7 and (t1.doccreaterid=" + + user.getUID() + + " or t1.ownerid=" + + user.getUID() + + ")))"; + } else { +// ayh 默认可以参看全部文档,包括处于非正常状态的文档 +// sqlWhere += " and t1.docstatus in(1,2,5) "; + sqlWhere += " and t1.docstatus in(1,2,3,4,5,6,7,8,9) "; + } + } else { + docstatus = docstatus.equals("1") ? "1,2" : docstatus; // 页面查询条件1表示 同时查询 正常、生效两种状态 + sqlWhere += + " and t1.docstatus " + + (docstatus.indexOf(",") > -1 ? ("in (" + docstatus + ")") : ("=" + docstatus)); + } + + if (docTableType == DocTableType.NEWEST_DOC + || docTableType == DocTableType.NO_READ_DOC) { // 最新文档(未读文档) + sqlWhere += + " and t1.doccreaterid " + + (belongtoids.isEmpty() + ? ("<> " + user.getUID()) + : ("not in (" + belongtoids + ")")); + } + } else if (docTableType == DocTableType.ENGINE_DOC_PROP_SET) { // 文档弹出窗口设置 + sqlWhere += " and t1.docstatus in(1,2,5) and t1.docextendname = 'html'"; + } else { + if (docstatus.isEmpty()) { + // sqlWhere += " and t1.docstatus in(1,2,5) "; + if (needRight) { + // sqlWhere += " and (t1.docstatus in(1,2,5) or (t1.docstatus=7 and (sharelevel>1 or + // (t1.doccreaterid="+user.getUID()+" or t1.ownerid="+user.getUID()+"))))"; +// ayh +// sqlWhere += +// " and (t1.docstatus in(1,2,5) or (t1.docstatus=7 and (t1.doccreaterid=" +// + user.getUID() +// + " or t1.ownerid=" +// + user.getUID() +// + ")))"; + sqlWhere += + " and (t1.docstatus in(1,2,3,4,5,6,7,8,9) or (t1.docstatus=7 and (t1.doccreaterid=" + + user.getUID() + + " or t1.ownerid=" + + user.getUID() + + ")))"; + } else { +// ayh +// sqlWhere += " and t1.docstatus in(1,2,5) "; + sqlWhere += " and t1.docstatus in(1,2,3,4,5,6,7,8,9) "; + } + } else { + docstatus = docstatus.equals("1") ? "1,2" : docstatus; // 页面查询条件1表示 同时查询 正常、生效两种状态 + sqlWhere += + " and t1.docstatus " + + (docstatus.indexOf(",") > -1 ? ("in (" + docstatus + ")") : ("=" + docstatus)); + } + + if (docTableType == DocTableType.NEWEST_DOC + || docTableType == DocTableType.NO_READ_DOC) { // 最新文档(未读文档) + sqlWhere += + " and t1.doccreaterid " + + (belongtoids.isEmpty() + ? ("<> " + user.getUID()) + : ("not in (" + belongtoids + ")")); + } + } + + String isNew = Util.null2String(request.getParameter("isNew")); + if ("yes".equals(isNew) + || docTableType == DocTableType.NEWEST_DOC + || docTableType == DocTableType.NO_READ_DOC) { + sqlWhere += + " and not exists(select 1 from docReadTag where t1.id=docid and userid " + + eqOrInBelongtoidsForSql + + " and usertype=1)"; + } + + if (!customSql.isEmpty()) { + sqlWhere += + " and exists(select 1 from cus_fielddata tcm where scope='" + + ConditionUtil.CUSTOM_SCOPE + + "' and id=t1.id " + + customSql + + ")"; + } + + if (docTableType == DocTableType.DOC_BATCHSHARE && needRight) { // 批量共享(不需要权限的是后台批量共享) + // sqlWhere += " and sharelevel=3 and exists(select 1 from DocSecCategory where + // DocSecCategory.id=t1.secCategory and DocSecCategory.shareable='1')"; + sqlWhere += + " and exists(select 1 from DocSecCategory where DocSecCategory.id=t1.secCategory and DocSecCategory.shareable='1')"; + } + + // if(needRight){ + if (docTableType == DocTableType.DOC_OUT_TABLE) { // 登录前门户more(只取内部) + boolean secretFlag = CheckPermission.isOpenSecret(); + if (secretFlag) sqlWhere += " and t1.secretLevel=" + DocManager.DEFAILT_SECRET_LEVEL; + } else { + sqlWhere += DocListUtil.getSecretSql(user, " and t1.secretLevel"); + } + // } + + // 统一过滤字段 + if (docTableType != DocTableType.DOC_SUBSCRIPTION_HISTORY + && docTableType != DocTableType.DOC_SUBSCRIPTION_APPROVE + && docTableType != DocTableType.DOC_SUBSCRIPTION_BACK + && docTableType != DocTableType.DOC_RECYCLE) { // 非文档订阅过虑历史文件 、 非回收站 + sqlWhere += " and (t1.ishistory is null or t1.ishistory = 0)"; + } + + if (docTableType == DocTableType.DOC_RECYCLE) { // 文档回收站 + sqlWhere += " and t1.ishistory != 1 "; + sqlWhere += " and t1.docdeleteuserid=" + user.getUID(); + } else if (docTableType == DocTableType.ENGINE_DOC_RECYCLE) { // 文档回收站(后台) + sqlWhere += " and t1.ishistory != 1 "; + } else { + sqlWhere += " and (t1.isreply is null or t1.isreply='' or t1.isreply='0')"; + } + + sqlWhere = sqlWhere.trim().startsWith("and") ? sqlWhere.substring(4) : sqlWhere; + + // 初次进入列表,代入默认值条件 + packDefaultValue(request, user, docTableType); + } + + public static String getSecretSql(User user, String column) { + boolean secretFlag = CheckPermission.isOpenSecret(); + if (secretFlag) { + HrmClassifiedProtectionBiz hcpb = new HrmClassifiedProtectionBiz(); + String userSecretLevel = user == null ? "" : hcpb.getMaxResourceSecLevel(user); + return column + ">=" + Util.getIntValue(userSecretLevel, DocManager.DEFAILT_SECRET_LEVEL); // + } + return ""; + } + + public static Map getCreateDate(HttpServletRequest request) { + String select = + request.getParameter(DocCondition.DOC_CREATEDATE_SELECT + ConditionUtil.DATE_SELECT); + String from = + request.getParameter(DocCondition.DOC_CREATEDATE_SELECT + ConditionUtil.DATE_FROM); + String to = request.getParameter(DocCondition.DOC_CREATEDATE_SELECT + ConditionUtil.DATE_TO); + + Map dateMap = new HashMap(); + if ("0".equals(select)) { + return dateMap; + } + dateMap = packDate(select, from, to); + + from = dateMap.get("from"); + to = dateMap.get("to"); + + if (from != null && !from.isEmpty()) { + from = new TimeZoneUtil().getServerDate(from + " 00:00:00"); + } + if (to != null && !to.isEmpty()) { + to = new TimeZoneUtil().getServerDate(to + " 23:59:59"); + } + + dateMap.put(DocCondition.DOC_CREATEDATE_SELECT.getName() + ConditionUtil.DATE_FROM, from); + dateMap.put(DocCondition.DOC_CREATEDATE_SELECT.getName() + ConditionUtil.DATE_TO, to); + + return dateMap; + } + + /** + * 初始进入列表,代入默认值条件 + * + * @author wangqs + */ + public void packDefaultValue(HttpServletRequest request, User user, DocTableType docTableType) { + + // + /*** + * String during = request.getParameter(DocCondition.DATE2DURING.getName()); + * if(during == null){ + * List options = ConditionUtil.getDateSelectDuring(user.getLanguage()); + * int date = 0; + * for(SearchConditionOption option : options){ + * if(option.isSelected()){ + * date = Util.getIntValue(option.getKey(),0); + * } + * } + * if(date >= 1 && date <= 36){ + * + * sqlWhere += " and t1.doclastmoddate>='" + getDate2During(date) + "'"; + * } + * } + * + ***/ + + // 最新文档有tab页,未读文档没有tab页 + if (docTableType == DocTableType.NEWEST_DOC) { // 最新文档 + try { + sqlWhere += this.packSearchTabDate(request.getParameter(ConditionUtil.TAB_REQ_NAME)); + } catch (Exception e) { + e.printStackTrace(); + } + } else if (docTableType == DocTableType.MY_DOC_TABLE + || docTableType == DocTableType.SEARCH_DOC_TABLE + || docTableType == DocTableType.CATEGORY_DOC_TABLE) { // 我的文档、查询文档、文档目录 + try { + // 0-全部,1-今天,2-本周,3-本月,4-本季,5-本年 + + int tab = + Util.getIntValue( + request.getParameter(ConditionUtil.TAB_REQ_NAME), ConditionUtil.TAB_DATE_DEFAULT); + + String updateDate = + Util.null2String( + request.getParameter( + DocCondition.DOC_LAST_MODDATE.getName() + ConditionUtil.DATE_SELECT)); + + if (updateDate.isEmpty()) { // 没有修改日期,取默认时间 + // sqlWhere += packDateType(DocCondition.DOC_LAST_MODDATE.getName(),tab + ""); + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + + sqlWhere = sqlWhere.trim().startsWith("and") ? sqlWhere.substring(4) : sqlWhere; + } + + /** 处理修改期间(最近n月)条件的查询 */ + public static String getDate2During(int month) { + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -30 * month); + Date cDate = new Date(calendar.getTimeInMillis()); + return new SimpleDateFormat("yyyy-MM-dd").format(cDate); + } + + /** 处理特殊时间类型(今天、本周、本月....)条件查询 0-全部,1-今天,2-本周,3-本月,7-上个月,4-本季,5-本年,8-上一年,6-指定日期范围 */ + public static String packDateType(String column, String value, DocCondition condition) { + Map dateMap = packDate(value, "", ""); + String sdate = Util.null2String(dateMap.get("from")); + String edate = Util.null2String(dateMap.get("to")); + + if ("0".equals(value)) { + return ""; + } + + if (condition == DocCondition.SUBSCRIPTION_APPROVE_DATE + || condition == DocCondition.SUBSCRIPTION_DATE + || condition == DocCondition.SUBSCRIPTION_STATE) { + if (!sdate.isEmpty()) { + if ("8".equals(value)) { + return TimeZoneUtil.handDateCondition(value, sdate, edate, column, "ds", false, true); + } else { + return TimeZoneUtil.handDateCondition(value, sdate, edate, column, "ds", false, true); + } + // if(sdate.equals(edate)){ + //// return TimeZoneUtil.handDateCondition(value,sdate,"",column,"ds",false,true); + // return " and ds." + column + "='" + sdate + "'"; + // }else{ + //// return TimeZoneUtil.handDateCondition(value,sdate,"",column,"ds",false,true); + // String test = " and ds." + column + ">='" + sdate + "' and ds." + column + "<='" + + // edate + "'"; + // return test; + // } + } + } else { + if (!sdate.isEmpty()) { + if ("8".equals(value)) { + return TimeZoneUtil.handDateCondition(value, sdate, edate, column, "t1", false, true); + } else { + return TimeZoneUtil.handDateCondition(value, sdate, edate, column, "t1", false, true); + } + // if(sdate.equals(edate)){ + // return " and t1." + column + "='" + sdate + "'"; + // }else{ + // String test = " and t1." + column + ">='" + sdate + "' and t1." + column + "<='" + + // edate + "'"; + // return test; + // } + } + } + + return ""; + } + + /** + * 处理特殊时间类型(今天、本周、本月....)条件查询 0-全部,1-今天,2-本周,3-本月,7-上个月,4-本季,5-本年,8-上一年,6-指定日期范围 + * + * @author wangqs + * @params select-类型值,from-指定类型的开始日期,to-指定日期的结束日期 + */ + public static Map packDate(String select, String from, String to) { + Map dateMap = new HashMap(); + + String sdate = ""; + String edate = TimeUtil.getCurrentDateString(); + switch (Util.getIntValue(select, 0)) { + case 1: + sdate = TimeUtil.getCurrentDateString(); + break; + case 2: + sdate = TimeUtil.getFirstDayOfWeek(); + break; + case 3: + sdate = TimeUtil.getFirstDayOfMonth(); + break; + case 4: + sdate = TimeUtil.getFirstDayOfSeason(); + break; + case 5: + sdate = TimeUtil.getFirstDayOfTheYear(); + break; + case 6: + sdate = from; + edate = to; + case 7: + sdate = TimeUtil.getLastMonthBeginDay(); + edate = TimeUtil.getLastMonthEndDay(); + break; + case 8: + sdate = TimeUtil.getFirstDayOfLastYear(); + edate = TimeUtil.getEndDayOfLastYear(); + break; + default: + break; + } + + // TimeZoneUtil timeZoneUtil = new TimeZoneUtil(); + // //多时区转换 + // sdate = timeZoneUtil.getServerDate(sdate,"begin"); + // edate = timeZoneUtil.getServerDate(edate,"end"); + + dateMap.put("from", sdate); + dateMap.put("to", edate); + + return dateMap; + } + + /** 根据规则 处理有主题条件的查询 */ + private String getDocSubjectSql(String docsubject) { + String tmpString = ""; + docsubject = docsubject.replaceAll("'", "''").replaceAll("\"", """); + if ((docsubject.indexOf(" ") == -1 && docsubject.indexOf("+") == -1) + || (docsubject.indexOf(" ") != -1 && docsubject.indexOf("+") != -1)) { + tmpString += " t1.docsubject like '%" + docsubject + "%'"; + } else if (docsubject.indexOf(" ") != -1 && docsubject.indexOf("+") == -1) { + String orArray[] = Util.TokenizerString2(docsubject, " "); + if (orArray.length > 0) { + tmpString += " ( "; + } + for (int i = 0; i < orArray.length; i++) { + tmpString += " t1.docsubject like '%" + orArray[i] + "%'"; + if (i + 1 < orArray.length) { + tmpString += " or "; + } + } + if (orArray.length > 0) { + tmpString += " ) "; + } + } else if (docsubject.indexOf(" ") == -1 && docsubject.indexOf("+") != -1) { + String andArray[] = Util.TokenizerString2(docsubject, "+"); + for (int i = 0; i < andArray.length; i++) { + tmpString += " t1.docsubject like '%" + andArray[i] + "%'"; + if (i + 1 < andArray.length) { + tmpString += " and "; + } + } + } + return tmpString; + } + + /** 根据规则 处理有关键字条件的查询 */ + private String getKeyWordSql(String keyword) { + String keywordSql = ""; + keyword = keyword.trim().replaceAll("'", "''"); + ArrayList keywordList = Util.TokenizerString(keyword, " "); + if (keywordList != null && keywordList.size() > 0) { + for (int i = 0; i < keywordList.size(); i++) { + String tempkeyword = (String) keywordList.get(i); + keywordSql += + keywordSql.equals("") + ? " t1.keyword like '%" + tempkeyword + "%' " + : " or t1.keyword like '%" + tempkeyword + "%' "; + } + if (!keywordSql.equals("")) { + keywordSql = " (" + keywordSql + ") "; + } + } + return keywordSql; + } + + /** + * 最新文档tab页转换成 sql条件 + * + * @author wangqs + */ + private String packSearchTabDate(String tabValue) throws Exception { + String sql = ""; + + switch (Util.getIntValue(tabValue, ConditionUtil.TAB_DEFAULT_VALUE)) { + case ConditionUtil.TAB_TODAY_VALUE: + sql = " and t1.doccreatedate='" + TimeUtil.getCurrentDateString() + "'"; + break; + case ConditionUtil.TAB_WEEK_VALUE: + sql = " and t1.doccreatedate>='" + TimeUtil.getFirstDayOfWeek() + "'"; + sql += " and t1.doccreatedate<='" + TimeUtil.getLastDayOfWeek() + "'"; + break; + case ConditionUtil.TAB_MONTH_VALUE: + sql = " and t1.doccreatedate>='" + TimeUtil.getFirstDayOfMonth() + "'"; + sql += " and t1.doccreatedate<='" + TimeUtil.getLastDayOfMonth() + "'"; + break; + case ConditionUtil.TAB_SESSION_VALUE: + sql = " and t1.doccreatedate>='" + TimeUtil.getFirstDayOfSeason() + "'"; + sql += " and t1.doccreatedate<='" + TimeUtil.getLastDayDayOfSeason() + "'"; + break; + case ConditionUtil.TAB_YEAR_VALUE: + sql = " and t1.doccreatedate>='" + TimeUtil.getFirstDayOfTheYear() + "'"; + sql += " and t1.doccreatedate<='" + TimeUtil.getLastDayOfYear() + "'"; + break; + default: + break; + } + + return sql; + } + + public String getSqlWhere() { +// ayh + new BaseBean().writeLog("create sql string from docListUtil, sqlWhere is :" + this.sqlWhere); + return this.sqlWhere; + } +} diff --git a/com/api/doc/search/web/SearchListAction.java b/com/api/doc/search/web/SearchListAction.java new file mode 100644 index 0000000..f1e6fb4 --- /dev/null +++ b/com/api/doc/search/web/SearchListAction.java @@ -0,0 +1,1018 @@ +package com.api.doc.search.web; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.serializer.SerializerFeature; +import com.api.browser.bean.BrowserBean; +import com.api.browser.bean.SearchConditionItem; +import com.api.browser.service.impl.DocCategoryService; +import com.api.browser.service.impl.DocFullSearchUtil; +import com.api.doc.category.service.CategoryService; +import com.api.doc.mobile.systemDoc.util.CategoryUtil; +import com.api.doc.search.bean.CustomFieldExt; +import com.api.doc.search.bean.RightMenu; +import com.api.doc.search.service.DocNewsService; +import com.api.doc.search.service.DocSearchService; +import com.api.doc.search.util.*; +import com.engine.common.util.ParamUtil; +import com.engine.doc.util.CheckPermission; +import com.engine.doc.util.DocApplySettingUtil; +import com.engine.portal.biz.menuinfo.MenuInfoCommonBiz; +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.TimeUtil; +import weaver.general.Util; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; +import weaver.hrm.moduledetach.ManageDetachComInfo; +import weaver.systeminfo.SystemEnv; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.ws.rs.GET; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; +import javax.ws.rs.core.Context; +import javax.ws.rs.core.MediaType; +import java.util.*; + +@Path("/doc/searchlist") +public class SearchListAction { + /** + * 列表 + * @author wangqs + * */ + @GET + @Path("/list") + @Produces(MediaType.TEXT_PLAIN) + public String getDataList(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser (request , response) ; + + + String getMost = request.getParameter("getMost"); + boolean noFullSearch = false; //微搜不支持,只能走sql + + if("reply".equals(getMost) || "read".equals(getMost) || "download".equals(getMost) || "score".equals(getMost)){ + noFullSearch = true; + } + + //当前选中tab + int tabInfo = Util.getIntValue(request.getParameter(ConditionUtil.TAB_REQ_NAME),ConditionUtil.TAB_LIST_DEFAULT); + + boolean fromProtal = false; + String protalViewcondition = ""; + DocTableType docTableType = null; + + if(tabInfo == ConditionUtil.TAB_LIST_MY){ + docTableType = DocTableType.MY_DOC_TABLE; + }else if(tabInfo == ConditionUtil.TAB_LIST_NO_READ){ + docTableType = DocTableType.NO_READ_DOC; + noFullSearch = true; + }else if(tabInfo >= ConditionUtil.TAB_LIST_ALL){ + docTableType = DocTableType.SEARCH_DOC_TABLE; + } + //外部用户暂不支持微搜 + if("2".equals(user.getLogintype())){ + noFullSearch=true; + } + + DocSearchService docSearchService = new DocSearchService(); + boolean useFullSearch = noFullSearch ? false : DocSearchService.useFullSearch(); + //boolean hasFullSearch = noFullSearch ? false : DocFullSearchUtil.isUseFullSearch(user.getLanguage() + ""); + + String elementmore = Util.null2String(request.getParameter("elementmore")); + + String secIds = ""; + String dumids = ""; + String cenids = ""; + String poids = ""; + String toids = ""; + String order = ""; + String orderBy = ""; + + if(!elementmore.isEmpty()) + { + //net.sf.json.JSONArray arry = net.sf.json.JSONArray.fromObject(elementmore); + //net.sf.json.JSONObject jb = arry.getJSONObject(0); + net.sf.json.JSONObject jb = net.sf.json.JSONObject.fromObject(elementmore); + + if(jb.get(DocNewsService.NEWS_CATEGORY_IDS) != null){ + useFullSearch = false; + String jonStr = jb.getString(DocNewsService.NEWS_CATEGORY_IDS); + net.sf.json.JSONArray arry = net.sf.json.JSONArray.fromObject(jonStr); + for(int i = 0;i < arry.size();i++){ + secIds += "," + arry.getInt(i); + } + secIds = secIds.isEmpty() ? "" : secIds.substring(1); + } + + if(jb.get(DocNewsService.NEWS_VIRTUAL_IDS) != null){ + useFullSearch = false; + String jonStr = jb.getString(DocNewsService.NEWS_VIRTUAL_IDS); + net.sf.json.JSONArray arry = net.sf.json.JSONArray.fromObject(jonStr); + for(int i = 0;i < arry.size();i++){ + dumids += "," + arry.getInt(i); + } + dumids = dumids.isEmpty() ? "" : dumids.substring(1); + } + + if(jb.get(DocNewsService.NEWS_CENTER_IDS) != null){ + useFullSearch = false; + String jonStr = jb.getString(DocNewsService.NEWS_CENTER_IDS); + net.sf.json.JSONArray arry = net.sf.json.JSONArray.fromObject(jonStr); + for(int i = 0;i < arry.size();i++){ + cenids += "," + arry.getInt(i); + } + cenids = cenids.isEmpty() ? "" : cenids.substring(1); + } + + if(jb.get(DocNewsService.NEWS_APPOINT_IND) != null){ + useFullSearch = false; + String jonStr = jb.getString(DocNewsService.NEWS_APPOINT_IND); + net.sf.json.JSONArray arry = net.sf.json.JSONArray.fromObject(jonStr); + for(int i = 0;i < arry.size();i++){ + poids += "," + arry.getInt(i); + } + poids = poids.isEmpty() ? "" : poids.substring(1); + } + + if(jb.get(DocNewsService.NEWS_TOP_IDS) != null){ + useFullSearch = false; + String jonStr = jb.getString(DocNewsService.NEWS_TOP_IDS); + net.sf.json.JSONArray arry = net.sf.json.JSONArray.fromObject(jonStr); + for(int i = 0;i < arry.size();i++){ + toids += "," + arry.getInt(i); + } + toids = toids.isEmpty() ? "" : toids.substring(1); + } + + order = ""; + orderBy = ""; + } + + String secid = Util.null2String(request.getParameter("secid")); + if(!secid.isEmpty()){ + secIds += secIds.isEmpty() ? secid : ("," + secid); + } + String menuid = Util.null2String(request.getParameter("menuidforportal")); + if (!menuid.isEmpty()){ + String paramsStr = new MenuInfoCommonBiz().getLeftMenuParams(menuid); + secid = getUrlParams(paramsStr,"secid"); + int viewcondition = Util.getIntValue(getUrlParams(paramsStr,"viewcondition")); + if(!secid.isEmpty()){ + secIds += secIds.isEmpty() ? secid : ("," + secid); + } + if(viewcondition == ConditionUtil.TAB_LIST_MY){ + docTableType = DocTableType.MY_DOC_TABLE; + fromProtal = true; + protalViewcondition = ConditionUtil.TAB_LIST_MY+""; + }else if(viewcondition == ConditionUtil.TAB_LIST_NO_READ){ + docTableType = DocTableType.NO_READ_DOC; + fromProtal = true; + protalViewcondition = ConditionUtil.TAB_LIST_NO_READ+""; + useFullSearch = false; + }else if(viewcondition >= ConditionUtil.TAB_LIST_ALL){ + docTableType = DocTableType.SEARCH_DOC_TABLE; + fromProtal = true; + protalViewcondition = ConditionUtil.TAB_LIST_ALL+""; + } + + } + + apidatas.put("secids",secIds); + apidatas.put("elementmore",elementmore); + if(useFullSearch){ + Map params = new HashMap(); + String groupid = request.getParameter("groupid"); //自定义查询 + ConditionUtil condition = new ConditionUtil(); + if(tabInfo > ConditionUtil.TAB_LIST_ALL && groupid != null && !groupid.isEmpty()){ + Map defaultValues = condition.getConditionMouldDetail(groupid, user); + for(String key : defaultValues.keySet()){ + params.put(key, defaultValues.get(key)); + } + }else{ + params = getRequestMap(request); + } + + if(!secIds.isEmpty()) + { + params.put("secCategory", secIds); + + } + apidatas = docSearchService.getDocListByFullSearch(docTableType,user,params); + apidatas.put("useType", "datasource"); + }else{ + DocListUtil docListUtil = new DocListUtil(request,user,docTableType); + String detailWhere = docListUtil.getSqlWhere(); +// ayh +// new BaseBean().writeLog("docListUtil get sql string!"); + + String moreWhere = ""; + if(!secIds.isEmpty()) + { + moreWhere += " or t1.seccategory in ("+secIds+")"; + } + if(!dumids.isEmpty()){ + moreWhere += " or exists (select 1 from DocDummyDetail where docid=t1.id and catelogid in("+dumids+"))"; + } + if(!cenids.isEmpty()){ + + RecordSet rs = new RecordSet(); + rs.executeQuery("select publishtype,departmentopt,dateopt,newsclause from DocFrontpage where id in(" + cenids + ")"); + + + String newsWhere = ""; + + int publishtype = 0; + int departmentopt = 0; + int dateopt = 0; + String newsclause = ""; + while(rs.next()){ + publishtype = rs.getInt("publishtype"); + departmentopt = rs.getInt("departmentopt"); + dateopt = rs.getInt("dateopt"); + newsclause = rs.getString("newsclause"); + + newsWhere += " or ("; + if(publishtype > 0){ + newsWhere += " t1.docpublishtype='" + publishtype + "'"; + }else{ + newsWhere += " t1.docpublishtype in('2','3')"; + } + + if(departmentopt > 0){ + newsWhere += " and t1.docdepartmentid=" + departmentopt ; + } + + if(dateopt > 0){ + + Calendar calendar = Calendar.getInstance(); + calendar.add(Calendar.DATE, -30); + String date = TimeUtil.getDateString(calendar); + + newsWhere += " and t1.doclastmoddate>='" + date + "'" ; + } + + if(!newsclause.isEmpty()){ + newsWhere += " and " + newsclause; + } + newsWhere += ")"; + } + + } + + String ids = toids + "," + poids; + + ids = ids.startsWith(",") ? ids.substring(1) : ids; + ids = ids.endsWith(",") ? ids.substring(0,ids.length() - 1) : ids; + + if(!ids.isEmpty()){ + moreWhere += " or t1.id in(" + ids + ")"; + } + + + if(!moreWhere.isEmpty()){ + detailWhere += " and (" + moreWhere.substring(4) + ")"; + } + + int seccategory = Util.getIntValue(request.getParameter(DocCondition.SEC_CATEGORY.getName()),0); + String _secid = secIds; + if(seccategory > 0){ + _secid = _secid.isEmpty() ? (seccategory+"") : (_secid + "," + seccategory); + } + + Map createDateMap = DocListUtil.getCreateDate(request); + createDateMap.put(DocCondition.SEC_CATEGORY.getName(),_secid); + + DocShareUtil docShareUtil = new DocShareUtil(user,detailWhere,createDateMap); + String shareTable = docShareUtil.getSqlShare(); + + + Map params = new HashMap(); + params.put("getMost", request.getParameter("getMost")); + + String getLog = new BaseBean().getPropValue("doc_full_search","sqlLog"); + if("1".equals(getLog)) + params.put("showTableString","1"); + + if(seccategory > 0){ + boolean useCustomSearch = docSearchService.isUseCustomSearch(seccategory); + params.put("useCustomSearch",useCustomSearch ? "1" : "0"); + } + + apidatas = docSearchService.getDocList(detailWhere,shareTable,seccategory,docTableType,user,params); + apidatas.put("useType", "sql"); + apidatas.put("seccategoryid",seccategory); + apidatas.put("fromPortal",fromProtal?"1":"0"); + apidatas.put("protalViewcondition",protalViewcondition); + apidatas.put("canCreate",true); + } + + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * 保存自定义查询模板 + * @author wangqs + * */ + @GET + @Path("/saveConditionMould") + @Produces(MediaType.TEXT_PLAIN) + public String saveConditionMould(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser (request , response) ; + + String conditionMouldId = Util.null2String(request.getParameter("conditionMouldId")); + String conditionMouldName = Util.null2String(request.getParameter("conditionMouldName")); + + Map conditionMap = getRequestMap(request); + + ConditionUtil conditionUtil = new ConditionUtil(); + apidatas = conditionUtil.saveConditionMould(conditionMouldId, conditionMouldName, user, conditionMap); + + }catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * 删除自定义查询模板 + * @author wangqs + * */ + @GET + @Path("/deleteConditionMould") + @Produces(MediaType.TEXT_PLAIN) + public String deleteConditionMould(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser (request , response) ; + + String conditionMouldId = Util.null2String(request.getParameter("groupid")); + + ConditionUtil conditionUtil = new ConditionUtil(); + apidatas = conditionUtil.deleteConditionMould(conditionMouldId, user); + + }catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * 高级搜索 + * @author wangqs + * */ + @GET + @Path("/condition") + @Produces(MediaType.TEXT_PLAIN) + public String getConDition(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser (request , response) ; + + //当前选中tab + int tabInfo = Util.getIntValue(request.getParameter(ConditionUtil.TAB_REQ_NAME),ConditionUtil.TAB_LIST_DEFAULT); + + //目录id + int secid = Util.getIntValue(request.getParameter(DocCondition.SEC_CATEGORY.getName())); + + List> grouplist = new ArrayList>(); + + Map groupitem1 = new HashMap(); + List itemlist1 = new ArrayList(); + groupitem1.put("title", SystemEnv.getHtmlLabelNames(ConditionUtil.COMMON_CONDITION, user.getLanguage())); + groupitem1.put("defaultshow", true); + groupitem1.put("items", itemlist1); + grouplist.add(groupitem1); + + Map defaultValues = new HashMap(); + if(tabInfo > ConditionUtil.TAB_LIST_ALL){ + String groupid = request.getParameter("groupid"); //自定义查询 + if(groupid != null && !groupid.isEmpty()){ + ConditionUtil condition = new ConditionUtil(); + defaultValues = condition.getConditionMouldDetail(groupid, user); + } + } + + + itemlist1.add(ConditionUtil.getCondition(DocCondition.DOC_SUBJECT,user, + defaultValues.get(DocCondition.DOC_SUBJECT.getName()))); + + boolean secretFlag = CheckPermission.isOpenSecret(); + if(secretFlag){ + //String tableType = request.getParameter("tableType"); + //if("propSet".equals(tableType)){ + // itemlist1.add(ConditionUtil.getSecretLevel(user)); + //}else{ + itemlist1.add(ConditionUtil.getCondition(DocCondition.SECRET_LEVEL,user, + defaultValues.get(DocCondition.SECRET_LEVEL.getName()))); + //} + } + + if(ConditionUtil.TAB_LIST_MY == tabInfo){ //我的文档 + itemlist1.add(ConditionUtil.getDocStatus2(user.getLanguage())); + }else if(ConditionUtil.TAB_LIST_NO_READ == tabInfo || ConditionUtil.TAB_LIST_ALL <= tabInfo){ // 未读文档、全部文档 + itemlist1.add(ConditionUtil.getCondition(DocCondition.DOC_CREATER_ID,user, + defaultValues.get(DocCondition.DOC_CREATER_ID.getName()))); + } + //增加属性,目录浏览框过滤隐藏目录 + SearchConditionItem searchConditionItem=ConditionUtil.getCondition(DocCondition.SEC_CATEGORY,user, + defaultValues.get(DocCondition.SEC_CATEGORY.getName())); + BrowserBean browserBean= searchConditionItem.getBrowserConditionParam(); + Map browserparams= browserBean.getDataParams(); + browserparams.put("ishidesec","1"); + browserBean.getCompleteParams().put("ishidesec","1"); + itemlist1.add(searchConditionItem); + itemlist1.add(ConditionUtil.getCondition(DocCondition.DOC_CREATEDATE_SELECT,user, + defaultValues.get(DocCondition.DOC_CREATEDATE_SELECT.getName()))); + itemlist1.add(ConditionUtil.getCondition(DocCondition.DOC_NO,user, + defaultValues.get(DocCondition.DOC_NO.getName()))); + //itemlist1.add(ConditionUtil.getCondition(DocCondition.DATE2DURING,user)); + itemlist1.add(ConditionUtil.getCondition(DocCondition.DOC_LAST_MODDATE,user, + defaultValues.get(DocCondition.DOC_LAST_MODDATE.getName()))); + + Map groupitem2 = new HashMap(); + List itemlist2 = new ArrayList(); + groupitem2.put("title", SystemEnv.getHtmlLabelNames(ConditionUtil.OTHER_CONDITION,user.getLanguage())); + groupitem2.put("defaultshow", true); + groupitem2.put("items", itemlist2); + grouplist.add(groupitem2); + + if(ConditionUtil.TAB_LIST_NO_READ == tabInfo || ConditionUtil.TAB_LIST_ALL <= tabInfo){ // 未读文档、全部文档 + itemlist2.add(ConditionUtil.getCondition(DocCondition.DEPARTMENT_ID,user, + defaultValues.get(DocCondition.DEPARTMENT_ID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.OWNER_ID,user, + defaultValues.get(DocCondition.OWNER_ID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.OWNER_DEPARTMENT_ID,user, + defaultValues.get(DocCondition.OWNER_DEPARTMENT_ID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.OWNER_SUBCOMPANY_ID,user, + defaultValues.get(DocCondition.OWNER_SUBCOMPANY_ID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.CREATER_SUBCOMPANY_ID,user, + defaultValues.get(DocCondition.CREATER_SUBCOMPANY_ID.getName()))); + } + itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_PUBLISH_TYPE,user, + defaultValues.get(DocCondition.DOC_PUBLISH_TYPE.getName()))); + //if(ConditionUtil.TAB_LIST_NO_READ == tabInfo){ + itemlist2.add(ConditionUtil.getCondition(DocCondition.TREE_DOC_FIELD_ID,user)); + //} + itemlist2.add(ConditionUtil.getCondition(DocCondition.KEYWORD,user, + defaultValues.get(DocCondition.KEYWORD.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.REPLAY_DOC_COUNT,user, + defaultValues.get(DocCondition.REPLAY_DOC_COUNT.getName()))); + if(ConditionUtil.TAB_LIST_NO_READ == tabInfo || ConditionUtil.TAB_LIST_ALL <= tabInfo){ // 未读文档、全部文档 + itemlist2.add(ConditionUtil.getDocStatus1(user.getLanguage())); + //itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_LANGURAGE,user, + // defaultValues.get(DocCondition.DOC_LANGURAGE.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_LAST_MODUSER_ID,user, + defaultValues.get(DocCondition.DOC_LAST_MODUSER_ID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_ARCHIVE_DATE,user, + defaultValues.get(DocCondition.DOC_ARCHIVE_DATE.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_ARCHIVE_USER_ID,user, + defaultValues.get(DocCondition.DOC_ARCHIVE_USER_ID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_APPROVE_DATE,user, + defaultValues.get(DocCondition.DOC_APPROVE_DATE.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.DOC_APPROVE_USER_ID,user, + defaultValues.get(DocCondition.DOC_APPROVE_USER_ID.getName()))); + + itemlist2.add(ConditionUtil.getCondition(DocCondition.CRMID,user, + defaultValues.get(DocCondition.CRMID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.ASSETID,user, + defaultValues.get(DocCondition.ASSETID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.HRMRESID,user, + defaultValues.get(DocCondition.HRMRESID.getName()))); + itemlist2.add(ConditionUtil.getCondition(DocCondition.PROJECTID,user, + defaultValues.get(DocCondition.PROJECTID.getName()))); + } + + + //自定义字段 + if(secid > 0){ + List itemlist3 = ConditionUtil.getCustomFieldExtProxyNew(secid, user); + + if(itemlist3 != null && itemlist3.size() > 0){ + + Map groupitem3 = new HashMap(); + groupitem3.put("title", SystemEnv.getHtmlLabelNames(ConditionUtil.CUSTOM_CONDITION,user.getLanguage())); + groupitem3.put("defaultshow", false); + groupitem3.put("items", itemlist3); + grouplist.add(groupitem3); + } + + } + + apidatas.put("condition", grouplist); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + + // 禁止序列化时,同一个对象产生引用 + return JSONObject.toJSONString(apidatas, SerializerFeature.DisableCircularReferenceDetect); + } + + /** + * 树结构 + * @author wangqs + * */ + @GET + @Path("/treeNode") + @Produces(MediaType.TEXT_PLAIN) + public String getTreeData(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + + //当前选中tab + int tabInfo = Util.getIntValue(request.getParameter(ConditionUtil.TAB_REQ_NAME),ConditionUtil.TAB_LIST_DEFAULT); + BaseBean bb = new BaseBean(); + User user = HrmUserVarify.getUser (request , response) ; + CategoryTree tree = new CategoryTree(); + + String isCommon = Util.null2String(request.getParameter("isCommon")); + String isFav = Util.null2String(request.getParameter("isFav")); + + int type = CategoryTree.ALL; + if("1".equals(isCommon)){ + type = CategoryTree.COMMON; + }else if("1".equals(isFav)){ + type = CategoryTree.FAV; + } + + Map dataMap = new HashMap(); + String secid = Util.null2String(request.getParameter("secid")); + String menuid = Util.null2String(request.getParameter("menuidforportal")); + String firstSecid = Util.null2s(request.getParameter("firstSecid"),"0"); + dataMap.put("firstSecid",firstSecid); +// bb.writeLog("111111111111111 secid:"+secid+"---menuid:"+menuid+"--firstSecid:"+firstSecid); + if (!menuid.isEmpty()){ + String paramsStr = new MenuInfoCommonBiz().getLeftMenuParams(menuid); + paramsStr = (paramsStr.indexOf("?")>0 ? "" : "?") +paramsStr; + secid = getUrlParams(paramsStr,"secid"); + } + + if(!secid.isEmpty()){ + dataMap.put("secid",secid); + } +// bb.writeLog("222222222222222 secid:"+secid+"---menuid:"+menuid+"--dataMap:"+dataMap+"---type:"+type+"--tabInfo:"+tabInfo); + String getLog = new BaseBean().getPropValue("doc_full_search","sqlLog"); + if("1".equals(getLog)) + tree.setGetSql(true); + + String treeJson = ""; + if(tabInfo == ConditionUtil.TAB_LIST_MY){ + treeJson = tree.getTree(user,DocTableType.MY_DOC_TABLE,"",type,dataMap); + }else if(tabInfo == ConditionUtil.TAB_LIST_NO_READ){ + treeJson = tree.getTree(user,DocTableType.NEWEST_DOC,"",type,dataMap); + }else if(tabInfo >= ConditionUtil.TAB_LIST_ALL){ + treeJson = tree.getTree(user,DocTableType.SEARCH_DOC_TABLE,"",type,dataMap); + } +// bb.writeLog("3333333333333333 secid:"+secid+"---menuid:"+menuid+"--treeJson:"+treeJson); + return treeJson; + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * 树结构数 + * @author wangqs + * */ + @POST + @Path("/treeNodeNum") + @Produces(MediaType.TEXT_PLAIN) + public String getTreeDataNum(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + + //当前选中tab + int tabInfo = Util.getIntValue(request.getParameter(ConditionUtil.TAB_REQ_NAME),ConditionUtil.TAB_LIST_DEFAULT); + + + User user = HrmUserVarify.getUser (request , response) ; + CategoryTree tree = new CategoryTree(); + + String isCommon = Util.null2String(request.getParameter("isCommon")); + String isFav = Util.null2String(request.getParameter("isFav")); + + int type = CategoryTree.ALL; + if("1".equals(isCommon)){ + type = CategoryTree.COMMON; + }else if("1".equals(isFav)){ + type = CategoryTree.FAV; + } + //处理异步加载目录num的逻辑start==== + Map dataMap = new HashMap(); + String secid = Util.null2String(request.getParameter("secid")); + String selectChild = Util.null2s(request.getParameter("selectChild"),"0"); + dataMap.put("selectChild",selectChild); + if(!secid.isEmpty()){ + dataMap.put("secid",secid); + if("1".equals(selectChild)&&!secid.contains(",")){ + String childSql = "select id from DocSecCategory where parentid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(childSql,secid); + String ids=""; + while (rs.next()){ + String id = rs.getString("id"); + ids = ids+","+id; + } + if(!ids.isEmpty()) ids = ids.substring(1); + dataMap.put("secid",ids); + } + dataMap.put("asynnum","1"); + } + + String getLog = new BaseBean().getPropValue("doc_full_search","sqlLog"); + if("1".equals(getLog)) + tree.setGetSql(true); + + //处理异步加载目录num的逻辑end==== + Map> treeNum = new HashMap>(); + if(tabInfo == ConditionUtil.TAB_LIST_MY){ + treeNum = tree.getTreeNum(user,DocTableType.MY_DOC_TABLE,"",type,dataMap); + }else if(tabInfo == ConditionUtil.TAB_LIST_NO_READ){ + treeNum = tree.getTreeNum(user,DocTableType.NEWEST_DOC,"",type,dataMap); + }else if(tabInfo >= ConditionUtil.TAB_LIST_ALL){ + treeNum = tree.getTreeNum(user,DocTableType.SEARCH_DOC_TABLE,"",type,dataMap); + } + + apidatas.put("treecount", treeNum); + apidatas.put("countcfg", tree.getTreeNumColor(user,true)); + + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * 右键菜单 + * @author wangqs + * */ + @GET + @Path("/rightMenu") + @Produces(MediaType.TEXT_PLAIN) + public String getRightMenu(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser (request , response) ; + List rightMenus = new ArrayList(); + + String view = Util.null2String(request.getParameter(RightMenu.TABLE_VIEW_PARAM)); + + int language = user.getLanguage(); + + //当前选中tab + int tabInfo = Util.getIntValue(request.getParameter(ConditionUtil.TAB_REQ_NAME),ConditionUtil.TAB_LIST_DEFAULT); + + + rightMenus.add(new RightMenu(language,RightMenuType.BTN_SEARCH,"",false)); + if(tabInfo == ConditionUtil.TAB_LIST_MY){ //我的文档 + rightMenus.add(new RightMenu(language,RightMenuType.BTN_DELETE,"doMuliDelete()", true,true)); + }else if(tabInfo == ConditionUtil.TAB_LIST_NO_READ){ //未读文档 + rightMenus.add(new RightMenu(language,RightMenuType.BTN_SUBSCRIBE,"doSubscribe()", false)); + rightMenus.add(new RightMenu(language,RightMenuType.BTN_SIGN_READED,"signReaded()", true,true)); + }else if(tabInfo >= ConditionUtil.TAB_LIST_ALL){ //全部文档 + rightMenus.add(new RightMenu(language,RightMenuType.BTN_SUBSCRIBE,"doSubscribe()", false)); + rightMenus.add(new RightMenu(language,RightMenuType.BTN_IMPORT_SELECT_TO_DUMMY,"importSelectedToDummy()", true,false)); + rightMenus.add(new RightMenu(language,RightMenuType.BTN_IMPORT_ALL_TO_DUMMY,"importAllToDummy()", false)); + //rightMenus.add(new RightMenu(language,RightMenuType.BTN_BACTH_DOWNLOAD_FILE,"bacthDownloadImageFile()", true,false)); + + } + //-------------------------------- + RightMenu createDocRightMenu = new RightMenu(language, RightMenuType.BTN_CREATE_DOC, "", true, true); + //判断是否开启了知识分权,开启了分权增加高级搜索按钮 + boolean useDocManageDetach = new ManageDetachComInfo().isUseDocManageDetach(); + if (useDocManageDetach){ + HashMap map = new HashMap(); + map.put("isHasAdvanceSerach",true); + createDocRightMenu.setCustomData(map); + } + rightMenus.add(createDocRightMenu); + //-------------------------------- + + if(DocSearchService.thumbnail){ + if(RightMenu.TABLE_VIEW_VIEW.equals(view)){ + rightMenus.add(new RightMenu(language,RightMenuType.BTN_LIST_DISPLAY,"",false)); + }else{ + RightMenu rMenu = new RightMenu(language,RightMenuType.BTN_MINIATURE_DISPLAY,"",false); + rMenu.setParams(RightMenu.TABLE_VIEW_PARAM + "=" + RightMenu.TABLE_VIEW_VIEW); + rightMenus.add(rMenu); + } + } + rightMenus.add(new RightMenu(language,RightMenuType.BTN_COLUMN,"",false)); + // rightMenus.add(new RightMenu(language,RightMenuType.BTN_STORE,"",false)); + // rightMenus.add(new RightMenu(language,RightMenuType.BTN_HELP,"",false)); + + apidatas.put("rightMenus", rightMenus); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * TAB页 + * @author wangqs + * */ + @GET + @Path("/tabInfo") + @Produces(MediaType.TEXT_PLAIN) + public String getTabInfo(@Context HttpServletRequest request, @Context HttpServletResponse response) throws Exception { + Map apidatas = new HashMap(); + try{ + User user = HrmUserVarify.getUser (request , response) ; + + int _default = ConditionUtil.TAB_LIST_DEFAULT; + + List> groupinfo = new ArrayList>(); + String protalViewcondition = ""; + boolean fromProtal = false; + String menuid = Util.null2String(request.getParameter("menuidforportal")); + if (!menuid.isEmpty()){ + String paramsStr = new MenuInfoCommonBiz().getLeftMenuParams(menuid); + int viewcondition = Util.getIntValue(getUrlParams(paramsStr,"viewcondition")); + if(viewcondition == ConditionUtil.TAB_LIST_MY){ + protalViewcondition = ConditionUtil.TAB_LIST_MY+""; + fromProtal = true; + }else if(viewcondition == ConditionUtil.TAB_LIST_NO_READ){ + protalViewcondition = ConditionUtil.TAB_LIST_NO_READ+""; + fromProtal = true; + }else if(viewcondition >= ConditionUtil.TAB_LIST_ALL){ + protalViewcondition = ConditionUtil.TAB_LIST_ALL+""; + fromProtal = true; + } + } + + if((fromProtal && "0".equals(protalViewcondition))||!fromProtal){ + Map myDoc = new HashMap(); + myDoc.put("color",""); + myDoc.put("selected",ConditionUtil.TAB_ALL_VALUE == _default); + myDoc.put("groupid","myDoc"); + myDoc.put("editable",false); + myDoc.put("showcount",false); + myDoc.put("title",SystemEnv.getHtmlLabelName(1212,user.getLanguage())); + myDoc.put(ConditionUtil.TAB_REQ_NAME, ConditionUtil.TAB_LIST_MY); + groupinfo.add(myDoc); + } + + if((fromProtal && "1".equals(protalViewcondition))||!fromProtal){ + Map noReadDoc = new HashMap(); + noReadDoc.put("color",""); + noReadDoc.put("selected",ConditionUtil.TAB_TODAY_VALUE == _default); + noReadDoc.put("groupid","noReadDoc"); + noReadDoc.put("editable",false); + noReadDoc.put("showcount",false); + noReadDoc.put("title",SystemEnv.getHtmlLabelName(18441,user.getLanguage())); + noReadDoc.put(ConditionUtil.TAB_REQ_NAME, ConditionUtil.TAB_LIST_NO_READ); + groupinfo.add(noReadDoc); + } + if((fromProtal && "2".equals(protalViewcondition))||!fromProtal){ + Map allDoc = new HashMap(); + allDoc.put("color",""); + allDoc.put("selected",ConditionUtil.TAB_WEEK_VALUE == _default); + allDoc.put("groupid","allDoc"); + allDoc.put("editable",false); + allDoc.put("showcount",false); + allDoc.put("title",SystemEnv.getHtmlLabelName(30898,user.getLanguage())); + allDoc.put(ConditionUtil.TAB_REQ_NAME, ConditionUtil.TAB_LIST_ALL); + groupinfo.add(allDoc); + } + if(!fromProtal){ + ConditionUtil conditionUtil = new ConditionUtil(); + List> conditionTabs = conditionUtil.getConditionMould("", user); + int count = 1; + for(Map conditionTab : conditionTabs){ + Map tab = new HashMap(); + tab.put("color",""); + tab.put("selected",false); + tab.put("groupid",conditionTab.get("id")); + tab.put("editable",true); + tab.put("showcount",false); + tab.put("title",conditionTab.get("name")); + tab.put(ConditionUtil.TAB_REQ_NAME, ConditionUtil.TAB_LIST_ALL + count); + groupinfo.add(tab); + count++; + } + } + String sql = "insert into doc_user_introstep(userid,stepstatus) values(?,?)"; + RecordSet rs = new RecordSet(); + rs.executeUpdate(sql,user.getUID(),1); + apidatas.put("groupinfo",groupinfo); + apidatas.put("fromPortal",fromProtal?"1":"0"); + apidatas.put("protalViewcondition",protalViewcondition); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("api_errormsg", "catch exception : " + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + /** + * 获取默认目录配置 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/defaultTreeNode") + @Produces(MediaType.TEXT_PLAIN) + public String defaultTreeNode(@Context HttpServletRequest request, @Context HttpServletResponse response) { + Map apidatas = new HashMap(); + User user = HrmUserVarify.getUser (request , response) ; + try { + BaseBean bb = new BaseBean(); + //默认目录树配置 0 :全部目录 1:收藏目录 + String default_treenode = Util.null2String(bb.getPropValue("doc_full_search","default_treenode")) ; + default_treenode = "0".equals(default_treenode) ? default_treenode : "1"; + apidatas.put("default_treenode",default_treenode); + + boolean showLeftTree = DocApplySettingUtil.getDocTreeOpen(); + apidatas.put("showLeftTree",showLeftTree); + String protalViewcondition = ""; + boolean fromProtal = false; + String menuid = Util.null2String(request.getParameter("menuidforportal")); + if (!menuid.isEmpty()){ + String paramsStr = new MenuInfoCommonBiz().getLeftMenuParams(menuid); + int viewcondition = Util.getIntValue(getUrlParams(paramsStr,"viewcondition")); + if(viewcondition == ConditionUtil.TAB_LIST_MY){ + protalViewcondition = ConditionUtil.TAB_LIST_MY+""; + fromProtal = true; + }else if(viewcondition == ConditionUtil.TAB_LIST_NO_READ){ + protalViewcondition = ConditionUtil.TAB_LIST_NO_READ+""; + fromProtal = true; + }else if(viewcondition >= ConditionUtil.TAB_LIST_ALL){ + protalViewcondition = ConditionUtil.TAB_LIST_ALL+""; + fromProtal = true; + } + } + apidatas.put("linkUrl",CategoryService.LINK_URL); + apidatas.put("linkRout",CategoryService.LINK_ROUT); + apidatas.put("domKey",CategoryService.DOM_KEY); + apidatas.put("params",CategoryService.PARAMS + DocSptm.DOC_ROOT_FLAG_VALUE); + apidatas.put(CategoryService.OPEN_NEW_WINDOW,"1"); + apidatas.put("openNewWind","1"); + apidatas.put("api_status",true); + apidatas.put("fromPortal",fromProtal?"1":"0"); + apidatas.put("protalViewcondition",protalViewcondition); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("msg", SystemEnv.getHtmlLabelName(500551,user.getLanguage()));// "获取目录树默认配置失败" + //记录异常日志 + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("SearchListAction--->defaultTreeNode:" + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + }/** + * 获取新建文档的链接 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/createUrl") + @Produces(MediaType.TEXT_PLAIN) + public String createUrl(@Context HttpServletRequest request, @Context HttpServletResponse response) { + Map apidatas = new HashMap(); + User user = HrmUserVarify.getUser (request , response) ; + try { + CategoryService categoryService = new CategoryService(); + apidatas.put("linkUrl",categoryService.LINK_URL); + apidatas.put("linkRout",categoryService.LINK_ROUT); + apidatas.put("domKey",categoryService.DOM_KEY); + apidatas.put("params",categoryService.PARAMS + DocSptm.DOC_ROOT_FLAG_VALUE); + apidatas.put(categoryService.OPEN_NEW_WINDOW,"1"); + apidatas.put("openNewWind","1"); + apidatas.put("api_status",true); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + apidatas.put("msg",SystemEnv.getHtmlLabelName(500554,user.getLanguage()));// "获取链接失败" + //记录异常日志 + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("SearchListAction--->createUrl:" + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + /** + * 文档查询页面新建权限的目录浏览按钮 + * + * @param request + * @param response + * @return + */ + @GET + @Path("/createDocCategoryBrowser") + @Produces(MediaType.TEXT_PLAIN) + public String createDocCategoryBrowser(@Context HttpServletRequest request, @Context HttpServletResponse response) { + Map apidatas = new HashMap(); + try { + User user = HrmUserVarify.getUser(request, response); + Map params = ParamUtil.request2Map(request); + apidatas.put("createDocCategoryBrowser", CategoryUtil.getCategoryBrowser(params,user, DocCategoryService.IS_CREATE));//新建文档全部目录 + apidatas.put("api_status",true); + + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + //记录异常日志 + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("SearchListAction--->createDocCategoryBrowser:" + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + + @GET + @Path("/getIntrostep") + @Produces(MediaType.TEXT_PLAIN) + public String getIntrostep(@Context HttpServletRequest request, @Context HttpServletResponse response) { + Map apidatas = new HashMap(); + try { + User user = HrmUserVarify.getUser(request, response); + Map params = ParamUtil.request2Map(request); + String sql = "select stepstatus from doc_user_introstep where userid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(sql,user.getUID()); + Boolean needIntro = true; + if (rs.next()){ + String status = rs.getString("stepstatus"); + if("1".equals(status)){ + needIntro = false; + } + } + apidatas.put("api_status",true); + apidatas.put("needIntro",needIntro); + } catch (Exception e) { + e.printStackTrace(); + apidatas.put("api_status", false); + //记录异常日志 + BaseBean baseBean = new BaseBean(); + baseBean.writeLog("SearchListAction--->getIntrostep:" + e.getMessage()); + } + return JSONObject.toJSONString(apidatas); + } + public Map getRequestMap(HttpServletRequest request){ + + Map dataMap = new HashMap(); + + Enumeration paramNames = request.getParameterNames(); + while (paramNames.hasMoreElements()) { + String paramName = (String) paramNames.nextElement(); + String paramValue = Util.null2String(request.getParameter(paramName)); + dataMap.put(paramName,paramValue); + } + return dataMap; + } + public String getUrlParams(String url,String paramname){ + String result = ""; + Map mapRequest = new HashMap(); + String[] arrSplit=null; + String strUrlParam=url; + if(strUrlParam==null){ + return ""; + } + arrSplit=strUrlParam.split("[&]"); + for(String strSplit:arrSplit){ + String[] arrSplitEqual=null; + arrSplitEqual= strSplit.split("[=]"); + //解析出键值 + if(arrSplitEqual.length>1){ + //正确解析 + mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]); + }else{ + if(arrSplitEqual[0]!=""){ + //只有参数没有值,不加入 + mapRequest.put(arrSplitEqual[0], ""); + } + } + } + if(mapRequest.containsKey(paramname)){ + result = mapRequest.get(paramname); + } + return result; + } +} diff --git a/com/customization/quanshimeting/NewMeetingServiceProxy.java b/com/customization/quanshimeting/NewMeetingServiceProxy.java new file mode 100644 index 0000000..4564b8a --- /dev/null +++ b/com/customization/quanshimeting/NewMeetingServiceProxy.java @@ -0,0 +1,544 @@ +package com.customization.quanshimeting; + + +import aiyh.utils.Util; +import aiyh.utils.zwl.common.ToolUtil; +import com.engine.core.cfg.annotation.ServiceDynamicProxy; +import com.engine.core.cfg.annotation.ServiceMethodDynamicProxy; +import com.engine.core.impl.aop.AbstractServiceProxy; +import com.engine.meeting.service.MeetingBaseService; +import com.engine.meeting.service.impl.MeetingBaseServiceImpl; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import weaver.aiyh_quanshi.RequestApi; +import weaver.aiyh_quanshi.entity.QsConfParty; +import weaver.aiyh_quanshi.entity.QsResponse; +import weaver.conn.RecordSet; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/17 0017 16:18 + * 代理类 + */ + +@ServiceDynamicProxy(target = MeetingBaseServiceImpl.class, desc = "对全时会议进行同步") +public class NewMeetingServiceProxy extends AbstractServiceProxy implements MeetingBaseService { + private final ToolUtil toolUtil = new ToolUtil(); + private final RequestApi requestApi = new RequestApi(); + private final SimpleDateFormat simpleFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm"); + + + @Override + @ServiceMethodDynamicProxy(desc = "创建会议,向全时会议中添加预约会议") + public Map newMeeting(Map map) { + + toolUtil.writeErrorLog(map.toString()); + try { + int quanShiType = Integer.parseInt(Util.null2String("".equals(toolUtil.getSystemParamValue("QUAN_SHI_TYPE")) ? null : toolUtil.getSystemParamValue("QUAN_SHI_TYPE"), "-1")); + int meetingType = Integer.parseInt(Util.null2String("".equals(String.valueOf(map.get("meetingtype"))) ? null : String.valueOf(map.get("meetingtype")), "0")); + if (quanShiType != meetingType) { + return (Map) executeMethod(map); + } + } catch (Exception e) { + toolUtil.writeErrorLog("转换失败,失败原因:" + e); + return (Map) executeMethod(map); + } + Map result = (Map) executeMethod(map); + // 获取会议标题 + String title = String.valueOf(map.get("name")); +// 会议内容 + String desc_n = String.valueOf(map.get("desc_n")); +// 获取会议创建人 + String creator = String.valueOf(map.get("contacter")); + RecordSet rs = new RecordSet(); +// 获取会议创建人邮件 + String query = "select * from hrmresource where id = ?"; + rs.executeQuery(query, creator); + rs.next(); + String creatorEmail = rs.getString("email"); + // 获取会议开始日期 + String startDate = String.valueOf(map.get("begindate")); +// 获取会议开始时间 + String startTime = String.valueOf(map.get("begintime")); + Date start; + try { + start = simpleFormat.parse(startDate + " " + startTime); + } catch (ParseException e) { +/* e.printStackTrace(); + Map resultErr = new HashMap<>(); +// 请求失败 + resultErr.put("status", false); + resultErr.put("retstatus", true); + resultErr.put("error", "日期转换失败!"); + resultErr.put("msg", "日期转换失败!"); + resultErr.put("api_errormsg", "日期转换失败!"); + return resultErr;*/ + return result; + } + +// 获取会议结束日期 + String endDate = String.valueOf(map.get("enddate")); +// 获取会议结束时间 + String endTime = String.valueOf(map.get("endtime")); + Date end; + try { + end = simpleFormat.parse(endDate + " " + endTime); + } catch (ParseException e) { +/* e.printStackTrace(); + Map resultErr = new HashMap<>(); +// 请求失败 + resultErr.put("status", false); + resultErr.put("retstatus", true); + resultErr.put("error", "日期转换失败!"); + resultErr.put("msg", "日期转换失败!"); + resultErr.put("api_errormsg", "日期转换失败!"); + return resultErr;*/ + return result; + } +// 计算会议时长 + int length = new Long((end.getTime() - start.getTime()) / (1000 * 60)).intValue(); +// 获取会议参与人 + String hrmStr = String.valueOf(map.get("hrmmembers")); +// 处理会议参与人 + List list = new ArrayList<>(); + List emailList = new ArrayList<>(); + query = "select * from hrmresource where id in ( " + hrmStr + ")"; + rs.executeQuery(query); + while (rs.next()) { + QsConfParty qsConfParty = new QsConfParty(); + qsConfParty.setEmail(rs.getString("email")); + emailList.add(rs.getString("email")); + list.add(qsConfParty); + if (emailList.size() == 199) { + QsResponse userIdsByEmails = requestApi.getInfoByEmail(emailList); + Map resultMap = new HashMap<>(); + + ObjectMapper mapper = new ObjectMapper(); + try { + resultMap = mapper.readValue(userIdsByEmails.getResult(), Map.class); + } catch (JsonProcessingException e) { + toolUtil.writeErrorLog(userIdsByEmails.toString()); + toolUtil.writeErrorLog("请求结果转换失败,失败信息:" + e); + } + for (QsConfParty confParty : list) { + confParty.setUserId(Long.valueOf(String.valueOf(((Map) resultMap.get(confParty.getEmail())).get("userId")))); + } + emailList.clear(); + } + } + QsResponse userIdsByEmails = requestApi.getInfoByEmail(emailList); + Map resultsMap = new HashMap<>(); + + ObjectMapper mapper = new ObjectMapper(); + try { + resultsMap = mapper.readValue(userIdsByEmails.getResult(), Map.class); + } catch (JsonProcessingException e) { + toolUtil.writeErrorLog(userIdsByEmails.toString()); + toolUtil.writeErrorLog("请求结果转换失败,失败信息:" + e); + } + for (QsConfParty confParty : list) { + confParty.setUserId(Long.valueOf(String.valueOf(((Map) resultsMap.get(confParty.getEmail())).get("userId")))); + } +/* toolUtil.writeErrorLog(list.toString()); + toolUtil.writeErrorLog(creatorEmail); + toolUtil.writeErrorLog(title); + toolUtil.writeErrorLog(String.valueOf(length)); + toolUtil.writeErrorLog(startDate + " " + startTime + ":00 ");*/ + QsResponse meeting = requestApi.createMeting(creatorEmail, title, length, startDate + " " + startTime + ":00", list); + if (meeting != null) { + if (!"0".equals(meeting.getStatus())) { + String update = "update meeting set quanshimeeting = ? where id = ?"; + rs.executeUpdate(update, "全时会议添加失败!", String.valueOf(map.get("meetingid"))); + toolUtil.writeErrorLog(meeting.toString()); +/* Map result = new HashMap<>(); +// 请求失败 + result.put("status", false); + result.put("retstatus", false); + result.put("error", "全时会议添加失败"); + result.put("msg", "全时会议添加失败!"); + result.put("api_errormsg", "全时会议添加失败!"); + return result;*/ + return result; + } else { +// 请求成功 + Map resultMap = new HashMap<>(); + + try { + resultMap = mapper.readValue(meeting.getResult(), Map.class); + } catch (JsonProcessingException e) { + toolUtil.writeErrorLog("请求结果转换失败,失败信息:" + e); + } + if (Boolean.parseBoolean(String.valueOf(result.get("status")))) { +// 添加成功 + String update = "update meeting set quan_shi_id = ?, quanshimeeting = ? where id = ?"; + String quanShjInfo = "会议密码:" + String.valueOf(resultMap.get("pcode2")) + "

会议连接:" + String.valueOf(resultMap.get("attendeeJoinUrl")); + rs.executeUpdate(update, String.valueOf(resultMap.get("conferenceId")), quanShjInfo, String.valueOf(map.get("meetingid"))); + return result; + } else { + QsResponse qsResponse = requestApi.cancelConference(String.valueOf(resultMap.get("conferenceId")), creatorEmail); + toolUtil.writeErrorLog(qsResponse.toString()); +/* Map resultErr = new HashMap<>(); +// 请求失败 + resultErr.put("status", false); + resultErr.put("retstatus", false); + resultErr.put("error", "OA会议添加失败!"); + resultErr.put("msg", "OA会议添加失败!"); + resultErr.put("api_errormsg", "OA会议添加失败!"); + return resultErr;*/ + return result; + } + } + } else { +/* Map resultErr = new HashMap<>(); +// 请求失败 + resultErr.put("status", false); + resultErr.put("retstatus", false); + resultErr.put("error", "全时会议添加失败"); + resultErr.put("msg", "全时会议添加失败!"); + resultErr.put("api_errormsg", "全时会议添加失败!"); + return resultErr;*/ + return result; + } + } +/* + Map result = (Map) executeMethod(map); + if (Boolean.parseBoolean(String.valueOf(result.get("status")))) { +// 会议添加成功,需要王全时会议中添加会议 + String meetingId = String.valueOf(result.get("meetingid")); +// 通过会议id获取到会议相关的信息 + String query = "select * from meeting where id = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, meetingId); + MeetingInfoDTO meetingInfoDTO = Util.recordeSet2Entity(rs, MeetingInfoDTO.class, true); +// 判断是否需要对会议进行全时会议添加 + int quanShiType = Integer.parseInt(Util.null2String(toolUtil.getSystemParamValue("QUAN_SHI_TYPE"), "-1")); + if (meetingInfoDTO.getMeetingtype() != quanShiType) { + return result; + } +// 通过信息查询全时会议所需要的数据 +// 获取创建人邮箱 + query = "select email from hrmresource where id = ?"; + rs.executeQuery(query, meetingInfoDTO.getCreater()); + rs.next(); + String creatorEmail = rs.getString("email"); +// 获取参与人邮箱 + List list = new ArrayList<>(); + query = "select email from hrmresource where id in ( " + meetingInfoDTO.getHrmmembers() + ")"; + rs.executeQuery(query); + while (rs.next()) { + QsConfParty qsConfParty = new QsConfParty(); + qsConfParty.setEmail(rs.getString("email")); + list.add(qsConfParty); + } +// 获取开始i时间和结束时间以及计算会议时长 + int length = 0; + String startDate = ""; + String startTime = ""; + try { +// 获取会议开始日期 + startDate = String.valueOf(meetingInfoDTO.getBegindate()); +// 获取会议开始时间 + startTime = String.valueOf(meetingInfoDTO.getBegintime()); + Date start = simpleFormat.parse(startDate + " " + startTime); +// 获取会议结束日期 + String endDate = String.valueOf(meetingInfoDTO.getEnddate()); +// 获取会议结束时间 + String endTime = String.valueOf(meetingInfoDTO.getEndtime()); + Date end = simpleFormat.parse(endDate + " " + endTime); +// 计算会议时长 + length = new Long((end.getTime() - start.getTime()) / (1000 * 60)).intValue(); + } catch (Exception e) { + toolUtil.writeErrorLog("日期传换失败,失败信息:" + e); + } +// 调取接口 + QsResponse meting = requestApi.createMeting(creatorEmail, meetingInfoDTO.getName(), length, startDate + " " + startTime + ":00 ", list); + if (!"0".equals(meting.getStatus())) { + toolUtil.writeErrorLog("全时会议添加失败!失败结果" + meting); +// 需要删除OA会议 +// 添加全时会议失败 + result.put("status", false); + result.put("retstatus", false); + result.put("error", "全时会议添加失败"); + result.put("msg", "全时会议添加失败!"); + result.put("api_errormsg", "abab全时会议添加失败!"); + result.remove("apiCost"); + result.remove("meetingid"); + } else { +// 添加全时会议成功 + String update = "update meeting set quan_shi_id = ? where id = ?"; + Map resultMap = new HashMap<>(); + ObjectMapper mapper = new ObjectMapper(); + try { + resultMap = mapper.readValue(meting.getResult(), Map.class); + } catch (JsonProcessingException e) { + toolUtil.writeErrorLog("请求结果转换失败,失败信息:" + e); + } + rs.executeUpdate(update, String.valueOf(resultMap.get("conferenceId")), String.valueOf(map.get("meetingid"))); + } + } +// throw new RuntimeException("全时会议添加失败!"); + return result;*/ + + @Override + @ServiceMethodDynamicProxy(desc = "删除会议时, 需要判断是否需要对全时会议的会议进行取消预约") + public Map deleteMeeting(Map map) { + Map result = (Map) executeMethod(map); +// 获取请求参数中的会议id + String meetingIds = String.valueOf(map.get("meetingids")); +// 查询要删除的会议中是否存再全时会议预约的,如果有需要对全时会议进行取消 + String query = "select * from meeting where id in (" + meetingIds + ") and cancel != 1 and quan_shi_id is not null and quan_shi_cancel is null"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query); + RecordSet rs_1 = new RecordSet(); + while (rs.next()) { +// 取消会议 + String quanShiId = rs.getString("quan_shi_id"); + String hrmId = rs.getString("contacter"); + query = "select * from hrmresource where id = ?"; + rs_1.executeQuery(query, hrmId); + rs_1.next(); + String creatorEmail = rs_1.getString("email"); + QsResponse qsResponse = requestApi.cancelConference(quanShiId, creatorEmail); + if (!"0".equals(qsResponse.getStatus())) { +// 取消失败 + toolUtil.writeErrorLog("全时会议取消失败!失败结果" + qsResponse); + /*Map resultErr = new HashMap<>(); + resultErr.put("status", false); + resultErr.put("retstatus", false); + resultErr.put("ret", false); + resultErr.put("error", "全时会议取消失败!"); + resultErr.put("msg", "全时会议取消失败!"); + resultErr.put("api_errormsg", "全时会议取消失败!"); + return resultErr;*/ + return result; + } else { + String update = "update meeting set quan_shi_cancel = ? where id = ?"; + rs_1.executeUpdate(update, "1", rs.getString("id")); + } + } +// 取消成功,需要删除OA中会议 +// Map result = (Map) executeMethod(map); + return result; + } + + @Override + public Map editMeeting(Map map) { + return null; + } + + @Override + public Map overMeeting(Map map) { + return null; + } + + @Override + @ServiceMethodDynamicProxy(desc = "取消会议时,需要对全时会议的会议也进行同步取消") + public Map cancelMeeting(Map map) { + String meetingId = String.valueOf(map.get("meetingid")); + // 通过会议id获取到会议相关的信息 + String query = "select * from meeting where id = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query, meetingId); + rs.next(); + String quanShiId = rs.getString("quan_shi_id"); + Map result = (Map) executeMethod(map); + int quanShiType = Integer.parseInt(Util.null2String(toolUtil.getSystemParamValue("QUAN_SHI_TYPE"), "-1")); + if (rs.getInt("meetingtype") != quanShiType) { + return result; + } + RecordSet rs_1 = new RecordSet(); +// 取消会议 + String hrmId = rs.getString("contacter"); + query = "select * from hrmresource where id = ?"; + rs_1.executeQuery(query, hrmId); + rs_1.next(); + String creatorEmail = rs_1.getString("email"); + QsResponse qsResponse = requestApi.cancelConference(quanShiId, creatorEmail); + if (!"0".equals(qsResponse.getStatus())) { +// 取消失败 + toolUtil.writeErrorLog("全时会议取消失败!失败结果" + qsResponse); + /*Map resultErr = new HashMap<>(); + resultErr.put("status", false); + resultErr.put("retstatus", false); + resultErr.put("ret", false); + resultErr.put("error", "全时会议取消失败!"); + resultErr.put("msg", "全时会议取消失败!"); + resultErr.put("api_errormsg", "全时会议取消失败!"); + return resultErr;*/ + return result; + } else { + String update = "update meeting set quan_shi_cancel = ? where id = ?"; + rs_1.executeUpdate(update, "1", rs.getString("id")); + } + return result; + } + + @Override + public Map chkMember(Map map) { + return null; + } + + @Override + public Map chkRoom(Map map) { + return null; + } + + @Override + public Map chkservice(Map map) { + return null; + } + + @Override + public Map chkRoomAttribute(Map map) { + return null; + } + + @Override + public Map chkWPMember(Map map) { + return null; + } + + @Override + public Map updateCkIsck(Map map) { + return null; + } + + @Override + public Map chkMeeting(Map map) { + return null; + } + + @Override + public Map customMeetingChk(Map map) { + return null; + } + + @Override + public Map changeMeeting(Map map) { + return null; + } + + @Override + public Map submitMeeting(Map map) { + return null; + } + + @Override + public Map afterMeetingNormal(Map map) { + return null; + } + + @Override + public Map afterMeetingChange(Map map) { + return null; + } + + @Override + public Map getUnReadCount(Map map) { + return null; + } + + @Override + public Map doSubmit(Map map) { + return null; + } + + @Override + public Map selRejectNode(Map map) { + return null; + } + + @Override + public Map doReject(Map map) { + return null; + } + + @Override + public Map getUserDefInfo(Map map) { + return null; + } + + @Override + public Map getNowMeeting(Map map) { + return null; + } + + @Override + public Map getMoreMeeting(Map map) { + return null; + } + + @Override + public Map getMeetingCornerMark(Map map) { + return null; + } + + @Override + public Map getRequestParams(Map map) { + return null; + } + + @Override + public Map exportExcel(Map map) { + return null; + } + + @Override + public Map chkRight(Map map) { + return null; + } + + @Override + public Map customChangeHrm(Map map) { + return null; + } + + @Override + public Map getMeetingTabElement(Map map) { + return null; + } + + @Override + public Map chkRepeatMeeting(Map map) { + return null; + } + + @Override + public Map afterMeetingDelete(Map map) { + return null; + } + + @Override + public Map meetingToGovern(Map map) { + return null; + } + + @Override + public Map meetingDecisionToGovern(Map map) { + return null; + } + + @Override + public Map getMeetingInfluenceInfo(String s) { + return null; + } + + @Override + public Map getMeetingSysWorkRecordList(Map map) { + return null; + } + + @Override + public Map getDefalutByLevel(Map map) { + return null; + } + + @Override + public Map getMeetingBaseInfo(Map map) { + return null; + } +} diff --git a/com/customization/quanshimeting/entity/MeetingInfoDTO.java b/com/customization/quanshimeting/entity/MeetingInfoDTO.java new file mode 100644 index 0000000..193cab5 --- /dev/null +++ b/com/customization/quanshimeting/entity/MeetingInfoDTO.java @@ -0,0 +1,113 @@ + +package com.customization.quanshimeting.entity; + + +public class MeetingInfoDTO { + + private int id; + private String name; + private int meetingtype; + private String begindate; + private String begintime; + private String endtime; + private String enddate; + private String descN; + private int creater; + private String hrmmembers; + + public void setId(int id){ + this.id = id; + } + + public void setName(String name){ + this.name = name; + } + + public void setMeetingtype(int meetingtype){ + this.meetingtype = meetingtype; + } + + public void setBegindate(String begindate){ + this.begindate = begindate; + } + + public void setBegintime(String begintime){ + this.begintime = begintime; + } + + public void setEndtime(String endtime){ + this.endtime = endtime; + } + + public void setEnddate(String enddate){ + this.enddate = enddate; + } + + public void setDescN(String descN){ + this.descN = descN; + } + + public void setCreater(int creater){ + this.creater = creater; + } + + public void setHrmmembers(String hrmmembers){ + this.hrmmembers = hrmmembers; + } + + public int getId(){ + return this.id; + } + + public String getName(){ + return this.name; + } + + public int getMeetingtype(){ + return this.meetingtype; + } + + public String getBegindate(){ + return this.begindate; + } + + public String getBegintime(){ + return this.begintime; + } + + public String getEndtime(){ + return this.endtime; + } + + public String getEnddate(){ + return this.enddate; + } + + public String getDescN(){ + return this.descN; + } + + public int getCreater(){ + return this.creater; + } + + public String getHrmmembers(){ + return this.hrmmembers; + } + + @Override + public String toString() { + return "MeetingInfoDTO{" + + "id='" + id + '\'' + + ", name='" + name + '\'' + + ", meetingtype='" + meetingtype + '\'' + + ", begindate='" + begindate + '\'' + + ", begintime='" + begintime + '\'' + + ", endtime='" + endtime + '\'' + + ", enddate='" + enddate + '\'' + + ", descN='" + descN + '\'' + + ", creater='" + creater + '\'' + + ", hrmmembers='" + hrmmembers + '\'' + + '}'; + } +} \ No newline at end of file diff --git a/customization/.DS_Store b/customization/.DS_Store new file mode 100644 index 0000000..99dba9e Binary files /dev/null and b/customization/.DS_Store differ diff --git a/customization/action/demo/MM050_SC_1230_FI_DocCreate_eg.java b/customization/action/demo/MM050_SC_1230_FI_DocCreate_eg.java new file mode 100644 index 0000000..87ab047 --- /dev/null +++ b/customization/action/demo/MM050_SC_1230_FI_DocCreate_eg.java @@ -0,0 +1,54 @@ +package customization.action.demo; + + +import customization.commons.Console; +import customization.commons.CustomAction; +import weaver.general.Util; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; +import weaver.workflow.request.RequestManager; + +/** + * 命名规则: + * 当一只流程只有一个和SAP场景交互时,接口命规则为: + * 流程编号+SAP接口场景编号 例如:MM050_SC_1230_FI_DocCreate_eg + * ******************************************** + * 当一只流程在不同节有多个SAP交互场景交互式,接口命名规则为: + * 流程编号_流程调用节点_nodeid 前(before)/后(after)/出口(export)/(归档前)end + * + * + */ +public class MM050_SC_1230_FI_DocCreate_eg extends CustomAction implements Action { + + @Override + public String execute(RequestInfo request) { + + //封装流程表单的值 + super.getWorkflowDataValue(request); + writeLog("execute action MM050_SC_1230_FI_DocCreate_eg");//打印日志 + RequestManager rm = request.getRequestManager(); + String requestid = request.getRequestid(); + try { + String srcString = Util.null2String(rm.getSrc()); + writeLog("srcString:"+srcString); + //当提交时执行 + if (srcString.equals("submit")) { + + //在这里编写业务逻辑代码,调用往SAP系统写入值,如果需要阻止流程继续流转,参考下方catch里面信息处理。 + + Console.log( "mainFieldValuesMap"+mainMap); + Console.log( "detailFieldValuesMap"+detailMap); + + System.out.println("selectvalue:"+super.getSeletItemValue("cgsqlxjms",rm.getFormid(), Util.null2String(mainMap.get("cgsqlxjms")))); + + + } + + }catch (Exception e){ + //异常报错是填写异常信息,阻止流程继续流转 + request.getRequestManager().setMessageid("90001"); + request.getRequestManager().setMessagecontent("-"+rm.getRequestid()+" 系统异常终止流程提交!"); + } + return Action.SUCCESS; + } +} diff --git a/customization/action/demo/MM050_node688_after.java b/customization/action/demo/MM050_node688_after.java new file mode 100644 index 0000000..8efb8b1 --- /dev/null +++ b/customization/action/demo/MM050_node688_after.java @@ -0,0 +1,76 @@ +package customization.action.demo; + + +import customization.commons.Console; +import customization.commons.CustomAction; +import customization.commons.CustomUtil; +import weaver.general.Util; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; +import weaver.workflow.request.RequestManager; + +/** + * 命名规则: + * 当一只流程只有一个和SAP场景交互时,接口命规则为: + * 流程编号+SAP接口场景编号 例如:MM050_SC_1230_FI_DocCreate_eg + * + * 当一只流程在不同节有多个SAP交互场景交互式,接口命名规则为: + * 流程编号_流程调用节点_nodeid 前(before)/后(after)/出口(export)/(归档前)end + + * type来源于流程接口里面配置的参数 + */ +public class MM050_node688_after extends CustomAction implements Action { + + private String type; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public String execute(RequestInfo requestInfo) { + RequestManager rm = requestInfo.getRequestManager(); + int requestid=rm.getRequestid(); + try { + + String srcString = Util.null2String(rm.getSrc());//submit 提交 reject 退回 + if (srcString.equals("submit")) { + //获取流程的数据 + super.getWorkflowDataValue(requestInfo); + System.out.println("主表数据:"+mainMap); + System.out.println("明细表数据:"+detailMap); + + Console.log("type:" + this.getType()); + //todo 在这里写相关业务逻辑 + + + if(!true){ + String errorinfo="我是测试信息"; + requestInfo.getRequestManager().setMessageid(""+requestid); + requestInfo.getRequestManager().setMessage("Action集成报错"); + requestInfo.getRequestManager().setMessagecontent("请求ID:" + rm.getRequestid() + ";
操作时间:"+ CustomUtil.getStringDate("yyyy-MM-dd HH:mm:ss") +";
和异构系统交互时返回错误!" + + "参考信息具体如下:
" +errorinfo); + super.sendActionErrorInfo(requestid); + return Action.FAILURE_AND_CONTINUE; + } + } + + }catch (Exception e){ + e.printStackTrace(); + //在这里编写业务逻辑代码,调用往SAP系统写入值,如果需要阻止流程继续流转,参考下方catch里面信息处理。 + requestInfo.getRequestManager().setMessageid(""+requestid); + requestInfo.getRequestManager().setMessage("Action集成报错"); + requestInfo.getRequestManager().setMessagecontent("请求ID:" + rm.getRequestid() + ";
操作时间:"+ CustomUtil.getStringDate("yyyy-MM-dd HH:mm:ss") +";
和异构系统交互时返回错误!" + + "参考信息具体如下:
" +e.toString()); + super.sendActionErrorInfo(requestid); + return Action.FAILURE_AND_CONTINUE; + } + + return Action.SUCCESS; + } + +} diff --git a/customization/action/demo/MM050_node688_before.java b/customization/action/demo/MM050_node688_before.java new file mode 100644 index 0000000..69566c4 --- /dev/null +++ b/customization/action/demo/MM050_node688_before.java @@ -0,0 +1,39 @@ +package customization.action.demo; + +import customization.commons.Console; +import customization.commons.CustomAction; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; + +/** + * 命名规则: + * 当一只流程只有一个和SAP场景交互时,接口命规则为: + * 流程编号+SAP接口场景编号 例如:MM050_SC_1230_FI_DocCreate_eg + * + * 当一只流程在不同节有多个SAP交互场景交互式,接口命名规则为: + * 流程编号_流程调用节点_nodeid 前(before)/后(after)/出口(export)/(归档前)end + + * + */ +public class MM050_node688_before extends CustomAction implements Action { + private String type; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + + @Override + public String execute(RequestInfo requestInfo) { + Console.log("type:" + this.getType()); + requestInfo.getRequestManager().setMessageid("90002"); + requestInfo.getRequestManager().setMessagecontent("MM050_node688_before"); + + return Action.FAILURE_AND_CONTINUE; + } + +} diff --git a/customization/action/demo/MM050_node688_export.java b/customization/action/demo/MM050_node688_export.java new file mode 100644 index 0000000..48debf0 --- /dev/null +++ b/customization/action/demo/MM050_node688_export.java @@ -0,0 +1,37 @@ +package customization.action.demo; + +import customization.commons.Console; +import customization.commons.CustomAction; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; + +/** + * 命名规则: + * 当一只流程只有一个和SAP场景交互时,接口命规则为: + * 流程编号+SAP接口场景编号 例如:MM050_SC_1230_FI_DocCreate_eg + * + * 当一只流程在不同节有多个SAP交互场景交互式,接口命名规则为: + * 流程编号_流程调用节点_nodeid 前(before)/后(after)/出口(export)/(归档前)end + * + */ +public class MM050_node688_export extends CustomAction implements Action { + + + private String type; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + @Override + public String execute(RequestInfo requestInfo) { + Console.log("type:"+this.getType()); + requestInfo.getRequestManager().setMessageid("90002"); + requestInfo.getRequestManager().setMessagecontent("MM050_node688_before"); + return Action.FAILURE_AND_CONTINUE; + } +} diff --git a/customization/commons/.DS_Store b/customization/commons/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/customization/commons/.DS_Store differ diff --git a/customization/commons/Console.java b/customization/commons/Console.java new file mode 100644 index 0000000..da1e0c2 --- /dev/null +++ b/customization/commons/Console.java @@ -0,0 +1,174 @@ +package customization.commons; + +import weaver.conn.RecordSet; +import weaver.general.GCONST; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @author liutaihong + * @version 1.0.0 + * @ClassName Console.java + * @Description 自己写的日志打印,UTF-8格式 + * @createTime 2020-04-29 14:31:00 + */ +public class Console { + + public static void log(String logStr) { + StackTraceElement[] stacks = new Throwable().getStackTrace(); + //int stacksLen = stacks.length; + String className = stacks[1].getClassName(); + String method = stacks[1].getMethodName(); + int number = stacks[1].getLineNumber(); + String actionFileName = stacks[1].getFileName(); + write(logStr,"log",className,method,number,actionFileName); + } + + public static void info(String logStr) { + StackTraceElement[] stacks = new Throwable().getStackTrace(); + //int stacksLen = stacks.length; + String className = stacks[1].getClassName(); + String method = stacks[1].getMethodName(); + int number = stacks[1].getLineNumber(); + String actionFileName = stacks[1].getFileName(); + write(logStr,"info",className,method,number,actionFileName); + } + + /** + * 根据action按照日期分类打印日志 + *

+ * 在配置文件中可以增加NoPrintLog.properties 的className键的值(多个用,隔开)来控制对应class的日志是否完整输出 + * eg: className=com.custompage.NodeBefore + * 那么 com.custompage.NodeBefore 里面的具体日志不会完整的被打印出来。 + *

+ * 适用场景: + * 场景1:很多大量的日志在调试完成后还会被打印出来会占用很大的磁盘空间,不得不一个个去掉调试日志。搞不好就能轻松一天打印80G的ecology日志。 + * 场景2:假设去掉日志以后,出现了新的问题,再调试之前又得一个个增加打印行。调试完成后回到场景1,往返循环。 + * 场景3:原来的log日志全部打印在/log/ecology*.log文件里面,假设你的日志达到很大的时候,比如200m的时候,找日志如同大海捞针。 + * 场景4:200M的日志文件你下载下来所消耗的时间和代价是巨大的,即使直接在浏览器里面访问也是痛苦不堪的。 + *

+ * 关于历史action迁移: + * 1.假定之前 extends BaseBean类来writeLog日志,只需要改为 extends ActionUtil这个类即可。 + * 调用还是使用writeLog()方法即可; + * 2.在调整的时候可以考虑使用该方法打印日志,花一点点时间你将解决前面应用场景里面的问题。 + *

+ * 关于日志路径: + * <<<<<<< HEAD + * 所有日志将被存放在/log/devlog/文件夹下面 按天按java类生成对应的日志。 + * eg: + * /log/devlog/NodeBefore.java_2017-06-18.log + * /log/devlog/NodeAfter.java_2017-06-18.log + * SendHrmResourceInfo.java_2017-06-28.log + * ======= + * 所有日志将被存放在/log/devlog/文件夹下面 按天按java类生成对应的日志。 + * eg: + * /log/devlog/NodeBefore.java_2017-06-18.log + * /log/devlog/NodeAfter.java_2017-06-18.log + * >>>>>>> 84c78e050685929fbe1387a54a96dc120300b2a7 + *

+ * 如果快速定位日志: + * eg: + * m=execute;n=14;t=10:06:23.743===>>开始日志 + * <<<<<<< HEAD + * m=execute;n=14;t=10:10:08.774===>>日志未打印,如需打开请从配置文件NoPrintLog中删除"com.customcode.action.ExportEg" + * ======= + * m=execute;n=14;t=10:10:08.774===>>日志未打印,如需打开请从配置文件NoPrintLog中删除"com.customcode.action.Export" + * >>>>>>> 84c78e050685929fbe1387a54a96dc120300b2a7 + *

+ * 如上日志提供每次调用的时候提供了以下信息: + * m=方法名(method);n=行数(number);t=执行时间(time)==>>打印日志(log) + * 例如第一行表示 执行了execute方法 在源码第14行打印,执行时间为 10:06:23.743 + * + * @param logStr log对象 + */ + private static void write(String logStr,String type,String className,String method,int number , String actionFileName ) { + + actionFileName = actionFileName.substring(0, actionFileName.indexOf(".")); + + + SimpleDateFormat CurrentDate = new SimpleDateFormat("yyyyMMdd"); + SimpleDateFormat CurrentTime = new SimpleDateFormat("HH:mm:ss.SSS"); + + SimpleDateFormat CurrentHour = new SimpleDateFormat("HH"); + Date date = new Date(); + String thisHour = CurrentHour.format(date); + String thisDate = CurrentDate.format(date); + String thisTime = CurrentTime.format(date); + + String log = type+":m=" + method + ";n=" + number + ";t=" + thisTime + "===>>"; + + String logPath = GCONST.getRootPath() + "log"+File.separatorChar +"devlog" ; + File dir = new File(logPath); + //writeLog(logPath); + if (!dir.exists()) { + dir.mkdir(); + System.out.println("创建"+logPath); + } + + logPath = GCONST.getRootPath() + "log"+File.separatorChar +"devlog" + File.separatorChar + thisDate; + dir = new File(logPath); + //writeLog(logPath); + if (!dir.exists()) { + dir.mkdir(); + System.out.println("创建"+logPath); + } + + + logPath = GCONST.getRootPath() +"log"+File.separatorChar +"devlog" + File.separatorChar + thisDate + File.separator + actionFileName; + + dir = new File(logPath); + //writeLog(logPath); + if (!dir.exists()) { + dir.mkdir(); + System.out.println("创建"+logPath); + } + + String dirStr = logPath + File.separatorChar + thisHour + ".log"; + // writeLog("dirStr:"+dirStr); + File fileName = new File(dirStr); + if (!fileName.exists()) { + try { + fileName.createNewFile(); + writeLog(fileName, "m=方法名(method);n=行数(number);t=执行时间(time)==>>打印日志(log)"); + } catch (IOException e) { + e.printStackTrace(); + } + } + RecordSet recordSet = new RecordSet(); + + + String allNoPrintLogClass = recordSet.getPropValue("NoPrintLog", "className"); + if (allNoPrintLogClass.contains(className)) { + // Log(fileName, log+ "日志未打印,如需打开请从配置文件NoPrintLog中删除\""+className+"\""); + + } else { + writeLog(fileName, log + logStr); + } + + + } + + /** + * @param fileName 写入的文件 + * @param log 写入的内容 + */ + private static void writeLog(File fileName, String log) { + try { + BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(fileName, true), StandardCharsets.UTF_8)); + + writer.write(log + "\r\n"); + if (writer != null) + writer.close(); + if (writer != null) + writer.close(); + } catch (IOException e) { + e.printStackTrace(); + + } finally { + + } + } +} diff --git a/customization/commons/CustomAction.java b/customization/commons/CustomAction.java new file mode 100644 index 0000000..fc53856 --- /dev/null +++ b/customization/commons/CustomAction.java @@ -0,0 +1,319 @@ +package customization.commons; + + + +import weaver.conn.RecordSet; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.soa.workflow.request.*; +import weaver.workflow.request.RequestManager; +import weaver.workflow.workflow.WorkflowRequestComInfo; + +import java.net.InetAddress; +import java.util.HashMap; +import java.util.LinkedHashMap; + + +/** + * Created by liutaihong on 16-06-17. + * 描述:日志及取值工具类 + */ +public class CustomAction extends BaseBean { + + + + protected HashMap mainMap;//主字段的值 + protected HashMap>> detailMap ;//所有明细表的值 + + protected WSBaseInfo wsBaseInfo ; + protected int wf_creater ; + protected int wf_formid ; + protected int wf_isbill ; + protected String formtablename ; + protected int wf_user ; + + + public CustomAction(){ + mainMap = new HashMap();//主字段的值 + detailMap = new HashMap>>();//所有明细表的值 + wsBaseInfo = new WSBaseInfo(); + wf_creater = 0; + wf_formid = 0; + wf_isbill = 0; + formtablename = ""; + wf_user = 0; + } + + + + + + /** + * 获取主表数据 + * 在流程action里面初始化后只需要通过Map就能快速的取到对应的主表的值 + *

+ * 适用场景: + * 1.通过获取表名,然后使用SQL语句查询你要的主表数据(升级之后表名还会出错)。 + * 2.通过遍历requestInfo.getMainTableInfo().getProperty()做判断匹配值。 + *

+ * 使用: + * 获取流程名称:map.get("requestName"); + * 获取流程requestid:map.get("requestId"); + * 获取流程创建人:map.get("creatorId"); + * 获取流程类型id:map.get("workflowId"); + * + * @param requestInfo 流程对象 + * @return mainMap 主表的列名和值 + */ + public synchronized void getWorkflowDataValue(RequestInfo requestInfo) { + /* + Console.log(" 执行:getWorkflowDataValue"); + long waittime=ProcessingUtil.start(); + Console.log(requestInfo.getRequestid()+"等待"+waittime+"ms"); + */ + + RequestManager rm = requestInfo.getRequestManager(); + + //System.out.println("select * from formtable_main_"+Math.abs(rm.getFormid())+" where requestid='"+rm.getRequestid()+"'"); + RequestManager RequestManager = requestInfo.getRequestManager(); + wf_formid = RequestManager.getFormid();//流程表单id + wf_creater = RequestManager.getCreater();//流程创建人 + wf_isbill = RequestManager.getIsbill();//是否为单据 + + wf_user = RequestManager.getUser().getUID();//当前操作者 + + + mainMap.put("requestname", requestInfo.getDescription());//流程标题 + mainMap.put("requestid", requestInfo.getRequestid());//流程id + mainMap.put("creatorid", requestInfo.getCreatorid());//流程创建人ID + mainMap.put("workflowid", requestInfo.getWorkflowid()); + + + try { + ResourceComInfo rci = new ResourceComInfo(); + DepartmentComInfo dci = new DepartmentComInfo(); + + + wsBaseInfo.setCreater_departmentcode(dci.getDepartmentCode(rci.getDepartmentID("" + wf_creater))); + wsBaseInfo.setCreater_departmentid(rci.getDepartmentID("" + wf_creater)); + wsBaseInfo.setCreater_departmentname(dci.getDepartmentname(rci.getDepartmentID("" + wf_creater))); + wsBaseInfo.setCreater_department_codeAndName(dci.getDepartmentCode(rci.getDepartmentID("" + wf_creater)) + "|" + dci.getDepartmentname(rci.getDepartmentID("" + wf_creater))); + + + wsBaseInfo.setCreater_lastname(rci.getLastname("" + wf_creater)); + wsBaseInfo.setCreater_workcode(rci.getWorkcode("" + wf_creater)); + wsBaseInfo.setCreater_workcodeAndName(rci.getWorkcode("" + wf_creater) + "|" + rci.getLastname("" + wf_creater)); + + + wsBaseInfo.setCurrent_departmentcode(dci.getDepartmentname(rci.getDepartmentID("" + wf_user))); + wsBaseInfo.setCurrent_departmentid(rci.getDepartmentID("" + wf_user)); + wsBaseInfo.setCurrent_departmentname(dci.getDepartmentCode(rci.getDepartmentID("" + wf_user))); + wsBaseInfo.setCurrent_department_codeAndName(dci.getDepartmentname(rci.getDepartmentID("" + wf_user)) + "|" + dci.getDepartmentCode(rci.getDepartmentID("" + wf_user))); + + wsBaseInfo.setCurrent_lastname(rci.getLastname("" + wf_user)); + wsBaseInfo.setCurrent_workcode(rci.getWorkcode("" + wf_user)); + wsBaseInfo.setCurrent_workcodeAndName(rci.getWorkcode("" + wf_user) + "|" + rci.getLastname("" + wf_user)); + + wsBaseInfo.setFormid(Math.abs(rm.getFormid())); + + + //************ 这部部分非30项目全新的项目可以去掉 + + mainMap.put("createrworkcode", rci.getWorkcode("" + wf_creater));//流程创建人工号 + mainMap.put("createrlastname", rci.getLastname("" + wf_creater));//流程创建人姓名 + mainMap.put("createrdepartmentid", rci.getDepartmentID("" + wf_creater));//流程创建人部门ID + mainMap.put("createrdepartmentname", dci.getDepartmentname(rci.getDepartmentID("" + wf_creater)));//流程创建人部门名称 + mainMap.put("createrdepartmentcode", dci.getDepartmentCode(rci.getDepartmentID("" + wf_creater)));//流程创建人部门编号 + + mainMap.put("currentworkcode", rci.getWorkcode("" + wf_user));//当前操作人工号 + mainMap.put("currentlastname", rci.getLastname("" + wf_user));//当前操作人姓名 + mainMap.put("currentdepartmentid", rci.getDepartmentID("" + wf_user));//当前操作人部门ID + mainMap.put("currentdepartmentname", dci.getDepartmentname(rci.getDepartmentID("" + wf_user)));//当前操作人部门名称 + mainMap.put("currentdepartmentcode", dci.getDepartmentCode(rci.getDepartmentID("" + wf_user)));//当前操作人部门编号 + + + } catch (Exception e) { + System.out.println("流程基础信息获取:" + e.toString()); + } + // System.out.println(".......>"+wsBaseInfo.getSys()); + + + System.out.println("requestid:" + requestInfo.getRequestid()); + Property[] properties = requestInfo.getMainTableInfo().getProperty();// 获取表单主字段信息 + for (int i = 0; i < properties.length; i++) {// 主表数据 + String name = properties[i].getName().toLowerCase(); + String value = Util.null2String(properties[i].getValue()); + //System.out.println("formtable_main_"+Math.abs(wf_formid)+"."+name+":"+ Util.null2String(value)); + mainMap.put(name, Util.null2String(value)); + //writeLog(name + ":" + value); + } + + DetailTable[] detailtable = null; + try { + detailtable = requestInfo.getDetailTableInfo().getDetailTable();// 获取明细表 + if (detailtable.length > 0) { + + for (int i = 1; i <= detailtable.length; i++) {//遍历明细表 + HashMap> rowList = new LinkedHashMap>(); + DetailTable dt = detailtable[i-1]; + Row[] s = dt.getRow(); + + for (int j = 1; j <= s.length; j++) { + HashMap rowMap = new LinkedHashMap(); + Row r = s[j-1]; + + Cell[] c = r.getCell(); + for (int k = 0; k < c.length; k++) { + Cell c1 = c[k]; + String name = c1.getName().toLowerCase(); + String value = c1.getValue(); + + //System.out.println(i+""+"-"+name+":"+value); + rowMap.put(name, Util.null2String(value)); + } + if (rowMap.size() > 0) { + rowList.put(r.getId(), rowMap); + } + + } + + detailMap.put(dt.getTableDBName(), rowList); + } + } + + } catch (Exception e) { + + } + + Console.log("-------------requestid:"+requestInfo.getRequestid()+"--------------"); + Console.log("mainMap:"+mainMap.toString()); + Console.log("detailMap:"+detailMap.toString()); + + } + + private String getSeletItemValue(String fieldname, int formid, String selectvalue, Integer index) { + String name = ""; + + try { + RecordSet recordSet = new RecordSet(); + if (selectvalue.equals("null") || selectvalue == null) { + selectvalue = ""; + } + + String detailtable = ""; + String fname = fieldname; + String billid = ""; + if (fieldname.contains(".")) { + detailtable = fieldname.split("\\.")[0]; + fname = fieldname.split("\\.")[1]; + } + + String sqls = "select * from workflow_billfield where billid= '" + formid + "' and fieldname='" + fname + "' "; + if (detailtable.equals("")) { + sqls = sqls + " and detailtable is null "; + } else { + sqls = sqls + " and detailtable ='" + detailtable + "'"; + } + + recordSet.execute(sqls); + if (recordSet.first()) { + billid = recordSet.getString("id"); + } + + sqls = "select * from WORKFLOW_SELECTITEM where SELECTvalue='" + selectvalue + "' and FIELDID='" + billid + "'"; + recordSet.execute(sqls); + if (recordSet.first()) { + name = recordSet.getString("selectName"); + } + + if (index != null && !name.isEmpty() && name.contains("|")) { + name = name.split("\\|")[index]; + } + } catch (Exception var11) { + } + + return name.trim(); + } + + public static String getSeletItemValue(String fieldname, int formid, String selectvalue) { + return new CustomAction().getSeletItemValue(fieldname, formid, selectvalue, (Integer)null); + } + + public static String getSeletItemValueBefore(String fieldname, int formid, String selectvalue) { + return new CustomAction().getSeletItemValue(fieldname, formid, selectvalue, 0); + } + + public static String getSeletItemValueAfter(String fieldname, int formid, String selectvalue) { + return new CustomAction().getSeletItemValue(fieldname, formid, selectvalue, 1); + } + + + /** + * 触发一个集成流程报错的提醒 + * @param requestid + */ + public static void sendActionErrorInfo(int requestid){ + + Boolean istrue = true; + String sendErrorWfCode = "," + Util.null2String(new BaseBean().getPropValue("customPropSet", "sendErrorWf"), "0") + ","; + String sqlstr = "select WORKFLOWID from workflow_requestbase where requestid='" + requestid + "'"; + RecordSet recordSet = new RecordSet(); + recordSet.execute(sqlstr); + if (recordSet.next()) { + if (sendErrorWfCode.contains("," + recordSet.getString("WORKFLOWID") + ",")) { + //当为设置的流程wrokflow时 + istrue = false; + } + } + if(sendErrorWfCode.equals(",0,")){ + istrue = true; + } + if (istrue) { + new Thread((new Runnable() { + @Override + public void run() { + String remarkfs = ""; //发送报文内容 + try { + + WorkflowRequestComInfo requestComInfo = new WorkflowRequestComInfo(); + String requestname = "【流程Action集成报错】:相关请求\"" + requestComInfo.getRequestName("" + requestid) + "(" + requestid + ")\""; + String remark = requestname + "
操作时间:" + CustomUtil.getStringDate("yyyy-MM-dd HH:mm:ss") + ""; + remark += "
相关请求:" + requestid + ""; + + InetAddress addr = InetAddress.getLocalHost(); + String ip = addr.getHostAddress().toString(); //获取本机ip + String hostName = addr.getHostName().toString(); //获取本机计算机名称 + remark += "
执行服务器IP:" + ip; + remark += "
服务主机名:" + hostName; + + + int resourceid = Util.getIntValue(Util.null2String(new BaseBean().getPropValue("customPropSet", "actionResourceid")), 1); + setSysRemindInfo(requestname, resourceid, remark); + // 设置主表信息 + + + } catch (Exception e) { + e.printStackTrace(); + } + } + })).start(); + } + + } + + /** + * 项目提醒工作流 + * @param requestname 工作流标题 + * @param resource 提醒人 + * @param remark 备注 + * @throws Exception + */ + public static void setSysRemindInfo(String requestname,int resource,String remark) throws Exception{ + new weaver.system.SysRemindWorkflow().setSysRemindInfo(requestname,0,0,0,0,resource,""+resource,remark); + } + + +} + diff --git a/customization/commons/CustomUtil.java b/customization/commons/CustomUtil.java new file mode 100644 index 0000000..88e3f7c --- /dev/null +++ b/customization/commons/CustomUtil.java @@ -0,0 +1,259 @@ +package customization.commons; + + +import weaver.conn.RecordSet; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * 自定义工具类 + * @author + */ +public class CustomUtil { + + public static String dateFormat(String format) { + return dateFormat(new Date(), format); + } + + public static String dateFormat(Date date, String format) { + return new SimpleDateFormat(format).format(date); + } + + public static Double getDouble(String v) { + return isBlank(v) ? null : getDouble(v, -1.0); + } + + /** + * 20200220121212转换2020-02-20 12-12 + * + * @param s + * @return + */ + public synchronized static String getDateofhour(String s) { + String r = ""; + Date d = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd HH:mm"); + try { + d = sdf.parse(s); + r = sdf1.format(d); + } catch (Exception e) { + // 格式不正确 + } + return r; + } + + /** + * 20200220转换2020-02-20 + * + * @param s + * @return + */ + public synchronized static String stringFormatToString(String s) { + String r = ""; + Date d = null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy-MM-dd"); + try { + d = sdf.parse(s); + r = sdf1.format(d); + } catch (Exception e) { + // 格式不正确 + } + System.out.println("格式化结果 = " + r); + return r; + } + + public static Double getDouble(String v, Double defValue) { + try { + return Double.parseDouble(v); + } catch (Exception e) { + return defValue; + } + } + + /** + * 如果字符串为空返回Null,否则转换成Integer返回,如果转换失败则抛出异常。 + * @param v + * @return + */ + public static Integer getInteger(String v) { + return isBlank(v) ? null : Integer.parseInt(v); + } + + /** + * 将对象转换成字符串。 + * @param value + * @return + */ + public static Integer getInteger(Object value, Integer defValue) { + try { + return Integer.parseInt(getString(value)); + } catch (Exception e) { + } + return defValue; + } + + /** + * 将字符串转换为整型,如果转化失败返回-1。 + * @param v + * @return + */ + public static int getInt(String v) { + return getInt(v, -1); + } + + /** + * 将字符串转换成整数,如果转换失败返回默认值。 + * @param v 字符串 + * @param defValue 默认值 + * @return 转换后的整数 + */ + public static int getInt(String v, Integer defValue) { + try { + return Integer.parseInt(v); + } catch (Exception e) { + return defValue; + } + } + + public static boolean isBlank(String v) { + return v == null || v.trim().length() == 0; + } + + public static boolean isNotBlank(String v) { + return !isBlank(v); + } + + public static String getDBValue(String val) { + if (val != null) { + val = "'" + val + "'"; + } + return val; + } + + public static String getString(Object obj) { + return getString(obj, null); + } + + public static String getString(Object obj, String defValue) { + if (obj == null) { + return defValue; + } + return obj.toString(); + } + + public static String getStringLeft(String str, int len) { + if (isBlank(str)) { + return ""; + } + len = str.length() > len ? len : str.length(); + return str.substring(0, len); + } + + public static void checkStringEmpty(String str, String errMessage) { + if (str == null || str.isEmpty()) { + throw new RuntimeException(errMessage); + } + } + + public static void checkNull(Object o, String errMessage) { + if (o == null) { + throw new RuntimeException(errMessage); + } + } + + public static void checkArrayEmpty(Object o, String errMessage) { + if (o == null) { + throw new RuntimeException(errMessage); + } + } + + public static List getDeclares(String str) { + Pattern p = Pattern.compile("(?<=\\u007B).*?(?=\\u007D)"); + Matcher m = p.matcher(str); + List result = new ArrayList(); + while (m.find()){ + if (m.group() != null){ + result.add(m.group()); + } + } + return result; + } + + public static void stdout(StackTraceElement[] stackTrace, Object... args){ + StackTraceElement s = stackTrace[1]; + String str = String.format("[%s] %s.%s(Line: %d) ", CustomUtil.dateFormat(new Date(), "HH:mm:ss.SSS"), + s.getClassName(), s.getMethodName(), s.getLineNumber()); + for (Object obj : args) { + str += ", " + obj; + } + System.out.println(str); + } + + public static String getStringDate(String format) { + return new SimpleDateFormat(format).format(new Date()); + } + + public static String getStringDate(String format, String date) throws ParseException { + + String olddate=date; + + + if(date.isEmpty()||date.equals("00000000")){ + return ""; + } + if(date.contains("-")){ + date=date.replace("-",""); + } + + if(format.contains("-")){ + Date rq = new SimpleDateFormat("yyyyMMdd").parse(date); + SimpleDateFormat sdf = new SimpleDateFormat(format); + date=sdf.format(rq); + } + + return date; + } + + public static String upperFirstWord(String str) { + String firstWord = str.substring(0, 1).toUpperCase(); + return firstWord + str.substring(1); + } + + public static String replace(String str){ + str=str.replaceAll("'","''"); + str=str.trim(); + return str; + } + + public static char getSeparator() { + return '\002'; + } + + public static String MerchantCode2name(String code){ + if(code.isEmpty())return ""; + + String name=""; + RecordSet rs= new RecordSet(); + rs.execute("select NAME_ORG1 from uf_Merchant where PARTNER= '" + code + "'"); + if (rs.next()) { + name = rs.getString("NAME_ORG1"); + } + return name; + } + + public static void main(String[] args) { + try { + System.out.println(getStringDate("yyyyMMdd",null)); + } catch (ParseException e) { + e.printStackTrace(); + } + } +} diff --git a/customization/commons/LocalTestAction.java b/customization/commons/LocalTestAction.java new file mode 100644 index 0000000..41a2d35 --- /dev/null +++ b/customization/commons/LocalTestAction.java @@ -0,0 +1,136 @@ +package customization.commons; + +import weaver.conn.RecordSet; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; +import weaver.soa.workflow.request.RequestService; + + +import java.util.HashMap; +import java.util.Map; + +/** + * Action测试 类。 + * @author + */ +public class LocalTestAction { + + private Integer requestId; + private String actionClass; + private Integer lastOperator; + private String src; + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + private String remark; + + private String mainFields; + private Map dtFields; + + public LocalTestAction(Integer requestId, String actionClass) { + this.requestId = requestId; + this.actionClass = actionClass; + } + + public Integer getRequestId() { + return requestId; + } + + public void setRequestId(Integer requestId) { + this.requestId = requestId; + } + + public String getActionClass() { + return actionClass; + } + + public void setActionClass(String actionClass) { + this.actionClass = actionClass; + } + + public Integer getLastOperator() { + return lastOperator; + } + + public void setLastOperator(Integer lastOperator) { + this.lastOperator = lastOperator; + } + + public String getSrc() { + return src; + } + + public void setSrc(String src) { + this.src = src; + } + + public String execute() throws Exception { + String result = null; + Action action = (Action) Class.forName(this.actionClass).newInstance(); + + + + RequestService requestService = new RequestService(); + RequestInfo req = requestService.getRequest(requestId); + + req.setLastoperator(this.lastOperator == null ? null : this.lastOperator.toString()); + //req.setRequestManager(new RequestManager()); + req.getRequestManager().setSrc(this.src); + req.getRequestManager().setFormid(Util.getIntValue(getByRequestId(requestId).get("FORMID").toString())); + req.getRequestManager().setCreater(Util.getIntValue(getByRequestId(requestId).get("CREATER").toString())); + req.getRequestManager().setLastoperator(this.lastOperator); + req.getRequestManager().setBillid(Util.getIntValue(getByRequestId(requestId).get("FORMID").toString())); + req.getRequestManager().setIsbill(Util.getIntValue(getByRequestId(requestId).get("ISBILL").toString())); + + + req.getRequestManager().setRequestid(this.requestId); + req.getRequestManager().setRemark(this.remark); + + + + User user=new User(1); + req.getRequestManager().setUser(user); + result = action.execute(req); + if (CustomUtil.isNotBlank(req.getRequestManager().getMessageid())) { + throw new Exception(req.getRequestManager().getMessageid() + ": " + req.getRequestManager().getMessagecontent()); + } + System.out.println("执行结果:"+result); + + /* + if("1".equals(result)) { + WorkflowRequestInfo responseInfo = new WorkflowServiceImpl().getWorkflowRequest(this.requestId, this.lastOperator, this.requestId); + String resp = new WorkflowServiceImpl().submitWorkflowRequest(responseInfo, this.requestId, this.lastOperator, this.src, this.remark); + System.out.println("流程提交结果:"+resp); + } + */ + + return result; + } + + + private static Map getByRequestId(int requestId) { + RecordSet rs = new RecordSet(); + String sql = "SELECT T1.REQUESTID, T1.WORKFLOWID, T1.REQUESTNAME,T2.ISBILL, " + + " T1.CREATER, T2.FORMID FROM WORKFLOW_REQUESTBASE T1" + + " INNER JOIN WORKFLOW_BASE T2 ON T2.ID=T1.WORKFLOWID" + + " WHERE T1.REQUESTID=?"; + Map data = new HashMap(); + if (rs.executeQuery(sql, requestId) && rs.next()) { + data.put("REQUESTID", rs.getInt("REQUESTID")); + data.put("WORKFLOWID", rs.getInt("WORKFLOWID")); + data.put("REQUESTNAME", rs.getString("REQUESTNAME")); + data.put("CREATER", rs.getInt("CREATER")); + data.put("FORMID", rs.getInt("FORMID")); + data.put("ISBILL", rs.getInt("ISBILL")); + } + return data; + } +} diff --git a/customization/commons/WSBaseInfo.java b/customization/commons/WSBaseInfo.java new file mode 100644 index 0000000..72fb90d --- /dev/null +++ b/customization/commons/WSBaseInfo.java @@ -0,0 +1,152 @@ +package customization.commons; + +public class WSBaseInfo { + + private int formid = 0; + private String creater_workcode = ""; + private String creater_lastname = ""; + private String creater_departmentid = ""; + private String creater_departmentname = ""; + private String creater_departmentcode = ""; + private String creater_workcodeAndName = ""; + private String creater_department_codeAndName = ""; + + + private String sys = ""; + + private String current_workcode = ""; + private String current_lastname = ""; + private String current_departmentid = ""; + private String current_departmentname = ""; + private String current_departmentcode = ""; + private String current_workcodeAndName = ""; + private String current_department_codeAndName = ""; + + public int getFormid() { + return formid; + } + + public void setFormid(int formid) { + this.formid = formid; + } + + public String getCreater_workcodeAndName() { + return creater_workcodeAndName; + } + + public void setCreater_workcodeAndName(String creater_workcodeAndName) { + this.creater_workcodeAndName = creater_workcodeAndName; + } + + public String getCreater_department_codeAndName() { + return creater_department_codeAndName; + } + + public void setCreater_department_codeAndName(String creater_department_codeAndName) { + this.creater_department_codeAndName = creater_department_codeAndName; + } + + public String getCurrent_workcodeAndName() { + return current_workcodeAndName; + } + + public void setCurrent_workcodeAndName(String current_workcodeAndName) { + this.current_workcodeAndName = current_workcodeAndName; + } + + public String getSys() { + return sys; + } + + public void setSys(String sys) { + this.sys = sys; + } + + public String getCurrent_department_codeAndName() { + return current_department_codeAndName; + } + + public void setCurrent_department_codeAndName(String current_department_codeAndName) { + this.current_department_codeAndName = current_department_codeAndName; + } + + public String getCreater_workcode() { + return creater_workcode; + } + + public void setCreater_workcode(String creater_workcode) { + this.creater_workcode = creater_workcode; + } + + public String getCreater_lastname() { + return creater_lastname; + } + + public void setCreater_lastname(String creater_lastname) { + this.creater_lastname = creater_lastname; + } + + public String getCreater_departmentid() { + return creater_departmentid; + } + + public void setCreater_departmentid(String creater_departmentid) { + this.creater_departmentid = creater_departmentid; + } + + public String getCreater_departmentname() { + return creater_departmentname; + } + + public void setCreater_departmentname(String creater_departmentname) { + this.creater_departmentname = creater_departmentname; + } + + public String getCreater_departmentcode() { + return creater_departmentcode; + } + + public void setCreater_departmentcode(String creater_departmentcode) { + this.creater_departmentcode = creater_departmentcode; + } + + public String getCurrent_workcode() { + return current_workcode; + } + + public void setCurrent_workcode(String current_workcode) { + this.current_workcode = current_workcode; + } + + public String getCurrent_lastname() { + return current_lastname; + } + + public void setCurrent_lastname(String current_lastname) { + this.current_lastname = current_lastname; + } + + public String getCurrent_departmentid() { + return current_departmentid; + } + + public void setCurrent_departmentid(String current_departmentid) { + this.current_departmentid = current_departmentid; + } + + public String getCurrent_departmentname() { + return current_departmentname; + } + + public void setCurrent_departmentname(String current_departmentname) { + this.current_departmentname = current_departmentname; + } + + public String getCurrent_departmentcode() { + return current_departmentcode; + } + + public void setCurrent_departmentcode(String current_departmentcode) { + this.current_departmentcode = current_departmentcode; + } +} \ No newline at end of file diff --git a/customization/proxy/CustomResourceViewCmd.java b/customization/proxy/CustomResourceViewCmd.java new file mode 100644 index 0000000..f138ed7 --- /dev/null +++ b/customization/proxy/CustomResourceViewCmd.java @@ -0,0 +1,51 @@ +package customization.proxy; + +import customization.commons.Console; +import com.engine.core.cfg.annotation.CommandDynamicProxy; +import com.engine.core.interceptor.AbstractCommandProxy; +import com.engine.core.interceptor.Command; +import com.engine.cube.cmd.resource.ResourceViewCmd; + +import java.util.Map; + +/** + * @author liutaihong + * @version 1.0.0 + * @ClassName CustomResourceViewCmd.java + * @Description TODO + * @createTime 2020-04-29 11:51:00 + */ +@CommandDynamicProxy(target = ResourceViewCmd.class, desc="重写resourceView.cmd") +public class CustomResourceViewCmd extends AbstractCommandProxy> { + @Override + public Map execute(Command> targetCommand) { + System.out.println(getClass().getName() + "command 执行之前做一些事"); + + //获取到被代理对象 + ResourceViewCmd rmCmd = (ResourceViewCmd) targetCommand; + //获取被代理对象的参数 + Map params = rmCmd.getParams(); + /* params.put("sqlwhere","id = t2.sourceid and (t2.sourceid in " + + "(select sbmc from uf_gxsboayy where ((startdate >= '2020-02-02' and startdate <= '2020-02-08') " + + "or (startdate >= '2020-02-02' and enddate <= '2020-02-08' )or (enddate >= '2020-02-02' and enddate <= '2020-02-08') " + + "or (startdate <= '2020-02-02' and enddate >= '2020-02-08')))or t2.sourceid in (select id from uf_yfsb where zyjb =0 )) " ); + + */ Console.log(params.toString()); + + //对参数做预处理 + //TODO + //参数回写 + //rmCmd.setParams(params); + //执行标准的业务处理 + Map result = nextExecute(targetCommand); + + //对返回值做加工处理 + result.put("我是Test的key", "我是"); + result.put("params", params); + + + System.out.println(getClass().getName() + "command 执行之后做一些事"); + + return result; + } +} diff --git a/customization/test/ActionTest.java b/customization/test/ActionTest.java new file mode 100644 index 0000000..3cfe466 --- /dev/null +++ b/customization/test/ActionTest.java @@ -0,0 +1,96 @@ +package customization.test; + +import org.junit.Test; +import aiyh.utils.fileUtil.WatermarkPoint; +import aiyh.utils.fileUtil.WatermarkPointEnum; +import weaver.file.FileUpload; +import weaver.soa.workflow.request.RequestInfo; +import weaver.system.SystemComInfo; +import weaver.workflow.request.RequestManager; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.FileOutputStream; +import java.io.OutputStream; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/7 0007 18:43 + * Action test + */ + + +public class ActionTest extends BaseTest { + + @Test + public void testConfig(){ +// AddWatermarkAction addWatermarkAction = new AddWatermarkAction(); +// RequestInfo requestInfo = new RequestInfo(); +// RequestManager requestManager = new RequestManager(); +// requestManager.setBilltablename("formtable_main_32"); +// requestInfo.setRequestManager(requestManager); +// requestInfo.setWorkflowid("6"); +// addWatermarkAction.execute(requestInfo); + } + + @Test + public void testPath(){ + System.out.println(-170 % 90); +// System.out.println(Math.toRadians(0)); +// System.out.println(new WatermarkPoint(WatermarkPointEnum.CENTER)); +// System.out.println(FileUpload.getCreateDir(new SystemComInfo().getFilesystem())); + } + + + + @Test + public void createWaterMarkByText() { + File srcImgFile = new File("C:\\Users\\77449\\Desktop\\test.jpg"); + String logoText = "[ 天使的翅膀 ]"; + + File outputImageFile = new File("C:\\Users\\77449\\Desktop\\test_mark.jpg"); + double degree = -45; + OutputStream os = null; + try { + Image srcImg = ImageIO.read(srcImgFile); + + BufferedImage buffImg = new BufferedImage(srcImg.getWidth(null), + srcImg.getHeight(null), BufferedImage.TYPE_INT_RGB); + + Graphics2D graphics = buffImg.createGraphics(); + graphics.setRenderingHint(RenderingHints.KEY_INTERPOLATION, + RenderingHints.VALUE_INTERPOLATION_BILINEAR); + graphics.drawImage(srcImg.getScaledInstance(srcImg.getWidth(null), + srcImg.getHeight(null), Image.SCALE_SMOOTH), 0, 0, null); + + graphics.rotate(Math.toRadians(degree), + (double) buffImg.getWidth() / 2, + (double) buffImg.getHeight() / 2); + graphics.setColor(Color.RED); + graphics.setFont(new Font("宋体", Font.BOLD, 36)); + + float alpha = 0.5f; + graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, + alpha)); + + graphics.drawString(logoText, buffImg.getWidth()/3, buffImg.getHeight()/2); + graphics.dispose(); + + os = new FileOutputStream(outputImageFile); + // 生成图片 + ImageIO.write(buffImg, "JPG", os); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (null != os) { + os.close(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} diff --git a/customization/test/AiyhUtilTest.java b/customization/test/AiyhUtilTest.java new file mode 100644 index 0000000..7925541 --- /dev/null +++ b/customization/test/AiyhUtilTest.java @@ -0,0 +1,700 @@ +package customization.test; + +import aiyh.utils.Util; +import aiyh.utils.fileUtil.WatermarkPoint; +import aiyh.utils.fileUtil.WatermarkPointEnum; +import aiyh.utils.fileUtil.WritWatermark; +import aiyh.utils.httpUtil.HttpManager; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.staticUtil.GlobalStaticCache; +import aiyh.utils.httpUtil.staticUtil.HttpStaticUtils; +import aiyh.utils.httpUtil.util.HttpUtils; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.mapUtil.UtilHashMap; +import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import com.api.aiyh_guijiu.service.WorkflowQueueService; +import com.api.aiyh_guijiu.vo.PicPsVO; +import com.drew.imaging.ImageMetadataReader; +import com.drew.imaging.ImageProcessingException; +import com.drew.metadata.Directory; +import com.drew.metadata.Metadata; +import com.drew.metadata.Tag; +import com.mzlion.core.http.ContentType; +import org.apache.http.HttpEntity; +import org.apache.http.NameValuePair; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.h2.util.StringUtils; +import org.json.JSONException; +import org.json.JSONObject; +import org.junit.Test; +import weaver.aiyh_quanshi.RequestApi; +import weaver.aiyh_quanshi.entity.QsResponse; +import weaver.conn.RecordSet; +import weaver.file.ImageFileManager; +import weaver.fna.invoice.utils.HttpUtil; +import weaver.general.GCONST; +import weaver.hrm.User; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.*; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.Paths; +import java.nio.file.attribute.BasicFileAttributeView; +import java.nio.file.attribute.BasicFileAttributes; +import java.security.KeyManagementException; +import java.security.KeyStoreException; +import java.security.NoSuchAlgorithmException; +import java.util.List; +import java.util.*; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/23 0023 17:55 + * 工具类测试 + */ + + +public class AiyhUtilTest extends BaseTest { + + @Test + public void testParaMap() { +// 使map可以链式调用,但是只支持String,Object的泛型,写死了 + Map map = ParaMap.create() + .put("name", "aiyh") + .put("age", 22) + .put("sex", "男"); + System.out.println(map); + } + + + @Test + public void testUtilMap() { + UtilHashMap map = Util.createUtilHashMap().uPut("id", 1).uPut("name", "%aiyh%"); + map.uPut("key", null).uPut(null, "value"); + System.out.println(map); +// 过滤键值都不为null,返回一个新的map,不影响原来的map + Map newMap = map.filter((key, value) -> !Objects.isNull(key) && !Objects.isNull(value)); + System.out.println(newMap); +// UtilLinkedHashMap用法一样。 + } + + /** + * 构建SQL条件 + */ + @Test + public void testWhere() { + System.out.println(aiyh.utils.Util.createSqlBuilder().updateSql("docimagefile" + , ParaMap.create().put("imagefileid", 2) + , aiyh.utils.Util.createPrepWhereImpl().whereAnd("docid").whereEqual(1)).getSqlStr()); + Where where = Util.createPrepWhereImpl() + .whereOr("test").whereEqual(2) + .whereAnd("id").whereEqual(1) + .whereOr("name").whereLike("%aiyh%"); +// 等效于下面代码 +// Where where = new PrepWhereImpl(); +// where.whereAnd("id").whereEqual(1).whereOr("name").whereLike("%aiyh%"); + System.out.println(where.getSql()); + System.out.println(where.getArgs()); +// WhereImpl类用法类似,但不推荐使用 + } + + @Test + public void testInnerPrepWhere() { + Where where = Util.createPrepWhereImpl() + .whereAnd("id").whereEqual(1) + .andInnerWhere("test").whereEqual("9") + .whereOr("innerOr").whereEqual("yes").endInnerWhere() + .whereOr("name").whereLike("%aiyh%"); + System.out.println(where.getSql()); + System.out.println(where.getArgs()); + } + + @Test + public void testInnerWhere() { + Where where = Util.createWhereImpl() + .whereAnd("id").whereEqual(1) + .andInnerWhere("test").whereEqual("9") + .whereOr("innerOr").whereEqual("yes").endInnerWhere() + .whereOr("name").whereLike("%aiyh%"); + System.out.println(where.getSql()); + } + + /** + * 构建单条插入SQL + */ + @Test + public void testBuilderSql1() { +// 创建键值对对应关系map + Map map = new HashMap<>(); + map.put("id", "1"); + map.put("name", "aiyh"); + map.put("age", "22"); + map.put("job", "java 开发"); + map.put("isnull", null); + PrepSqlResultImpl insertSql = Util.createSqlBuilder().insertSql("tableName", map); + System.out.println(insertSql.getSqlStr()); + System.out.println(insertSql.getArgs()); + } + + /** + * 构建批量插入SQL + */ + @Test + public void testBuilderSql2() { + List> list = new ArrayList<>(); +// 创建键值对对应关系map + for (int i = 0; i < 5; i++) { + LinkedHashMap map = new LinkedHashMap<>(); + map.put("id", i); + map.put("name", "aiyh" + i); + map.put("age", "22"); + map.put("job", "java 开发"); + list.add(map); + } + BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().insertBatchSql("tableName", list); + System.out.println(batchSqlResult.getSqlStr()); + System.out.println(batchSqlResult.getBatchList()); + } + + /** + * 构建单条更新SQL + */ + @Test + public void testBuilderSql3() { + Map map = new HashMap<>(); + map.put("lastname", "aiyh"); + map.put("loginid", "aiyh"); + Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual("22058"); + PrepSqlResultImpl updateSql = Util.createSqlBuilder().updateSql("hrmresource", map, where); + System.out.println(updateSql.getSqlStr()); + System.out.println(updateSql.getArgs()); + RecordSet recordSet = new RecordSet(); + recordSet.executeUpdate(updateSql.getSqlStr(), updateSql.getArgs()); + } + + /** + * 构建批量更新SQL + */ + @Test + public void testBuilderSql4() { + List> list = new ArrayList<>(); + List whereList = new ArrayList<>(); + for (int i = 0; i < 5; i++) { + LinkedHashMap map = new LinkedHashMap<>(); + map.put("name", "aiyh" + i); + map.put("age", "22"); + map.put("job", "java 开发"); + list.add(map); + Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual(i); + whereList.add(where); + } + BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("tableName", list, whereList); + System.out.println(batchSqlResult.getSqlStr()); + System.out.println(batchSqlResult.getBatchList()); + } + + + @Test + public void testHttpClient() throws IOException, JSONException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { + CloseableHttpClient httpConnection = HttpManager.getHttpConnection(""); + HttpGet httpGet = new HttpGet("https://www.baidu.com"); + CloseableHttpResponse execute = httpConnection.execute(httpGet); + HttpEntity entity = execute.getEntity(); + System.out.println(EntityUtils.toString(entity, StandardCharsets.UTF_8)); + + +// http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList +// yZGiC98iGbbyQXw3WG19w5rE3swjU3ld +// CloseableHttpClient httpConnection1 = HttpManager.getHttpConnection(); + JSONObject param = new JSONObject(); + param.put("page", 1); + HttpPost httpPost = new HttpPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList"); + StringEntity stringEntity = new StringEntity(param.toString()); + stringEntity.setContentType(ContentType.APPLICATION_JSON.toString()); + httpPost.setEntity(stringEntity); + httpPost.setHeader("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld"); + httpPost.setHeader("content-type", ContentType.APPLICATION_JSON.toString()); + CloseableHttpResponse execute1 = httpConnection.execute(httpPost); + HttpEntity entity1 = execute1.getEntity(); + System.out.println(EntityUtils.toString(entity1, StandardCharsets.UTF_8)); + +// CloseableHttpClient httpConnection2 = HttpManager.getHttpConnection(); + HttpPost httpPost1 = new HttpPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList"); + List nvps = new ArrayList<>(); + nvps.add(new BasicNameValuePair("name", "value")); + httpPost1.setEntity(new UrlEncodedFormEntity(nvps)); + httpPost1.setHeader("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld"); + CloseableHttpResponse execute2 = httpConnection.execute(httpPost1); + HttpEntity entity2 = execute2.getEntity(); + System.out.println(EntityUtils.toString(entity2, StandardCharsets.UTF_8)); + + ResponeVo post = HttpStaticUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList", null); + System.out.println(); + } + + @Test + public void testUtil() throws IOException { + GlobalStaticCache.header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld"); + ResponeVo responeVo = HttpStaticUtils.apiGet("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList"); + System.out.println("=========" + Arrays.toString(responeVo.getAllHeaders())); + System.out.println(responeVo.getEntityString()); + System.out.println(responeVo.getEntityMap()); + System.out.println(responeVo.getCode()); + System.out.println(responeVo.getEntity(TestVo.class)); + TestVo entity = responeVo.getEntity(TestVo.class); + entity.getItems().forEach(item -> System.out.println(item.getCurrency() + " => " + item.getLocalCurrency() + " : " + item.getRate())); + } + + + @Test + public void testCallBack() throws IOException { + HttpStaticUtils.apiGet("https://www.baidu.com/s", new HashMap() {{ + put("wd", "java"); + put("ie", "utf-8"); + }}, null, response -> { + try { + System.out.println(EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8)); + System.out.println(response.getStatusLine().getStatusCode()); + } catch (IOException e) { + e.printStackTrace(); + } + }); + } + + + @Test + public void testPost() throws IOException { + GlobalStaticCache.header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld"); + GlobalStaticCache.paramMap.put("", ""); + long l = System.currentTimeMillis(); + ResponeVo responeVo = HttpStaticUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList", + null, null); + long l1 = System.currentTimeMillis(); + System.out.println(l1 - l); + TestVo entity = responeVo.getEntity(TestVo.class); + System.out.println(entity); + System.out.println(responeVo.getEntityMap()); + + } + + @Test + public void testAsync() throws IOException, ExecutionException, InterruptedException { + HttpUtils httpUtils = new HttpUtils(); + httpUtils.getGlobalCache().header.put("apiKey", "yZGiC98iGbbyQXw3WG19w5rE3swjU3ld"); + long l = System.currentTimeMillis(); + Future responeVoFuture = httpUtils.asyncApiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/appapi/GetExchangeRateList", + null, null); + long l1 = System.currentTimeMillis(); + System.out.println(l1 - l); + System.out.println("test"); + ResponeVo responeVo = responeVoFuture.get(); + long l2 = System.currentTimeMillis(); + System.out.println(l2 - l1); + System.out.println(l2 - l); + System.out.println("aaaa"); + System.out.println(responeVo.getEntityMap()); + } + + @Test + public void testPDFUTil() throws IOException { +// File file = new File("C:\\Users\\77449\\Pictures\\Saved Pictures\\7c3fbba87cac45568374bdb64622f8d2!400x400.png"); +// String path = WritWatermark.addWatermark(file, "C:\\Users\\77449\\Pictures\\Saved Pictures\\2.jpg", +// "这个是水印\nthis is water", "宋体", 0, new Color(249, 231, 186), 0, 20, 0); +// System.out.println(path); +// Files.delete(Paths.get(path)); + +// ImageFileManager imageFileManager ImageFileManager(); +// imageFileManager.getInputStreamById(); +// imageFileManager.saveImageFileByInputStream(); + } + + + @Test + public void testPDfUtil2() throws IOException { + /*ImageFileManager imageFileManager = new ImageFileManager(); + InputStream inputStreamById = ImageFileManager.getInputStreamById(3639); + Image image = ImageIO.read(inputStreamById); + int width = image.getWidth(null); + int height = image.getHeight(null); + BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + Graphics graphics = bufferedImage.createGraphics(); + graphics.drawImage(image, 0, 0, width, height, null); + graphics.setColor(new Color(200, 120, 120)); + graphics.setFont(new Font("宋体", 0, 50)); + String[] pressTexts = "我是水印".split("\n"); + for (int i = 0; i < pressTexts.length; i++) { + graphics.drawString(pressTexts[i], 20, 20 + (50 * (i + 1)) + (int) Math.round((height * 0.02))); + } + graphics.dispose(); + FileOutputStream fileOutputStream1 = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Pictures\\Saved Pictures\\水印-1.jpg", "utf-8")); + ImageIO.write(bufferedImage, "jpg", fileOutputStream1); + fileOutputStream1.close(); + + ByteArrayOutputStream bs = new ByteArrayOutputStream(); + ImageOutputStream imOut = ImageIO.createImageOutputStream(bs); + ImageIO.write(bufferedImage, "jpg", imOut); +//将图片转为inputStream流 + InputStream inputStream = new ByteArrayInputStream(bs.toByteArray()); + int i = imageFileManager.saveImageFileByInputStream(new FileInputStream("C:\\Users\\77449\\Pictures\\Saved Pictures\\水印-1.jpg"), "水印1.jpg"); + System.out.println(i);*/ + + int i = WritWatermark.addTextTileWatermarkById(3639, "文字水印测试!", new Color(200, 100, 155), + "宋体", 0, 50, -40, 0.5F,1, 300, 100, 200); + //FileInputStream fs = new FileInputStream(URLDecoder.decode("I:\\wind主题\\开始按钮\\gLogoMid-v3.png","utf-8")); + +// int i = WritWatermark.addPicWatermarkById(3639, 3724,new WatermarkPoint(WatermarkPointEnum.CENTER), -45, 0.5F); + + InputStream inputStreamById1 = ImageFileManager.getInputStreamById(i); + Image image1 = ImageIO.read(inputStreamById1); + int width1 = image1.getWidth(null); + int height1 = image1.getHeight(null); + BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB); + Graphics graphics1 = bufferedImage1.createGraphics(); + graphics1.drawImage(image1, 0, 0, width1, height1, null); + graphics1.dispose(); + FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\水印1-1.jpg", "utf-8")); + ImageIO.write(bufferedImage1, "jpg", fileOutputStream); + fileOutputStream.close(); + } + + @Test + public void testCase() { + String query = "select * from uf_temp_attachment"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query); +// 如果有时间转换,需要添加自定义注解weaver.aiyh_pcn.aiyh.aiyh.utils.annotation.DateFormatAn,指定个话类型 + TestCaseVo testCaseVo = Util.recordeSet2Entity(rs, TestCaseVo.class, true); + System.out.println(testCaseVo); + } + + @Test + public void creatJava() throws IOException { + Util.creatJavaFileByTable("uf_htmb", "createJava.test.createFile"); + String selectConfigBase = "select lf.id, lf.is_out_user,lf.is_sell_change,lf.will_write, " + + "wfvw.fieldname as will_write_field,wfvw.tablename as will_write_table, " + + "lf.is_customer_address,lf.workflow_type, lf.customer_id, " + + "lf.change_setting, wslu.selectvalue as update_mark, " + + "lf.manager_type, lf.customer_manager, wfvm.fieldname as manager_field, " + + "wsli.selectvalue as insert_mark,wfv.fieldname as update_insert, " + + "wfv.tablename as update_insert_table " + + "from uf_external_law_fir as lf " + + "left join workflow_selectitem as wslu on wslu.id = lf.update_mark " + + "left join workflow_selectitem as wsli on wsli.id = lf.insert_mark " + + "left join workflow_field_view as wfv on wfv.id = lf.update_insert " + + "left join workflow_field_view as wfvm on wfvm.id = lf.manager_field " + + "left join workflow_field_view as wfvw on wfvw.id = lf.will_write_field " + + "where workflow_type in " + + "(select id from workflow_base where activeVersionID in " + + "(select activeVersionID from workflow_base where id = 2) or id = 2)"; + Util.creatJavaFileBySql(selectConfigBase, "testSqlJava", "createJava.test.createFile"); + } + + + @Test + public void testPicPs() { + FileInputStream fileInputStream = null; + try { + BasicFileAttributeView basicview = Files.getFileAttributeView(Paths.get("C:\\Users\\77449\\Desktop\\5dc086a14941f4d5aeec44068986d04.jpg"), BasicFileAttributeView.class, + LinkOption.NOFOLLOW_LINKS); + BasicFileAttributes attr; + try { + attr = basicview.readAttributes(); + //attr.lastModifiedTime(); + Date lastmodfiyTimeDate = new Date(attr.lastModifiedTime().toMillis()); + Date createTimeDate = new Date(attr.creationTime().toMillis()); + System.out.println(lastmodfiyTimeDate); + System.out.println(createTimeDate); + } catch (Exception e) { + e.printStackTrace(); + } +// 获取媒体数据 + fileInputStream = new FileInputStream( + URLDecoder.decode("C:\\Users\\77449\\Desktop\\8308CC261209F70EBC82293C4092C8B5.jpg", + "utf-8")); + Metadata metadata = ImageMetadataReader.readMetadata(fileInputStream); +// 遍历Directory对象,每个对象里面包含标签 + for (Directory directory : metadata.getDirectories()) { + String directoryName = directory.getName(); + if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName) + || directoryName.contains("Adobe")) { + System.out.println("图片经过Adobe Photoshop!"); + } + System.out.println(directoryName); + for (Tag tag : directory.getTags()) { + if ("Software".equalsIgnoreCase(tag.getTagName())) { + if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase()) + || tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) { + System.out.println("图片经过 Adobe Photoshop!"); + } else { + System.out.println("图片经过 " + tag.getDescription() + "!"); + } + } + if ("User Comment".equalsIgnoreCase(tag.getTagName())) { + try { + com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription()); + System.out.println("图片经过手机端图片处理软件,软件未知!"); + } catch (Exception e) { + e.printStackTrace(); + } + } + System.out.println(tag); + } + } + } catch (ImageProcessingException | IOException e) { + e.printStackTrace(); + } finally { + if (fileInputStream != null) { + try { + fileInputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + + @Test + public void testPic() { + PicPsVO picPsVO = PicPsVO.PicPsVOBuilder.aPicPsVO() + .docId(0) + .fileId(0) + .fileName("name") + .build(); +// 通过物理文件的id进行获取对应的输入流信息。 + ImageFileManager imageFileManager = new ImageFileManager(); + // 通过文件id获取输入流 + InputStream inputStreamById = ImageFileManager.getInputStreamById(3786); + FileInputStream fileInputStream = null; + + try { + fileInputStream = new FileInputStream( + URLDecoder.decode("C:\\Users\\77449\\Desktop\\50c42dffc1d2af366364daf0adcd694.jpg", + "utf-8")); +// 获取媒体数据 + Metadata metadata = ImageMetadataReader.readMetadata(fileInputStream); +// 遍历Directory对象,每个对象里面包含标签 + for (Directory directory : metadata.getDirectories()) { + String directoryName = directory.getName(); + if ("Photoshop".equalsIgnoreCase(directoryName) || "Adobe JPEG".equalsIgnoreCase(directoryName) + || directoryName.contains("Adobe")) { + if (picPsVO.getScore() > 80) { + continue; + } + picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!"); + picPsVO.setScore(80); + } + String model = ""; + for (Tag tag : directory.getTags()) { + if(tag.getDescription() != null && tag.getDescription().toLowerCase().contains("Adobe".toLowerCase())){ + System.out.println(tag + " ===============> "); + } + System.out.println(tag); + if ("Software".equalsIgnoreCase(tag.getTagName())) { + if (tag.getDescription().toLowerCase().contains("Adobe".toLowerCase()) + || tag.getDescription().toLowerCase().contains("Photoshop".toLowerCase())) { + picPsVO.setDescribe("图片经过Adobe Photoshop软件,注意审核!"); + picPsVO.setScore(100); + } else { + if (picPsVO.getScore() > 70) { + continue; + } + picPsVO.setDescribe("图片经过" + tag.getDescription() + "软件,注意审核!"); + picPsVO.setScore(70); + } + if (!StringUtils.isNullOrEmpty(model) && picPsVO.getDescribe().contains(model)) { + picPsVO.setDescribe(""); + picPsVO.setScore(-1); + } + } + if ("Model".equalsIgnoreCase(tag.getTagName())) { + model = tag.getDescription(); + if (!StringUtils.isNullOrEmpty(picPsVO.getDescribe())) { + if (picPsVO.getDescribe().contains(tag.getDescription())) { + picPsVO.setDescribe(""); + picPsVO.setScore(-1); + } + } + } + if ("User Comment".equalsIgnoreCase(tag.getTagName())) { + try { + if (picPsVO.getScore() > 60) { + continue; + } + com.alibaba.fastjson.JSONObject.parseObject(tag.getDescription()); + picPsVO.setDescribe("图片经过手机端图片处理软件,软件未知!请注意审核!"); + picPsVO.setScore(60); + } catch (Exception e) { + if (picPsVO.getScore() > 30) { + continue; + } + picPsVO.setDescribe("图片可能经过未知软件!请注意审核!"); + picPsVO.setScore(30); + } + } + } + } + } catch (ImageProcessingException | IOException e) { + e.printStackTrace(); + } finally { + if(fileInputStream != null){ + try { + fileInputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + System.out.println(picPsVO); + } + + @Test + public void testRe2String(){ + RecordSet rs = new RecordSet(); + String query = "select id from workflow_base " + + "where activeVersionID in (select activeVersionID " + + "from workflow_base where id = ?) or id = ?"; + rs.executeQuery(query,2,2); + System.out.println(Util.recordeSet2Array(rs, Integer.class)); + } + + + + @Test + public void testConfig(){ + WorkflowQueueService workflowQueueService = new WorkflowQueueService(); +// String watermarkConfig = workflowQueueService.getWatermarkConfig("2"); +// System.out.println(watermarkConfig); +// String picIsPs = workflowQueueService.getPicIsPs("259,260,261"); +// System.out.println(picIsPs); + +// String workflowConflictConfig = workflowQueueService.getWorkflowConflictConfig("3"); +// System.out.println(workflowConflictConfig); + +// String picPsConfig = workflowQueueService.getPicPsConfig(); +// System.out.println(picPsConfig); + + +// String watermarkConfig = workflowQueueService.getWatermarkConfig(); +// System.out.println(watermarkConfig); + + Properties prop = new Properties(); + try { + // 通过输入缓冲流进行读取配置文件 + InputStream InputStream = new BufferedInputStream(new FileInputStream(new File("H:\\e-cology-dev\\web\\test.properties"))); + // 加载输入流 + prop.load(InputStream); + // 根据关键字获取value值 + Enumeration enumeration = prop.propertyNames(); + while (enumeration.hasMoreElements()){ + String key = (String) enumeration.nextElement(); + System.out.println(key); + System.out.println(prop.getProperty(key)); + } + } catch (Exception e) { + e.printStackTrace(); + } + + } + + + @Test + public void testE(){ + System.out.println(!"-1".equals("1002095")); + } + + + @Test + public void testLock(){ +// Lock lock = new ReentrantLock(); +// lock.lock(); +// lock.unlock(); + } + + + @Test + public void testMap(){ + String query = "select * from meeting where id = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query,8); + Map stringObjectMap = Util.recordSet2Map(rs,true); + System.out.println(stringObjectMap); + } + + public Map getPropertiesMap(String prx){ + Properties prop = new Properties(); + Map map = new HashMap<>(); + try { + // 通过输入缓冲流进行读取配置文件 + InputStream InputStream = new BufferedInputStream(new FileInputStream(new File("H:\\e-cology-dev\\web\\test.properties"))); + // 加载输入流 + prop.load(InputStream); + // 根据关键字获取value值 + Enumeration enumeration = prop.propertyNames(); + while (enumeration.hasMoreElements()){ + String key = (String) enumeration.nextElement(); + if(key.contains(prx)){ + map.put(key.replace(prx + ".", ""),prop.getProperty(key)); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return map; + } + + @Test + public void getProp2Map(){ + System.out.println(GCONST.getPropertyPath()); + System.out.println(Util.null2String(null,"-1")); + Map propertiesMap = Util.getProperties2Map("test","aiyh.test"); + System.out.println(propertiesMap); + } + + + @Test + public void getInfo(){ + RequestApi requestApi = new RequestApi(); + QsResponse quanShiInfo = requestApi.getQuanShiInfo("59733978"); + } + + + + @Test + public void testHttpUtil() throws IOException { +// HttpUtil + HttpUtils httpUtils = new HttpUtils(); + httpUtils.getGlobalCache().header.put("authentication","8cb0ddd0fd07424e9e77140d1f7378ab"); + ResponeVo files = httpUtils.apiUploadFileById("http://192.168.3.2:8081/upload/fileUpload", + 713, "files", "2008年全国统一高考英语试卷(全国卷Ⅱ)(含解析版).doc", + new HashMap(){{ + put("fileName","2008年全国统一高考英语试卷(全国卷Ⅱ)(含解析版).doc"); + }}, null); + System.out.println(files.getEntityString()); + } + + + @Test + public void testHttpInvoice(){ + net.sf.json.JSONObject jsonObject = HttpUtil.postImage(new byte[1], new User()); + System.out.println(jsonObject); + } +} diff --git a/customization/test/BaseTest.java b/customization/test/BaseTest.java new file mode 100644 index 0000000..cedc2f1 --- /dev/null +++ b/customization/test/BaseTest.java @@ -0,0 +1,26 @@ +package customization.test; + +import customization.commons.Console; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import weaver.general.GCONST; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +public class BaseTest { + + @Before + public void before() throws Exception { + GCONST.setServerName("ecology"); + GCONST.setRootPath("H:\\e-cology-dev\\web\\"); + } + + @AfterClass + public static void after() { + System.out.println("单元测试结束!"); + } + + +} diff --git a/customization/test/CopyFileTest.java b/customization/test/CopyFileTest.java new file mode 100644 index 0000000..ab1a5f7 --- /dev/null +++ b/customization/test/CopyFileTest.java @@ -0,0 +1,49 @@ +package customization.test; + +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.util.HttpUtils; +import aiyh.utils.mapUtil.ParaMap; +import com.api.aiyh_pcn.copy_attachment.dao.ConfigTableData; +import com.api.aiyh_pcn.copy_attachment.model.ConfigEmpty; +import com.api.aiyh_pcn.copy_attachment.web.CopyAttachment; +import org.junit.Test; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/29 0029 17:31 + * ceshilei + */ + + +public class CopyFileTest extends BaseTest{ + + @Test + public void testGetConfig(){ + CopyAttachment copyAttachment = new CopyAttachment(); + String s = copyAttachment.queryConfig("5"); + System.out.println(s); + } + + + @Test + public void testRequest() throws IOException { + HttpUtils httpUtils = new HttpUtils(); + httpUtils.getGlobalCache().header.put("apiKey","yZGiC98iGbbyQXw3WG19w5rE3swjU3ld"); + httpUtils.getGlobalCache().paramMap.put("ToKen","1"); + httpUtils.getGlobalCache().paramMap.put("pageSize","100"); + httpUtils.getGlobalCache().paramMap.put("page","1"); + ResponeVo responeVo = httpUtils.apiPost("https://apigwaws-lite.porsche-cloudservice.com/env-101/Eflow/eflow/Services/Services/ToiBuyService.asmx/GetVendorList", null); + VendorResult entity = responeVo.getEntity(VendorResult.class); + System.out.println(entity); + } + + @Test + public void testInt(){ + TestVo testVo = new TestVo(); + System.out.println(testVo); + } +} diff --git a/customization/test/DocCopyTest.java b/customization/test/DocCopyTest.java new file mode 100644 index 0000000..1b3bbd4 --- /dev/null +++ b/customization/test/DocCopyTest.java @@ -0,0 +1,172 @@ +package customization.test; + +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.impl.PrepWhereImpl; +import com.api.aiyh_kafang.service.UploadByBase64Service; +import org.apache.axiom.util.base64.Base64Utils; +import org.junit.Test; +import weaver.conn.RecordSet; +import weaver.docs.docs.DocManager; +import weaver.file.ImageFileManager; +import weaver.workflow.workflow.WorkflowVersion; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/26 0026 13:19 + * wen dang fu zhi + */ + + +public class DocCopyTest extends BaseTest { + @Test + public void testCopyFile() throws Exception { + DocManager doc = new DocManager(); + doc.setId(16); + doc.copyDocNew(); + } + + + @Test + public void testUploadBase64() throws IOException { + ImageFileManager fileManager = new ImageFileManager(); + byte[] data = null; + String base64 = new String("/9j/4AAQSkZJRgABAQEAeAB4AAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMj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IBO1HvS0UAJRS4pcUAJQKdijFAxKKXbxRg0AJS0oFFACClopaAGmmnrTjSGgBKOlGKO1AhveiiigApBS0UAOb7oNJTj9xaZQMkUYRR7UU7FGKSGNxRinYopiG0U6igBtLS0UAFGKKWmAlFLSUAFFLRQAUUtGKACloooAKXtRRQAUUUtABRRRQAtFFFACYopaKADtRRRQAlLRRQAUUUUAFJS0lABRRRQAUUUUAFFFFABRSUUALRSUUAFLSUUAFFFFAB3ooooAKKKKACkpaSgBaSlpKACiiigApKWkoAWiiigAopKWgQlFFFAwooooEFJS0lABSUtJQMKKKKBBSUtFACUUppKACiiikAUUUlACUUtFADTRRR3pgJRRRQAtJRS0AGKUUUtABRRRQAUUtJQAtJRRQAtFFJQAtFJS0AFJRS0AFFJS0AFFFFABS0lLQAlGaWjvQAZooooAKKKKACkPSlooATtRRSUAKaSiigAoopKACiijtQAUd6KO9ABRRiigAoxRRQAlFLRSASlopaYCUtFKBSAKWkp1AwoxS0lACUmaU02gBaKSjNAB2pKWigQYpMUtFADaTtTj1pKAEpO9LSUASN9xaZSseBTaBk9FOpMUkAlHalopgJ2pKWjtQAlFLRigAopcUUAJRS44opgFFFLQAYopaKAEpaMUUgCiiigBaO1FHamAtFFFIAooooAKKKKYBRRRQAUUUUAFFFJQAUUUUAFFFJQAUUUUALmkoooAKKKKACikooAWiiigAopKKAClpKKACiiigAooooAKKKKACiiigBKKKKACiiigQUUUUAFFFJQMWkpaSgQUUUUAFJRRQAUUtJmgAooooAKSlooASiiigA7UlLSUAFFFFACUlOpKAGmkpzUgGaAAUoFLilxQAUUUUALRRRQAUlLSUALSUUUAFFFFAC0UUUAFFFFABRRRQAUUUUAFLRRQAUUUlAC0UUUAFFJRQAUmaWkoAKKSjigBaSiigApKWk5oAXtRRRQAtJ3opaAEooooAKKO9FIBKWk7UUwFFLSClpDDFLiilFABSiiigBaSlpKAE7U2nGm0AFFLSUAJ3pRSUtAgoNJmkzQAtJRmigBKO9FFACt9wU2nv/qxUeaBlukpe1FJAJSUtFMBKKWigBKKXFFABS4pKKAFoopaYCUUtJQAuKKSloAWkoopAFFFGaACijNFABRS0lABRRRQAUUUUwCiiigApaKKAEooooAKKKSgAooooAKKSigAooooAKKKKACiiigAooooAKKKSgBaKKKACiikoAWikooAKXtSUUCCiiigAoopKAClpKO1ABS0lFABRRRQAUUlFAC0lFFABRRRQAUUUUAFJS0UAJRS0YoAbS0lFABRS9qSgAopaSgAoopKAFxS0lFAC0dqSigBaKTNFAC0UCigBKKWkoAO1FFFABRRS0AFFFFACUtFFABRRSZoAWijrSUALRSUooAKKU0lABRRSUAFLSUUAFFJR2oAKSiloAKKKKACilooASlooFABR0opKAFFJR3pKACijNHekAUtJS0wCloopDF70tJRQA6ikzRQAtJRRQAUlLSUAIaKKSgAopKKACiim0CFopM0UAL1pQKQU8UAI/3BUdSv/q/xqKgC3RRRSQwpKWimAlFLRQAUUUHpQBFLPDBt86ZI933dxxmo/t9l/wA/kH/fYrmvGVvHealoFtKu6KW4IYZ6jisLVdS8G6Rq1xp8+jzM8DYZkJxQB6Kl5aScJdQse2HFTf0615pq+n6O2n6Hqmk28lt9quVXBY8jNdnJr1nJql9onzLdRW+4buA2R2pgaokR1DI4ZT0IORQ0sSHbJNGjejMAa878KXGqaJpu6dzPaPKyNABmSFieD9K1YrCDUNWaz8QW8st6FLRzxEhHTqPxoA64TwNwLiI/8DFO3Dfs3rvxkLnkivPl/wCENm0S51JEuo44JfKdRJ84b1xWUniea5sxdW8NzLqFm/l2k6oSrxej+9AHqomh6edHkf7Qp24bgu4bjyBnk15n9p8OXKCa80/VIrmT5pdgbCt3xWtNb3UegSaq90HawXfZSq3JT+64oA7bOPvEAe9J5kf/AD1j/wC+hXn2neJ77xH4R12a8EaNDEApj461E0HhzR/D+l3WrS3vm3cecpITk96APRg6f89U/wC+hTu2c/lXmos/Det6VqE2k3d8s1pEZNzORj0rsfCTvJ4U095HZ2MfLMck0AbVFJS0gCikopgLRSUUAFLSUUALRRSUALRSUUAFFF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bj+6cVCPAXhvPFif++jQAN8QfDS/wDL2x+imqkvxK8PpnZ50n0Wrv8Awg3h0f8ALjn/AIFVqLwtoMIAXTYePUZoA5iX4nIxxZ6VLJ6FjUDeKPGGp/JZab5Oeh2130NjY264gtIUx6IKshsDgAfQUxHmY8IeKdaO/VtRMSHqu7p+Fbuk/D/R9NYSTK11KO8nSusOaMetIBscccKCOGNY0HQKMUbc80/FHagBmOaUUtJ2oAO9Lmm0vSgBacKYOtPFADhTuKbTqBjqUU0U4dKQhwp4FNFOXpQA1TUq1EtSLQBKOlLSCloGIayNaDLGky9Uatg9Ko6hH5lq6+1NCI4XE0KuvRhmn44rN0mYqrW7feU5H0rVFMBmKMU/AzRikBGRRin7aTGKAGYoApxFJ2pgFLRxR2oAKKKKAFopPeloAWik7UtIAooooAKKOaKACiiloASiiigAoFFAoAWkNFFABRRRQAUlGaM0AFFANFABSdqKKADtRSUtABRRRQApPrSdqXqKSgBKWj6UUDCiilxQAlFGKX60CG0UvaigApKWkoAKKWigBKWiigBKKWigBKMUUUAFFFFAC0UUn1oAWlpKKACiiloASkp1JigBKKKKACiiigAooooAKMGiigA5opQaKAEope1FACUUd6KAFFLTaKAHdqKSigAooooAKKKSgAopaSgAGKKKKACilpKACl6UlFABRRRQAUtJRQAUdqBRQAlFLigigBKKKKAClpKUZoAOaKWigBM0ZoPFNJ9KAHZpe1MGaXNADqUU3NGeaAH8UlGaKACiikoAWikzS0AJijFLRQAzbSYp5FJQA3bRinUUDGYoxT6b0oEJikxT6Q0ANPWkNLSUALSUlFAAaTvS0lAB0pKWk70AKOtOFJThQA4dKcOlNFOAoGKKd0NNFL70gJBTl6VGKeDxQB//2Q=="); + data = Base64Utils.decode(base64); + System.out.println(data.length); + fileManager.setImagFileName("buzhidap.jpg"); + fileManager.setData(data); +// int i = fileManager.saveImageFile(); +// System.out.println(i); + InputStream inputStreamById1 = ImageFileManager.getInputStreamById(2364); + Image image1 = ImageIO.read(inputStreamById1); + int width1 = image1.getWidth(null); + int height1 = image1.getHeight(null); + BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB); + Graphics graphics1 = bufferedImage1.createGraphics(); + graphics1.drawImage(image1, 0, 0, width1, height1, null); + graphics1.dispose(); + FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\测试base64.jpg", "utf-8")); + ImageIO.write(bufferedImage1, "jpg", fileOutputStream); + fileOutputStream.close(); + } + + + @Test + public void test(){ + System.out.println("[" + WorkflowVersion.getVersionStringByWfid("45") + "]"); + } + + + @Test + public void testuplosd() throws IOException { + UploadByBase64Service uploadByBase64Service = new UploadByBase64Service(); + int i = uploadByBase64Service.uploadImage(null); + System.out.println(i); + InputStream inputStreamById1 = ImageFileManager.getInputStreamById(i); + Image image1 = ImageIO.read(inputStreamById1); + int width1 = image1.getWidth(null); + int height1 = image1.getHeight(null); + BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB); + Graphics graphics1 = bufferedImage1.createGraphics(); + graphics1.drawImage(image1, 0, 0, width1, height1, null); + graphics1.dispose(); + FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\测试base64.jpg", "utf-8")); + ImageIO.write(bufferedImage1, "jpg", fileOutputStream); + fileOutputStream.close(); + } + + + @Test + public void testBatchUpdate(){ + ArrayList> objects = new ArrayList>(){{ + add(new LinkedHashMap(){{ + put("email","1@qq.com"); + }}); + add(new LinkedHashMap(){{ + put("email","2@qq.com"); + }}); + add(new LinkedHashMap(){{ + put("email","3@qq.com"); + }}); + add(new LinkedHashMap(){{ + put("email","4@qq.com"); + }}); + add(new LinkedHashMap(){{ + put("email","5@qq.com"); + }}); + }}; + ArrayList prepWheres = new ArrayList(){{ + add(Util.createPrepWhereImpl().whereAnd("id").whereEqual(22)); + add(Util.createPrepWhereImpl().whereAnd("id").whereEqual(23)); + add(Util.createPrepWhereImpl().whereAnd("id").whereEqual(24)); + add(Util.createPrepWhereImpl().whereAnd("id").whereEqual(25)); + add(Util.createPrepWhereImpl().whereAnd("id").whereEqual(26)); + }}; + + BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("hrmresource",objects, prepWheres); + RecordSet rs = new RecordSet(); + rs.executeBatchSql(batchSqlResult.getSqlStr(),batchSqlResult.getBatchList()); + } + + + @Test + public void testEntity() throws IntrospectionException, InvocationTargetException, IllegalAccessException { + TestVoItem testVoItem = new TestVoItem(); + testVoItem.setCurrency("currency"); + testVoItem.setLocalCurrency("localCurrency"); + testVoItem.setRate("1.22"); + BeanInfo beanInfo = Introspector.getBeanInfo(testVoItem.getClass(), Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor proper : propertyDescriptors) { + String name = proper.getName(); + Method readMethod = proper.getReadMethod(); + Object invoke = readMethod.invoke(testVoItem); + System.out.println(name); + System.out.println(invoke); + } + +// List entityFields = Util.getEntityFields(testVoItem.getClass()); +// System.out.println(entityFields); +// for (Field entityField : entityFields) { +// entityField.setAccessible(true); +// String name = entityField.getName(); +// System.out.println(name); +// System.out.println(String.valueOf(entityField.get(name))); +// } + } + + @Test + public void testByentity(){ + TestVoItem testVoItem = new TestVoItem(); + testVoItem.setCurrency("currency"); + testVoItem.setLocalCurrency("localCurrency"); + testVoItem.setRate("1.22"); + PrepSqlResultImpl testTable = Util.createSqlBuilder().insertSqlByEntity("testTable", testVoItem); + System.out.println(testTable.getSqlStr()); + System.out.println(testTable.getArgs()); + } + + +} diff --git a/customization/test/NewActionTest.java b/customization/test/NewActionTest.java new file mode 100644 index 0000000..bd7b6be --- /dev/null +++ b/customization/test/NewActionTest.java @@ -0,0 +1,189 @@ +package customization.test; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigMainDTO; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.api.aiyh_kafang.dao.InvoiceMapping; +import com.api.aiyh_kafang.entity.UfInvoiceConfigDTO; +import com.api.aiyh_kafang.service.InvoiceService; +import com.api.aiyh_kafang.web.InvoiceController; +import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils; +import com.cloudstore.dev.api.util.Util_DataCache; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.junit.Test; +import weaver.aiyh_pcn.fadada.UploadFile2FaDDAction; +import weaver.soa.workflow.request.RequestInfo; +import weaver.workflow.request.RequestManager; + +import java.io.IOException; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/21 0021 11:48 + * ce shi action + */ + +/*公司名 = 陕西正天建设有限公司 + creditNo = 916100007273444965 + 企业编号 = e23deb7a29714d0da5b806665ab3e2f8*/ + + +public class NewActionTest extends BaseTest { + + @Test + public void testAction() { + UploadFile2FaDDAction uploadFile2FaDDAction = new UploadFile2FaDDAction(); + RequestInfo requestInfo = new RequestInfo(); + requestInfo.setRequestid("68072"); + requestInfo.setWorkflowid("45"); + RequestManager requestManager = new RequestManager(); + requestManager.setBilltablename("formtable_main_17"); + requestInfo.setRequestManager(requestManager); + uploadFile2FaDDAction.setContractField("htwj"); + uploadFile2FaDDAction.execute(requestInfo); +// uploadFile2FaDDAction.signedContract(); + + } + + @Test + public void testContractStatus() throws JsonProcessingException { + Map data = new HashMap<>(); + data.put("contractNo", "7622cb620bc04e77b4e85950c564493b"); + Map stringObjectMap = FaDDRequestUtils.queryDetailContractStatus(data); + System.out.println(stringObjectMap); + } + + + @Test + public void getCode() throws UnsupportedEncodingException { + Map map = new HashMap<>(); + map.put("companyName", "陕西正天建设有限公司"); + map.put("creditNo", "916100007273444965"); + String s = FaDDRequestUtils.builderBizContent(map); + System.out.println(s); + byte[] decode = Base64.getDecoder().decode(s.getBytes(StandardCharsets.UTF_8)); + String decodeStr = new String(decode, "UTF-8"); + System.out.println(decodeStr); + String decode1 = URLDecoder.decode(decodeStr, "UTF-8"); + System.out.println(decode1); + JSONObject jsonObject = JSON.parseObject(decode1); + System.out.println(jsonObject); +// Map stringObjectMap = FaDDRequestUtils.checkCompanyInfo(map); +// System.out.println(JSON.toJSONString(stringObjectMap)); + } + + @Test + public void testDown() throws UnsupportedEncodingException { + FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig("45", 2); + System.out.println(JSONObject.toJSONString(faDaDaConfigDTO)); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(faDaDaConfigDTO.getParamsConfig()); +// System.out.println(JSONObject.toJSONString(apiConfigMainDTO)); +// FaDDController faDDController = new FaDDController(); +// faDDController.getAllVersion("45"); +// FaDDServiceImpl faDDService = new FaDDServiceImpl(); +// faDDService.queryContractStatus("45","68072"); +// faDDController.signedContract("45","68072"); +// Response response = faDDController.contractDownload("68072"); +// Response response1 = faDDController.contractDownload("68072"); +// System.out.println(response); +// System.out.println(response1); +// FaDDServiceImpl faDDService = new FaDDServiceImpl(); +// StreamingOutput contractZipStream = faDDService.contractDownload("68072"); +// Response build = Response.ok(contractZipStream) +// .type("application/zip") +// .header("Content-Disposition", "attachment;filename=contracts.zip").build(); +// System.out.println(build); +// String str = "public.docx"; +// System.out.println(str.substring(0,str.indexOf("."))); +// FaDDRequestUtils.downContract(ParaMap.create().put("contractNo","bc8485e3ce1343f5bc898325f371d739")); +// FaDDServiceImpl faDDService = new FaDDServiceImpl(); +// faDDService.queryContractStatus("45","68072"); + +// ModeDataIdUpdate modeDataIdUpdate = ModeDataIdUpdate.getInstance(); +// ModeRightInfo mr = new ModeRightInfo(); +// mr.rebuildModeDataShareByEdit(1, 11, Util.getIntValue("5"));//数据权限重构 + } + + + + + @Test + public void testCha() throws IOException { + List list = new ArrayList<>(); + List list_rm = new ArrayList<>(); + List list1 = new ArrayList<>(); + List list1_rm = new ArrayList<>(); + list.add("1"); + list.add("2"); + list.add("3"); + list.add("4"); + list.add("5"); + list.add("6"); + list.add("7"); + list.add("8"); + list1.add("2"); + list1.add("4"); + list1.add("6"); + list1.add("8"); + list1.add("10"); + list1.add("20"); + for (String s : list) { + for (String s1 : list1) { + if (s.equals(s1)) { + list_rm.add(s); + list1_rm.add(s1); + } + } + } + list.removeAll(list_rm); + list1.removeAll(list1_rm); +// Util_DataCache.setObjVal("list_123",list,20); + System.out.println(list); + System.out.println(list1); + } + + @Test + public void getCache() { + List list = (List) Util_DataCache.getObjVal("list_123"); + System.out.println(list); + } + + + + @Test + public void testInvoiceConfig() { + InvoiceMapping invoiceMapping = new InvoiceMapping(); + UfInvoiceConfigDTO configInfo = invoiceMapping.getConfigInfo("48"); + System.out.println(JSON.toJSONString(configInfo)); + } + + @Test + public void testIncoiceCheck(){ + Map testData = new HashMap<>(); + testData.put("requestId","171172"); + testData.put("workflowId","48"); + InvoiceService invoiceService = new InvoiceService(); + Map result = invoiceService.contrastInvoiceInfo(testData); + System.out.println(JSON.toJSONString(result)); + } + + @Test + public void testIncoiceCheckController(){ + Map testData = new HashMap<>(); + testData.put("requestId","171172"); + testData.put("workflowId","48"); + InvoiceController invoiceController = new InvoiceController(); + String result = invoiceController.check(null, null, testData); + System.out.println(result); + } + + +} diff --git a/customization/test/NewTest.java b/customization/test/NewTest.java new file mode 100644 index 0000000..7d8a461 --- /dev/null +++ b/customization/test/NewTest.java @@ -0,0 +1,480 @@ +package customization.test; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.entity.FnainvoiceinterfaceDTO; +import aiyh.utils.httpUtil.HttpArgsType; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.httpUtil.util.HttpUtils; +import aiyh.utils.mapUtil.UtilLinkedHashMap; +import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import aiyh.utils.sqlUtil.whereUtil.impl.PrepWhereImpl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping; +import com.api.aiyh_pcn.fadada.service.impl.FaDDServiceImpl; +import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils; +import com.weaver.general.TimeUtil; +import org.apache.axiom.util.base64.Base64Utils; +import org.apache.commons.codec.binary.Hex; +import org.apache.http.HttpEntity; +import org.junit.Test; +import weaver.conn.RecordSet; +import weaver.file.ImageFileManager; +import weaver.formmode.data.ModeDataIdUpdate; +import weaver.formmode.setup.ModeRightInfo; +import weaver.general.xcommon.IOUtils; +import weaver.hrm.User; +import weaver.soa.workflow.FileProcessor; +import weaver.workflow.workflow.WorkflowVersion; + +import java.io.*; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/30 0030 12:50 + * xinceshilei + */ + + +public class NewTest extends BaseTest { + + public static Predicate distinctByKey(Function keyExtractor) { + Map seen = new ConcurrentHashMap<>(); +// putIfAbsent添加不存在的键,返回null,如果为null表示不重复 + return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; + } + + public static String string2SHA256(String str) { + MessageDigest messageDigest; + String encdeStr = ""; + try { + messageDigest = MessageDigest.getInstance("SHA-256"); + byte[] hash = messageDigest.digest(str.getBytes(StandardCharsets.UTF_8)); + encdeStr = Hex.encodeHexString(hash); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return encdeStr.toUpperCase(); + } + + @Test + public void testNewSQL() { + String sql = "select * from workflow_base"; + RecordSet rs = new RecordSet(); + rs.executeQuery(sql); + List> maps = Util.recordSet2MapList(rs); + System.out.println(maps); + System.out.println("jiehus"); + } + + @Test + public void test() { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid("45"); + System.out.println(versionStringByWfid); + } + + @Test + public void createJavaFile() throws IOException { + String query = ""; + /*query = "select main.id,main.workflow_type, wf.fieldname field_control, " + + "(select GROUP_CONCAT('',selectvalue,'') result from workflow_selectitem where FIND_IN_SET(id,main.check_personal)) check_personal, " + + "(select GROUP_CONCAT('',selectvalue,'') result from workflow_selectitem where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " + + "main.check_source_type,wdt.tablename check_source " + + "from uf_attestation_conf main " + + "left join workflow_field_table_view wf on wf.id = main.field_control " + + "left join workflow_detail_table_view wdt on wdt.id = main.check_source and wdt.workflow_id = main.workflow_type"; + query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " + + "dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql,dt.api_type " + + "from uf_attestation_conf_dt1 dt " + + "left join workflow_field_table_view wf on wf.id = dt.workflow_field "; + */ + /*query = "select dt.id,dt.line_num,dt.param_name,dt.param_type,dt.object_child,dt.parent_line,dt.change_rule, " + + "dt.param_value,wf.fieldname workflow_field,wf.tablename tablename,dt.array_sql " + + "from uf_api_param_config_dt1 dt " + + "left join workflow_field_table_view wf on wf.id = dt.workflow_field "; + Util.creatJavaFileBySql(query, "ApiConfigDetail", "aiyh.utils.entity"); + query = "select id,workflow_type,api_url,api_name from uf_api_param_config "; + Util.creatJavaFileBySql(query, "ApiConfigMain", "aiyh.utils.entity");*/ + /*query = "select main.id,main.workflow_type,main.api_type, main.params_config, " + + "wf.fieldname field_control, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_personal)) check_personal, " + + "(select GROUP_CONCAT('',selectvalue,'') selectvalue from workflow_selectitem where FIND_IN_SET(id,main.check_enterprise)) check_enterprise, " + + "main.check_source_type,wdt.tablename check_source " + + "from uf_contract_config main " + + "left join workflow_field_table_view wf on wf.id = main.field_control " + + "left join workflow_detail_table_view wdt on wdt.id = main.check_source and wdt.workflow_id = main.workflow_type ";*/ + + query = "select * from uf_multi_language_dt1"; + Util.creatJavaFileBySql(query, "MultiLanguage", "aiyh.utils.entity"); + } + + @Test + public void testQueryConf() { + FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); +// FaDDConfigMainDTO configParam = faDDServiceMapping.getConfigParam("45"); +// System.out.println(JSON.toJSONString(configParam)); + } + + @Test + public void testSubString() { + String str = "formtable_main_17_dt1"; + System.out.println(str.substring(str.indexOf("_dt") + 3)); + } + + @Test + public void pattern() { + String str = "流程的requestid{{$requestId}}流程路径的{{$workflowid}}我不知道{{main.test}}对不对,{{detail.field}}"; + String pattern = "\\{{2}(?

((?!\\$)\\S)+?)\\.(?\\S+?)}{2}"; + String pattern1 = "\\{{2}\\$(?(\\S)+?)}{2}"; + Pattern compile1 = Pattern.compile(pattern1); + Matcher matcher1 = compile1.matcher(str); +// while (matcher1.find()){ +// str = str.replaceFirst(pattern1,matcher1.group("value")); +// System.out.println(str); +// System.out.println(matcher1.group("value")); +// } + Pattern compile = Pattern.compile(pattern); + Matcher matcher = compile.matcher(str); + while (matcher.find()) { + System.out.println(matcher.group("table")); + System.out.println(matcher.group("field")); + } + System.out.println(matcher); + } + + @Test + public void testParsingSql() { + Map params = new HashMap<>(); + params.put("requestId", "67544"); + params.put("workflowId", "45"); + params.put("main.field", null); + params.put("main.field1", "field1"); + params.put("main.field2", "field2"); + params.put("main.field3", "field3"); + String map = Util.parsingSq("select * from maintable where " + + "test1 = {{main.field1}} and " + + "test2 = {{main.field2}} and " + + "test3 = {{main.field}} and " + + "test4 = {{main.field1}} and " + + "test5 = {{main.field3}}", params); + System.out.println(map); + } + + @Test + public void testParsingSqlByWorkflowId() { + Map params = new HashMap<>(); + params.put("requestId", "67544"); + params.put("workflowId", "45"); + params.put("main.field", "field"); + params.put("main.field1", "field1"); + params.put("main.field2", "field2"); + params.put("main.field3", "field3"); + params.put("main.indata", "1,2,3,4,5,6"); + String result = "select * from maintable where " + + "test1 = {{main.field1}} and " + + "test2 = {{main.field2}} and " + + "test3 = {{main.field}} and " + + "test4 = {{main.field1}} and " + + "test5 = {{main.field3}} and " + + "id in (#{{main.indata}})"; + String s = Util.parsingSq(result, params); + System.out.println(s); + + } + + @Test + public void testImp() { + FaDDServiceImpl faDDService = new FaDDServiceImpl(); +// Map configParam1 = faDDService.getConfigParam1("45"); +// System.out.println(JSON.toJSONString(configParam1)); +// Map configParam = faDDService.getConfigParam("45"); +// System.out.println(JSON.toJSONString(configParam)); +// Map map = new HashMap<>(); +// map.put("workflowId","45"); +// map.put("dataArr",new ArrayList(){{ +// TableFieldMappingVO tableFieldMappingVO = new TableFieldMappingVO(); +// tableFieldMappingVO.setField("field"); +// tableFieldMappingVO.setTableName("tableName"); +// add(tableFieldMappingVO); +// TableFieldMappingVO tableFieldMappingVO1 = new TableFieldMappingVO(); +// tableFieldMappingVO1.setField("field1"); +// tableFieldMappingVO1.setTableName("tableName1"); +// add(tableFieldMappingVO1); +// }}); +// faDDService.checkCertification(map); + + Map map = new HashMap<>(); + List> dataArr = new ArrayList>() {{ + Map map = new HashMap<>(); + map.put("detail_1.gyshtfmczw", "gyshtfmczw-value-api"); + map.put("detail_1.tyshxydm", "gyshtflb-value-api"); + add(map); + Map map1 = new HashMap<>(); + map1.put("detail_1.gyshtfmczw", "gyshtfmczw1-value-api"); + map1.put("detail_1.tyshxydm", "gyshtflb1-value-api"); + add(map1); + Map map2 = new HashMap<>(); + map2.put("detail_1.gyshtfmczw", "gyshtfmczw2-value-api"); + map2.put("detail_1.tyshxydm", "gyshtflb2-value-api"); + add(map2); + Map map3 = new HashMap<>(); + map3.put("detail_1.gyshtfmczw", "gyshtfmczw3-value-api"); + map3.put("detail_1.tyshxydm", "gyshtflb3-value-api"); + add(map3); + Map map4 = new HashMap<>(); + map4.put("detail_1.gyshtfmczw", "gyshtfmczw4-value-api"); + map4.put("detail_1.tyshxydm", "gyshtflb4-value-api"); + add(map4); + }}; + map.put("dataArr", dataArr); + map.put("workflowId", "45"); + Map stringObjectMap = faDDService.checkCertification(map); +// faDDService.checkCertification1(map); + System.out.println(stringObjectMap); + } + + @Test + public void testMap() { + List list = new ArrayList() {{ + add("测试"); + add("测试1"); + add("测试2"); + add("测试3"); + add("测试4"); + add("测试"); + }}; + List collect = list.stream().map(item -> item + "[aaa]").collect(Collectors.toList()); + System.out.println(collect); + System.out.println(list); + } + + @Test + public void testHttp() throws UnsupportedEncodingException { + HttpUtils httpUtils = new HttpUtils(); + Map header = httpUtils.getGlobalCache().header; + header.put("appId", "100001"); + header.put("signType", "SHA256"); + header.put("timestamp", Util.getTime("yyyy-MM-dd HH:mm:ss")); + Map data = new HashMap<>(); + data.put("companyName", "公司名称"); + data.put("creditNo", "统一社会信用代码"); + String jsonString = JSONObject.toJSONString(data); + String encode = URLEncoder.encode(jsonString, "UTF-8"); + String bizContent = Base64.getEncoder().encodeToString(encode.getBytes(StandardCharsets.UTF_8)); + header.put("bizContent", bizContent); + StringBuilder signBuilder = new StringBuilder(); + String signStr = signBuilder.append("appId=").append(header.get("appId")) + .append("&bizContent=").append(header.get("bizContent")) + .append("&signType=").append(header.get("signType")) + .append("×tamp=").append(header.get("timestamp")).toString(); + System.out.println(signStr); + String appkey = "L7P59oqA2An0XgJ1LeMN0fRu1"; + String sha256 = string2SHA256(signStr) + appkey; + String sign = Base64.getEncoder().encodeToString(string2SHA256(sha256).getBytes(StandardCharsets.UTF_8)); + System.out.println(sign); + header.put("sign", sign); + header.put("apikey", "TulQxnZSRKeHoQfmeZzOUzGn6KpTDkDK"); + header.put("Content-Type", HttpArgsType.APPLICATION_JSON); + try { + ResponeVo responeVo = httpUtils.apiPost("http://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/account/company/info", + data, null); + System.out.println(responeVo.getEntityString()); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + public void testApi() { + + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig("2"); + } + + + @Test + public void getCode() { + Map map = new HashMap<>(); + map.put("companyName", "陕西正天建设有限公司"); + map.put("creditNo", "916100007273444965"); + Map stringObjectMap = FaDDRequestUtils.checkCompanyInfo(map); + System.out.println(JSON.toJSONString(stringObjectMap)); + } + + + @Test + public void testBatch() { + List> list = new ArrayList<>(); + List whereList = new ArrayList<>(); + for (int i = 0; i < 50; i++) { + int finalI = i; + list.add(new UtilLinkedHashMap() {{ + put("mobile", "1111111" + finalI); + }}); + whereList.add(new PrepWhereImpl().whereAnd("id").whereEqual(22 + finalI)); + } + BatchSqlResultImpl hrmresource = Util.createSqlBuilder().updateBatchSql("hrmresource", list, whereList); + RecordSet rs = new RecordSet(); + long l = System.currentTimeMillis(); + boolean b = rs.executeBatchSql(hrmresource.getSqlStr(), hrmresource.getBatchList()); + long l1 = System.currentTimeMillis(); + System.out.println(l1 - l); + System.out.println(b); + } + + @Test + public void testUpdate() { + long constTime = 0L; + RecordSet rs = new RecordSet(); + for (int i = 0; i < 50; i++) { + int finalI = i; + UtilLinkedHashMap mobile = new UtilLinkedHashMap() {{ + put("mobile", "111111" + finalI); + }}; + Where id = new PrepWhereImpl().whereAnd("id").whereEqual(22 + finalI); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql("hrmresource", mobile, id); + long l = System.currentTimeMillis(); + boolean b = rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + long l1 = System.currentTimeMillis(); + constTime += (l1 - l); + System.out.println(b); + } + System.out.println(constTime); + } + + + @Test + public void testSuffix() { + String str = "【保时捷】合同管理需求文档-第一阶段流程V5.3.pdf"; + String substring = str.substring(str.lastIndexOf(".")); + System.out.println(substring); + } + + + @Test + public void testUpload() { + RecordSet rs = new RecordSet(); + String query = "select * from formtable_main_17_dt1 where mainid = 5"; + rs.executeQuery(query); + List> maps = Util.recordSet2MapList(rs); + System.out.println(JSONObject.toJSONString(maps)); +// Map map = Util.queryLanguage(1, 8); +// System.out.println(map); + + } + + @Test + public void invoice() throws IOException { + String query = "select * from fnainvoiceinterface where interfaceType=2 and status=1 and subIdStatus=0"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query); + FnainvoiceinterfaceDTO fnainvoiceinterfaceDTO = Util.recordeSet2Entity(rs, FnainvoiceinterfaceDTO.class); + System.out.println(fnainvoiceinterfaceDTO); +// Util.creatJavaFileByTable("fnainvoiceinterface","aiyh.utils.entity"); + } + + + @Test + public void testLanguage() { + System.out.println(Util.getHtmlLabelName(1, 7, "不知道")); + } + + @Test + public void createJava() throws IOException { + Util.creatJavaFileByTable("uf_invoice_config", "com.api.aiyh_kafang.entity"); + } + + @Test + public void testUtil() { + RecordSet rs = new RecordSet(); + rs.executeQuery("select formid from workflow_base where id = 45"); + String s = Util.recordeSet2Entity(rs, String.class); + System.out.println(s); + } + + + @Test + public void testMode() { + ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance(); + String formModeId = "52"; + int dataid = mdu.getModeDataNewId("uf_contract_config", + Util.getIntValue(formModeId, -1), + 1, 0, TimeUtil.getCurrentDateString(), + TimeUtil.getOnlyCurrentTimeString()); + //数据权限重构 + ModeRightInfo mri = new ModeRightInfo(); + mri.rebuildModeDataShareByEdit(1, Util.getIntValue(formModeId, -1), 1); + + } + + @Test + public void donwTest() throws IOException { + Map data = new HashMap<>(); + data.put("contractNo", "bda970602f4a4e1dbe37ee9c43908cfc"); + AtomicReference content = new AtomicReference<>(); + FaDDRequestUtils.downContract(data, response -> { + HttpEntity entity = response.getEntity(); + if (response.getStatusLine().getStatusCode() != 200) { + throw new RuntimeException("法大大请求接口错误!"); + } + try { + content.set(entity.getContent()); + } catch (IOException e) { + e.printStackTrace(); + } + InputStream inputStream = content.get(); + try { + byte[] bytes = IOUtils.toByteArray(inputStream); + } catch (IOException e) { + e.printStackTrace(); + } + }, "https://apigwaws-lite.porsche-cloudservice.com/env-101/econtract/econtract/contract/api/v1/contract/download"); + } + + + @Test + public void testBase642system() throws IOException { + String path = "C:\\Users\\77449\\Downloads\\154157.pdf"; + InputStream is = new FileInputStream(path); + byte[] bytes = IOUtils.toByteArray(is); + String base64 = Base64Utils.encode(bytes); + FileProcessor fileProcessor = new FileProcessor(); + User user = new User(); + user.setUid(1); + user.setLogintype("1"); + int process = fileProcessor.Process("base64:"+base64, ",,88", user, "测试合同下载保存.pdf"); + System.out.println(process); + } + + @Test + public void downPDF() throws IOException { + InputStream inputStreamById = ImageFileManager.getInputStreamById(3618); + OutputStream out = new FileOutputStream("C:\\Users\\77449\\Downloads\\154157合同测试.pdf"); + int cache = 1024 * 10; + byte[] bytes = new byte[cache]; + int len = 0; + while ((len = inputStreamById.read(bytes)) != -1){ + out.write(bytes,0,len); + } + out.flush(); + out.close(); + } + +} + + + diff --git a/customization/test/PsApiTest.java b/customization/test/PsApiTest.java new file mode 100644 index 0000000..05fc3ed --- /dev/null +++ b/customization/test/PsApiTest.java @@ -0,0 +1,22 @@ +package customization.test; + +import aiyh.utils.ApiResult; +import com.api.aiyh_guijiu.service.WorkflowQueueService; +import org.junit.Test; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/16 0016 14:22 + * 会议接口测试 + */ + + +public class PsApiTest extends BaseTest { + + @Test + public void test() { + WorkflowQueueService workflowQueueService = new WorkflowQueueService(); + String picIsPs = workflowQueueService.getPicIsPs("73"); + System.out.println(picIsPs); + } +} diff --git a/customization/test/TestAction.java b/customization/test/TestAction.java new file mode 100644 index 0000000..52fc921 --- /dev/null +++ b/customization/test/TestAction.java @@ -0,0 +1,370 @@ +package customization.test; + +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSON; +import com.api.aiyh_guijiu.service.WorkflowQueueService; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.ibm.icu.text.SimpleDateFormat; +import com.interfaces.toolkit.SSOLoginUtil; +import km.org.apache.poi.hssf.usermodel.HSSFCellStyle; +import km.org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.usermodel.*; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.h2.util.StringUtils; +import org.junit.Test; +import aiyh.utils.HotDeployToolUtil; +import tebie.applib.api.M; +import weaver.aiyh_pcn.async_organization.SyncOrganizationForOtherAPI; +import weaver.aiyh_pcn.async_organization.model.Department; +import weaver.aiyh_pcn.async_organization.model.Employee; +import weaver.aiyh_pcn.async_organization.model.Position; +import weaver.aiyh_pcn.async_organization.result.ApiAsyncConfigResult; +import weaver.aiyh_pcn.async_organization.result.GetOrganizationResult; +import weaver.aiyh_pcn.async_organization.util.GetModelValue; +import weaver.aiyh_quanshi.QsAPI; +import weaver.aiyh_quanshi.RequestApi; +import weaver.aiyh_quanshi.entity.QsResponse; +import weaver.conn.RecordSet; + +import java.io.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.net.URL; +import java.util.*; + +/** + * @author liutaihong + * @version 1.0.0 + * @ClassName TestAction.java + * @Description TODO + * @createTime 2020-05-15 10:55:00 + */ +public class TestAction extends BaseTest { + + + @Test + public void testHot() throws ClassNotFoundException, InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException, InterruptedException { + int i = 0; + while (true) { + + HotDeployToolUtil hotDeployToolUtil = new HotDeployToolUtil("d:\\WEAVER\\ecology\\classbean\\", ""); + Class aClass = hotDeployToolUtil.loadClass("com.api.aiyhTools.TestHot"); + Object o = aClass.newInstance(); + Method test = o.getClass().getMethod("test"); + Object invoke = test.invoke(o); + Thread.sleep(1000); + System.out.println(invoke); + if (i > 100) { + return; + } + i++; + } + } + + + @Test + public void testFile() throws ClassNotFoundException { + HotDeployToolUtil hotDeployTool = new HotDeployToolUtil("d:\\WEAVER\\ecology\\classbean\\", ""); + hotDeployTool.findClass("com\\api\\aiyhTools\\HotDeployTool.class"); + } + + @Test + public void testLog4j() { + ToolUtil toolUtil = new ToolUtil(); + toolUtil.writeDebuggerLog("TestAction", "i am is test log4j method, are you ok?"); + } + + @Test + public void getDate() { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); +// return "?date=" + formatter.format(date); + System.out.println("?date=" + formatter.format(date)); + } + + @Test + public void testAsync() { + SyncOrganizationForOtherAPI syncOrganization = new SyncOrganizationForOtherAPI(); + syncOrganization.SynTimingToOADepartment(); + syncOrganization.SynTimingToOAJobtitle(); + syncOrganization.SynTimingToOAHrmResource(); + } + + @Test + public void testString() { + RecordSet rs = new RecordSet(); + rs.executeProc("HrmResourceMaxId_Get", ""); + rs.next(); + int hrmid = rs.getInt(1); + System.out.println(hrmid); + StringBuilder sysSetSql = new StringBuilder(); + System.out.println(StringUtils.isNullOrEmpty(null)); + System.out.println(sysSetSql.lastIndexOf(",")); + String str = "q=1,w=2,e=3,"; + System.out.println(str.substring(0, str.lastIndexOf(","))); + } + + @Test + public void testCallMethod() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + ApiAsyncConfigResult asyncConfigResult = new ApiAsyncConfigResult(); + asyncConfigResult.setId(1); + asyncConfigResult.setAsyncType(0); + asyncConfigResult.setApiField("apiField"); + asyncConfigResult.setoAField("oAField"); + asyncConfigResult.setFieldType(1); + asyncConfigResult.setChangeRules(2); + asyncConfigResult.setCustomRules("customRules"); + String str = "Id"; + GetModelValue apiAsyncConfigResultGetModelValue = new GetModelValue<>(); + Object id = apiAsyncConfigResultGetModelValue.getValueForString(asyncConfigResult, "Id"); +// Class clazz = asyncConfigResult.getClass(); +// Method getId = clazz.getDeclaredMethod("get" + str); +// Object invoke = getId.invoke(asyncConfigResult); + System.out.println(id); + } + + + @Test + public void testQueryConfigTableInfo() { + GetModelValue getModelValue = new GetModelValue<>(); + Position position = new Position(); + position.setCompany_Code("public static void main test~"); + + this.builderSql("Company_Code", position, getModelValue); + } + + public void builderSql(String filedName, Object obj, GetModelValue getModelValue) { + // 拼接系统部门字段 + try { + String value = getModelValue.getValueForString(obj, filedName).toString(); + System.out.println(value); + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + e.printStackTrace(); + } + } + + @Test + public void testSyncOrganizationForOtherAPI() { + new SyncOrganizationForOtherAPI().SynTimingToOADepartment(); + } + + @Test + public void testFormatSql() { + Map map = new HashMap<>(); + URL resource = Thread.currentThread().getContextClassLoader().getResource(""); + String path = resource.getPath().replaceFirst("/", "").replace("/", "\\"); + map.put("packageName", "com.api.aiyhTools"); + map.put("filePath", path); + map.put("path", path); + map.put("classPath", path + "com.api.aiyhTools".replace(".", System.getProperties().getProperty("file.separator"))); + System.out.println(map); + File file = new File((String) map.get("classPath")); + if (file.exists()) { + System.out.println(map.get("classPath")); + } + } + + @Test + public void testWritExcel() throws IOException { + GetOrganizationResult getOrganizationResult = new GetOrganizationResult(); + List employeeList = getOrganizationResult.getEmployeeList(); + SXSSFWorkbook sxssfWorkbook = new SXSSFWorkbook(); + CellStyle cellStyle = sxssfWorkbook.createCellStyle(); + // 设置单元格居中对齐 + cellStyle.setAlignment(HorizontalAlignment.forInt(HSSFCellStyle.ALIGN_CENTER)); + Font font = sxssfWorkbook.createFont(); + font.setColor(HSSFColor.RED.index); + cellStyle.setFont(font); + Sheet sheet = sxssfWorkbook.createSheet("人员信息"); + Row desc = sheet.createRow(0); + sheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 13)); + Cell cell2 = desc.createCell(0); + cell2.setCellValue("员工信息表,同步数据时,按照岗位id进行同步!"); + cell2.setCellStyle(cellStyle); + Row th = sheet.createRow(1); + th.createCell(0).setCellValue("员工ID"); + th.createCell(1).setCellValue("名(英文)"); + th.createCell(2).setCellValue("姓(英文)"); + th.createCell(3).setCellValue("中文姓名"); + th.createCell(4).setCellValue("英文名"); + th.createCell(5).setCellValue("员工编号"); + th.createCell(6).setCellValue("岗位ID"); + th.createCell(7).setCellValue("部门ID"); + th.createCell(8).setCellValue("部门名称"); + th.createCell(9).setCellValue("成本中心编码"); + th.createCell(10).setCellValue("邮箱"); + th.createCell(11).setCellValue("公司实体"); + th.createCell(12).setCellValue("电话号"); + th.createCell(13).setCellValue("座机号"); + for (int i = 0; i < employeeList.size(); i++) { + Employee e = employeeList.get(i); + Row row = sheet.createRow(i + 2); + row.createCell(0).setCellValue(e.getUserID()); + row.createCell(1).setCellValue(e.getFIRSTNAMEEN()); + row.createCell(2).setCellValue(e.getLASTNAMEEN()); + row.createCell(3).setCellValue(e.getUSERNAMECN()); + row.createCell(4).setCellValue(e.getPreferred_Name()); + row.createCell(5).setCellValue(e.getUSERCODE()); + row.createCell(6).setCellValue(e.getJOBCODEID()); + row.createCell(7).setCellValue(e.getDEPARTMENTID()); + row.createCell(8).setCellValue(e.getDEPARTMENTNAME()); + row.createCell(9).setCellValue(e.getCOSTCENTERCODE()); + row.createCell(10).setCellValue(e.getEMAIL()); + row.createCell(11).setCellValue(e.getORGANIZATION()); + row.createCell(12).setCellValue(e.getMOBILENO()); + row.createCell(13).setCellValue(e.getTEL()); + } + + List departmentList = getOrganizationResult.getDepartmentList(); + Sheet depSheet = sxssfWorkbook.createSheet("部门信息"); + Row depdesc = depSheet.createRow(0); + depSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 2)); + Cell cell1 = depdesc.createCell(0); + cell1.setCellValue("部门信息表,同步数据时按照该上级部门id进行排序同步!红色字体为根部门!"); + cell1.setCellStyle(cellStyle); + Row depTh = depSheet.createRow(1); + depTh.createCell(0).setCellValue("部门ID"); + depTh.createCell(1).setCellValue("部门名称"); + depTh.createCell(2).setCellValue("上级部门"); + for (int i = 0; i < departmentList.size(); i++) { + Row row = depSheet.createRow(i + 2); + Department d = departmentList.get(i); + row.createCell(0).setCellValue(d.getDEPARTMENTID()); + row.createCell(1).setCellValue(d.getDEPARTMENTNAME()); + Cell cell = row.createCell(2); + cell.setCellValue(d.getPARENTDEPARTMENDID()); + if (d.getPARENTDEPARTMENDID() == 0) { + cell.setCellStyle(cellStyle); + } + } + + List positionList = getOrganizationResult.getPositionList(); + Sheet posSheet = sxssfWorkbook.createSheet("职位信息"); + Row posdesc = posSheet.createRow(0); + posSheet.addMergedRegion(new CellRangeAddress(0, 0, 0, 3)); + Cell cell3 = posdesc.createCell(0); + cell3.setCellValue("职位信息表,职位同步过程中以上级岗位id升序排序进行同步!"); + cell3.setCellStyle(cellStyle); + Row posTh = posSheet.createRow(1); + posTh.createCell(0).setCellValue("岗位编号"); + posTh.createCell(1).setCellValue("岗位编号"); + posTh.createCell(2).setCellValue("岗位描述"); + posTh.createCell(3).setCellValue("上级岗位ID"); + for (int i = 0; i < positionList.size(); i++) { + Row row = posSheet.createRow(i + 2); + Position p = positionList.get(i); + row.createCell(0).setCellValue(p.getJOBCODEID()); + row.createCell(1).setCellValue(p.getJOBCODE()); + row.createCell(2).setCellValue(p.getJOBFUNCTION()); + row.createCell(3).setCellValue(p.getSUPERIORJOBCODEID()); + } + + + File file = new File("F:\\fanwei\\cms_async\\cms_data_proud.xlsx"); + if (!file.exists()) { + //先得到文件的上级目录,并创建上级目录,在创建文件 + file.getParentFile().mkdir(); + try { + //创建文件 + file.createNewFile(); + } catch (IOException e) { + e.printStackTrace(); + } + } + FileOutputStream fileOutputStream = new FileOutputStream(file); + //写入文件 + sxssfWorkbook.write(fileOutputStream); + + fileOutputStream.close(); + } + + + @Test + public void testSyncOrganization() throws IOException { + GetOrganizationResult getOrganizationResult = new GetOrganizationResult(); + List employeeList = getOrganizationResult.getEmployeeList(); + System.out.println(employeeList.size()); + BufferedWriter employeeListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\employee-list.json")); + employeeListOut.write(JSON.toJSONString(employeeList)); + employeeListOut.close(); + List departmentList = getOrganizationResult.getDepartmentList(); + BufferedWriter departmentListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\department-list.json")); + departmentListOut.write(JSON.toJSONString(departmentList)); + departmentListOut.close(); + System.out.println(departmentList.size()); + List positionList = getOrganizationResult.getPositionList(); + BufferedWriter positionListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\position-list.json")); + positionListOut.write(JSON.toJSONString(positionList)); + positionListOut.close(); + System.out.println(positionList.size()); + } + + @Test + public void testContains() { + + String str = "select d.id,m.api_field_type,d.api_field,d.change_rules,d.custom_rules_value,d.ao_field,oa_field_type from uf_cms_async as m inner join uf_cms_async_dt1 as d on d.mainid = m.id"; + RecordSet rs = new RecordSet(); + rs.executeQuery(str); + rs.next(); + System.out.println(rs.getString(0)); + } + + @Test + public void testSortEmployee() throws IOException { + GetOrganizationResult getOrganizationResult = new GetOrganizationResult(); + List employeeList = getOrganizationResult.getEmployeeList(); + Collections.sort(employeeList); + System.out.println(employeeList.size()); + BufferedWriter employeeListOut = new BufferedWriter(new FileWriter("F:\\fanwei\\employee-list-sort.json")); + employeeListOut.write(JSON.toJSONString(employeeList)); + employeeListOut.close(); + } + + + @Test + public void testCav(){ + Map map = new HashMap<>(); + map.put("contrast","[{\n" + + "\t\"start\": \"fieldName\",\n" + + "\t\"tableName\": \"databaseTableName\",\n" + + "\t\"end\": \"endFieldName\",\n" + + "\t\"workflowId\": 9,\n" + + "\t\"user\": 10\n" + + "}, {\n" + + "\t\"start\": \"fieldName\",\n" + + "\t\"tableName\": \"databaseTableName\",\n" + + "\t\"end\": \"endFieldName\",\n" + + "\t\"workflowId\": 9,\n" + + "\t\"user\": 10\n" + + "}, {\n" + + "\t\"start\": \"fieldName\",\n" + + "\t\"tableName\": \"databaseTableName\",\n" + + "\t\"end\": \"endFieldName\",\n" + + "\t\"workflowId\": 9,\n" + + "\t\"user\": 10\n" + + "}]"); + WorkflowQueueService workflowQueueService = new WorkflowQueueService(); + workflowQueueService.getWorkflowQueue(map); + } + + + @Test + public void testEmailgetID(){ + RequestApi requestApi = new RequestApi(); + QsResponse userIdsByEmails = requestApi.getInfoByEmail( new ArrayList() {{ + add("ZhangYun03@saicmotor.com"); + }}); + Map resultMap = new HashMap<>(); + + ObjectMapper mapper = new ObjectMapper(); + try { + resultMap = mapper.readValue(userIdsByEmails.getResult(), Map.class); + } catch (JsonProcessingException e) { +// toolUtil.writeErrorLog("请求结果转换失败,失败信息:" + e); + } + System.out.println(((Map) resultMap.get("ZhangYun03@saicmotor.com")).get("userId")); + System.out.println(userIdsByEmails); + } +} diff --git a/customization/test/TestCaseVo.java b/customization/test/TestCaseVo.java new file mode 100644 index 0000000..b2a26f9 --- /dev/null +++ b/customization/test/TestCaseVo.java @@ -0,0 +1,48 @@ +package customization.test; + +import aiyh.utils.annotation.DateFormatAn; + +import java.util.Date; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/3 0003 15:39 + * testVo + */ + + +public class TestCaseVo { + int id; + int requestId; + int workflowType; + int attachmentField; + int showField; + String modelTableName; + String modelField; + int showValue; + int hiddenValue; + int formmodeid; + String templateField; + String isTemplateShow; + @DateFormatAn("yyyy-MM-dd") + Date modedatacreatedate; + + @Override + public String toString() { + return "TestCaseVo{" + + "id=" + id + + ", requestId=" + requestId + + ", workflowType=" + workflowType + + ", attachmentField=" + attachmentField + + ", showField=" + showField + + ", modelTableName='" + modelTableName + '\'' + + ", modelField='" + modelField + '\'' + + ", showValue=" + showValue + + ", hiddenValue=" + hiddenValue + + ", formmodeid=" + formmodeid + + ", templateField='" + templateField + '\'' + + ", isTemplateShow='" + isTemplateShow + '\'' + + ", modedatacreatedate=" + modedatacreatedate + + '}'; + } +} diff --git a/customization/test/TestDBVo.java b/customization/test/TestDBVo.java new file mode 100644 index 0000000..94c61f2 --- /dev/null +++ b/customization/test/TestDBVo.java @@ -0,0 +1,31 @@ +package customization.test; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/3 0003 14:59 + * shujv + */ + + +public class TestDBVo { + int id; + String fieldname; + String indexdesc; + String tablename; + int billid; + String showtablename; + int fieldhtmltype; + + @Override + public String toString() { + return "TestDBVo{" + + "id=" + id + + ", fieldname='" + fieldname + '\'' + + ", indexdesc='" + indexdesc + '\'' + + ", tablename='" + tablename + '\'' + + ", billid=" + billid + + ", showtablename='" + showtablename + '\'' + + ", fieldhtmltype=" + fieldhtmltype + + '}'; + } +} diff --git a/customization/test/TestRecordUtil.java b/customization/test/TestRecordUtil.java new file mode 100644 index 0000000..ad17c6d --- /dev/null +++ b/customization/test/TestRecordUtil.java @@ -0,0 +1,33 @@ +package customization.test; + + +import customization.commons.Console; +import org.junit.Test; +import weaver.conn.RecordSet; + +/** + * @author liutaihong + * @version 1.0.0 + * @ClassName TestRecordUtil.java + * @Description 本地调用服务器的实例, + * @createTime 2020-04-28 14:31:00 + */ +public class TestRecordUtil extends BaseTest { + + + @Test + public void with() { + String sql = "select COMPANYNAME,LICENSE,EXPIREDATE,CVERSION from license "; + RecordSet rs = new RecordSet(); + rs.executeQuery(sql); + if (rs.next()) { + System.out.println("公司名称:" + rs.getString(1)); + System.out.println("LICENSE:" + rs.getString(2)); + System.out.println("授权到期日期:" + rs.getString(3)); + System.out.println("版本:" + rs.getString(4)); + Console.log(sql); + } + } + + +} diff --git a/customization/test/TestVo.java b/customization/test/TestVo.java new file mode 100644 index 0000000..42fac8a --- /dev/null +++ b/customization/test/TestVo.java @@ -0,0 +1,71 @@ +package customization.test; + +import com.simplerss.dataobject.Item; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/31 0031 23:28 + * testVo + */ + + +public class TestVo { + boolean code; + String errorMessage; + String traceId; + int index; + List items; + + @Override + public String toString() { + return "TestVo{" + + "code=" + code + + ", errorMessage='" + errorMessage + '\'' + + ", traceId='" + traceId + '\'' + + ", index=" + index + + ", items=" + items + + '}'; + } + + public int getIndex() { + return index; + } + + public void setIndex(int index) { + this.index = index; + } + + public boolean isCode() { + return code; + } + + public void setCode(boolean code) { + this.code = code; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } +} diff --git a/customization/test/TestVoItem.java b/customization/test/TestVoItem.java new file mode 100644 index 0000000..7579db2 --- /dev/null +++ b/customization/test/TestVoItem.java @@ -0,0 +1,71 @@ +package customization.test; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/31 0031 23:29 + * testVoItem + */ + + +public class TestVoItem { + /** + * 货币 + */ + String currency; + /** + * 人民币 + */ + String localCurrency; + /** + * 汇率 + */ + String rate; + /** + * 有效期 + */ + String validDate; + + @Override + public String toString() { + return "TestVoItem{" + + "currency='" + currency + '\'' + + ", localCurrency='" + localCurrency + '\'' + + ", rate='" + rate + '\'' + + ", validDate='" + validDate + '\'' + + '}'; + } + + public String getCurrency() { + return currency; + } + + public void setCurrency(String currency) { + this.currency = currency; + } + + public String getLocalCurrency() { + return localCurrency; + } + + public void setLocalCurrency(String localCurrency) { + this.localCurrency = localCurrency; + } + + public String getRate() { + return rate; + } + + public void setRate(String rate) { + this.rate = rate; + } + + public String getValidDate() { + return validDate; + } + + public void setValidDate(String validDate) { + this.validDate = validDate; + } + + +} diff --git a/customization/test/UfTempAttachmentDTO.java b/customization/test/UfTempAttachmentDTO.java new file mode 100644 index 0000000..82b18e6 --- /dev/null +++ b/customization/test/UfTempAttachmentDTO.java @@ -0,0 +1,47 @@ +package customization.test; +public class UfTempAttachmentDTO{ + private int id; + private int requestId; + private int workflowType; + private String attachmentField; + private String showField; + private String modelTableName; + private String modelField; + private String showValue; + private String hiddenValue; + private int formmodeid; + private int modedatacreater; + private int modedatacreatertype; + private String modedatacreatedate; + private String modedatacreatetime; + private int modedatamodifier; + private String modedatamodifydatetime; + private String MODEUUID; + private String templateField; + private int isTemplateShow; + + @Override + public String toString() { + return "UfTempAttachmentDTO{" + + "id=" + id + + ", requestId=" + requestId + + ", workflowType=" + workflowType + + ", attachmentField='" + attachmentField + '\'' + + ", showField='" + showField + '\'' + + ", modelTableName='" + modelTableName + '\'' + + ", modelField='" + modelField + '\'' + + ", showValue='" + showValue + '\'' + + ", hiddenValue='" + hiddenValue + '\'' + + ", formmodeid=" + formmodeid + + ", modedatacreater=" + modedatacreater + + ", modedatacreatertype=" + modedatacreatertype + + ", modedatacreatedate='" + modedatacreatedate + '\'' + + ", modedatacreatetime='" + modedatacreatetime + '\'' + + ", modedatamodifier=" + modedatamodifier + + ", modedatamodifydatetime='" + modedatamodifydatetime + '\'' + + ", MODEUUID='" + MODEUUID + '\'' + + ", templateField='" + templateField + '\'' + + ", isTemplateShow=" + isTemplateShow + + '}'; + } +} \ No newline at end of file diff --git a/customization/test/UploadTest.java b/customization/test/UploadTest.java new file mode 100644 index 0000000..a0496bb --- /dev/null +++ b/customization/test/UploadTest.java @@ -0,0 +1,49 @@ +package customization.test; + +import org.apache.axiom.util.base64.Base64Utils; +import org.junit.Test; +import weaver.file.ImageFileManager; +import weaver.soa.workflow.FileProcessor; + +import javax.imageio.ImageIO; +import java.awt.*; +import java.awt.image.BufferedImage; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.net.URLDecoder; +import java.util.UUID; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/2 0002 11:11 + * shangchuan ceshi + */ + + +public class UploadTest extends BaseTest { + @Test + public void testBaseUpload() throws IOException { + String base = "/9j/4AAQSkZJRgABAQEAeAB4AAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCANBBMkDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3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KKWigAoo7UUAJRS0UAJRS9qKAEopaKADtS0lLQAlFLRimMKKKKQgoopaACijpRQAlFLSUALSUUtAB2ooooAKKKKACiiigBKKWigAooooAKKKWgBKWiigAooooAKKKKACikpaACiiigAooooAKMUUUAFFFFACd6O9LRQAlJS0UAFFFFABRR2ooAKKKKAEo7UtFABSUUUDCiikAxQIWkpaKACkpaKAE70UUUAFFLRQAlLSUUAFFFFAB2pKKKACiiigApKKWgBKKWkoAKKSigAooooAKO9FFABiiiigAooopAFFFLQAUlLRQAlFFGKYBRR2opAFFFFABRS0UDEo98UtFACUUtFIBKWjvRQAVDcnEYOO9T1Bdf6kfWsamxpAqCQE07cvtUe1c5xRtHpXCbo26KDRXrHIFJS0UAJRRRQAUUUUAFFGKKACkpcUUAJiilpKACiijFACUUuKKAEopaSgBKSnUlAhKWkooAKKKKACiiigYUUUlAC0lLRQAlFFFAgooooAKKWkoAO1FFFABRRS0AJR3paKACiiigApaSlpgFFFFABRS0UgEooooASloo7UAJS0UUAFFFFABR2oooAKPwoooAKKKWgAoooNABRRRQAd6O9FLQAlFLSUAFFFFABR2ooFABRRxRQAUUdqO1AB3ooooAKKSloASiiigAopaKACkoooAO9HejvRQAUUUUAFFHakoAKKWkoAWkoooAKKKKADtRRR3oAKKKKACiiigApKKKAEpaSloASiiigAooooAKKKKACik7UUABpKKKACiiigApaKKAEpe9FFAB2ooopAFApaSmAUUd6KACiiikAlFFFMAooopAFLRRQMKKKKACiiigApRSUo6UgCorjmD6GpelR3AzA1ZVNi4lHjtRS0mD6V573OhGzRRRXrnIHaiikoAKKKKACiig0AFLTefSgZ9KAHUlHtSZoAWim55xS0ALRTd1GeKAHUU3dRmgBaKTNGaADFFGaKAE70UGigQUUUUDEpaMUUAFJS0lABRRRQAd6MUUUAFFFFACUtFFACUUtFAhKKWigAoo7UUAFFFFAxe9FHSigQtFJS0AFFFFABRRSUALRRR7UAFFFFABRRRQAUUUUAFFFFABSUtHSgAo70UUAFFL3oxQAlLRiigAoxS0UAJiilooASkxTqKAG0UvajFACUUYoxQAUUUUAFFFFABRRRQAd6KO9FABRRRQAUUUUAFFFFACUUe1FABSUtFACUtFFACUUtFACUd6KKAA0Ue9FABRSGloASjvRRmgApKWkoAO9FFGeKACiiigBaSiigApKM0UAFFFFACUGlpM0ALS0lHpQAUUd6WgAopKWgApB0paKAE70UYooAKKKKQBSUvSkoAO1FFFMAoo70Uhi9aKKKACikpaADvS0lFIBaZMMwsPan0yX/AFLn2rOexcdyjjml2+9GRijeK857nQjXooor1zkCkpaSgApaKKAEprHCu3opP6U+o5jiCYntEx/SgDh9Ml1y80galceJIrOJ5mjUSxjHB9auxprtyzCy8V2E7KpbYsYJ4rFl0m91v4Y2UNhbNcSi+eRkX0yaPBfhvU9I166ubzTpLaH7K43N0BxQB0vhTWbjUNBkvNWniV0naPzPuggVWfxVNqGbbTraS0uc5WW8TEZUdea5O6fy/hXGwBcnVMgDv8x4ro/EN+PEPhMQQ2s0N35sYa1cYkC9yB6UAWbfxaNc82w0LZ/a0YyRMP3Zx1wapaRq3jfVrV547SwRUkMeJMgkjrWjpXhK30bxGmpWIEVubby2izltx6mrepanczXB0rRVT7Yy7vtDrmFR3GR3oAqDXNVjDadcQ2g1wrviiV/kZO5z61S0nxF4p1mB5rXSrNo43MbEyYyw64rn9M8ITR+Lzb6vctcK0TStPbSE/wDAc/0rd0jxP4Z0G1ks7ZNTWLzWYl7djg9+aANE+IdUTfZS6Yg1gfMkCtlWTuc1f07xHpWqXS2ltdA3WCXiwflI6iue0jWbHSg1/BK1xoU0hRrucHzo5D/D67a2NH0htE1VhaQRS6fcK032lgPMVjzj6UAZun+LdZ1cSyaf4eM8Echj3+aByKuf254hXO/wrMMdxIK5C2urq1+GN9LaTyQynUTh4+uM8074f6tqt34nMNzqF1LAbd22SscZAoA73w9rS6/pbXq27QbZWjZGOeRWr2rlfh8c+GZT63kv866rtQAUUfSigBKKWigQlFFFAwooooAKSlooASiiloASiiigQUdqWkoAO1HalooASiiigApaSloA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FFAC0lFFAhe9HeiigA70d6KKAF70fw0UUAFHaiigBO9FFFAC9qKKKAEpKKKADtSd6KKAA9qbRRTASk/woooAB1o70UUAFJRRQAtFFFABQOlFFAAaB0oopAL6UUUUAHek7UUUALQKKKACjvRRQACl9KKKAEHSlFFFAB2pD0oooAPWg9TRRQAnam9qKKAE7fjSGiigY7sKQ0UUAL3/Cl7CiigBPT60vrRRQAnejtRRQAUCiigBe4oHaiigAPWgUUUgDtS96KKAEFJ3oooEIelIaKKAG+v0pD2oooAQ0h6UUUwG07vRRQA4daePvUUVIxw609aKKAJV7/SpRRRUjHt/q3+h/lXM0UVzz3No7H/2Q=="; +// FileProcessor fileProcessor = new FileProcessor(); +// fileProcessor.Process(base,) + ImageFileManager fileManager = new ImageFileManager(); + byte[] data = null; + data = Base64Utils.decode(base); + fileManager.setData(data); + String fileName = "" + System.currentTimeMillis() + UUID.randomUUID() + ".jpg"; + fileManager.setImagFileName(fileName); + int imageFileId = fileManager.saveImageFile(); + InputStream inputStreamById = ImageFileManager.getInputStreamById(imageFileId); + Image image1 = ImageIO.read(inputStreamById); + int width1 = image1.getWidth(null); + int height1 = image1.getHeight(null); + BufferedImage bufferedImage1 = new BufferedImage(width1, height1, BufferedImage.TYPE_INT_RGB); + Graphics graphics1 = bufferedImage1.createGraphics(); + graphics1.drawImage(image1, 0, 0, width1, height1, null); + graphics1.dispose(); + FileOutputStream fileOutputStream = new FileOutputStream(URLDecoder.decode("C:\\Users\\77449\\Desktop\\"+ fileName, "utf-8")); + ImageIO.write(bufferedImage1, "jpg", fileOutputStream); + fileOutputStream.close(); + } +} diff --git a/customization/test/UtilTest.java b/customization/test/UtilTest.java new file mode 100644 index 0000000..29bc21d --- /dev/null +++ b/customization/test/UtilTest.java @@ -0,0 +1,86 @@ +package customization.test; + +import aiyh.utils.Util; +import org.junit.Test; + +import java.beans.BeanInfo; +import java.beans.IntrospectionException; +import java.beans.Introspector; +import java.beans.PropertyDescriptor; +import java.io.IOException; +import java.util.Collection; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/6 0006 20:03 + * 工具类测试 + */ + + +public class UtilTest extends BaseTest { + + @Test + public void createJava() throws IOException { +/* Util.creatJavaFileBySql("select upw.workflow,upw.water_type,upw.water_point,upw.font_size, " + + "upw.water_content,upw.font_style,upw.font_color,upw.water_fields, " + + "wftv.fieldname as water_field,upw.save_source,wftv1.fieldname as source_field," + + "upw.water_text,upw.add_time,upw.water_alpha from uf_pic_watermark as upw " + + "left join workflow_field_table_view as wftv on wftv.id = upw.water_field " + + "left join workflow_field_table_view as wftv1 on wftv1.id = upw.source_field", + "config","com.api.aiyh_guijiu.pojo");*/ +/* Util.creatJavaFileBySql("select dt.id,main.enable,wf.tablename,wf.fieldname as start_date_field, " + + "wf1.fieldname as start_time_field,wf2.fieldname as end_date_field, " + + "wf3.fieldname as end_time_field from uf_workflow_conflic_dt1 as dt " + + "left join workflow_field_table_view as wf on wf.id = dt.start_date_field " + + "left join workflow_field_table_view as wf1 on wf1.id = dt.start_time_field " + + "left join workflow_field_table_view as wf2 on wf2.id = dt.end_date_field " + + "left join workflow_field_table_view as wf3 on wf3.id = dt.end_time_field " + + "left join uf_workflow_conflic as main on dt.mainid = main.id", + "workflowConfig","com.api.aiyh_guijiu.pojo");*/ + Util.creatJavaFileBySql("select id,name,meetingtype,begindate,begintime,endtime,enddate,desc_n,creater,hrmmembers from meeting where id = 8", + "meetingInfo", "com.customization.quanshimeting.entity"); +// Util.creatJavaFileByTable("uf_workflow_conflic_dt1","com.api.aiyh_guijiu.pojo"); + + + } + + + @Test + public void testIntrospector() throws IntrospectionException { + // 不内省父类的信息,第二个参数stopClass代表从stopClass开始往上的父类不再内省 + BeanInfo beanInfo = Introspector.getBeanInfo(TestVo.class, Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor p : propertyDescriptors) { + System.out.println(p.getName()); + System.out.println(p.getPropertyType()); + System.out.println(p.getPropertyType().equals(String.class)); + } + } + + + public void toJsonString(T t) throws Exception { + BeanInfo beanInfo = Introspector.getBeanInfo(t.getClass(), Object.class); + PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); + for (PropertyDescriptor proper : propertyDescriptors) { + String name = proper.getName(); + Class propertyType = proper.getPropertyType(); + if (int.class.equals(propertyType) || long.class.equals(propertyType) + || short.class.equals(propertyType) || byte.class.equals(propertyType) + || float.class.equals(propertyType) || double.class.equals(propertyType) + || boolean.class.equals(propertyType) || Boolean.class.equals(propertyType) + || Integer.class.equals(propertyType) || Long.class.equals(propertyType) + || Short.class.equals(propertyType) || Byte.class.equals(propertyType) + || Float.class.equals(propertyType) || Double.class.equals(propertyType)) { +// 整数类型和浮点数以及boolean类型 + continue; + } + if (String.class.equals(propertyType) || Character.class.equals(propertyType) + || char.class.equals(propertyType)) { +// 字符串类型的数据处理 + continue; + } + if (proper.getReadMethod().invoke(t) instanceof Collection) { + } + } + } +} \ No newline at end of file diff --git a/customization/test/VendorContent.java b/customization/test/VendorContent.java new file mode 100644 index 0000000..e49be76 --- /dev/null +++ b/customization/test/VendorContent.java @@ -0,0 +1,48 @@ +package customization.test; + + +import java.util.List; + +/** + * @author XiaoBokang + * @create 2021/10/9 13:52 + */ + +public class VendorContent { + private Integer totalPage; + private Integer page; + private List items; + + @Override + public String toString() { + return "VendorContent{" + + "totalPage=" + totalPage + + ", page=" + page + + ", items=" + items + + '}'; + } + + public Integer getTotalPage() { + return totalPage; + } + + public void setTotalPage(Integer totalPage) { + this.totalPage = totalPage; + } + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } +} diff --git a/customization/test/VendorItem.java b/customization/test/VendorItem.java new file mode 100644 index 0000000..196d22e --- /dev/null +++ b/customization/test/VendorItem.java @@ -0,0 +1,295 @@ +package customization.test; + +/** + * @author XiaoBokang + * @create 2021/10/9 14:06 + */ + +public class VendorItem { + private String vendorCode; + private String vendorNameCn; + private String vendorNameEn; + private String vatRegNo; + private String addressEn; + private String postCode; + private String city; + private String chineseName; + private String englishName; + private String telephoneNo; + private String email; + private String nationalType; + private String purchasingGroup; + private String contactPerson; + private String vendorType; + private String renderedService; + private String mobileNumber; + private String paymentMethod; + private String invoiceType; + private String taxRate; + private String language; + private String isRelatedParty; + private String whetherTobeDealer; + private String businessPartnerCheckNumber; + private String organization; + private String createBy; + private String whetherSupportEchapter; + private String fadadaEchapter; + + @Override + public String toString() { + return "VendorItem{" + + "vendorCode='" + vendorCode + '\'' + + ", vendorNameCn='" + vendorNameCn + '\'' + + ", vendorNameEn='" + vendorNameEn + '\'' + + ", vatRegNo='" + vatRegNo + '\'' + + ", addressEn='" + addressEn + '\'' + + ", postCode='" + postCode + '\'' + + ", city='" + city + '\'' + + ", chineseName='" + chineseName + '\'' + + ", englishName='" + englishName + '\'' + + ", telephoneNo='" + telephoneNo + '\'' + + ", email='" + email + '\'' + + ", nationalType='" + nationalType + '\'' + + ", purchasingGroup='" + purchasingGroup + '\'' + + ", contactPerson='" + contactPerson + '\'' + + ", vendorType='" + vendorType + '\'' + + ", renderedService='" + renderedService + '\'' + + ", mobileNumber='" + mobileNumber + '\'' + + ", paymentMethod='" + paymentMethod + '\'' + + ", invoiceType='" + invoiceType + '\'' + + ", taxRate='" + taxRate + '\'' + + ", language='" + language + '\'' + + ", isRelatedParty='" + isRelatedParty + '\'' + + ", whetherTobeDealer='" + whetherTobeDealer + '\'' + + ", businessPartnerCheckNumber='" + businessPartnerCheckNumber + '\'' + + ", organization='" + organization + '\'' + + ", createBy='" + createBy + '\'' + + ", whetherSupportEchapter='" + whetherSupportEchapter + '\'' + + ", fadadaEchapter='" + fadadaEchapter + '\'' + + '}'; + } + + public String getVendorCode() { + return vendorCode; + } + + public void setVendorCode(String vendorCode) { + this.vendorCode = vendorCode; + } + + public String getVendorNameCn() { + return vendorNameCn; + } + + public void setVendorNameCn(String vendorNameCn) { + this.vendorNameCn = vendorNameCn; + } + + public String getVendorNameEn() { + return vendorNameEn; + } + + public void setVendorNameEn(String vendorNameEn) { + this.vendorNameEn = vendorNameEn; + } + + public String getVatRegNo() { + return vatRegNo; + } + + public void setVatRegNo(String vatRegNo) { + this.vatRegNo = vatRegNo; + } + + public String getAddressEn() { + return addressEn; + } + + public void setAddressEn(String addressEn) { + this.addressEn = addressEn; + } + + public String getPostCode() { + return postCode; + } + + public void setPostCode(String postCode) { + this.postCode = postCode; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getChineseName() { + return chineseName; + } + + public void setChineseName(String chineseName) { + this.chineseName = chineseName; + } + + public String getEnglishName() { + return englishName; + } + + public void setEnglishName(String englishName) { + this.englishName = englishName; + } + + public String getTelephoneNo() { + return telephoneNo; + } + + public void setTelephoneNo(String telephoneNo) { + this.telephoneNo = telephoneNo; + } + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public String getNationalType() { + return nationalType; + } + + public void setNationalType(String nationalType) { + this.nationalType = nationalType; + } + + public String getPurchasingGroup() { + return purchasingGroup; + } + + public void setPurchasingGroup(String purchasingGroup) { + this.purchasingGroup = purchasingGroup; + } + + public String getContactPerson() { + return contactPerson; + } + + public void setContactPerson(String contactPerson) { + this.contactPerson = contactPerson; + } + + public String getVendorType() { + return vendorType; + } + + public void setVendorType(String vendorType) { + this.vendorType = vendorType; + } + + public String getRenderedService() { + return renderedService; + } + + public void setRenderedService(String renderedService) { + this.renderedService = renderedService; + } + + public String getMobileNumber() { + return mobileNumber; + } + + public void setMobileNumber(String mobileNumber) { + this.mobileNumber = mobileNumber; + } + + public String getPaymentMethod() { + return paymentMethod; + } + + public void setPaymentMethod(String paymentMethod) { + this.paymentMethod = paymentMethod; + } + + public String getInvoiceType() { + return invoiceType; + } + + public void setInvoiceType(String invoiceType) { + this.invoiceType = invoiceType; + } + + public String getTaxRate() { + return taxRate; + } + + public void setTaxRate(String taxRate) { + this.taxRate = taxRate; + } + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public String getIsRelatedParty() { + return isRelatedParty; + } + + public void setIsRelatedParty(String isRelatedParty) { + this.isRelatedParty = isRelatedParty; + } + + public String getWhetherTobeDealer() { + return whetherTobeDealer; + } + + public void setWhetherTobeDealer(String whetherTobeDealer) { + this.whetherTobeDealer = whetherTobeDealer; + } + + public String getBusinessPartnerCheckNumber() { + return businessPartnerCheckNumber; + } + + public void setBusinessPartnerCheckNumber(String businessPartnerCheckNumber) { + this.businessPartnerCheckNumber = businessPartnerCheckNumber; + } + + public String getOrganization() { + return organization; + } + + public void setOrganization(String organization) { + this.organization = organization; + } + + public String getCreateBy() { + return createBy; + } + + public void setCreateBy(String createBy) { + this.createBy = createBy; + } + + public String getWhetherSupportEchapter() { + return whetherSupportEchapter; + } + + public void setWhetherSupportEchapter(String whetherSupportEchapter) { + this.whetherSupportEchapter = whetherSupportEchapter; + } + + public String getFadadaEchapter() { + return fadadaEchapter; + } + + public void setFadadaEchapter(String fadadaEchapter) { + this.fadadaEchapter = fadadaEchapter; + } +} diff --git a/customization/test/VendorResult.java b/customization/test/VendorResult.java new file mode 100644 index 0000000..799c939 --- /dev/null +++ b/customization/test/VendorResult.java @@ -0,0 +1,55 @@ +package customization.test; + +/** + * @author XiaoBokang + * @create 2021/10/9 12:48 + */ + +public class VendorResult { + private Boolean code; + private String errorMessage; + private String traceId; + private VendorContent content; + + @Override + public String toString() { + return "VendorResult{" + + "code=" + code + + ", errorMessage='" + errorMessage + '\'' + + ", traceId='" + traceId + '\'' + + ", content=" + content + + '}'; + } + + public Boolean getCode() { + return code; + } + + public void setCode(Boolean code) { + this.code = code; + } + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public String getTraceId() { + return traceId; + } + + public void setTraceId(String traceId) { + this.traceId = traceId; + } + + public VendorContent getContent() { + return content; + } + + public void setContent(VendorContent content) { + this.content = content; + } +} diff --git a/customization/test/WorkflowToCustomerTest.java b/customization/test/WorkflowToCustomerTest.java new file mode 100644 index 0000000..1d172ef --- /dev/null +++ b/customization/test/WorkflowToCustomerTest.java @@ -0,0 +1,205 @@ +package customization.test; + +import com.engine.crm.util.CrmCommonUtil; +import org.junit.Test; +import aiyh.utils.Util; +import aiyh.utils.sqlUtil.sqlResult.impl.BatchSqlResultImpl; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.sqlUtil.whereUtil.Where; +import weaver.aiyh_pcn.workflow_to_customer.AddCustomer_Action; +import weaver.aiyh_pcn.workflow_to_customer.config.CRM_Config; +import weaver.aiyh_pcn.workflow_to_customer.model.MainResult; +import weaver.aiyh_pcn.workflow_to_customer.utils.*; +import weaver.conn.RecordSet; +import weaver.crm.Maint.*; +import weaver.hrm.companyvirtual.ResourceVirtualComInfo; +import weaver.soa.workflow.request.RequestInfo; +import weaver.workflow.request.RequestManager; + +import java.util.*; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/6 0006 15:46 + * ceshi + */ + + +public class WorkflowToCustomerTest extends BaseTest{ + + @Test + public void testSqlBuilderBatch(){ + List> list = new ArrayList<>(); + List whereList = new ArrayList<>(); + list.add(new LinkedHashMap(){{ + put("id",9); + put("name","updateSql"); + put("status","prod"); + }}); + list.add(new LinkedHashMap(){{ + put("id",10); + put("name","updateSql1"); + put("status","prod1"); + }}); + list.add(new LinkedHashMap(){{ + put("id",11); + put("name","updateSql2"); + put("status","prod3"); + }}); + whereList.add(Util.createPrepWhereImpl() + .whereAnd("id").whereEqual(9) + .whereAnd("name").whereLike("%Sql%")); + whereList.add(Util.createPrepWhereImpl() + .whereAnd("id").whereEqual(10) + .whereAnd("name").whereLike("%Sql%")); + whereList.add(Util.createPrepWhereImpl() + .whereAnd("id").whereEqual(11) + .whereAnd("name").whereLike("%Sql%")); + BatchSqlResultImpl batchSqlResult = Util.createSqlBuilder().updateBatchSql("tablename", list, whereList); + System.out.println(batchSqlResult.getSqlStr()); + System.out.println(batchSqlResult.getBatchList()); + } + + @Test + public void testSqlBuilder(){ + PrepSqlResultImpl prepSqlResult = Util.createSqlBuilder().insertSql("tablename", + ParaMap.create().put("id", 10) + .put("name", "insertSql") + .put("status", "test")); + System.out.println(prepSqlResult.getSqlStr()); + System.out.println(prepSqlResult.getArgs()); + } + + +// @Test +// public void testUtilSql(){ +// String sql = Util.createWhereImpl().whereAnd("id").whereEqual("90").whereOr("name") +// .whereLike("%不知道%") +// .whereAnd("age").whereIn(1,2,3,4,5).getSql(); +// System.out.println(sql); +// } + +// @Test +// public void testUtilPreSql(){ +// Where where = Util.createPrepWhereImpl().whereAnd("id").whereEqual("90").whereOr("name") +// .whereLike("%不知道%") +// .whereAnd("age").whereIn(1, 2, 3, 4, 5); +// System.out.println(where.getSql()); +// System.out.println(where.getArgs()); +// } + + @Test + public void testMap(){ + UtilMap utilMap = new UtilMap<>(); + utilMap.uPut("test","testValue").uPut("liu","liu").uPut("isnull",null); + Map filter = utilMap.filter((key,value) -> !Objects.isNull(value)); + System.out.println(filter); + System.out.println(utilMap); + } + + @Test + public void testPinYin(){ + CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); + System.out.println(crmCommonUtil.getPinYin("不知道", 7)); + } + + + @Test + public void testInsert(){ + RecordSet rs = new RecordSet(); + boolean b = rs.executeUpdate("insert into formtable_main_2 (requestId,jbr) values (-121,2);"); + rs.executeQuery("select @@identity"); + System.out.println(rs.getString(1)); + System.out.println(rs.getString(2)); + } + + @Test + public void testSQLWhere(){ + SQLWhere sqlWhere = SQLWhere.creatWhere() + .and("id").equal(90) + .or("name").like("%testname%") + .and("mainid").equalSql("select id from maintable") + .create(); + Map map = new HashMap<>(); + map.put("id", "90"); + String tablename = BuilderSqlUtil.builderUpdateFullSql("tablename", map, sqlWhere); + System.out.println(tablename); + } + + @Test + public void testPrepSQLWhere(){ + PrepSQLWhere prepSQLWhere = PrepSQLWhere.creatPrepWhere() + .and("id").equal(6) + .or("name").like("%public%") + .and("status").in(2,3,4,5,6) + .create(); + Map map = new HashMap<>(); + map.put("id", "90"); + SqlResult tablename = BuilderSqlUtil.builderUpdateSql("tablename", map, prepSQLWhere); + System.out.println(tablename.getSqlStr()); + System.out.println(Arrays.toString(tablename.getArgs())); + } + + @Test + public void testInnerPrepSQLWhere(){ + PrepSQLWhere prepSQLWhere = PrepSQLWhere.creatPrepWhere() + .and("id").equal(6) + .or("name").like("%public%") + .and("status").in(2,3,4,5,6) + .create(); + Map map = new HashMap<>(); + map.put("id", "90"); + SqlResult tablename = BuilderSqlUtil.builderUpdateSql("tablename", map, prepSQLWhere); + System.out.println(tablename.getSqlStr()); + System.out.println(Arrays.toString(tablename.getArgs())); + } + + + @Test + public void testRemoveCache(){ + CustomerInfoComInfo customerInfo = new CustomerInfoComInfo(); + customerInfo.removeCustomerInfoCache(); + customerInfo.removeCache(); + ResourceVirtualComInfo resource = new ResourceVirtualComInfo(); + resource.removeCache(); + resource.removeResourceVirtualCache(); + (new CustomerContacterComInfo()).removeCustomerContacterCache(); + } + + @Test + public void test_crm_config(){ +// CRM_Config conf = new CRM_Config("6","formtable_main_32","105106"); + RequestInfo requestInfo = new RequestInfo(); + AddCustomer_Action addCustomer = new AddCustomer_Action(); + requestInfo.setRequestid("179181"); + requestInfo.setWorkflowid("6"); + requestInfo.setCreatorid("1"); + requestInfo.setRequestManager(new RequestManager(){{setBilltablename("formtable_main_32");}}); + addCustomer.execute(requestInfo); +// System.out.println(conf.getConfigInfo());; + } + + @Test + public void test_removeSegmentation(){ + StringBuilder sqlBuilder = new StringBuilder(" ,insert into 1,2,3,4,5 , "); + System.out.println(Utils.removeSeparator(sqlBuilder)); + } + + @Test + public void testAddCustomerAction(){ + AddCustomer_Action addCustomer_action = new AddCustomer_Action(); + CRM_Config config = new CRM_Config("4","formtable_main_2","5011"); + Map>> configInfoMap = config.getConfigInfo(); + MainResult mainResult = config.getMainResult(); + System.out.println(configInfoMap); + System.out.println(mainResult); + if(mainResult.getChangeSetting() == 0){ +// 表示插入 + addCustomer_action.insertCustomerModel(mainResult,configInfoMap); + }else{ +// 表示根据流程字段判断是插入还是更新 + + } + } + +} diff --git a/weaver/aiyh_pcn/async_organization/SyncOrganizationForOtherAPI.java b/weaver/aiyh_pcn/async_organization/SyncOrganizationForOtherAPI.java new file mode 100644 index 0000000..d422fc3 --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/SyncOrganizationForOtherAPI.java @@ -0,0 +1,191 @@ +package weaver.aiyh_pcn.async_organization; + +import aiyh.utils.zwl.common.ToolUtil; +import weaver.aiyh_pcn.async_organization.model.Department; +import weaver.aiyh_pcn.async_organization.model.Employee; +import weaver.aiyh_pcn.async_organization.model.Position; +import weaver.aiyh_pcn.async_organization.result.GetOrganizationResult; +import weaver.aiyh_pcn.async_organization.util.SyncOrganizationUtils; +import com.weaver.esb.server.cache.ResourceComInfo; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.company.SubCompanyComInfo; +import weaver.hrm.job.JobTitlesComInfo; +import weaver.hrm.resource.HrmSynDAO; +import weaver.integration.logging.Logger; +import weaver.integration.logging.LoggerFactory; +import weaver.interfaces.hrm.*; +import weaver.matrix.MatrixUtil; + +import java.util.*; + + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/20 0020 15:16 + * 同步第三方系统人员组织结构 + */ + + +public class SyncOrganizationForOtherAPI extends ToolUtil implements HrmSynService { + private HashMap synResult; + String className = "SyncOrganizationForOtherAPI"; + private final Logger log = LoggerFactory.getLogger(SyncOrganizationForOtherAPI.class); + private final GetOrganizationResult getOrganizationResult = new GetOrganizationResult(); + private final SyncOrganizationUtils organizationUtils = new SyncOrganizationUtils(); + + public SyncOrganizationForOtherAPI(){ + this.writeDebuggerLog(className,"===========> create Object! <============"); + this.synResult = new HashMap<>(); + } + /**同步到分公司(分部)*/ + @Override + public String SynTimingToOASubCompany() { + this.writeDebuggerLog(className,"===========> synchronous company to OA system start <============"); + this.synResult.put("1",null); + this.writeDebuggerLog(className,"===========> synchronous company to OA system end <============"); + return null; + } + + /**同步到部门*/ + @Override + public String SynTimingToOADepartment() { + this.writeDebuggerLog(className,"===========> synchronous department to OA system starts <============"); + List departmentList = getOrganizationResult.getDepartmentList(); + Collections.sort(departmentList); + List> synResultlist = new ArrayList<>(); + departmentList.forEach(department -> { + Map stringStringMap = organizationUtils.asyncDepartment(department); + synResultlist.add(buildItemMap("","",department.getDEPARTMENTNAME(),stringStringMap.get("code"),stringStringMap.get("msg"))); + }); + this.writeDebuggerLog(className,departmentList.size() +" data pieces are updated this time"); + //清除OA中分部的缓存记录 + SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); + subCompanyComInfo.removeCompanyCache(); + subCompanyComInfo.removeCache(); + //清除部门缓存 + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + departmentComInfo.removeCompanyCache(); + departmentComInfo.removeCache(); + + //同步部门数据到矩阵 + MatrixUtil.sysDepartmentData(); + + this.writeDebuggerLog(className,"This time together step or update data " + departmentList.size()); + this.synResult.put("2",synResultlist); + this.writeDebuggerLog(className,"===========> synchronous department to OA system end <============"); + return null; + } + + /**同步到职位*/ + @Override + public String SynTimingToOAJobtitle() { + this.writeDebuggerLog(className,"===========> synchronous job to OA system starts <============"); + List positionList = getOrganizationResult.getPositionList(); + Collections.sort(positionList); + List> synResultlist = new ArrayList<>(); + positionList.forEach(position->{ + Map stringStringMap = organizationUtils.asyncPosition(position); + synResultlist.add(buildItemMap(position.getJOBCODE(),position.getJOBCODE(),position.getJOBFUNCTION(),stringStringMap.get("code"),stringStringMap.get("msg"))); + }); + this.writeDebuggerLog(className,positionList.size() +" data pieces are updated this time"); +// 清除职位缓存 + JobTitlesComInfo jobTitlesComInfo = new JobTitlesComInfo(); + jobTitlesComInfo.removeJobTitlesCache(); + jobTitlesComInfo.removeCache(); + this.synResult.put("3",synResultlist); + this.writeDebuggerLog(className,"===========> synchronous job to OA system end <============"); + return null; + } + + /**同步到人员*/ + @Override + public String SynTimingToOAHrmResource() { + this.writeDebuggerLog(className,"===========> synchronous hrm to OA system starts <============"); + List employeeList = getOrganizationResult.getEmployeeList(); + List> synResultlist = new ArrayList<>(); + Collections.sort(employeeList); + employeeList.forEach(employee->{ + Map stringStringMap = organizationUtils.asyncEmployee(employee); + synResultlist.add(buildItemMap(employee.getUSERCODE(),employee.getUSERCODE(),employee.getPreferred_Name() + "/" + employee.getUSERNAMECN(),stringStringMap.get("code"),stringStringMap.get("msg"))); + }); + this.writeDebuggerLog(className,employeeList.size() +" data pieces are updated this time"); + // 清除人员缓存 + try { + ResourceComInfo rsc = new ResourceComInfo(); + rsc.removeCache(); + } catch (Exception e) { + this.writeErrorLog(className,"removeCache error!"); + e.printStackTrace(); + } +// organizationUtils.asyncEmployee(employeeList.get(0)); + this.synResult.put("4", synResultlist); + this.writeDebuggerLog(className,"===========> synchronous hrm to OA system end <============"); + return null; + } + + @Override + public void SynTimingFromOASubCompany(SubCompanyBean[] subCompanyBeans) { + + } + + @Override + public void SynTimingFromOADepartment(DepartmentBean[] departmentBeans) { + + } + + @Override + public void SynTimingFromOAJobtitle(JobTitleBean[] jobTitleBeans) { + + } + + @Override + public void SynTimingFromOAHrmResource(UserBean[] userBeans) { + + } + + @Override + public void SynInstantSubCompany(SubCompanyBean subCompanyBean) { + + } + + @Override + public void SynInstantDepartment(DepartmentBean departmentBean) { + + } + + @Override + public void SynInstantJobtitle(JobTitleBean jobTitleBean) { + + } + + @Override + public void SynInstantHrmResource(UserBean userBean) { + + } + + @Override + public boolean SynSendMessage(String s, String s1, String s2, String s3, String s4) { + return false; + } + + @Override + public HashMap getSynResult() { + return this.synResult; + } + + @Override + public void removeSynResult() { + this.synResult = new HashMap(); + } + + private Map buildItemMap(String pkcode, String pk, String memo, String succ, String error){ + //保存结果 + HashMap itemMap = new HashMap<>(); + itemMap.put(weaver.hrm.resource.HrmSynDAO.OUTPK, pkcode); + itemMap.put(weaver.hrm.resource.HrmSynDAO.PK, pk); + itemMap.put(weaver.hrm.resource.HrmSynDAO.Memo, memo); + itemMap.put(weaver.hrm.resource.HrmSynDAO.Success, succ); + itemMap.put(HrmSynDAO.ErrorMessage, error); + return itemMap; + } +} diff --git a/weaver/aiyh_pcn/async_organization/config/SyncOrganizationConfig.java b/weaver/aiyh_pcn/async_organization/config/SyncOrganizationConfig.java new file mode 100644 index 0000000..80eedfe --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/config/SyncOrganizationConfig.java @@ -0,0 +1,148 @@ +package weaver.aiyh_pcn.async_organization.config; + +import aiyh.utils.zwl.common.ToolUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.TypeReference; +import com.ibm.icu.text.SimpleDateFormat; +import org.apache.http.HttpEntity; +import org.apache.http.client.methods.CloseableHttpResponse; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.protocol.HTTP; +import org.apache.http.util.EntityUtils; +import weaver.aiyh_pcn.async_organization.result.ResultBean; +import weaver.wechat.request.HttpManager; + +import java.io.IOException; +import java.util.*; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/20 0020 16:40 + * 同步第三方系统人员组织结构配置类 + */ + + +public class SyncOrganizationConfig extends ToolUtil { + + /** + * api验证参数 + */ + private final String API_KEY = this.getSystemParamValue("CMS_API_KEY"); + /** + * 测试地址URL + */ + private String CMS_TEST_URL = this.getSystemParamValue("CMS_TEST_URL"); + /** + * 生产环境地址URL + */ + private String CMS_PROUD_URL = this.getSystemParamValue("CMS_PROUD_URL"); + /** + * 员工 + */ + private String EmployeeApi = this.getSystemParamValue("EmployeeApi"); + /** + * 部门 + */ + private String DepartmentApi = this.getSystemParamValue("DepartmentApi"); + /** + * 职位 + */ + private String PositionApi = this.getSystemParamValue("PositionApi"); + private String CMS_API_URL_MARK = this.getSystemParamValue("CMS_API_URL_MARK"); + private String REQUEST_API_RUL = ""; + /** + * 每页数据大小 + */ + private final String PAGE_SIZE = this.getSystemParamValue("CMS_API_GET_DATA_SIZE"); + private String CMS_API_QUERY_DATA = ""; + + public SyncOrganizationConfig() { + if (0 == Integer.parseInt(CMS_API_URL_MARK)) { + this.REQUEST_API_RUL = this.CMS_TEST_URL; + this.CMS_API_QUERY_DATA = "?date=" + this.getSystemParamValue("CMS_API_QUERY_DATA"); + } else { + this.REQUEST_API_RUL = this.CMS_PROUD_URL; + this.CMS_API_QUERY_DATA = "?date=" + this.getDate(); + } + } + + private String getDate() { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd"); + return "?date=" + formatter.format(date); + } + + // 封装整理接口数据 + public List getDataList(String url) { + int pageIndex = 1; + ArrayList employees = new ArrayList<>(); + while (true) { + ResultBean employeeResultBean = getDataResult(pageIndex, url); + assert employeeResultBean != null; + employees.addAll(employeeResultBean.getItems()); + pageIndex++; + if (employeeResultBean.getPage() >= employeeResultBean.getTotalPage() || employeeResultBean.getItems().size() < employeeResultBean.getPageSize()) { + break; + } + } + return employees; + } + + + // 请求api接口数据 + private ResultBean getDataResult(int pageIndex, String url) { + DefaultHttpClient httpClient = HttpManager.getHttpClient(); + HttpPost httpPost = new HttpPost(url); + Map params = new HashMap(2); + params.put("pageSize", PAGE_SIZE); + params.put("pageIndex", Integer.toString(pageIndex)); +// List nvps = new ArrayList<>(); +// nvps.add(new BasicNameValuePair("pageSize","10")); +// nvps.add(new BasicNameValuePair("pageIndex","1")); +// httpPost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8)); + httpPost.setHeader("apikey", API_KEY); + httpPost.setHeader("Content-Type", "application/json"); + httpPost.setEntity(new StringEntity(JSON.toJSONString(params), HTTP.UTF_8)); + CloseableHttpResponse execute = null; + try { + execute = httpClient.execute(httpPost); + if (execute.getStatusLine().getStatusCode() == 200) { + HttpEntity entity = execute.getEntity(); + String response = EntityUtils.toString(entity, "utf-8"); + return JSON.parseObject(response, new TypeReference>() { + }); + } + HttpEntity entity = execute.getEntity(); + String response = EntityUtils.toString(entity, "utf-8"); +// System.out.println(url); +// System.out.println(response); +// System.out.println(JSON.parseObject(response, new TypeReference>() {})); + return null; + } catch (IOException e) { + try { + if (execute != null) { + execute.close(); + } + } catch (IOException ioException) { + ioException.printStackTrace(); + return null; + } + e.printStackTrace(); + return null; + } + } + + public String getEMPLOYEE_API_RUL() { + return this.REQUEST_API_RUL + this.EmployeeApi + this.CMS_API_QUERY_DATA; + } + + public String getDEPARTMENT_API_URL() { + return this.REQUEST_API_RUL + this.DepartmentApi + this.CMS_API_QUERY_DATA; + } + + public String getPOSITION_API_URL() { + return this.REQUEST_API_RUL + this.PositionApi + this.CMS_API_QUERY_DATA; + } +} diff --git a/weaver/aiyh_pcn/async_organization/model/Department.java b/weaver/aiyh_pcn/async_organization/model/Department.java new file mode 100644 index 0000000..9071fad --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/model/Department.java @@ -0,0 +1,82 @@ +package weaver.aiyh_pcn.async_organization.model; + +import org.jetbrains.annotations.NotNull; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/20 0020 17:18 + * 部门实体类 + */ + + +public class Department implements Comparable{ + /**部门ID*/ + private Long DEPARTMENTID; + /**部门名称*/ + private String DEPARTMENTNAME; + /**上级部门ID 此处为0时,表示该部门为根部门。对应所属公司,从【一级部门对应实体mapping表】上取值*/ + private Long PARENTDEPARTMENDID; + + + public String getValue(String fieldName){ + if("DEPARTMENTID".equals(fieldName)) { + return String.valueOf(this.getDEPARTMENTID()); + } + if("DEPARTMENTNAME".equals(fieldName)) { + return this.getDEPARTMENTNAME(); + } + if("PARENTDEPARTMENDID".equals(fieldName)) { + return String.valueOf(this.getPARENTDEPARTMENDID()); + } + return null; + } + + public Department() { + } + + public Department(Long DEPARTMENTID, String DEPARTMENTNAME, Long PARENTDEPARTMENDID) { + this.DEPARTMENTID = DEPARTMENTID; + this.DEPARTMENTNAME = DEPARTMENTNAME; + this.PARENTDEPARTMENDID = PARENTDEPARTMENDID; + } + + public Long getDEPARTMENTID() { + return DEPARTMENTID; + } + + public void setDEPARTMENTID(Long DEPARTMENTID) { + this.DEPARTMENTID = DEPARTMENTID; + } + + public String getDEPARTMENTNAME() { + return DEPARTMENTNAME; + } + + public void setDEPARTMENTNAME(String DEPARTMENTNAME) { + this.DEPARTMENTNAME = DEPARTMENTNAME; + } + + public Long getPARENTDEPARTMENDID() { + return PARENTDEPARTMENDID; + } + + public void setPARENTDEPARTMENDID(Long PARENTDEPARTMENDID) { + this.PARENTDEPARTMENDID = PARENTDEPARTMENDID; + } + + + + @Override + public String toString() { + return "Department{" + + "DEPARTMENTID='" + DEPARTMENTID + '\'' + + ", DEPARTMENTNAME='" + DEPARTMENTNAME + '\'' + + ", PARENTDEPARTMENDID='" + PARENTDEPARTMENDID + '\'' + + '}'; + } + + @Override + public int compareTo(@NotNull Department o) { + return new Long(this.PARENTDEPARTMENDID - o.getPARENTDEPARTMENDID()).intValue(); + } +} diff --git a/weaver/aiyh_pcn/async_organization/model/Employee.java b/weaver/aiyh_pcn/async_organization/model/Employee.java new file mode 100644 index 0000000..4009664 --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/model/Employee.java @@ -0,0 +1,246 @@ +package weaver.aiyh_pcn.async_organization.model; + +import org.jetbrains.annotations.NotNull; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/20 0020 17:09 + * 员工实体类 + */ + +public class Employee implements Comparable{ + /**员工id*/ + private Long UserID; + /**名 (英文)*/ + private String FIRSTNAMEEN; + /**姓 (英文)*/ + private String LASTNAMEEN; + /**中文姓名 */ + private String USERNAMECN; + /**员工编号*/ + private String USERCODE; + /**岗位id*/ + private Long JOBCODEID; + /**部门id*/ + private Long DEPARTMENTID; + /**部门名称*/ + private String DEPARTMENTNAME; + /*成本中心编码*/ + private String COSTCENTERCODE; + /**邮箱*/ + private String EMAIL; + /**公司实体*/ + private String ORGANIZATION; + /**电话号*/ + private String MOBILENO; + /**座机号*/ + private String TEL; + /**英文名*/ + private String Preferred_Name; + + public String getValue(String fieldName){ + if("UserID".equals(fieldName)){ + return String.valueOf(this.getUserID()); + } + if("FIRSTNAMEEN".equals(fieldName)){ + return this.getFIRSTNAMEEN(); + } + if("LASTNAMEEN".equals(fieldName)){ + return this.getLASTNAMEEN(); + } + if("USERNAMECN".equals(fieldName)){ + return this.getUSERNAMECN(); + } + if("USERCODE".equals(fieldName)){ + return this.getUSERCODE(); + } + if("JOBCODEID".equals(fieldName)){ + return String.valueOf(this.getJOBCODEID()); + } + if("DEPARTMENTID".equals(fieldName)){ + return String.valueOf(this.getDEPARTMENTID()); + } + if("DEPARTMENTNAME".equals(fieldName)){ + return this.getDEPARTMENTNAME(); + } + if("COSTCENTERCODE".equals(fieldName)){ + return this.getCOSTCENTERCODE(); + } + if("EMAIL".equals(fieldName)){ + return this.getEMAIL(); + } + if("ORGANIZATION".equals(fieldName)){ + return this.getORGANIZATION(); + } + if("MOBILENO".equals(fieldName)){ + return this.getMOBILENO(); + } + if("TEL".equals(fieldName)){ + return this.getTEL(); + } + if("Preferred_Name".equals(fieldName)){ + return this.getPreferred_Name(); + } + return null; + } + + public Employee() { + } + + @Override + public String toString() { + return "Employee{" + + "UserID='" + UserID + '\'' + + ", FIRSTNAMEEN='" + FIRSTNAMEEN + '\'' + + ", LASTNAMEEN='" + LASTNAMEEN + '\'' + + ", USERNAMECN='" + USERNAMECN + '\'' + + ", USERCODE='" + USERCODE + '\'' + + ", JOBCODEID='" + JOBCODEID + '\'' + + ", DEPARTMENTID='" + DEPARTMENTID + '\'' + + ", DEPARTMENTNAME='" + DEPARTMENTNAME + '\'' + + ", COSTCENTERCODE='" + COSTCENTERCODE + '\'' + + ", EMAIL='" + EMAIL + '\'' + + ", ORGANIZATION='" + ORGANIZATION + '\'' + + ", MOBILENO='" + MOBILENO + '\'' + + ", TEL='" + TEL + '\'' + + ", Preferred_Name='" + Preferred_Name + '\'' + + '}'; + } + + public Employee(Long userID, String FIRSTNAMEEN, String LASTNAMEEN, String USERNAMECN, String USERCODE, Long JOBCODEID, Long DEPARTMENTID, String DEPARTMENTNAME, String COSTCENTERCODE, String EMAIL, String ORGANIZATION, String MOBILENO, String TEL, String preferred_Name) { + UserID = userID; + this.FIRSTNAMEEN = FIRSTNAMEEN; + this.LASTNAMEEN = LASTNAMEEN; + this.USERNAMECN = USERNAMECN; + this.USERCODE = USERCODE; + this.JOBCODEID = JOBCODEID; + this.DEPARTMENTID = DEPARTMENTID; + this.DEPARTMENTNAME = DEPARTMENTNAME; + this.COSTCENTERCODE = COSTCENTERCODE; + this.EMAIL = EMAIL; + this.ORGANIZATION = ORGANIZATION; + this.MOBILENO = MOBILENO; + this.TEL = TEL; + Preferred_Name = preferred_Name; + } + + public Long getUserID() { + return UserID; + } + + public void setUserID(Long userID) { + UserID = userID; + } + + public String getFIRSTNAMEEN() { + return FIRSTNAMEEN; + } + + public void setFIRSTNAMEEN(String FIRSTNAMEEN) { + this.FIRSTNAMEEN = FIRSTNAMEEN; + } + + public String getLASTNAMEEN() { + return LASTNAMEEN; + } + + public void setLASTNAMEEN(String LASTNAMEEN) { + this.LASTNAMEEN = LASTNAMEEN; + } + + public String getUSERNAMECN() { + return USERNAMECN; + } + + public void setUSERNAMECN(String USERNAMECN) { + this.USERNAMECN = USERNAMECN; + } + + public String getUSERCODE() { + return USERCODE; + } + + public void setUSERCODE(String USERCODE) { + this.USERCODE = USERCODE; + } + + public Long getJOBCODEID() { + return JOBCODEID; + } + + public void setJOBCODEID(Long JOBCODEID) { + this.JOBCODEID = JOBCODEID; + } + + public Long getDEPARTMENTID() { + return DEPARTMENTID; + } + + public void setDEPARTMENTID(Long DEPARTMENTID) { + this.DEPARTMENTID = DEPARTMENTID; + } + + public String getDEPARTMENTNAME() { + return DEPARTMENTNAME; + } + + public void setDEPARTMENTNAME(String DEPARTMENTNAME) { + this.DEPARTMENTNAME = DEPARTMENTNAME; + } + + public String getCOSTCENTERCODE() { + return COSTCENTERCODE; + } + + public void setCOSTCENTERCODE(String COSTCENTERCODE) { + this.COSTCENTERCODE = COSTCENTERCODE; + } + + public String getEMAIL() { + return EMAIL; + } + + public void setEMAIL(String EMAIL) { + this.EMAIL = EMAIL; + } + + public String getORGANIZATION() { + return ORGANIZATION; + } + + public void setORGANIZATION(String ORGANIZATION) { + this.ORGANIZATION = ORGANIZATION; + } + + public String getMOBILENO() { + return MOBILENO; + } + + public void setMOBILENO(String MOBILENO) { + this.MOBILENO = MOBILENO; + } + + public String getTEL() { + return TEL; + } + + public void setTEL(String TEL) { + this.TEL = TEL; + } + + public String getPreferred_Name() { + return Preferred_Name; + } + + public void setPreferred_Name(String preferred_Name) { + Preferred_Name = preferred_Name; + } + + + + + @Override + public int compareTo(@NotNull Employee o) { + return new Long(this.JOBCODEID - o.getJOBCODEID()).intValue(); + } +} diff --git a/weaver/aiyh_pcn/async_organization/model/Position.java b/weaver/aiyh_pcn/async_organization/model/Position.java new file mode 100644 index 0000000..c9c4c59 --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/model/Position.java @@ -0,0 +1,125 @@ +package weaver.aiyh_pcn.async_organization.model; + +import org.jetbrains.annotations.NotNull; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/20 0020 17:20 + * 岗位实体类 + */ + + +public class Position implements Comparable{ + /**岗位id*/ + private long JOBCODEID; + /**岗位编号*/ + private String JOBCODE; + /**岗位描述*/ + private String JOBFUNCTION; + /**上级岗位id 为空则表示该岗位无上级*/ + private long SUPERIORJOBCODEID; + private long POSITIONOCCUPIED; + private String Company_Code; + + + public String getValue(String fieldName){ + if("JOBCODEID".equals(fieldName)){ + return String.valueOf(this.getJOBCODEID()); + } + if("JOBCODE".equals(fieldName)){ + return this.getJOBCODE(); + } + if("JOBFUNCTION".equals(fieldName)){ + return this.getJOBFUNCTION(); + } + if("SUPERIORJOBCODEID".equals(fieldName)){ + return String.valueOf(this.getSUPERIORJOBCODEID()); + } + if("POSITIONOCCUPIED".equals(fieldName)){ + return String.valueOf(this.getPOSITIONOCCUPIED()); + } + if("Company_Code".equals(fieldName)){ + return this.getCompany_Code(); + } + return null; + } + + public Position() { + } + + public Position(long JOBCODEID, String JOBCODE, String JOBFUNCTION, long SUPERIORJOBCODEID, long POSITIONOCCUPIED, String company_Code) { + this.JOBCODEID = JOBCODEID; + this.JOBCODE = JOBCODE; + this.JOBFUNCTION = JOBFUNCTION; + this.SUPERIORJOBCODEID = SUPERIORJOBCODEID; + this.POSITIONOCCUPIED = POSITIONOCCUPIED; + this.Company_Code = company_Code; + } + + + + public int getJOBCODEID() { + return (int)JOBCODEID; + } + + public void setJOBCODEID(long JOBCODEID) { + this.JOBCODEID = JOBCODEID; + } + + public String getJOBCODE() { + return JOBCODE; + } + + public void setJOBCODE(String JOBCODE) { + this.JOBCODE = JOBCODE; + } + + public String getJOBFUNCTION() { + return JOBFUNCTION; + } + + public void setJOBFUNCTION(String JOBFUNCTION) { + this.JOBFUNCTION = JOBFUNCTION; + } + + public long getSUPERIORJOBCODEID() { + return SUPERIORJOBCODEID; + } + + public void setSUPERIORJOBCODEID(long SUPERIORJOBCODEID) { + this.SUPERIORJOBCODEID = SUPERIORJOBCODEID; + } + + public long getPOSITIONOCCUPIED() { + return POSITIONOCCUPIED; + } + + public void setPOSITIONOCCUPIED(long POSITIONOCCUPIED) { + this.POSITIONOCCUPIED = POSITIONOCCUPIED; + } + + public String getCompany_Code() { + return Company_Code; + } + + public void setCompany_Code(String company_Code) { + Company_Code = company_Code; + } + + @Override + public int compareTo(@NotNull Position o) { + return new Long(this.SUPERIORJOBCODEID - o.getSUPERIORJOBCODEID()).intValue(); + } + + @Override + public String toString() { + return "Position{" + + "JOBCODEID=" + JOBCODEID + + ", JOBCODE='" + JOBCODE + '\'' + + ", JOBFUNCTION='" + JOBFUNCTION + '\'' + + ", SUPERIORJOBCODEID=" + SUPERIORJOBCODEID + + ", POSITIONOCCUPIED=" + POSITIONOCCUPIED + + ", Company_Code='" + Company_Code + '\'' + + '}'; + } +} diff --git a/weaver/aiyh_pcn/async_organization/result/ApiAsyncConfigResult.java b/weaver/aiyh_pcn/async_organization/result/ApiAsyncConfigResult.java new file mode 100644 index 0000000..4ad425c --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/result/ApiAsyncConfigResult.java @@ -0,0 +1,121 @@ +package weaver.aiyh_pcn.async_organization.result; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/23 0023 15:28 + * api配置结果查询结果 + */ + + +public class ApiAsyncConfigResult { + /** + * id + */ + private long id; + /** + * 同步类型,0表示部门信息,1表示人员信息,2表示职位信息 + */ + private int asyncType; + /** + * 第三方api返回的数据对应字段 + */ + private String apiField; + /** + * api对应字段的值需要插入到的OA系统的字段 + */ + private String oAField; + /** + * OA字段类型,0表示系统自带的字段,1表示用户自定义的字段 + */ + private int fieldType; + /** + * 同步数据时的转换规则,0表示不转换,1表示固定值,3表示自定义SQL转换 + */ + private int changeRules; + /** + * 自定义的转换规则 + */ + private String customRules; + + public ApiAsyncConfigResult() { + } + + public ApiAsyncConfigResult(long id, int asyncType, String apiField, String oAField, int fieldType, int changeRules, String customRules) { + this.id = id; + this.asyncType = asyncType; + this.apiField = apiField; + this.oAField = oAField; + this.fieldType = fieldType; + this.changeRules = changeRules; + this.customRules = customRules; + } + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public int getAsyncType() { + return asyncType; + } + + public void setAsyncType(int asyncType) { + this.asyncType = asyncType; + } + + public String getApiField() { + return apiField; + } + + public void setApiField(String apiField) { + this.apiField = apiField; + } + + public String getoAField() { + return oAField; + } + + public void setoAField(String oAField) { + this.oAField = oAField; + } + + public int getFieldType() { + return fieldType; + } + + public void setFieldType(int fieldType) { + this.fieldType = fieldType; + } + + public int getChangeRules() { + return changeRules; + } + + public void setChangeRules(int changeRules) { + this.changeRules = changeRules; + } + + public String getCustomRules() { + return customRules; + } + + public void setCustomRules(String customRules) { + this.customRules = customRules; + } + + @Override + public String toString() { + return "ApiAsyncConfigResult{" + + "id=" + id + + ", asyncType=" + asyncType + + ", apiField='" + apiField + '\'' + + ", oAField='" + oAField + '\'' + + ", fieldType=" + fieldType + + ", changeRules=" + changeRules + + ", customRules='" + customRules + '\'' + + '}'; + } +} diff --git a/weaver/aiyh_pcn/async_organization/result/GetOrganizationResult.java b/weaver/aiyh_pcn/async_organization/result/GetOrganizationResult.java new file mode 100644 index 0000000..68d84c9 --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/result/GetOrganizationResult.java @@ -0,0 +1,43 @@ +package weaver.aiyh_pcn.async_organization.result; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import weaver.aiyh_pcn.async_organization.config.SyncOrganizationConfig; +import weaver.aiyh_pcn.async_organization.model.Department; +import weaver.aiyh_pcn.async_organization.model.Employee; +import weaver.aiyh_pcn.async_organization.model.Position; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/21 0021 15:13 + * 获取第三方api请求结果 + */ + + +public class GetOrganizationResult { + /**获取员工数据*/ + public List getEmployeeList(){ + SyncOrganizationConfig employeeSyncOrganizationConfig = new SyncOrganizationConfig<>(); + List dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getEMPLOYEE_API_RUL()); + String jsonString = JSON.toJSON(dataList).toString(); + return (List) JSONObject.parseArray(jsonString, Employee.class); + } + + /**获取部门数据*/ + public List getDepartmentList(){ + SyncOrganizationConfig employeeSyncOrganizationConfig = new SyncOrganizationConfig<>(); + List dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getDEPARTMENT_API_URL()); + String jsonString = JSON.toJSON(dataList).toString(); + return (List) JSONObject.parseArray(jsonString, Department.class); + } + + /**获取职位数据*/ + public List getPositionList(){ + SyncOrganizationConfig employeeSyncOrganizationConfig = new SyncOrganizationConfig<>(); + List dataList = employeeSyncOrganizationConfig.getDataList(employeeSyncOrganizationConfig.getPOSITION_API_URL()); + String jsonString = JSON.toJSON(dataList).toString(); + return (List) JSONObject.parseArray(jsonString, Position.class); + } +} diff --git a/weaver/aiyh_pcn/async_organization/result/ResultBean.java b/weaver/aiyh_pcn/async_organization/result/ResultBean.java new file mode 100644 index 0000000..27852b5 --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/result/ResultBean.java @@ -0,0 +1,138 @@ +package weaver.aiyh_pcn.async_organization.result; + + +import java.util.ArrayList; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/21 0021 13:57 + * + */ + + +public class ResultBean{ + /**响应状态码*/ + private boolean code; + private String errorMessage; + private String traceId; + /**响应消息*/ + private String msg; + /**总页数*/ + private int totalPage; + /**当前页数*/ + private int page; + /**每页数据量*/ + private int pageSize; + /**数据总量*/ + private int totalCount; + /**响应数据*/ + private ArrayList items; + + @Override + public String toString() { + return "ResultBean{" + + "code=" + code + + ", errorMessage='" + errorMessage + '\'' + + ", traceId='" + traceId + '\'' + + ", msg='" + msg + '\'' + + ", totalPage=" + totalPage + + ", page=" + page + + ", pageSize=" + pageSize + + ", totalCount=" + totalCount + + ", items=" + items + + '}'; + } + + public ResultBean() { + } + + public ResultBean(boolean code, String msg, int totalPage, int page, int pageSize, int totalCount, ArrayList items) { + this.code = code; + this.msg = msg; + this.totalPage = totalPage; + this.page = page; + this.pageSize = pageSize; + this.totalCount = totalCount; + this.items = items; + } + + public boolean getCode() { + return code; + } + + public void setCode(boolean code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public int getTotalPage() { + return totalPage; + } + + public void setTotalPage(int totalPage) { + this.totalPage = totalPage; + } + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getTotalCount() { + return totalCount; + } + + public void setTotalCount(int totalCount) { + this.totalCount = totalCount; + } + + public ArrayList getItems() { + return items; + } + + public boolean isCode() { + return code; + } + + public String getErrorMessage() { + return errorMessage; + } + + public String getTraceId() { + return traceId; + } + + public ResultBean(boolean code, String errorMessage, String traceId, String msg, int totalPage, int page, int pageSize, int totalCount, ArrayList items) { + this.code = code; + this.errorMessage = errorMessage; + this.traceId = traceId; + this.msg = msg; + this.totalPage = totalPage; + this.page = page; + this.pageSize = pageSize; + this.totalCount = totalCount; + this.items = items; + } + + public void setItems(ArrayList items) { + this.items = items; + } +} \ No newline at end of file diff --git a/weaver/aiyh_pcn/async_organization/util/GetModelValue.java b/weaver/aiyh_pcn/async_organization/util/GetModelValue.java new file mode 100644 index 0000000..4e5deaf --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/util/GetModelValue.java @@ -0,0 +1,20 @@ +package weaver.aiyh_pcn.async_organization.util; + + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/26 0026 8:55 + * 获取model类的属性值 + */ + + +public class GetModelValue { + public Object getValueForString(T obj, String mothodName) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { + Class clazz = obj.getClass(); + Method getValue = clazz.getDeclaredMethod("get" + mothodName); + return getValue.invoke(obj); + } +} diff --git a/weaver/aiyh_pcn/async_organization/util/SyncOrganizationUtils.java b/weaver/aiyh_pcn/async_organization/util/SyncOrganizationUtils.java new file mode 100644 index 0000000..7aa2e98 --- /dev/null +++ b/weaver/aiyh_pcn/async_organization/util/SyncOrganizationUtils.java @@ -0,0 +1,875 @@ +package weaver.aiyh_pcn.async_organization.util; + +import aiyh.utils.zwl.common.ToolUtil; +import com.ibm.icu.text.MessageFormat; +import com.ibm.icu.text.SimpleDateFormat; +import com.weaver.formmodel.util.EncryptHelper; +import com.weaver.general.TimeUtil; +import com.weaver.general.Util; +import org.h2.util.StringUtils; +import weaver.aiyh_pcn.async_organization.model.Department; +import weaver.aiyh_pcn.async_organization.model.Employee; +import weaver.aiyh_pcn.async_organization.model.Position; +import weaver.conn.RecordSet; +import java.lang.reflect.InvocationTargetException; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/7/22 0022 10:06 + * 同步人员组织结构工具类 + */ + + +public class SyncOrganizationUtils extends ToolUtil { + private static final String className = "SyncOrganization_Cronjob"; + + public Map asyncDepartment(Department department) { +// writeErrorLog( "---------------"+className+" asyncDepartment Begin --------------------"); + GetModelValue getModelValue = new GetModelValue<>(); + Map successMark = new HashMap<>(); + RecordSet rs = new RecordSet(); +// 所属分部id + int subcompanyid1 = 0; +// 上级部门的id + int supDepId = 0; +// 如果该部门是属于根部门,则需要进行分部的同步 + // TODO 查询手动维护的分部信息表,将分部信息保存到分部表hrmsubcompany中,并且将部门的分部id赋值 + if (department.getPARENTDEPARTMENDID() == 0) { +// 查询mapping表,查看分部与部门的映射关系,通过部门id查询分部信息 + String querySql = "select * from uf_sub_mapping where frist_company = " + + Util.null2String(String.valueOf(department.getDEPARTMENTID())); +// 查询数据库 + try { + rs.executeQuery(querySql); + } catch (Exception e) { + writeErrorLog(className, "select subcomany error:" + querySql); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询分部信息出错,错误SQL:" + querySql); + } + if (rs.next()) { + subcompanyid1 = Util.getIntValue(rs.getString("subcompany"), 0); + } + +// Map stringIntegerMap = this.subCompanyHandler(department); +// subcompanyid1 = stringIntegerMap.get("subcompanyid1"); +// supDepId = stringIntegerMap.get("supDepId"); + } else { +// 如果不是根部门,需要查询到他的父级部门,然后查出他的分部id +// 查询部门的父级部门 + try { + rs.executeQuery("select * from hrmdepartment where outkey = ?", Util.null2String(String.valueOf(department.getPARENTDEPARTMENDID()))); + } catch (Exception e) { + writeErrorLog("select hrmdepartment error in 51 line,sql: select * from hrmdepartment where outkey = " + Util.null2String(String.valueOf(department.getPARENTDEPARTMENDID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询分部信息出错,错误SQL:" + "select hrmdepartment error in 51 line,sql: select * from hrmdepartment where outkey = " + Util.null2String(String.valueOf(department.getPARENTDEPARTMENDID()))); + } + rs.next(); +// 将上级部门的分部id保存起来 + subcompanyid1 = Util.getIntValue(Util.null2String(rs.getString("subcompanyid1"))); +// 将上级部门的id保存起来 + supDepId = Util.getIntValue(Util.null2String(rs.getString("id"))); + } +// 处理部门信息 +// 查询HR同步配置表用于更新或者插入字段 TODO 查询配置表 + Map> configTableInfo = this.queryConfigTableInfo(department, getModelValue, "m.api_field_type = 0"); + Map sysDep = configTableInfo.get("sys"); + Map defDep = configTableInfo.get("def"); + +// 查询部门表,是否存在该部门 + String depSql = "select * from hrmdepartment where outkey = " + department.getDEPARTMENTID(); + try { + rs.executeQuery(depSql); + } catch (Exception e) { + writeErrorLog("select hrmdepartment error in 70 line, sql: " + depSql); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询分部信息出错,错误SQL:" + depSql); + } + int finalSubcompanyid = subcompanyid1; + if (rs.next()) { +// 存在该部门 +// 拼接更新SQL TODO +// 查询父级部门的id并更新 + String querySupId = "select * from hrmdepartment where outkey = ?"; + RecordSet r_rs = new RecordSet(); + r_rs.executeQuery(querySupId, department.getPARENTDEPARTMENDID()); + String supDepId1; + if (r_rs.next()) { + supDepId1 = r_rs.getString("id"); + sysDep.put("supdepid", supDepId1); + } + sysDep.put("subcompanyid1", String.valueOf(finalSubcompanyid)); + StringBuilder sysSetSql = this.builderSql(sysDep, 1).get("update"); + StringBuilder defSetSql = this.builderSql(defDep, 1).get("update"); +// 添加更新默认值 + Map sysMap = new HashMap<>(); + sysMap.put("modified", this.getTime()); + this.addDefaultUpdateSql(sysSetSql, sysMap); +// 更新数据库 TODO + this.executeUpdateData(sysSetSql, "hrmdepartment", "id = " + Util.null2String(rs.getString("id"))); + this.executeUpdateData(defSetSql, "hrmdepartmentdefined", "deptid = " + Util.null2String(rs.getString("id"))); + successMark.put("code", "2"); + successMark.put("msg", "更新部门" + department.getPARENTDEPARTMENDID() + "成功!"); + } else { +// 拼接插入SQL TODO +// 不存在部门信息 + Map insertSysBuilderMap = this.builderSql(sysDep, 2); + StringBuilder sysInsertSqlField = insertSysBuilderMap.get("insertField"); + StringBuilder sysInsertSqlValue = insertSysBuilderMap.get("insertValue"); + Map insertDefBuilderMap = this.builderSql(defDep, 2); + StringBuilder defInsertSqlField = insertDefBuilderMap.get("insertField"); + StringBuilder defInsertSqlValue = insertDefBuilderMap.get("insertValue"); +// 加入默认值 + int finalSupDepId = supDepId; + + Map map = new HashMap() {{ + // 外部系统主键 + put("outkey", Util.getIntValue(String.valueOf(department.getDEPARTMENTID()), 0)); + // 所属分部id + put("subcompanyid1", finalSubcompanyid); + // 上级部门id + put("supdepid", finalSupDepId); + put("departmentmark", Util.null2String(department.getDEPARTMENTNAME())); + put("departmentname", Util.null2String(department.getDEPARTMENTNAME())); + }}; + // 创建时间 + map.put("created", this.getTime()); + this.addDefaultInsertSql(sysInsertSqlField, sysInsertSqlValue, map); + int departmentId = 0; + this.executeInsertData(sysInsertSqlField, sysInsertSqlValue, "hrmdepartment"); +// 查询刚添加的部门id + try { + rs.executeQuery("select * from hrmdepartment where outkey = ?", Util.null2String(String.valueOf(department.getDEPARTMENTID()))); + } catch (Exception e) { + writeErrorLog("select hrmdepartment error in 112 line, sql: select * from hrmdepartment where outkey = " + Util.null2String(String.valueOf(department.getDEPARTMENTID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询分部信息出错,错误SQL:" + "select * from hrmdepartment where outkey = " + Util.null2String(String.valueOf(department.getDEPARTMENTID()))); + } + rs.next(); + departmentId = Util.getIntValue(Util.null2String(rs.getString("id"))); +// 设置默认值 + if (defInsertSqlField.lastIndexOf(",") != -1 && defInsertSqlValue.lastIndexOf(",") != -1) { + this.addDefaultInsertSql(defInsertSqlField, defInsertSqlValue, "deptid", departmentId); + } + this.executeInsertData(defInsertSqlField, defInsertSqlValue, "hrmdepartmentdefined"); + successMark.put("code", "1"); + successMark.put("msg", "插入部门" + department.getPARENTDEPARTMENDID() + "成功!"); + } + return successMark; +// writeErrorLog( "---------------"+className+" asyncDepartment end --------------------"); + } + + + public Map asyncPosition(Position position) { +// writeErrorLog( "---------------"+className+" asyncPosition Begin --------------------"); +// TODO 职位同步的SQL + RecordSet rs = new RecordSet(); + Map successMark = new HashMap<>(); + try { + rs.executeQuery("select id from hrmjobtitles where outkey = ?", Util.getIntValues(String.valueOf(position.getJOBCODEID()))); + } catch (Exception e) { + writeErrorLog("select htmjobtitles error in 131 line, sql: select id from hrmjobtitles where outkey = " + Util.getIntValues(String.valueOf(position.getJOBCODEID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询职位错误,错误SQL:" + "select id from hrmjobtitles where outkey = " + Util.getIntValues(String.valueOf(position.getJOBCODEID()))); + } +// 判断该职位是否存在于系统中 + if (rs.next()) { +// 存在该条职位,需要进行职位的更新 + String updateSqlStr = MessageFormat.format("update hrmjobtitles set " + + "modified = ''{0}'', jobtitlemark = ''{1}'', jobtitlename = ''{2}'', cmsSupJobId = ''{3}'', " + + "jobtitlecode = ''{4}'' where outkey = ''{5}''", + this.getTime(), Util.null2String(position.getJOBFUNCTION()), Util.null2String(position.getJOBFUNCTION()), + Util.null2String(String.valueOf(position.getSUPERIORJOBCODEID())), Util.null2String(position.getJOBCODE()), Util.null2String(String.valueOf(position.getJOBCODEID()))); + // id + try { + rs.executeUpdate(updateSqlStr); + successMark.put("code", "2"); + successMark.put("msg", "更新职位" + position.getJOBCODEID() + "成功!"); + } catch (Exception e) { + writeErrorLog(className, "update jobtitle error: " + updateSqlStr); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "更新职位失败,错误SQL:" + updateSqlStr); + } + } else { + +// 不存在该条职位 +// 判断该职位是否属于根职位(是否存在上级职位id),如果属于根职位,则需要进行创建工作类型(插入数据到工作类型表中) +// 并且创建职责数据,然后将数据插入到职位表中 +// 如果不是根职位,则需要判断其上级职位是否属于根职位,如果上级职位属于根职位,则需要插入职责表,同时工作类型为父级岗位的 +// 工作类型,然后将数据插入到职位表中,职责类型为刚插入的职责数据id。如果上级职位不属于根职位,则插入数据到职位表中, +// 职责id为父级职位的职责id + +// 判断是否是根职位 + if (position.getSUPERIORJOBCODEID() == 0) { +// 是根职位,插入数据到工作类型表中hrmjobgroups + int groupId = this.insertJobGroup(position); +// 插入数据到工作职责表中,并且绑定工作类型id为刚插入的数据的id + int activityId = this.insertJobActive(position, groupId); +// 将职位插入到职位表中,职责id为刚插入数据的id + this.insertJobTitle(position, rs, activityId, 0); + } else { +// 不是根职位,判断父职位是否属于根职位 + try { + rs.executeQuery("select * from hrmjobtitles where outkey = ?", Util.getIntValues(String.valueOf(position.getSUPERIORJOBCODEID()))); + } catch (Exception e) { + writeErrorLog("select htmjobtitles error in 166 line, sql: select * from hrmjobtitles where outkey = " + Util.getIntValues(String.valueOf(position.getJOBCODEID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询父级职位失败,错误SQL:" + "select * from hrmjobtitles where outkey = " + Util.getIntValues(String.valueOf(position.getSUPERIORJOBCODEID()))); + } + if (rs.next()) { + if (Util.getIntValue(Util.null2String(rs.getString("cmssupjobid"))) == 0) { +// 父职位属于根职位,获取父级职位的工作类型id + try { + rs.executeQuery("select * from hrmjobactivities where id = ?", Util.getIntValue(Util.null2String(rs.getString("jobactivityid")))); + } catch (Exception e) { + writeErrorLog("select hrmjobactivities error in 175 line, sql: select * from hrmjobactivities where id = " + Util.getIntValue(Util.null2String(rs.getString("jobactivityid")))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询父职位工作类型错误,错误SQL:" + "select * from hrmjobactivities where id = " + Util.getIntValue(Util.null2String(rs.getString("jobactivityid")))); + } + rs.next(); + int groupId = Util.getIntValue(Util.null2String(rs.getString("jobgroupid"))); +// 将数据插入到工作职责表中 + int activityId = this.insertJobActive(position, groupId); +// 将数据插入到职位表中 + this.insertJobTitle(position, rs, activityId, Util.getIntValue(String.valueOf(position.getSUPERIORJOBCODEID()))); + } else { +// 父级职位不属于根职位,获取父级职责id并将数据插入到职位表中 + int activityId = Util.getIntValue(Util.null2String(rs.getString("jobactivityid"))); +// 将数据插入到职位表中 + this.insertJobTitle(position, rs, activityId, Util.getIntValue(String.valueOf(position.getSUPERIORJOBCODEID()))); + } + } + } + successMark.put("code", "1"); + successMark.put("msg", "插入" + position.getJOBCODEID() + "成功!"); + } + return successMark; +// writeErrorLog( "---------------"+className+" asyncPosition end --------------------"); + } + + + public Map asyncEmployee(Employee employee) { +// writeErrorLog( "---------------"+className+" asyncEmployee Begin --------------------"); +// 直接上级 + int managerId = 0; + String managerStr = ""; + Map successMark = new HashMap<>(); +// 安全级别 + String seclevel = getSystemParamValue("HR_SECLEVEL"); + if (seclevel == null || "".equals(seclevel)) { + seclevel = "0"; + } + String password = getSystemParamValue("PASSWORD"); + if (StringUtils.isNullOrEmpty(password)) { + password = employee.getUSERCODE(); + } +// 人员id + int hrmid = 0; +// TODO 不知道是否需要判断组织编码是否存在 + GetModelValue getModelValue = new GetModelValue<>(); + RecordSet rs = new RecordSet(); +// 查询配置表信息 + Map> configTableInfo = this.queryConfigTableInfo(employee, getModelValue, "m.api_field_type = 1"); + Map sysDep = configTableInfo.get("sys"); + Map defDep = configTableInfo.get("def"); +// 获取自定义字段的scopeid + rs.executeQuery("select * from cus_formfield"); + +// 查询人员的职责表,获取分部id,和直接上级id + Map subIdAndManagerIdMap = this.getSubIdAndManagerId(employee); + managerId = Util.getIntValue(String.valueOf(subIdAndManagerIdMap.get("managerId")), 0); + String departmentid = subIdAndManagerIdMap.get("departmentId").toString(); + String subcompanyid1 = subIdAndManagerIdMap.get("subCompanyId").toString(); + String today = TimeUtil.getCurrentDateString(); + // 根据outkey,询是否存在该人员 + String query = "select id from hrmresource where outkey = ?"; + try { + rs.executeQuery(query, Util.null2String(String.valueOf(employee.getUserID()))); + } catch (Exception e) { + writeErrorLog("select hrmresource error: " + query + Util.null2String(String.valueOf(employee.getUserID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + successMark.put("code", "0"); + successMark.put("msg", "查询出错,错误SQL:" + "select hrmresource error: " + query + Util.null2String(String.valueOf(employee.getUserID()))); + } + if (rs.next()) { +// 存在人员信息,获取到人员id + hrmid = Util.getIntValue(rs.getString("id")); +// 更新人员信息,拼接更新SQL + StringBuilder sysSetSql = this.builderSql(sysDep, 1).get("update"); +// StringBuilder defSetSql = this.builderSql(defDep, employee, getModelValue,1).get("update"); + Map sysMap = new HashMap() {{ + put("departmentid", subIdAndManagerIdMap.get("departmentId")); + put("subcompanyid1", subIdAndManagerIdMap.get("subCompanyId")); + }}; + // 查询该人员的职位信息 +// 查询到当前职位的id + String jobId = String.valueOf(subIdAndManagerIdMap.get("jobtitleId")); + sysMap.put("jobtitle", jobId); + if (null != subIdAndManagerIdMap.get("managerstr")) { + managerStr = subIdAndManagerIdMap.get("managerstr").toString(); + if (!managerStr.startsWith(",")) { + managerStr = "," + managerStr; + } + if (!managerStr.endsWith(",")) { + managerStr = managerStr + ","; + } + managerStr = managerStr + managerId + ","; + sysMap.put("managerstr", managerStr); + sysMap.put("managerid", managerId); + } + + sysMap.put("managerid", managerId); + sysMap.put("modified", this.getTime()); + + this.addDefaultUpdateSql(sysSetSql, sysMap); + + this.executeUpdateData(sysSetSql, "hrmresource", "id = '" + hrmid + "'"); +// TODO 待完善更新自定义人员信息表 +// 判断该字段的scopeid + for (Map.Entry entry : defDep.entrySet()) { +// 判断该字段属于的scopeid + String fieldId = entry.getKey().replace("field", ""); + try { + rs.executeQuery("select * from cus_formfield where fieldid = '" + Util.null2String(fieldId) + "' and scope = 'HrmCustomFieldByInfoType'"); + } catch (Exception e) { + writeErrorLog("select cus_fromfield error: select * from cus_formfield where fieldid = '" + Util.null2String(fieldId) + "' and scope = 'HrmCustomFieldByInfoType'"); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + String scopeid = Util.null2String(rs.getString("scopeid")); +// TODO 判断是否存在该信息,如果存在着更新,不存在着插入 + rs.executeQuery("select id from cus_fielddata where id = '" + hrmid + "' and scope = 'HrmCustomFieldByInfoType' and scopeid = '" + scopeid + "'"); + if (rs.next()) { +// 存在该信息,更新指定信息 + try { + rs.executeUpdate("update cus_fielddata set " + entry.getKey() + " = '" + entry.getValue() + "' where scopeid = " + scopeid + " and id = " + hrmid); + } catch (Exception e) { + writeErrorLog(className, "update error, sql: update cus_fielddata set " + entry.getKey() + " = " + entry.getValue() + " where scopeid = \" + scopeid +\" and id = \" + hrmid"); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + + } else { +// 不存在该信息,插入 + try { + rs.executeUpdate("insert into cus_fielddata (id,scopeid,scope," + entry.getKey() + ") values ('" + hrmid + "','" + scopeid + "','HrmCustomFieldByInfoType','" + entry.getValue() + "')"); + } catch (Exception e) { + writeErrorLog(className, "insert into error, sql : \"insert into cus_fielddata (id,scopeid,scope,\" + entry.getKey() + \") values ('\" + hrmid + \"','\" + scopeid + \"','HrmCustomFieldByInfoType','\" + entry.getValue() + \"')\""); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + } +// + } +// this.executeUpdateData(defSetSql,"cus_fielddata",""); + successMark.put("code", "2"); + successMark.put("msg", "更新成功!"); + } else { +// 不存在人员信息需要将人员信息插入到数据库中 +// 获取当前人员表中的最大id + rs.executeProc("HrmResourceMaxId_Get", ""); + rs.next(); + hrmid = rs.getInt(1); + if (managerId == 0) { + managerId = hrmid; + } +// 拼接插入SQL + Map insertSysBuilderMap = this.builderSql(sysDep, 2); + StringBuilder sysInsertSqlField = insertSysBuilderMap.get("insertField"); + StringBuilder sysInsertSqlValue = insertSysBuilderMap.get("insertValue"); +// 加入默认值 + String finalSeclevel = seclevel; + Map map = new HashMap() {{ + // 外部系统主键 + put("outkey", Util.null2String(String.valueOf(employee.getUserID()))); + // 所属分部id + put("subcompanyid1", subIdAndManagerIdMap.get("subCompanyId")); + // 部门id + put("departmentid", subIdAndManagerIdMap.get("departmentId")); +// 安全级别 + put("seclevel", finalSeclevel); +// 员工编号 + put("workcode", Util.null2String(employee.getUSERCODE())); +// 姓名 + put("lastname", Util.null2String(employee.getPreferred_Name()) + "/" + Util.null2String(employee.getUSERNAMECN())); + +// 岗位id + put("jobtitle", subIdAndManagerIdMap.get("jobtitleId")); +// 状态 + put("status", 1); +// 电话 + put("telephone", Util.null2String(employee.getTEL())); +// 移动电话 + put("mobile", Util.null2String(employee.getMOBILENO())); +// 电子邮件 + put("email", Util.null2String(employee.getEMAIL())); + + }}; + if (null != subIdAndManagerIdMap.get("managerstr")) { + managerStr = subIdAndManagerIdMap.get("managerstr").toString(); + if (!managerStr.startsWith(",")) { + managerStr = "," + managerStr; + } + if (!managerStr.endsWith(",")) { + managerStr = managerStr + ","; + } + managerStr = managerStr + managerId + ","; + map.put("managerstr", managerStr); + } +// userCode不为null的人员 + if (!StringUtils.isNullOrEmpty(employee.getUSERCODE())) { +// 登录名 + map.put("loginid", employee.getUSERCODE()); +// 密码 + map.put("password", EncryptHelper.encodeMd5(password).toUpperCase()); + } else { + writeErrorLog("the employee hove not usercode: " + employee); + } + +// id + map.put("id", hrmid); +// 直接上级 + map.put("managerid", managerId); + // 创建时间 + map.put("created", this.getTime()); +// 拼接默认值SQL + this.addDefaultInsertSql(sysInsertSqlField, sysInsertSqlValue, map); + // 插入数据 + this.executeInsertData(sysInsertSqlField, sysInsertSqlValue, "hrmresource"); + try { + if (departmentid == null || "".equals(departmentid)) { + departmentid = "0"; + } + if (subcompanyid1 == null || "".equals(subcompanyid1)) { + subcompanyid1 = "0"; + } + //共享信息 + char separator = Util.getSeparator(); + String p_para = "" + hrmid + separator + departmentid + separator + subcompanyid1 + separator + managerId + separator + seclevel + separator + managerStr + + separator + "0" + separator + "0" + separator + "0" + separator + "0" + separator + "0" + separator + "0"; +// this.writeDebuggerLog(p_para); + rs.executeProc("HrmResourceShare", p_para); + rs.executeProc("HrmResource_CreateInfo", "" + hrmid + separator + "1" + separator + today + separator + "1" + separator + today); + //触发器 + String para = "" + hrmid + separator + managerId + separator + departmentid + separator + subcompanyid1 + separator + "0" + separator + managerStr; + rs.executeProc("HrmResource_Trigger_Insert", para); + //入职维护状态 + rs.executeUpdate("insert into HrmInfoStatus (itemid,hrmid,status) values(1," + hrmid + ",1)"); + + rs.executeUpdate("insert into HrmInfoStatus (itemid,hrmid) values(2," + hrmid + ")"); + + rs.executeUpdate("insert into HrmInfoStatus (itemid,hrmid) values(3," + hrmid + ")"); + + rs.executeUpdate("insert into HrmInfoStatus (itemid,hrmid) values(10," + hrmid + ")"); + } catch (Exception e) { + writeErrorLog("error info:" + e.getMessage() + "\n"); + } +// 插入自定义信息表 + for (Map.Entry entry : defDep.entrySet()) { +// 判断该字段属于的scopeid + String fieldId = entry.getKey().replace("field", ""); + try { + rs.executeQuery("select * from cus_formfield where fieldid = '" + Util.null2String(fieldId) + "' and scope = 'HrmCustomFieldByInfoType'"); + } catch (Exception e) { + writeErrorLog("select cus_fromfield error: select * from cus_formfield where fieldid = '" + Util.null2String(fieldId) + "' and scope = 'HrmCustomFieldByInfoType'"); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + String scopeid = rs.getString("scopeid"); +// 插入数据表中指定字段信息 + rs.executeUpdate("insert into cus_fielddata (id,scopeid,scope," + entry.getKey() + ") values ('" + hrmid + "','" + scopeid + "','HrmCustomFieldByInfoType','" + entry.getValue() + "')"); + } + successMark.put("code", "1"); + successMark.put("msg", "插入成功!"); + } + return successMark; +// writeErrorLog( "---------------"+className+" asyncEmployee end --------------------"); + } + + private void addDefaultUpdateSql(StringBuilder sqlBuilder, Map map) { + for (Map.Entry entry : map.entrySet()) { + sqlBuilder.append(entry.getKey()); + sqlBuilder.append(" = "); + sqlBuilder.append("'"); + sqlBuilder.append(entry.getValue()); + sqlBuilder.append("',"); + } + } + + private Map getSubIdAndManagerId(Employee employee) { + Map map = new HashMap<>(); + RecordSet rs = new RecordSet(); +// 通过部门id查询该员工的分部id + String querySubIdAndId = "select id, subcompanyid1 from hrmdepartment where outkey = ?"; + try { + rs.executeQuery(querySubIdAndId, Util.null2String(String.valueOf(employee.getDEPARTMENTID()))); + } catch (Exception e) { + writeErrorLog("select hrmdepartment error: " + querySubIdAndId + Util.null2String(String.valueOf(employee.getDEPARTMENTID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); +// 该员工所属部门id + String departmentId = Util.null2String(rs.getString("id")); +// 该员工所属分部id + String subCompanyId = Util.null2String(rs.getString("subcompanyid1")); + map.put("subCompanyId", subCompanyId); + map.put("departmentId", departmentId); +// 查询该员工的直接上级id => 查询该员工的职位的cmssupjobid对应的职位 +// 由于需要判断该员工的职位是否存在上级职位,所以不能一条SQL搞定,首先需要查询该员工的职位的上级职位id,也就是判断是否存在上级职位 + String queryJobTitleId = "select id,cmssupjobid from hrmjobtitles where outkey = ?"; +// TODO 不知道需不需要在维护一下职位表中的所属部门id,如果需要的haunt将部门id更新进去就可以 +// 查询当前人员对应的职位id以及cms中的上级职位id + try { + rs.executeQuery(queryJobTitleId, Util.null2String(String.valueOf(employee.getJOBCODEID()))); + } catch (Exception e) { + writeErrorLog("select htmjobtitles error: " + queryJobTitleId + Util.null2String(String.valueOf(employee.getJOBCODEID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); +// 获取职位id + map.put("jobtitleId", Util.null2String(rs.getString("id"))); +// 获取cms中的上级职位id,如果存在则查询上级职位的id,如果不存在则表示该人员表示没有直接上级 + int cmsSupId = Util.getIntValue(Util.null2String(rs.getString("cmssupjobid")), 0); +/* if (cmsSupId != 0) { +// 表示该职位拥有上级职位,需要查询上级职位对应的人员 + String queryManagerId = "select h.id,h.managerstr from hrmresource as h join hrmjobtitles as j on h.jobtitle = j.id where j.outkey = ?"; + try { + rs.executeQuery(queryManagerId, Util.null2String(String.valueOf(cmsSupId))); + } catch (Exception e) { + writeErrorLog("select hrmresource error: " + queryManagerId + Util.null2String(String.valueOf(cmsSupId))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + if (rs.next()) { + map.put("managerId", Util.getIntValue(Util.null2String(rs.getString("id")))); + map.put("managerstr", Util.null2String(rs.getString("managerstr"))); + } else { + map.put("managerId", 0); + } + } else { +// 如果该职位没有上级职位,则将该员工的直接上级id设置为0 + map.put("managerId", 0); + }*/ + while (cmsSupId >= 0) { +// 表示该职位拥有上级职位,需要查询上级职位对应的人员 + String queryManagerId = "select h.id,h.managerstr from hrmresource as h join hrmjobtitles as j on h.jobtitle = j.id where j.outkey = ?"; + try { + rs.executeQuery(queryManagerId, Util.null2String(String.valueOf(cmsSupId))); + } catch (Exception e) { + writeErrorLog("select hrmresource error: " + queryManagerId + Util.null2String(String.valueOf(cmsSupId))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + if (rs.next()) { + map.put("managerId", Util.getIntValue(Util.null2String(rs.getString("id")))); + map.put("managerstr", Util.null2String(rs.getString("managerstr"))); + break; + } else { + if (cmsSupId == 0) { + break; + } + queryJobTitleId = "select id,cmssupjobid from hrmjobtitles where outkey = ?"; +// 查询当前人员对应的职位id以及cms中的上级职位id + try { + rs.executeQuery(queryJobTitleId, Util.null2String(String.valueOf(cmsSupId))); + } catch (Exception e) { + writeErrorLog("select htmjobtitles error: " + queryJobTitleId + Util.null2String(String.valueOf(employee.getJOBCODEID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + cmsSupId = Util.getIntValue(Util.null2String(rs.getString("cmssupjobid"))); + map.put("managerId", 0); + } + } + /*else { +// 如果该职位没有上级职位,则将该员工的直接上级id设置为0 + map.put("managerId", 0); + }*/ + return map; + } + + private void executeInsertData(StringBuilder insertFieldBuilder, StringBuilder insertValueBuilder, String table) { + RecordSet rs = new RecordSet(); + if (insertFieldBuilder.lastIndexOf(",") != -1 && insertValueBuilder.lastIndexOf(",") != -1) { +// 去除最后一个逗号 + String insertFiledStr = this.removeLastComma(insertFieldBuilder); + String insertValueStr = this.removeLastComma(insertValueBuilder); + String insertSysSql = "insert into " + table + " (" + insertFiledStr + ") values (" + insertValueStr + ")"; + try { + rs.executeUpdate(insertSysSql); + } catch (Exception e) { + writeErrorLog("insert " + table + " error: " + insertSysSql); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + + } + } + + private void executeUpdateData(StringBuilder updateSqlBuilder, String table, String conditions) { + RecordSet rs = new RecordSet(); + if (updateSqlBuilder.lastIndexOf(",") != -1) { + String updateSqlBuilderStr = updateSqlBuilder.substring(0, updateSqlBuilder.lastIndexOf(",")); + String updateSql = "update " + table + " set " + updateSqlBuilderStr + " where " + conditions; + try { + rs.executeUpdate(updateSql); + } catch (Exception e) { + writeErrorLog("update " + table + " error: " + updateSql); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + } + } + + private String removeLastComma(StringBuilder sqlBuilder) { + return sqlBuilder.substring(0, sqlBuilder.lastIndexOf(",")); + } + + private void addDefaultInsertSql(StringBuilder filedBuilder, StringBuilder valueBuilder, String filedName, Object value) { + filedBuilder.append(filedName); + filedBuilder.append(","); + valueBuilder.append("'"); + valueBuilder.append(value); + valueBuilder.append("',"); + } + + private void addDefaultInsertSql(StringBuilder filedBuilder, StringBuilder valueBuilder, Map map) { + for (Map.Entry entry : map.entrySet()) { + filedBuilder.append(entry.getKey()); + filedBuilder.append(","); + valueBuilder.append("'"); + valueBuilder.append(entry.getValue()); + valueBuilder.append("',"); + } + } + + private Map subCompanyHandler(Department department) { +// 企业(总部)id + int companyid = 1; +// 上级分部id + int supsubcomid = 0; + int subCompanyId; + int subcompanyid1 = 0; + int supDepId = 0; + RecordSet rs = new RecordSet(); + + + Map map = new HashMap<>(); +// 查询部门与手动维护的分部信息,并进行同步 + String subCompanySql = MessageFormat.format("select * from uf_subcompany where yjbmid = ''{0}''", String.valueOf(department.getDEPARTMENTID())); + if (rs.executeQuery(subCompanySql) && rs.next()) { + String subCompanyName = Util.null2String(rs.getString("fbmmc")); + String subCompanyDisc = Util.null2String(rs.getString("fbmms")); + subCompanyId = Util.getIntValue(Util.null2String(rs.getString("fbmid"))); +// 查询分部表,是否存在该分部 +// rs.executeQuery("select * from hrmsubcompany where id = ?", subCompanyId); + try { + rs.executeQuery("select * from hrmsubcompany where outkey = ?", Util.getIntValue(String.valueOf(subCompanyId))); + } catch (Exception e) { + writeErrorLog("select hrmsubcompany error: select * from hrmsubcompany where outkey = " + Util.getIntValue(String.valueOf(subCompanyId))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + if (rs.next()) { +// 已经存在分部信息,保存部门对应分部id + subcompanyid1 = Util.getIntValue(Util.null2String(rs.getString("id"))); +// 设置上级部门id为0 + supDepId = 0; +// 更新分部信息 + String updateSql = "update hrmsubcompany set " + + "subcompanyname = '" + subCompanyName + + "', subcompanydesc = '" + subCompanyDisc + + "', modified = '" + this.getTime() + + "' where id = " + subcompanyid1; + rs.executeUpdate(updateSql); + + } else { +// 不存在分部信息 + String insertSql = "insert into hrmsubcompany " + + "(outkey,companyid,subcompanyname,subcompanydesc,created,supsubcomid) values ('" + + subCompanyId + "', '" + companyid + "', '" + subCompanyName + "','" + subCompanyDisc + "','" + + this.getTime() + "','" + supsubcomid + "')"; + rs.executeUpdate(insertSql); +// 查询刚插入的分部id + try { + rs.executeQuery("select * from hrmsubcompany where outkey = ?", subCompanyId); + } catch (Exception e) { + writeErrorLog("select hrmsubcompany error: select * from hrmsubcompany where outkey = " + subCompanyId); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + subcompanyid1 = Util.getIntValue(Util.null2String(rs.getString("id"))); + } + } + map.put("subcompanyid1", subcompanyid1); + map.put("supDepId", supDepId); + return map; + } + + private Map builderSql(Map filedAndValue, int type) { + StringBuilder sql = new StringBuilder(); + Map map = new HashMap<>(); + if (type == 1) { +// 拼接更新SQL + for (Map.Entry entry : filedAndValue.entrySet()) { + sql.append(entry.getKey()).append(" = '"); + sql.append(entry.getValue()).append("',"); + } + map.put("update", sql); + return map; + } + if (type == 2) { +// 拼接插入SQL + StringBuilder sysInsertSqlField = new StringBuilder(); + StringBuilder sysInsertSqlValue = new StringBuilder(); + for (Map.Entry entry : filedAndValue.entrySet()) { + sysInsertSqlField.append(entry.getKey()); + sysInsertSqlField.append(","); + sysInsertSqlValue.append("'"); + sysInsertSqlValue.append(entry.getValue()); + sysInsertSqlValue.append("',"); + } + map.put("insertField", sysInsertSqlField); + map.put("insertValue", sysInsertSqlValue); + return map; + } + return map; + } + + private int insertJobGroup(Position position) { + RecordSet rs = new RecordSet(); + String insertJobGroups = MessageFormat.format("insert into hrmjobgroups (" + + "jobgroupname,jobgroupremark,created,outkey) values (" + + "''{0}'',''{1}'',''{2}'',''{3}'')", + position.getJOBFUNCTION(), position.getJOBFUNCTION(), this.getTime(), String.valueOf(position.getJOBCODEID())); + + try { + rs.executeUpdate(insertJobGroups); + } catch (Exception e) { + writeErrorLog("insert hrmjobgroups error: " + insertJobGroups); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + try { + rs.executeQuery("select * from hrmjobgroups where outkey = ?", Util.getIntValue(String.valueOf(position.getJOBCODEID()))); + } catch (Exception e) { + writeErrorLog("select hrmjobgroups error: select * from hrmjobgroups where outkey = " + Util.getIntValue(String.valueOf(position.getJOBCODEID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + return Util.getIntValue(Util.null2String(rs.getString("id"))); + } + + private int insertJobActive(Position position, int groupId) { + RecordSet rs = new RecordSet(); + String insertJobActive = MessageFormat.format("insert into hrmjobactivities (" + + "jobactivitymark,jobactivityname,jobgroupid,created,outkey) values (" + + "''{0}'',''{1}'',''{2}'',''{3}'',''{4}'')", + position.getJOBFUNCTION(), position.getJOBFUNCTION(), String.valueOf(groupId), this.getTime(), String.valueOf(position.getJOBCODEID())); + + try { + rs.executeUpdate(insertJobActive); + } catch (Exception e) { + writeErrorLog("insert hrmjobactivities error: " + insertJobActive); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + + try { + rs.executeQuery("select * from hrmjobactivities where outkey = ?", Util.getIntValue(String.valueOf(position.getJOBCODEID()))); + } catch (Exception e) { + writeErrorLog("select hrmjobactivities error: select * from hrmjobactivities where outkey = " + Util.getIntValue(String.valueOf(position.getJOBCODEID()))); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + return Util.getIntValue(Util.null2String(rs.getString("id"))); + } + + private void insertJobTitle(Position position, RecordSet rs, int activityId, int cmsSupJobId) { + String insertJobTitle = MessageFormat.format("insert into hrmjobtitles (" + + "jobtitlemark,jobtitlename,jobactivityid,jobtitlecode,created,outkey,cmssupjobid) values (" + + "''{0}'',''{1}'',''{2}'',''{3}'',''{4}'',''{5}'',''{6}'')", + position.getJOBFUNCTION(), position.getJOBFUNCTION(), String.valueOf(activityId), position.getJOBCODE(), + this.getTime(), String.valueOf(position.getJOBCODEID()), String.valueOf(cmsSupJobId)); + try { + rs.executeUpdate(insertJobTitle); + } catch (Exception e) { + writeErrorLog("insert hrmjobtitles error: " + insertJobTitle); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + + } + + /** + * 查询配置表字段信息 + * + * @return + */ + public Map> queryConfigTableInfo(Object obj, GetModelValue getModelValue, String conditions) { + RecordSet rs = new RecordSet(); + Map> configResults = new HashMap<>(); + try { + rs.executeQuery("select d.id,m.api_field_type,d.api_field,d.change_rules,d.custom_rules_value,d.ao_field,oa_field_type from uf_cms_async as m " + + "inner join uf_cms_async_dt1 as d on d.mainid = m.id where " + conditions); + } catch (Exception e) { + writeErrorLog("select configTable error: " + "select d.id,m.api_field_type,d.api_field,d.change_rules,d.custom_rules_value,d.ao_field,oa_field_type from uf_cms_async as m " + + "inner join uf_cms_async_dt1 as d on d.mainid = m.id where " + conditions); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + Map sysDep = new HashMap<>(); + Map defDep = new HashMap<>(); +// TODO 判断转换规则,如果是自定义SQL,则需要先执行SQL,如果是固定值,则需要进行直接赋值,如果是不转换,则按照默认走 + while (rs.next()) { + String apiFieldType = Util.null2String(rs.getString("api_field_type")); + String oaFieldType = Util.null2String(rs.getString("oa_field_type")); + String apiField = Util.null2String(rs.getString("api_field")); + int changeRules = Util.getIntValue(Util.null2String(rs.getString("change_rules"))); + if (changeRules == 0) { +// 转换规则为不转换,获取api字段对应的值 + try { + apiField = (String) getModelValue.getValueForString(obj, apiField); + } catch (NoSuchMethodException | InvocationTargetException | IllegalAccessException e) { + this.writeErrorLog(className, "changeRules error,args is: apiField[" + apiField + "],obj[" + obj + "]"); + e.printStackTrace(); + } + } else if (changeRules == 2) { +// 转换规则为自定义SQL + String customRulesValue = Util.null2String(rs.getString("custom_rules_value")); + if (customRulesValue.contains("delete") || customRulesValue.contains("update") || + customRulesValue.contains("exec") || customRulesValue.contains("drop") || + customRulesValue.contains("truncate")) { +// sql 不包含delete,update,exec,drop,truncate等危险关键字 + } else if (customRulesValue.contains("select")) { +// 包含查询关键词 + try { + rs.executeQuery(customRulesValue); + } catch (Exception e) { + writeErrorLog("execute custom sql error: " + customRulesValue); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + apiField = Util.null2String(rs.getString(1)); + } + } else { + apiField = Util.null2String(rs.getString("custom_rules_value")); + } +// 如果属于系统字段 + if ("0".equals(oaFieldType)) { + sysDep.put(Util.null2String(rs.getString("ao_field").replace(apiFieldType + oaFieldType, "")), apiField); + } else { +// 属于自定义字段 + defDep.put(Util.null2String(rs.getString("ao_field").replace(apiFieldType + oaFieldType, "")), apiField); + } + } + configResults.put("sys", sysDep); + configResults.put("def", defDep); + return configResults; + } + + public String getTime() { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + return formatter.format(date); + } +} diff --git a/weaver/aiyh_pcn/copy_attachment/AttachmentIdName.java b/weaver/aiyh_pcn/copy_attachment/AttachmentIdName.java new file mode 100644 index 0000000..2173fd3 --- /dev/null +++ b/weaver/aiyh_pcn/copy_attachment/AttachmentIdName.java @@ -0,0 +1,37 @@ +package weaver.aiyh_pcn.copy_attachment; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/9 0009 14:39 + * id和name + */ + + +public class AttachmentIdName { + private String docid; + private String imagefilename; + + @Override + public String toString() { + return "AttachmentIdName{" + + "docId='" + docid + '\'' + + ", imagefilename='" + imagefilename + '\'' + + '}'; + } + + public String getDocid() { + return docid; + } + + public void setDocid(String docId) { + this.docid = docId; + } + + public String getImagefilename() { + return imagefilename; + } + + public void setImagefilename(String imagefilename) { + this.imagefilename = imagefilename; + } +} diff --git a/weaver/aiyh_pcn/copy_attachment/CopyAttachmentAction.java b/weaver/aiyh_pcn/copy_attachment/CopyAttachmentAction.java new file mode 100644 index 0000000..b27b16c --- /dev/null +++ b/weaver/aiyh_pcn/copy_attachment/CopyAttachmentAction.java @@ -0,0 +1,132 @@ +package weaver.aiyh_pcn.copy_attachment; + +import aiyh.utils.Util; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.copy_attachment.dao.ConfigTableData; +import com.api.aiyh_pcn.copy_attachment.model.ConfigEmpty; +import weaver.conn.RecordSet; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/9 0009 13:42 + * 模板覆盖文件 + */ + + +public class CopyAttachmentAction extends ToolUtil implements Action { + //当前类名称 + private final String className = "AddCustomer_Action"; + private String overrideField; + + + @Override + public String execute(RequestInfo requestInfo) { + this.writeDebuggerLog(className + "======>" + overrideField); + try { + String workflowid = requestInfo.getWorkflowid(); + //流程请求ID + String requestid = Util.null2String(requestInfo.getRequestid()); + //流程表单名称 + String tableName = requestInfo.getRequestManager().getBillTableName(); + ConfigEmpty config = ConfigTableData.getConfig(workflowid); +// 查询是流程数据 + String query = "select * from " + tableName + " where requestid = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(query,requestid); + Map requestMap = Util.recordSet2Map(rs); + if(requestMap == null || config == null){ + return Action.SUCCESS; + } + if(!requestMap.get(config.getShowField()).equals(config.getShowValue())){ + return Action.SUCCESS; + } +// 需要模板覆盖 + String attachmentValue = String.valueOf(requestMap.get(config.getAttachmentField())); + String overrideValue = String.valueOf(requestMap.get(overrideField)); + this.writeDebuggerLog(requestMap.toString()); +// 查询这些文件的相关信息 + query = "select docid,imagefilename from docimagefile where docid in (" + attachmentValue + ")"; + this.writeDebuggerLog(query); + rs.executeQuery(query); + List attachmentList = Util.recordeSet2Array(rs, AttachmentIdName.class); + query = "select docid,imagefilename from docimagefile where docid in (" + overrideValue + ")"; + rs.executeQuery(query); + this.writeDebuggerLog(query); + List overrideList = Util.recordeSet2Array(rs, AttachmentIdName.class); + this.writeDebuggerLog(attachmentList.toString()); + this.writeDebuggerLog(overrideList.toString()); + if (attachmentList.size() != overrideList.size()){ + requestInfo.getRequestManager().setMessagecontent("合同模板与上传模板数量不一致"); + requestInfo.getRequestManager().setMessageid("合同模板与上传模板数量不一致"); + return Action.FAILURE_AND_CONTINUE; + } +// 需要移除的文件 + List removeFile = new ArrayList<>(); +// 移除所有的pdf文件 + for (AttachmentIdName overrideIdName : overrideList) { + String fileName = overrideIdName.getImagefilename(); + String extension = ""; + this.writeDebuggerLog(overrideIdName.toString()); + int index = fileName.lastIndexOf('.'); + if (index > 0) { + extension = fileName.substring(index + 1); + } + this.writeDebuggerLog(extension); + if("pdf".equalsIgnoreCase(extension)){ + removeFile.add(overrideIdName); + } + } +// 删除文件 + for (AttachmentIdName overrideIdName : removeFile) { + overrideList.remove(overrideIdName); + } +// 添加pdf文件 + for (AttachmentIdName attachmentIdName : attachmentList) { + String fileName = attachmentIdName.getImagefilename(); + String extension = ""; + this.writeDebuggerLog(attachmentIdName.toString()); + int index = fileName.lastIndexOf('.'); + if (index > 0) { + extension = fileName.substring(index + 1); + } + this.writeDebuggerLog(extension); + if("pdf".equalsIgnoreCase(extension)){ + overrideList.add(attachmentIdName); + } + } + if (attachmentList.size() != overrideList.size()){ + requestInfo.getRequestManager().setMessagecontent("合同模板与上传模板数量不一致"); + requestInfo.getRequestManager().setMessageid("合同模板与上传模板数量不一致"); + return Action.FAILURE_AND_CONTINUE; + } + StringBuilder overrideBuilder = new StringBuilder(); + for (AttachmentIdName overrideIdName : overrideList) { + overrideBuilder.append(",").append(overrideIdName.getDocid()); + } + String overrideResult = Util.removeSeparator(overrideBuilder); + this.writeDebuggerLog(overrideResult); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(tableName, ParaMap.create().put(this.overrideField, overrideResult), + Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestid)); + rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + }catch (Exception e){ + this.writeErrorLog(e.getMessage()); + } + return Action.SUCCESS; + } + + public String getOverrideField() { + return overrideField; + } + + public void setOverrideField(String overrideField) { + this.overrideField = overrideField; + } +} diff --git a/weaver/aiyh_pcn/copy_attachment/CopyAttachmentSecretAction.java b/weaver/aiyh_pcn/copy_attachment/CopyAttachmentSecretAction.java new file mode 100644 index 0000000..92137c3 --- /dev/null +++ b/weaver/aiyh_pcn/copy_attachment/CopyAttachmentSecretAction.java @@ -0,0 +1,205 @@ +package weaver.aiyh_pcn.copy_attachment; + +import aiyh.utils.Util; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.copy_attachment.dao.DocTemplateDao; +import com.api.aiyh_pcn.copy_attachment.model.ConfigEmpty; +import org.h2.util.StringUtils; +import weaver.conn.RecordSet; +import weaver.hrm.User; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/8 0008 15:38 + * baomixieyi + */ + + +public class CopyAttachmentSecretAction extends ToolUtil implements Action { + private String attachmentTemplateId; + private String isBrowseBox; + @Override + public String execute(RequestInfo requestInfo) { + ToolUtil toolUtil = new ToolUtil(); + + try { + User user = requestInfo.getRequestManager().getUser(); + String billTableName = requestInfo.getRequestManager().getBillTableName(); + String requestId = requestInfo.getRequestid(); + String workflowId = requestInfo.getWorkflowid(); + RecordSet rs_1 = new RecordSet(); +// 查询流程数据 + String query = "select * from " + billTableName + " where requestid = ?"; + toolUtil.writeErrorLog("进入保密协议action!"); + +// 查询配置表,获取配置数据 + String querySql = "select ufta.id,ufta.workflow_type,wftva.fieldname as template_field, " + + "wftvb.fieldname as attachment_field,wftv.fieldname as show_field, wftvb.id as attachment_field_id, " + + "ufta.is_template_show,ufta.model_table_name, ufta.model_field,wsl.selectvalue as show_value, " + + "wftv.tablename as show_table_name,wftva.tablename as template_table_name,wftvb.tablename as attachment_table_name, " + + "wsla.selectvalue as hidden_value from uf_temp_attachment as ufta " + + "left join workflow_selectitem as wsl on wsl.id = ufta.show_value " + + "left join workflow_selectitem as wsla on wsla.id = ufta.hidden_value " + + "left join workflow_field_table_view as wftv on wftv.id = ufta.show_field " + + "left join workflow_field_table_view as wftva on wftva.id = ufta.template_field " + + "left join workflow_field_table_view as wftvb on wftvb.id = ufta.attachment_field " + + "where workflow_type in " + + "(select id from workflow_base where activeVersionID in " + + "(select activeVersionID from workflow_base where id = ?) or id = ?) and attachment_type = ?"; + RecordSet rs = new RecordSet(); + rs.executeQuery(querySql, workflowId, workflowId, 1); + if (rs.next()) { +// id + int id = Util.getIntValue(rs.getString("id")); +// 显示值 + int showValue = Util.getIntValue(rs.getString("show_value")); +// 隐藏值 + int hiddenValue = Util.getIntValue(rs.getString("hidden_value")); +// 流程id + String workflowType = rs.getString("workflow_type"); +// 模板字段 + String templateField = rs.getString("template_field"); +// 附件字段 + String attachmentField = rs.getString("attachment_field"); +// 是否用字段控制模板 + String isTemplateShow = rs.getString("is_template_show"); +// 模板建模表表名 + String modelTableName = rs.getString("model_table_name"); +// 控制模板显示与否的字段 + String showField = rs.getString("show_field"); +// 建模表福建模板字段 + String modelField = rs.getString("model_field"); +// 控制显示所在表 + String showTableName = rs.getString("show_table_name"); +// 模板字段所在表 + String templateTableName = rs.getString("template_table_name"); +// 附件字段所在表 + String attachmentTableName = rs.getString("attachment_table_name"); +// 附件字段id + String attachmentFieldId = rs.getString("attachment_field_id"); + toolUtil.writeDebuggerLog("保密协议已经查询到数据!"); + + ConfigEmpty configEmpty = ConfigEmpty.create() + .id(id) + .showValue(showValue) + .hiddenValue(hiddenValue) + .workflowType(workflowType) + .templateField(templateField) + .attachmentField(attachmentField) + .isTemplateShow(isTemplateShow) + .modelTableName(modelTableName) + .showField(showField) + .modelField(modelField) + .showTableName(showTableName) + .templateTableName(templateTableName) + .attachmentTableName(attachmentTableName) + .attachmentFieldId(attachmentFieldId) + .builder(); + toolUtil.writeErrorLog("保密协议数据:" + configEmpty.toString()); +// 如果不控制是否使用模板,那就默认不添加保密协议 + if ("1".equals(isTemplateShow)) { +// 不使用模板 + return Action.SUCCESS; + } + rs_1.executeQuery(query, requestId); + Map requestData = Util.recordSet2Map(rs_1); + toolUtil.writeErrorLog(requestData.toString()); +// rs_1.next(); + String showFieldValue = String.valueOf(requestData.get(configEmpty.getShowField())); +// 不使用保密协议模板 + if (configEmpty.getShowValue() != Integer.parseInt(showFieldValue)) { + return Action.SUCCESS; + } +// 使用保密协议模板 + String docIds = copyFile(user, configEmpty,String.valueOf(requestData.get(configEmpty.getTemplateField()))); + toolUtil.writeErrorLog("复制完成文件id:" + docIds); + if (StringUtils.isNullOrEmpty(docIds)) { + requestInfo.getRequestManager().setMessageid("1"); +// TODO 修改htmlLabel + requestInfo.getRequestManager().setMessagecontent(aiyh.utils.Util.getHtmlLabelName(-87783, user.getLanguage(), "保密协议复制失败,未能正确复制保密协议!")); + return Action.FAILURE_AND_CONTINUE; + } + String fileIds = Util.null2String(rs_1.getString(configEmpty.getAttachmentField())); + String[] split = fileIds.split(","); + List list = Arrays.stream(split).collect(Collectors.toList()); + String[] split1 = docIds.split(","); + list.addAll(Arrays.stream(split1).collect(Collectors.toList())); + +// 修改流程数据,将保密协议的docid更新到流程中 + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(billTableName, ParaMap.create().put(configEmpty.getAttachmentField(), String.join(",", list)), + Util.createPrepWhereImpl().whereAnd("requestid").whereEqual(requestId)); + toolUtil.writeErrorLog("sql : " + sqlResult.getSqlStr() + " 参数: ---> " + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + }catch (Exception e){ + toolUtil.writeErrorLog("出现错误: " + e); + } + return Action.SUCCESS; + } + + public String copyFile(User user, ConfigEmpty configEmpty,String browseBoxId){ + ToolUtil toolUtil = new ToolUtil(); +// 建模表名称 params.get("tableName") + String tableName = String.valueOf(configEmpty.getModelTableName()); +// 建模字段名 params.get("fieldName") + String fieldName = String.valueOf(configEmpty.getModelField()); +// 附件字段id params.get("fileFieldId") + String fileFieldId = String.valueOf(configEmpty.getAttachmentField()); +// 配置id params.get("configId") +// String configId = String.valueOf(configEmpty.getId()); + String configId; + if("true".equals(isBrowseBox)){ + configId = browseBoxId; + }else { + configId = attachmentTemplateId; + } +// 流程id params.get("workflowId") + String workflowId = String.valueOf(configEmpty.getWorkflowType()); + DocTemplateDao docTemplateDao = new DocTemplateDao(); + int[] docIds = null; + try{ + docIds = docTemplateDao.copyFile(user.getUID(), tableName, fieldName, configId); + }catch(Exception e){ + toolUtil.writeErrorLog("复制文件出错: " + e); + return null; + } + if(docIds == null){ + return null; + } + try{ + docTemplateDao.updateFileInfo(workflowId,fileFieldId,docIds); + }catch(Exception e){ + toolUtil.writeErrorLog("复制文件更新权限和目录出错: " + e); + return null; + } + toolUtil.writeDebuggerLog("数据更新成功!" + Arrays.toString(docIds)); + List intList= Arrays.stream(docIds).boxed().collect(Collectors.toList()) + .stream().map(String::valueOf).collect(Collectors.toList()); + return String.join(",",intList); + } + + public String getAttachmentTemplateId() { + return attachmentTemplateId; + } + + public void setAttachmentTemplateId(String attachmentTemplateId) { + this.attachmentTemplateId = attachmentTemplateId; + } + + public String getIsBrowseBox() { + return isBrowseBox; + } + + public void setIsBrowseBox(String isBrowseBox) { + this.isBrowseBox = isBrowseBox; + } +} diff --git a/weaver/aiyh_pcn/fadada/FaDDContractAction.java b/weaver/aiyh_pcn/fadada/FaDDContractAction.java new file mode 100644 index 0000000..51d53db --- /dev/null +++ b/weaver/aiyh_pcn/fadada/FaDDContractAction.java @@ -0,0 +1,140 @@ +package weaver.aiyh_pcn.fadada; + +import aiyh.utils.Util; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import org.h2.util.StringUtils; +import weaver.aiyh_pcn.fadada.util.FaddContractUtil; +import weaver.hrm.User; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; +import weaver.systeminfo.SystemEnv; + +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/3 0003 15:20 + */ + + +public class FaDDContractAction extends ToolUtil implements Action { + private final FaDDContractMapping faDDContractMapping = new FaDDContractMapping(); + private final ToolUtil toolUtil = new ToolUtil(); +// 合同字段 + private String contractField; +// 客户编号字段 + private String customerNoField; +// 客户编号 + private String customerNo; +// 是否是顺序签订 + private String queueSigned; +// 签订字段 + private String signedField; +// 签订值 + private String signedValue; + + + @Override + public String execute(RequestInfo requestInfo) { +// 获取user + User user = requestInfo.getRequestManager().getUser(); +// 获取流程id + String workflowId = requestInfo.getWorkflowid(); +// 获取请求id + String requestId = requestInfo.getRequestid(); +// 获取主表名称 + String mainTableName = requestInfo.getRequestManager().getBillTableName(); +// 获取法大大配置信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 2); +// 获取明细数据在那个表 + String tableName = faDaDaConfigDTO.getCheckSource(); +// 查询主表信息 + Map mainMap = faDDContractMapping.queryMainMap(requestId, mainTableName); +// 判断主表中的电子签章类型 + String value = Util.null2String(mainMap.get(signedField)); + if (StringUtils.isNullOrEmpty(value)) { + value = String.valueOf(System.currentTimeMillis()); + } +// 如果不需要进行电子签章,则放行流程 + if (!value.equals(signedValue)) { + return Action.SUCCESS; + } + String mainId = Util.null2String(mainMap.get("id")); +// 查询明细数据 + List> detailMaps = faDDContractMapping.queryDetailMaps(mainId, tableName); +// 开始签署合同 + FaddContractUtil faddContractUtil = new FaddContractUtil(workflowId, requestId, mainTableName, tableName, + customerNo, customerNoField, contractField, queueSigned, detailMaps, mainMap); + try { + faddContractUtil.createContract(); + } catch (Exception e) { + toolUtil.writeErrorLog("合同创建失败,失败原因:" + e); +// TODO 更换labelIndex + requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-87660,user.getLanguage(),"合同创建失败,未能正确创建法大大合同!")); + requestInfo.getRequestManager().setMessageid("1"); + return Action.FAILURE_AND_CONTINUE; + } + try { + faddContractUtil.signedContract(); + } catch (Exception e) { + toolUtil.writeErrorLog("合同已创建,但发起签署失败,失败原因:" + e); +// TODO 更换labelIndex + requestInfo.getRequestManager().setMessagecontent(Util.getHtmlLabelName(-87659,user.getLanguage(),"合同已创建,当合同发起签署时失败!")); + requestInfo.getRequestManager().setMessageid("2"); + return Action.FAILURE_AND_CONTINUE; + } + return Action.SUCCESS; + } + + + public String getContractField() { + return contractField; + } + + public void setContractField(String contractField) { + this.contractField = contractField; + } + + public String getCustomerNoField() { + return customerNoField; + } + + public void setCustomerNoField(String customerNoField) { + this.customerNoField = customerNoField; + } + + public String getCustomerNo() { + return customerNo; + } + + public void setCustomerNo(String customerNo) { + this.customerNo = customerNo; + } + + public String getSignedField() { + return signedField; + } + + public void setSignedField(String signedField) { + this.signedField = signedField; + } + + public String getSignedValue() { + return signedValue; + } + + public void setSignedValue(String signedValue) { + this.signedValue = signedValue; + } + + public String getQueueSigned() { + return queueSigned; + } + + public void setQueueSigned(String queueSigned) { + this.queueSigned = queueSigned; + } +} diff --git a/weaver/aiyh_pcn/fadada/UploadFile2FaDDAction.java b/weaver/aiyh_pcn/fadada/UploadFile2FaDDAction.java new file mode 100644 index 0000000..a485bb3 --- /dev/null +++ b/weaver/aiyh_pcn/fadada/UploadFile2FaDDAction.java @@ -0,0 +1,493 @@ +package weaver.aiyh_pcn.fadada; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigDetailDTO; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.fadada.dao.FaDDServiceMapping; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils; +import com.fasterxml.jackson.core.JsonProcessingException; +import org.h2.util.StringUtils; +import weaver.aiyh_pcn.fadada.entity.FileInfo; +import weaver.conn.RecordSet; +import weaver.file.ImageFileManager; +import weaver.hrm.User; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; +import weaver.workflow.workflow.WorkflowVersion; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/13 0013 19:41 + * 上传合同 + */ + + +public class UploadFile2FaDDAction extends ToolUtil implements Action { + private final FaDDServiceMapping faDDServiceMapping = new FaDDServiceMapping(); + private String workflowId; + private String requestId; + private String mainTableName; + private String tableName; + private final RecordSet rs = new RecordSet(); + private String contractField; + private String customerNoField; + private String customerNo; + private String manySigned; + private String manySignedNum; + private String manySignedCompanyNo; + private String signedField; + private String signedValue; + private String manySignedKeyWord; + private List> detailMaps; + private Map mainMap; + + @Override + public String execute(RequestInfo requestInfo) { + this.workflowId = requestInfo.getWorkflowid(); + this.requestId = requestInfo.getRequestid(); + this.mainTableName = requestInfo.getRequestManager().getBillTableName(); + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 2); + this.tableName = faDaDaConfigDTO.getCheckSource(); + super.writeErrorLog("进入action:workflowId:" + workflowId + ",requestId:" + requestId + ",mainTableName:" + + mainTableName + ",tableName:" + tableName + ",contractField:" + contractField + ",customerNoField:" + customerNoField); + String query = "select * from " + this.mainTableName + " where requestid = ?"; + RecordSet rs_1 = new RecordSet(); + rs_1.executeQuery(query, this.requestId); + this.mainMap = Util.recordSet2Map(rs_1); + String value = String.valueOf(mainMap.get(signedField)); + if(signedValue == null){ + signedValue = ""; + } + if(!signedValue.equals(value)){ + return Action.SUCCESS; + } + try { + this.createContract(); + try { + this.signedContract(); + } catch (Exception e) { + super.writeErrorLog("合同签署时发生错误:" + e); + throw e; + } + } catch (Exception e) { + e.printStackTrace(); + super.writeErrorLog("合同action出现错误,错误原因:" + e.toString()); + User user = requestInfo.getRequestManager().getUser(); + Map map = Util.queryLanguage(1, user.getLanguage()); + requestInfo.getRequestManager().setMessagecontent(map.get("actionInfo")); + requestInfo.getRequestManager().setMessageid(map.get("actionInfo")); + return Action.FAILURE_AND_CONTINUE; + } +// this.signedContract(); + return Action.SUCCESS; + } + + public void createContract() { + String versionStringByWfid = WorkflowVersion.getVersionStringByWfid(workflowId); + RecordSet rs = new RecordSet(); + rs.executeQuery("select * from uf_contract_config where workflow_type in ( " + versionStringByWfid + " ) and api_type = ?", 2); + rs.next(); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(rs.getString("params_config")); + String query = "select * from " + this.mainTableName + " where requestid = ?"; + RecordSet rs_1 = new RecordSet(); + rs_1.executeQuery(query, this.requestId); + this.mainMap = Util.recordSet2Map(rs_1); + String mainId = ""; + if (this.mainMap != null) { + mainId = String.valueOf(this.mainMap.get("id")); + } else { + super.writeErrorLog("没有查询到相关的请求id的数据!"); + } + query = "select * from " + this.tableName + " where mainid = ?"; + super.writeErrorLog(mainMap.toString()); + this.rs.executeQuery(query, mainId); + this.detailMaps = Util.recordSet2MapList(this.rs); + if (detailMaps == null) { + super.writeErrorLog("查询明细失败!maps为null"); + throw new RuntimeException("明细查询失败!maps为null"); + } + super.writeErrorLog("明细表数据:" + detailMaps); + for (Map detail : detailMaps) { + List fileInfos = this.contractHandle(detail, this.contractField); + List contractNoIds = new ArrayList<>(); + List fileNoIds = new ArrayList<>(); + List fileName = new ArrayList<>(); + if (fileInfos == null || fileInfos.size() == 0) { + throw new RuntimeException("创建合同失败!"); + } + for (FileInfo fileInfo : fileInfos) { + ResponeVo contract = FaDDRequestUtils.createContract(fileInfo, apiConfigMainDTO.getApiUrl()); + Map result; + try { + Map entityMap = contract.getEntityMap(); + if (!"200".equals(String.valueOf(entityMap.get("code")))) { + super.writeErrorLog("创建合同失败,错误信息:" + entityMap.get("message")); + throw new RuntimeException("创建合同失败!"); + } + result = (Map) entityMap.get("data"); + contractNoIds.add(Util.null2String(result.get("contractNo"))); + fileNoIds.add(Util.null2String(result.get("fileNo"))); + fileName.add(fileInfo.getImagefilename()); + } catch (JsonProcessingException e) { + super.writeErrorLog(e.toString()); + throw new RuntimeException("创建合同失败!"); + } + } + String joinContract = String.join(",", contractNoIds); + String joinFileNoIds = String.join(",", fileNoIds); + String joinFileName = String.join(",", fileName); + Map updateMap = ParaMap.create().put("contract_no", joinContract) + .put("file_no", joinFileNoIds) + .put("file_name", joinFileName); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(this.tableName, updateMap, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(detail.get("id"))); + super.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + + } + } + + public List contractHandle(Map detail, String contractField) { + String fileIds = Util.null2String(detail.get(contractField)); + if (StringUtils.isNullOrEmpty(fileIds)) { + fileIds = Util.null2String(this.mainMap.get(contractField)); + } + if ("".equals(fileIds)) { + return null; + } + List fileInfos = faDDServiceMapping.queryImgFileIdByDocIds(fileIds); + String customer = customerNo; + ; + if (StringUtils.isNullOrEmpty(customerNo)) { + + String query = " select fadadaechapter from uf_gyszsjb where vendorCode = ?"; + rs.executeQuery(query, String.valueOf(detail.get(customerNoField))); + rs.next(); + customer = rs.getString(1); + } +// super.writeErrorLog("fileInfos:" + fileInfos + ",fileIds:" + fileIds + ",customerNo:" + customerNo); + for (FileInfo fileInfo : fileInfos) { + InputStream inputStreamById = ImageFileManager.getInputStreamById(fileInfo.getImagefileid()); + fileInfo.setFile(inputStreamById); + String imagefilename = fileInfo.getImagefilename(); + if (imagefilename == null) { + return null; + } + fileInfo.setContractExtension(imagefilename.substring(imagefilename.lastIndexOf("."))); + fileInfo.setContractTitle(imagefilename); +// TODO fileInfo.setCustomerNo(Util.null2String(detail.get("customer_no"))); +// fileInfo.setCustomerNo("e23deb7a29714d0da5b806665ab3e2f8"); + fileInfo.setCustomerNo(Util.null2String(customer)); + if (StringUtils.isNullOrEmpty(fileInfo.getCustomerNo())) { + fileInfo.setCustomerNo(Util.null2String(detail.get("companyno"))); + } + fileInfo.setUploadType(1); + } + return fileInfos; + } + + public void signedContract() { + String query = "select * from " + this.tableName + " where mainid = ?"; + this.rs.executeQuery(query, String.valueOf(mainMap.get("id"))); + this.detailMaps = Util.recordSet2MapList(this.rs); + if (detailMaps == null) { + super.writeErrorLog("查询明细失败!maps为null"); + return; + } + FaDaDaConfigDTO faDaDaConfigDTO = faDDServiceMapping.queryConfig(workflowId, 3); + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); + List> dataArr = new ArrayList<>(); + String detailTable; + String dt = this.tableName.substring(this.tableName.indexOf("_dt") + 3); + detailTable = "detail_" + dt; + for (Map detailMap : this.detailMaps) { + Map dataMap = new HashMap<>(); + for (Map.Entry entry : detailMap.entrySet()) { + dataMap.put(detailTable + "." + entry.getKey(), entry.getValue()); + } + for (Map.Entry entry : this.mainMap.entrySet()) { + dataMap.put("main" + "." + entry.getKey(), entry.getValue()); + } + dataArr.add(dataMap); + } + List> maps = objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + int n = 0; + for (Map map : maps) { + int contractNum = 0; + if ("true".equals(manySigned)) { + String[] companyNos = manySignedCompanyNo.split(","); + String[] keyWords = manySignedKeyWord.split(","); + for (int i = 0; i < companyNos.length; i++) { + String companyNo = String.valueOf(detailMaps.get(n).get(companyNos[i])); + String keyWord = String.valueOf(detailMaps.get(n).get(keyWords[i])); + map.put("companyNo", companyNo); + map.put("locateKey", keyWord); + String contractNos = Util.null2String(map.get("contractNo")); + String[] split = contractNos.split(","); + for (String s : split) { + map.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl()); + contractNum++; + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { + super.writeErrorLog("法大大接口签署合同失败!"); + } + } + } + } else { + String contractNos = Util.null2String(map.get("contractNo")); + String[] split = contractNos.split(","); + for (String s : split) { + map.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl()); + contractNum++; + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { + super.writeErrorLog("法大大接口签署合同失败!"); + } + } + } +// 更新合同数量 + Map updateMap = new HashMap<>(); + updateMap.put("contract_num", contractNum); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(tableName, updateMap, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(detailMaps.get(n).get("id")))); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + n++; + } + } + + private List> objectAndListHandle(List treeList, List> dataArr) { + List> params = new ArrayList<>(); + for (Map dataMap : dataArr) { + Map param = new HashMap<>(); + for (ApiConfigDetailDTO apiConfigDetailDTO : treeList) { + Object value; + if (apiConfigDetailDTO.getParamType() == 3) { + Map map = new HashMap<>(); +// object类型 + for (ApiConfigDetailDTO child : apiConfigDetailDTO.getChildren()) { + if (child.getChildren() == null || child.getChildren().size() == 0) { +// handleChild(child.getChildren(), dataMap) + map.put(child.getParamName(), changeRuleHandle(child, dataMap)); + } else { + map.put(child.getParamName(), handleChild(child.getChildren(), dataMap)); + } + } + value = map; + } else if (apiConfigDetailDTO.getParamType() == 4) { + String sql = apiConfigDetailDTO.getArraySql(); + String parsingSq = Util.parsingSq(sql, dataMap); +// list类型 + if (parsingSq.contains("delete") || parsingSq.contains("update") || + parsingSq.contains("exec") || parsingSq.contains("drop") || + parsingSq.contains("truncate")) { + value = new ArrayList<>(); + } else { + RecordSet rs = new RecordSet(); + rs.executeQuery(parsingSq.replace("select", "select")); + value = Util.recordeSet2Array(rs, String.class); + } + } else { + value = changeRuleHandle(apiConfigDetailDTO, dataMap); + } + param.put(apiConfigDetailDTO.getParamName(), value); + } + params.add(param); + } + return params; + } + + private Object handleChild(List children, Map dataMap) { + Map params = new HashMap<>(); + for (ApiConfigDetailDTO child : children) { + Object value; + if (child.getChildren() != null) { + value = handleChild(child.getChildren(), dataMap); + } else { + value = changeRuleHandle(child, dataMap); + } + params.put(child.getParamName(), value); + } + return params; + } + + private Object changeRuleHandle(ApiConfigDetailDTO apiConfigDetailDTO, Map dataMap) { + Object value; + String tableName; + String table; + String sql; + String resultSql; +// 判断参数的转换规则 + switch (apiConfigDetailDTO.getChangeRule()) { + case 0: +// 不转换 + case 2: +// 流程字段值 + table = apiConfigDetailDTO.getTablename(); + if (!table.contains("_dt")) { +// 表示字段属于主表 + tableName = "main"; + } else { +// 字段属于明细表 + String dt = table.substring(table.indexOf("_dt") + 3); + tableName = "detail_" + dt; + } +// super.writeErrorLog("参数值:" + dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField()) + ",参数map:" + dataMap); + value = dataMap.get(tableName + "." + apiConfigDetailDTO.getWorkflowField()); + break; + case 1: +// 固定值 + value = apiConfigDetailDTO.getParamValue(); + break; + case 3: +// 系统日期 + value = Util.getTime("yyyy-MM-dd"); + break; + case 4: +// 系统时间 + value = Util.getTime("HH:mm:ss"); + break; + case 5: +// 系统日期-时间 + value = Util.getTime("yyyy-MM-dd HH:mm:ss"); + break; + case 6: +// 自定义SQL + case 7: +// 流程字段转SQL + sql = apiConfigDetailDTO.getParamValue(); + resultSql = Util.parsingSq(sql, dataMap); + if (resultSql.contains("delete ") || resultSql.contains("update ") || + resultSql.contains("exec ") || resultSql.contains("drop ") || + resultSql.contains("truncate ")) { + value = null; + } else { + RecordSet rs = new RecordSet(); + rs.executeQuery(resultSql.replace("select", "select")); + rs.next(); + value = Util.null2String(rs.getString(1)); + } + break; + case 8: +// TODO +// 流程名称 + value = Util.getWorkflowNameById(String.valueOf(dataMap.get("workflowid"))); + break; + case 9: +// TODO +// 请求标题 + value = Util.getRequestTitleById(String.valueOf(dataMap.get("requestid"))); + break; + case 10: +// TODO +// 流程requestId + value = dataMap.get("requestid"); + break; + default: + value = null; + break; + } + if (apiConfigDetailDTO.getParamType() == 1) { +// Integer + value = Integer.parseInt(String.valueOf(value)); + } else if (apiConfigDetailDTO.getParamType() == 2) { +// Boolean + value = Boolean.parseBoolean(String.valueOf(value)); + } + return value; + } + + public String getCustomerNo() { + return customerNo; + } + + public void setCustomerNo(String customerNo) { + this.customerNo = customerNo; + } + + public String getCustomerNoField() { + return customerNoField; + } + + public void setCustomerNoField(String customerNoField) { + this.customerNoField = customerNoField; + } + + public String getContractField() { + return contractField; + } + + public void setContractField(String contractField) { + this.contractField = contractField; + } + + public String getManySigned() { + return manySigned; + } + + public void setManySigned(String manySigned) { + this.manySigned = manySigned; + } + + public String getManySignedNum() { + return manySignedNum; + } + + public void setManySignedNum(String manySignedNum) { + this.manySignedNum = manySignedNum; + } + + public String getManySignedCompanyNo() { + return manySignedCompanyNo; + } + + public void setManySignedCompanyNo(String manySignedCompanyNo) { + this.manySignedCompanyNo = manySignedCompanyNo; + } + + public String getManySignedKeyWord() { + return manySignedKeyWord; + } + + public void setManySignedKeyWord(String manySignedKeyWord) { + this.manySignedKeyWord = manySignedKeyWord; + } + + public String getSignedField() { + return signedField; + } + + public void setSignedField(String signedField) { + this.signedField = signedField; + } + + public String getSignedValue() { + return signedValue; + } + + public void setSignedValue(String signedValue) { + this.signedValue = signedValue; + } +} diff --git a/weaver/aiyh_pcn/fadada/entity/FileInfo.java b/weaver/aiyh_pcn/fadada/entity/FileInfo.java new file mode 100644 index 0000000..2f9bcf0 --- /dev/null +++ b/weaver/aiyh_pcn/fadada/entity/FileInfo.java @@ -0,0 +1,93 @@ +package weaver.aiyh_pcn.fadada.entity; + +import java.io.FileInputStream; +import java.io.InputStream; + +/** + * @author EBU7-dev1-ayh + * @create 2021/10/18 0018 11:25 + * 文件信息 + */ + + +public class FileInfo { + private int imagefileid; + private String imagefilename; + private String contractExtension; + private String contractTitle; + private String customerNo; + private int uploadType = 1; + InputStream file; + + { + this.uploadType = 1; + } + public int getImagefileid() { + return imagefileid; + } + + public void setImagefileid(int imagefileid) { + this.imagefileid = imagefileid; + } + + public String getImagefilename() { + return imagefilename; + } + + public void setImagefilename(String imagefilename) { + this.imagefilename = imagefilename; + } + + public String getContractExtension() { + return contractExtension; + } + + public void setContractExtension(String contractExtension) { + this.contractExtension = contractExtension; + } + + public String getContractTitle() { + return contractTitle; + } + + public void setContractTitle(String contractTitle) { + this.contractTitle = contractTitle; + } + + public String getCustomerNo() { + return customerNo; + } + + public void setCustomerNo(String customerNo) { + this.customerNo = customerNo; + } + + public int getUploadType() { + return uploadType; + } + + public void setUploadType(int uploadType) { + this.uploadType = uploadType; + } + + public InputStream getFile() { + return file; + } + + public void setFile(InputStream file) { + this.file = file; + } + + @Override + public String toString() { + return "FileInfo{" + + "imagefileid=" + imagefileid + + ", imagefilename='" + imagefilename + '\'' + + ", contractExtension='" + contractExtension + '\'' + + ", contractTitle='" + contractTitle + '\'' + + ", customerNo='" + customerNo + '\'' + + ", uploadType='" + uploadType + '\'' + + ", file=" + file + + '}'; + } +} diff --git a/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java b/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java new file mode 100644 index 0000000..bb51df2 --- /dev/null +++ b/weaver/aiyh_pcn/fadada/util/FaddContractUtil.java @@ -0,0 +1,326 @@ +package weaver.aiyh_pcn.fadada.util; + +import aiyh.utils.Util; +import aiyh.utils.entity.ApiConfigMainDTO; +import aiyh.utils.httpUtil.ResponeVo; +import aiyh.utils.mapUtil.ParaMap; +import aiyh.utils.sqlUtil.sqlResult.impl.PrepSqlResultImpl; +import aiyh.utils.zwl.common.ToolUtil; +import com.api.aiyh_pcn.fadada.dao.FaDDContractMapping; +import com.api.aiyh_pcn.fadada.entity.FaDaDaConfigDTO; +import com.api.aiyh_pcn.fadada.service.impl.FaDDContractService; +import com.api.aiyh_pcn.fadada.util.FaDDRequestUtils; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.weaver.general.TimeUtil; +import org.h2.util.StringUtils; +import weaver.aiyh_pcn.fadada.entity.FileInfo; +import weaver.conn.RecordSet; +import weaver.file.ImageFileManager; +import weaver.formmode.data.ModeDataIdUpdate; +import weaver.formmode.setup.ModeRightInfo; + +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/11/3 0003 16:50 + * heton gonjvlei + */ + + +public class FaddContractUtil { + private String workflowId; + private String requestId; + private String mainTableName; + private String tableName; + private String customerNo; + private String contractField; + private String queueSigned; + private final String contractInfoTable = "uf_contract_info"; + private String customerNoField; + private List> detailMaps; + private Map mainMap; + private FaDDContractMapping faDDContractMapping = new FaDDContractMapping(); + private FaDDContractService faDDContractService = new FaDDContractService(); + private final ToolUtil toolUtil = new ToolUtil(); + + public FaddContractUtil() { + } + + public FaddContractUtil(String workflowId, String requestId, String mainTableName, String tableName, String customerNo, + String customerNoField, String contractField,String queueSigned, List> detailMaps, Map mainMap) { + this.workflowId = workflowId; + this.requestId = requestId; + this.mainTableName = mainTableName; + this.tableName = tableName; + this.customerNo = customerNo; + this.customerNoField = customerNoField; + this.contractField = contractField; + this.queueSigned = queueSigned; + this.detailMaps = detailMaps; + this.mainMap = mainMap; + } + + /** + * 创建合同 + */ + public void createContract() { +// 查询配置参数 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 2); +// 查询api配置参数 + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfig(Util.null2String(faDaDaConfigDTO.getParamsConfig())); + RecordSet rs = new RecordSet(); + List fileInfos = this.contractHandle(this.contractField); + List contractNoIds = new ArrayList<>(); + List fileNoIds = new ArrayList<>(); + List fileName = new ArrayList<>(); + if (fileInfos.size() == 0) { + toolUtil.writeErrorLog("fileInfos 为空"); + } +// 多文件的时候会遍历文件去创建合同问文件,但是一个流程只创建一次,一次可能回有多份文件需要创建为合同文件 + for (FileInfo fileInfo : fileInfos) { +// 发起合同创建 + ResponeVo contract = FaDDRequestUtils.createContract(fileInfo, apiConfigMainDTO.getApiUrl()); + Map result; + try { + Map entityMap = contract.getEntityMap(); + if (!"200".equals(String.valueOf(entityMap.get("code")))) { + toolUtil.writeErrorLog("创建合同失败,错误信息:" + entityMap.get("message")); + throw new RuntimeException("创建合同失败!"); + } + result = (Map) entityMap.get("data"); + contractNoIds.add(Util.null2String(result.get("contractNo"))); + fileNoIds.add(Util.null2String(result.get("fileNo"))); + fileName.add(fileInfo.getImagefilename()); + } catch (JsonProcessingException e) { + toolUtil.writeErrorLog(e.toString()); + throw new RuntimeException("创建合同失败!"); + } + } +// 创建合同文件成功之后收集合同编号,文件编号和合同文件的名字 + String joinContract = String.join(",", contractNoIds); + String joinFileNoIds = String.join(",", fileNoIds); + String joinFileName = String.join(",", fileName); + /* + TODO 主表创建字段 contract_no(合同编号)、file_no(文件编号)、file_name(文件名称) + */ +// 将合同的基本信息更新到流程主表中保存 + Map updateMap = ParaMap.create().put("contract_no", joinContract) + .put("file_no", joinFileNoIds) + .put("file_name", joinFileName); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(this.mainTableName, updateMap, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(mainMap.get("id"))); + toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); +// 将合同信息和流程表信息保存到自定义的建模表中 + updateMap.put("workflow_type",workflowId); + updateMap.put("workflow_request_id",requestId); + updateMap.put("workflow_main_table",mainTableName); + updateMap.put("workflow_detail_table",tableName); +// 1表示创建 2表示等待对方签署,3表示等待本方签署,4表示完成 + updateMap.put("contract_status",1); + updateMap.put("should_signed_num",detailMaps.size()); + updateMap.put("signed_num",0); + updateMap.put("main_id",String.valueOf(mainMap.get("id"))); + updateMap.put("queue_signed","true".equals(queueSigned) ? 1 : 0); + updateMap.put("single_contract_file_num",contractNoIds.size()); +// 查询合同信息中,是否存在该信息,如果存在着更新,不存在则插入 + String query = "select * from " + contractInfoTable + " where workflow_request_id = ?"; + rs.executeQuery(query,requestId); + String formModeId = "52"; + if(rs.next()){ + sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable,updateMap, + Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); + toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); +// 权限重构 + ModeRightInfo mri = new ModeRightInfo(); + int dataId = rs.getInt("id"); + toolUtil.writeErrorLog("id:" + dataId); + mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId); + }else{ + ModeDataIdUpdate mdu = ModeDataIdUpdate.getInstance(); + int dataId = mdu.getModeDataNewId(contractInfoTable, + Util.getIntValue(formModeId,-1), + 1, 0, TimeUtil.getCurrentDateString(), + TimeUtil.getOnlyCurrentTimeString()); + sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, updateMap, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(dataId)); + toolUtil.writeErrorLog(sqlResult.getSqlStr() + ",参数:" + sqlResult.getArgs()); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + ModeRightInfo mri = new ModeRightInfo(); + mri.rebuildModeDataShareByEdit(1,Util.getIntValue(formModeId,-1),dataId); + } + } + + /** + * 处理合同创建数据 + * + * @param contractField + * @return + */ + public List contractHandle(String contractField) { + String fileIds = Util.null2String(this.mainMap.get(contractField)); +// 如果没有合同字段的数据,则返回一个空的 + if ("".equals(fileIds)) { + return new ArrayList<>(); + } + List fileInfos = faDDContractMapping.queryImgFileIdByDocIds(fileIds); + String customer = customerNo; +// 查询创建合同的企业编号 + if (StringUtils.isNullOrEmpty(customerNo)) { + toolUtil.writeErrorLog("创建合同失败,失败原因:customerNo 为空!"); + } +// 处理数据信息 + for (FileInfo fileInfo : fileInfos) { + InputStream inputStreamById = ImageFileManager.getInputStreamById(fileInfo.getImagefileid()); + fileInfo.setFile(inputStreamById); + String imagefilename = fileInfo.getImagefilename(); + if (imagefilename == null) { + return new ArrayList<>(); + } + fileInfo.setContractExtension(imagefilename.substring(imagefilename.lastIndexOf("."))); + fileInfo.setContractTitle(imagefilename); + fileInfo.setCustomerNo(Util.null2String(customer)); + if (StringUtils.isNullOrEmpty(fileInfo.getCustomerNo())) { + toolUtil.writeErrorLog("创建合同失败,失败原因,customer!"); +// fileInfo.setCustomerNo(Util.null2String(detail.get("companyno"))); + } + fileInfo.setUploadType(1); + } + return fileInfos; + } + + /** + * 签署合同 + */ + public void signedContract() { +// 获取配置表信息 + FaDaDaConfigDTO faDaDaConfigDTO = faDDContractMapping.queryConfig(workflowId, 3); +// 查询接口配置树形结构 + ApiConfigMainDTO apiConfigMainDTO = Util.queryApiConfigTree(faDaDaConfigDTO.getParamsConfig()); +// 查询签署数据 + List> dataArr = faDDContractService.getDataArr(requestId, workflowId, mainTableName, tableName); +// 处理数据 + List> maps = faDDContractService.objectAndListHandle(apiConfigMainDTO.getDetails(), dataArr); + if(maps == null){ + toolUtil.writeErrorLog("签署合同错误,错误原因:maps为null!"); + throw new RuntimeException("签署合同错误,错误原因:maps为null!"); + } + if(maps.size() == 0){ + return; + } + RecordSet rs = new RecordSet(); + Map update = new HashMap<>(); +// 顺序签署合同 + if("true".equals(queueSigned)){ + Map map = maps.get(0); + signedRequest(map,apiConfigMainDTO); +// 将合同签署信息更新到合同信息表中 + update.put("contract_status",2); + update.put("single_signed_num",0); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, + Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); + rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + update.clear(); +// 更新明细表合同信息 TODO 明细表添加字段,signed_status(合同方签署状态) +// 签署状态,1 已发送待签署,2 已签蜀 + update.put("signed_status",1); + sqlResult = Util.createSqlBuilder().updateSql(tableName, update, + Util.createPrepWhereImpl().whereAnd("id").whereEqual(String.valueOf(map.get("id")))); + rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + return; + } + for (Map map : maps) { + signedRequest(map,apiConfigMainDTO); + + } + // 将合同签署信息更新到合同信息表中 + update.put("contract_status",2); + PrepSqlResultImpl sqlResult = Util.createSqlBuilder().updateSql(contractInfoTable, update, + Util.createPrepWhereImpl().whereAnd("workflow_request_id").whereEqual(requestId)); + rs.executeUpdate(sqlResult.getSqlStr(),sqlResult.getArgs()); + + } + + /** + * 合同签署发送请求 + * @param map + * @param apiConfigMainDTO + */ + private void signedRequest(Map map, ApiConfigMainDTO apiConfigMainDTO){ + String contractNos = Util.null2String(map.get("contractNo")); + String[] split = contractNos.split(","); + RecordSet rs = new RecordSet(); + for (String s : split) { + map.put("contractNo", s); + ResponeVo responeVo = FaDDRequestUtils.signedContract(map, apiConfigMainDTO.getApiUrl()); + Map response = null; + try { + response = responeVo.getEntityMap(); + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + if (!"200".equals(response.get("code"))) { + toolUtil.writeErrorLog("法大大接口签署合同失败!"); + throw new RuntimeException("法大大接口签署合同失败!"); + } + } + } + + + @Override + public String toString() { + return "FaddContractUtil{" + + "workflowId='" + workflowId + '\'' + + ", requestId='" + requestId + '\'' + + ", mainTableName='" + mainTableName + '\'' + + ", tableName='" + tableName + '\'' + + ", customerNo='" + customerNo + '\'' + + ", contractField='" + contractField + '\'' + + ", queueSigned='" + queueSigned + '\'' + + ", contractInfoTable='" + contractInfoTable + '\'' + + ", customerNoField='" + customerNoField + '\'' + + ", detailMaps=" + detailMaps + + ", mainMap=" + mainMap + + '}'; + } + + public String getWorkflowId() { + return workflowId; + } + + public void setWorkflowId(String workflowId) { + this.workflowId = workflowId; + } + + public String getRequestId() { + return requestId; + } + + public void setRequestId(String requestId) { + this.requestId = requestId; + } + + public String getMainTableName() { + return mainTableName; + } + + public void setMainTableName(String mainTableName) { + this.mainTableName = mainTableName; + } + + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/AddCustomer_Action.java b/weaver/aiyh_pcn/workflow_to_customer/AddCustomer_Action.java new file mode 100644 index 0000000..20bcda7 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/AddCustomer_Action.java @@ -0,0 +1,994 @@ +package weaver.aiyh_pcn.workflow_to_customer; + + +import aiyh.utils.zwl.common.ToolUtil; +import com.engine.crm.util.CrmCommonUtil; +import org.h2.util.StringUtils; +import weaver.aiyh_pcn.workflow_to_customer.config.CRM_Config; +import weaver.aiyh_pcn.workflow_to_customer.exception.DataExistsException; +import weaver.aiyh_pcn.workflow_to_customer.exception.LoginIdRepeatException; +import weaver.aiyh_pcn.workflow_to_customer.model.MainResult; +import weaver.aiyh_pcn.workflow_to_customer.utils.*; +import weaver.conn.RecordSet; +import weaver.crm.CrmShareBase; +import weaver.crm.Maint.*; +import weaver.crm.data.CustomerModifyLog; +import weaver.general.Util; +import weaver.hrm.city.CityComInfo; +import weaver.hrm.city.CitytwoComInfo; +import weaver.hrm.companyvirtual.DepartmentVirtualComInfo; +import weaver.hrm.companyvirtual.SubCompanyVirtualComInfo; +import weaver.hrm.outinterface.HrmOutInterface; +import weaver.hrm.province.ProvinceComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; + +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +/** + * @author EBU7-dev1-ayh + * @create 2021-08-05 09:33 + * 功能:流程转客户 + */ +public class AddCustomer_Action extends ToolUtil implements Action { + //当前类名称 + private final String className = "AddCustomer_Action"; + private RequestInfo request; + MainResult mainResult; + String tableName; + String customerID; + String subId; + String deprtId; + + /** + * 实现父类方法 + * + * @param requestInfo + * @return + */ + @Override + public String execute(RequestInfo requestInfo) { + this.writeDebuggerLog(className, "------------" + className + " Begin -----------------"); + RecordSet rs = new RecordSet(); + this.request = requestInfo; + //获取流程类型ID + String workflowid = Util.null2String(requestInfo.getWorkflowid()); + //流程请求ID + String requestid = Util.null2String(requestInfo.getRequestid()); + //流程表单名称 + this.tableName = requestInfo.getRequestManager().getBillTableName(); + this.writeErrorLog("这个是创建者id:" + requestInfo.getRequestManager().getCreater()); +// 通过流程id查询表名 + if ("".equals(this.tableName)) { + this.tableName = getBillTableNameByWorkflowId(workflowid); + } + this.writeDebuggerLog("wrokflowid:{" + workflowid + "},requestid:{" + requestid + "},tablename:{" + this.tableName + "}"); + CRM_Config config = new CRM_Config(workflowid, this.tableName, requestid); + Map>> configInfoMap = config.getConfigInfo(); + this.mainResult = config.getMainResult(); + try { + if (this.mainResult.getChangeSetting() == 0) { +// 表示插入 + this.insertCustomerModel(this.mainResult, configInfoMap); +// 数据会写流程操作 + if (this.mainResult.getWillWrite() == 1) { +// 数据需要会写 + ParaMap map = ParaMap.create().put(this.mainResult.getWillWriteField(), this.customerID); + if ("main_table".equals(this.mainResult.getWillWriteTable())) { +// 数据会写到流程主表 + this.updateHandle(this.tableName, map, + PrepSQLWhere.creatPrepWhere() + .and("requestid").equal(requestid) + .create()); + } else { +// 数据回写到明细表中 + this.updateHandle(this.mainResult.getWillWriteTable(), map, + PrepSQLWhere.creatPrepWhere() + .and("mainid").equalSql("select id from " + this.tableName + " where requestid = " + requestid) + .create()); + } + } + } else { +// TODO 表示根据流程字段判断是插入还是更新 + String workflowName; + if ("main_table".equals(this.mainResult.getUpdateInsertTable())) { + workflowName = this.tableName; + rs.executeQuery("select " + this.mainResult.getUpdateInsert() + " from " + workflowName + " where requestid = ?", requestid); + } else { + workflowName = this.mainResult.getUpdateInsertTable(); + rs.executeQuery("select " + this.mainResult.getUpdateInsert() + " from " + workflowName + " where mainid in (select id from " + this.tableName + " where requestid = ?)", requestid); + } + rs.next(); + int mark = Util.getIntValue(rs.getString(1), -1); + if (mark != -1 && mark == this.mainResult.getInsertMark()) { + this.insertCustomerModel(this.mainResult, configInfoMap); + } else if (mark != -1 && mark == this.mainResult.getUpdateMark()) { + this.updateCustomerModel(this.mainResult, configInfoMap, rs.getString(this.mainResult.getCustomerId())); + } + } + } catch (LoginIdRepeatException e) { + this.writeErrorLog(e + "\n"); + this.request.getRequestManager().setMessagecontent("登录名重复,请重新输入登录名"); + this.request.getRequestManager().setMessageid("登录名重复"); + return Action.FAILURE_AND_CONTINUE; + } catch (Exception e) { + this.writeDebuggerLog("insert customer error!"); + this.writeDebuggerLog(e + "\n"); + } finally { + this.writeDebuggerLog(className, "------------" + className + " End -----------------"); + } + return Action.SUCCESS; + + } + + public void updateCustomerModel(MainResult mainResult, Map>> configInfoMap, String customerId) { + // 1、更新客户基本信息crm_customerinfo + if (Utils.conformSql(configInfoMap, "CRM_CustomerInfo")) { +// TODO 将客户基本信息更新 + this.updateCustomerInfo(configInfoMap.get("CRM_CustomerInfo"), customerId); + } else { + return; + } +// 2、判断更新客户联系信息crm_customercontacter + if (Utils.conformSql(configInfoMap, "CRM_CustomerContacter") || this.mainResult.getIsOutUser() == 1 || this.mainResult.getIsOutUser() == 0) { +// TODO 将客户联系信息更新到客户联系表中 + if (Utils.conformSql(configInfoMap, "CRM_CustomerContacter")) { + this.updateCustomerContacter(configInfoMap.get("CRM_CustomerContacter"), customerId); + } else { + this.updateCustomerContacter(configInfoMap.get("CRM_CustomerInfo"), customerId); + } + } +// 3、判断更新客户地址信息CRM_CustomerAddress + if (Utils.conformSql(configInfoMap, "CRM_CustomerAddress")) { +// TODO 将客户信息更新到客户地址表中 + this.updateCustomerAddress(configInfoMap.get("CRM_CustomerAddress"), customerId); + } +// 4、判断更新客户销售商机信息CRM_SellChance + if (Utils.conformSql(configInfoMap, "CRM_SellChance")) { +// TODO 将客户联系信息更新到客户联系表中 + this.updateCustomerSellChance(configInfoMap.get("CRM_SellChance"), customerId); + } +// 5、判断更新虚拟分部信息hrmsubcompanyvirtual + if (Utils.conformSql(configInfoMap, "hrmsubcompanyvirtual") || this.mainResult.getIsOutUser() == 0) { +// TODO 将客户信息更新到虚拟分部信息表中 + this.updateHrmsubcompanyvirtual(configInfoMap.get("hrmsubcompanyvirtual"), customerId); + } else { + return; + } +// 6、判断更新虚拟部门信息hrmdepartmentvirtual + if (Utils.conformSql(configInfoMap, "hrmdepartmentvirtual") || this.mainResult.getIsOutUser() == 0) { +// TODO 见客户信息更新到虚拟部门信息表中 + this.updateHrmdepartmentvirtual(configInfoMap.get("hrmdepartmentvirtual"), customerId); + } else { + return; + } +// 7、判断更新外部人员信息hrmresource + if (Utils.conformSql(configInfoMap, "hrmResource") || this.mainResult.getIsOutUser() == 0) { +// TODO 将客户更新到外部人员信息表中 + this.updateHrmresource(configInfoMap.get("hrmResource"), customerId); + } + } + + public void updateCustomerInfo(List> mapList, String customerId) { + RecordSet rs = new RecordSet(); +// 查询客户表,是否存在该客户,如果存在则对客户信息进行修改,如果不存在则跳过 + String querySql = "select * from crm_customerinfo where id = ?"; + rs.executeQuery(querySql, customerId); + if (rs.next()) { +// 表示存在该客户,需要修改该客户的信息,并添加修改的 默认信息 + mapList.forEach(item -> this.updateCustomerInfo(item, customerId)); + } + } + + public void updateCustomerInfo(Map map, String customerId) { + map.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + map.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + this.updateHandle("crm_customerInfo", map, + PrepSQLWhere.creatPrepWhere() + .and("id").equal(customerId) + .create()); + } + + public void updateCustomerContacter(List> mapList, String customerId) { +// 存在BUG,如果批量修改则会出现所有联系人都会被修改为同一个 + RecordSet rs = new RecordSet(); +// 查询客户表,是否存在该客户,如果存在则对客户信息进行修改,如果不存在则跳过 + String querySql = "select * from crm_customercontacter where customerid = ?"; + rs.executeQuery(querySql, customerId); + if (rs.next()) { +// 表示存在该客户,需要修改该客户的信息,并添加修改的 默认信息 + mapList.forEach(item -> { + if (item.containsKey("fullname")) { + item.put("firstname", item.get("fullname")); + } + if (item.containsKey("firstname")) { + item.put("fullname", item.get("firstname")); + } + String query = "select id from CRM_CustomerContacter where customerid = ? and fullname = ?"; + rs.executeQuery(query, rs.getString("id"), item.get("fullname")); + if (rs.next()) { + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + this.updateCustomerContacter(item, rs.getString("id")); + } + }); + } + } + + public void updateCustomerContacter(Map map, String contacter) { + map.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + map.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + this.updateHandle("crm_customercontacter", map, + PrepSQLWhere.creatPrepWhere() + .and("id").equal(contacter) + .create()); + } + + public void updateCustomerAddress(List> mapList, String customerId) { +// 存在BUG,如果批量修改则会出现所有联系人都会被修改为同一个 + RecordSet rs = new RecordSet(); +// 查询客户表,是否存在该客户,如果存在则对客户信息进行修改,如果不存在则跳过 + String querySql = "select * from crm_customeraddress where customerid = ?"; + rs.executeQuery(querySql, customerId); + if (rs.next()) { +// 表示存在该客户,需要修改该客户的信息,并添加修改的 默认信息 + mapList.forEach(item -> { + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + this.updateHandle("crm_customeraddress", item, + PrepSQLWhere.creatPrepWhere().and("customerid").equal(customerId) + .and("id").equal(rs.getString("id")).create()); + }); + } + } + + public void updateCustomerSellChance(List> mapList, String customerId) { +// 存在BUG,如果批量修改则会出现所有联系人都会被修改为同一个 + RecordSet rs = new RecordSet(); +// 查询客户表,是否存在该客户,如果存在则对客户信息进行修改,如果不存在则跳过 + String querySql = "select * from crm_sellchance where customerid = ?"; + rs.executeQuery(querySql, customerId); + if (rs.next()) { +// 表示存在该客户,需要修改该客户的信息,并添加修改的 默认信息 + mapList.forEach(item -> { + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + this.updateHandle("crm_sellchance", item, + PrepSQLWhere.creatPrepWhere().and("customerid").equal(customerId) + .and("id").equal(rs.getString("id")).create()); + }); + } + } + + public void updateHrmsubcompanyvirtual(List> mapList, String customerId) { + // 存在BUG,如果批量修改则会出现所有联系人都会被修改为同一个 + RecordSet rs = new RecordSet(); + String querySql = "select * from crm_customerinfo where id = ?"; + rs.executeQuery(querySql, customerId); + CustomerInfoComInfo customerInfoComInfo = new CustomerInfoComInfo(); +// 查询客户表,是否存在该客户,如果存在则对客户信息进行修改,如果不存在则跳过 + querySql = "select * from hrmsubcompanyvirtual where id = ?"; + if (rs.next()) { + rs.executeQuery(querySql, this.subId); + if (rs.next()) { +// 表示存在该客户,需要修改该客户的信息,并添加修改的 默认信息 + mapList.forEach(item -> { + this.updateHandle("hrmsubcompanyvirtual", item, + PrepSQLWhere.creatPrepWhere() + .and("id").equal(rs.getString("id")).create()); + }); + } + } + } + + public void updateHrmdepartmentvirtual(List> mapList, String customerId) { +// 存在BUG,如果批量修改则会出现所有联系人都会被修改为同一个 + RecordSet rs = new RecordSet(); + String querySql = "select * from crm_customerinfo where id = ?"; + rs.executeQuery(querySql, customerId); + CustomerInfoComInfo customerInfoComInfo = new CustomerInfoComInfo(); +// 查询客户表,是否存在该客户,如果存在则对客户信息进行修改,如果不存在则跳过 + querySql = "select * from hrmdepartmentvirtual where id = ?"; + if (rs.next()) { + rs.executeQuery(querySql, this.deprtId); + if (rs.next()) { +// 表示存在该客户,需要修改该客户的信息,并添加修改的 默认信息 + mapList.forEach(item -> { + this.updateHandle("hrmdepartmentvirtual", item, + PrepSQLWhere.creatPrepWhere() + .and("id").equal(rs.getString("id")).create()); + }); + } + } + } + + public void updateHrmresource(List> mapList, String customerId) { +// 先查询外部用户与人员表的对应关系 + + } + + public void insertCustomerModel(MainResult mainResult, Map>> configInfoMap) { + Map customer; +// 1、插入客户基本信息crm_customerinfo + if (Utils.conformSql(configInfoMap, "CRM_CustomerInfo")) { +// TODO 将客户基本信息插入表中 + customer = this.insertCustomerInfo(configInfoMap.get("CRM_CustomerInfo")); + } else { + return; + } +// 2、判断插入客户联系信息crm_customercontacter + if (Utils.conformSql(configInfoMap, "CRM_CustomerContacter") || this.mainResult.getIsOutUser() == 1 || this.mainResult.getIsOutUser() == 0) { +// TODO 将客户联系信息插入到客户联系表中 + if (Utils.conformSql(configInfoMap, "CRM_CustomerContacter")) { + this.insertCustomerContacter(configInfoMap.get("CRM_CustomerContacter"), customer, 0); + } else { + this.insertCustomerContacter(configInfoMap.get("CRM_CustomerInfo"), customer, 1); + } + } +// 3、判断插入客户地址信息CRM_CustomerAddress + if (Utils.conformSql(configInfoMap, "CRM_CustomerAddress")) { +// TODO 将客户信息出入到客户地址表中 + this.insertCustomerAddress(configInfoMap.get("CRM_CustomerAddress"), customer); + } +// 4、判断插入客户销售商机信息CRM_SellChance + if (Utils.conformSql(configInfoMap, "CRM_SellChance")) { +// TODO 将客户联系信息插入到客户联系表中 + this.insertCustomerSellChance(configInfoMap.get("CRM_SellChance"), customer); + } +// 5、判断插入虚拟分部信息hrmsubcompanyvirtual + + if (Utils.conformSql(configInfoMap, "hrmsubcompanyvirtual") || this.mainResult.getIsOutUser() == 0) { +// TODO 将客户信息插入到虚拟分部信息表中 + this.subId = this.insertHrmsubcompanyvirtual(configInfoMap.get("hrmsubcompanyvirtual"), customer); + } else { + return; + } +// 6、判断插入虚拟部门信息hrmdepartmentvirtual + + if (Utils.conformSql(configInfoMap, "hrmdepartmentvirtual") || this.mainResult.getIsOutUser() == 0) { +// TODO 见客户信息插入到虚拟部门信息表中 + this.deprtId = this.insertHrmdepartmentvirtual(configInfoMap.get("hrmdepartmentvirtual"), customer, subId); + } else { + return; + } +// 7、判断插入外部人员信息hrmresource + if (Utils.conformSql(configInfoMap, "hrmResource") || this.mainResult.getIsOutUser() == 0) { +// TODO 将客户插入到外部人员信息表中 + this.insertHrmresource(configInfoMap.get("hrmResource"), customer, subId, deprtId); + } + } + + public void insertHrmresourceVirtual(Map customer, String hrmid, String subId, String deparId) { + RecordSet rs = new RecordSet(); + rs.executeQuery("select max(id) from HrmResourceVirtual"); + int hrmvId = 0; + if (rs.next()) { + hrmvId = rs.getInt(1) + 1; + } + int finalHrmvId = hrmvId; + int finalHrmvId1 = hrmvId; + CustomerInfoComInfo comInfo = new CustomerInfoComInfo(); + String queryCompanyId = "select id from HrmCompanyVirtual where companyname like '%客户维度%'"; + rs.executeQuery(queryCompanyId); + rs.next(); + String companyId = rs.getString("id"); + Map hrmrVmap = Utils.createMap() + .uPut("id", finalHrmvId) + .uPut("resourceid", finalHrmvId1) + .uPut("managerid", 0) + .uPut("subcompanyid", subId) + .uPut("departmentid", deparId) + .uPut("managerstr", "") + .uPut("virtualtype", companyId); + this.insertHandle("HrmResourceVirtual", hrmrVmap); + Map hrmOMap = Utils.createMap() + .uPut("resourceid", hrmid) + .uPut("wxname", Util.null2String(customer.get("wxname"))) + .uPut("wxopenid", Util.null2String(customer.get("wxopenid"))) + .uPut("wxuuid", Util.null2String(customer.get("wxuuid"))) + .uPut("customid", customer.get("customerId")) + .uPut("country", Util.null2String(customer.get("country"))) + .uPut("province", Util.null2String(customer.get("province"))) + .uPut("city", Util.null2String(customer.get("city"))) + .uPut("customfrom", Util.null2String(customer.get("customfrom"))) + .uPut("isoutmanager", 0); + this.insertHandle("hrmresourceout", hrmOMap); + } + + public void insertHrmresource(List> mapList, Map customer, String subId, String deparId) { + + CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); + mapList.forEach(item -> { + RecordSet rs = new RecordSet(); + String hrmid; +// 获取人员id + rs.executeProc("HrmResourceMaxId_Get", ""); + rs.next(); + hrmid = rs.getString(1); +// 整理数据 + item.put("createdate", Utils.getTime("yyyy-MM-dd")); + item.put("id", hrmid); + item.put("createrid", this.request.getRequestManager().getCreater()); + if (!item.containsKey("lastname")) { + item.put("lastname", customer.get("name")); + } + if (!item.containsKey("loginid")) { + item.put("loginid", crmCommonUtil.getPinYin((String) customer.get("name"), 7).get("pinyin")); + } + if (item.containsKey("seclevel") && Integer.parseInt((String) item.get("seclevel")) > 0) { + item.put("seclevel", -1); + } + if (!item.containsKey("seclevel")) { + item.put("seclevel", -1); + } + if (!item.containsKey("password")) { + item.put("password", Util.getEncrypt((String) crmCommonUtil.getPinYin((String) customer.get("name"), 7).get("pinyin"))); + } + if (item.containsKey("password")) { + System.out.println(item.get("password")); + item.put("password", Util.getEncrypt((String) item.get("password"))); + } + if (!item.containsKey("lastmoddate")) { + item.put("lastmoddate", Utils.getTime("yyyy-MM-dd")); + } + if (!item.containsKey("lastmodid")) { + item.put("lastmodid", 1); + } + if (!item.containsKey("systemlanguage")) { + item.put("systemlanguage", 7); + } + if (!item.containsKey("departmentid")) { +// customerInfo.getCustomerInfoSubcompanyid(String.valueOf(customer.get("customerId"))) + item.put("departmentid", 0); + } + if (!item.containsKey("subcompanyid1")) { +// customerInfo.getCustomerInfoDepartmentid(String.valueOf(customer.get("customerId"))) + item.put("subcompanyid1", 0); + } + if (!item.containsKey("status")) { + item.put("status", 1); + } + if (!item.containsKey("accounttype")) { + item.put("accounttype", 0); + } + if (!item.containsKey("dsporder")) { + item.put("dsporder", hrmid); + } + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) customer.get("name"), 7)); +// 查询loginid是否已经存在 + String quertLogin = "select count(1) from hrmresource where loginid= ?"; + rs.executeQuery(quertLogin, item.get("loginid")); + if (rs.next() && rs.getInt(1) > 0) { +// 存在登录名 + throw new LoginIdRepeatException("loginid is repeat,Please re-enter logind!"); + } + this.insertHandle("hrmresource", item); + if (this.mainResult.getManagerType() == 3) { + // 将外部客户的客户经理更新为当前插入的外部用户,方便外部用户参与流程审批 + this.updateHandle("CRM_CustomerInfo", Utils.createMap().uPut("manager", hrmid) + .uPut("lastupdatedtime", Utils.getTime("HH:mm:ss")) + .uPut("lastupdatedtime", Utils.getTime("HH:mm:ss")), + PrepSQLWhere.creatPrepWhere() + .and("id").equal(customer.get("customerId")) + .create()); + } + + HrmOutInterface hrmOutInterface = new HrmOutInterface(); + CustomerInfoComInfo customerInfo = new CustomerInfoComInfo(); + customerInfo.removeCustomerInfoCache(); + customerInfo.removeCache(); + (new CustomerDescComInfo()).removeCache(); + (new CustomerRatingComInfo()).removeCache(); + (new CustomerSizeComInfo()).removeCache(); + (new CustomerStatusComInfo()).removeCache(); + customerInfo.addCustomerInfoCache(String.valueOf(customer.get("customerId"))); +// 应该是 + hrmOutInterface.initMatrixDataOutManager(subId, hrmid); + + ResourceComInfo resourceComInfo = null; + try { + resourceComInfo = new ResourceComInfo(); + } catch (Exception e) { + e.printStackTrace(); + } + if (!Objects.isNull(resourceComInfo)) { + resourceComInfo.removeResourceCache(); + resourceComInfo.removeCache(); + } + this.insertHrmresourceVirtual(customer, hrmid, subId, deparId); + Map map = new HashMap() {{ + put("relateditemid", Util.null2String(customer.get("customerId"))); + put("sharetype", "1"); + put("seclevel", "10"); + put("sharelevel", "1"); + put("crmid", "0"); + put("contents", hrmid); + put("deleted", "0"); + put("seclevelMax", "100"); + put("jobtitleid", hrmid); + put("joblevel", "0"); + put("scopeid", "0"); + }}; + this.insertHandle("CRM_ShareInfo", map); + }); + } + + public String insertHrmdepartmentvirtual(List> mapList, Map customer, String subId) { + if (Objects.isNull(mapList) || mapList.size() == 0) { + mapList = new ArrayList<>(); + mapList.add(new HashMap<>()); + } + CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); + RecordSet rs = new RecordSet(); + String queryCompanyId = "select id from HrmCompanyVirtual where companyname like '%客户维度%'"; + rs.executeQuery(queryCompanyId); + rs.next(); + String companyId = rs.getString("id"); +// 查询是否存在客户经理的部门 + String querydepartment = "select id from hrmdepartmentvirtual where subcompanyid1 = ? and departmentname = ?"; + rs.executeQuery(querydepartment, subId, "客户经理"); + if (rs.next()) { + this.insertHandle("hrmdepartmentvirtual", new ArrayList>() {{ + add(new HashMap() { + { + put("departmentname", "客户经理"); + put("departmentmark", "客户经理"); + put("subcompanyid1", subId); + put("showOrderOfTree", "0"); + put("virtualtype", companyId); + put("ecology_pinyin_search", crmCommonUtil.getPinYin("客户经理", 7)); + } + }); + }}); + } + String queryderId = "select id from hrmdepartmentvirtual where subcompanyid1 = ? and departmentname = ?"; + rs.executeQuery(queryderId, subId, customer.get("name")); + if (!rs.next()) { + mapList.forEach(item -> { + item.put("departmentname", customer.get("name")); + item.put("departmentmark", customer.get("name")); + item.put("subcompanyid1", subId); + item.put("showOrderOfTree", "0"); + item.put("virtualtype", companyId); + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) customer.get("name"), 7)); + }); + this.insertHandle("hrmdepartmentvirtual", mapList); + DepartmentVirtualComInfo departmentVirtualComInfo = new DepartmentVirtualComInfo(); + departmentVirtualComInfo.removeCache(); + departmentVirtualComInfo.removeDepartmentCache(); + rs.executeQuery(queryderId, subId, customer.get("name")); + rs.next(); + return rs.getString(1); + } + return rs.getString(1); + } + + public String insertHrmsubcompanyvirtual(List> mapList, Map customer) { + if (Objects.isNull(mapList) || mapList.size() == 0) { + mapList = new ArrayList<>(); + mapList.add(new HashMap<>()); + } + CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); + RecordSet rs = new RecordSet(); + String queryCompanyId = "select id from HrmCompanyVirtual where companyname like '%客户维度%'"; + rs.executeQuery(queryCompanyId); + rs.next(); + String companyId = rs.getString("id"); + String quertSupsubcomId = "select id from hrmsubcompanyvirtual where subcompanyname = '新用户'"; + rs.executeQuery(quertSupsubcomId); + rs.next(); + String supcomId = rs.getString("id"); + String querySubID = "select id from hrmsubcompanyvirtual where subcompanyname = ?"; + rs.executeQuery(querySubID, customer.get("name")); + if (!rs.next()) { + mapList.forEach(item -> { + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) customer.get("name"), 7)); + item.put("subcompanyname", customer.get("name")); + item.put("subcompanydesc", customer.get("name")); + item.put("companyid", companyId); + item.put("virtualtypeid", companyId); + item.put("supsubcomid", supcomId); + }); + this.insertHandle("hrmsubcompanyvirtual", mapList); + SubCompanyVirtualComInfo subCompanyVirtualComInfo = new SubCompanyVirtualComInfo(); + subCompanyVirtualComInfo.removeCache(); + subCompanyVirtualComInfo.removeSubCompanyCache(); + rs.executeQuery(querySubID, customer.get("name")); + rs.next(); + return rs.getString("id"); + } + return rs.getString("id"); + } + + public void insertCustomerSellChance(List> mapList, Map customer) { + mapList.forEach(item -> { + item.put("customerid", Util.null2String(customer.get("customerId"))); + item.put("createdate", Utils.getTime("yyyy-MM-dd")); + item.put("createtime", Utils.getTime("HH:mm:ss")); + item.put("createrid", this.request.getRequestManager().getCreater()); + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + item.put("creater", this.request.getRequestManager().getCreater()); + }); + this.insertHandle("CRM_SellChance", mapList); + } + + public void insertCustomerAddress(List> mapList, Map customer) { + RecordSet rs = new RecordSet(); + mapList.forEach(item -> { + item.put("customerid", Util.null2String(customer.get("customerId"))); + item.put("createdate", Utils.getTime("yyyy-MM-dd")); + item.put("createtime", Utils.getTime("HH:mm:ss")); + item.put("createrid", this.request.getRequestManager().getCreater()); + item.put("lastupdatedby", this.request.getRequestManager().getCreater()); + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + if (item.containsKey("contacter")) { + if (Util.getIntValue(String.valueOf(item.get("contacter")), 0) == 0) { + String queryContacter = "select id from crm_customercontacter where customerid = ? and (fullname = ? or firstname = ?)"; + rs.executeUpdate(queryContacter, customer.get("customerId"), item.get("contacter"), item.get("contacter")); + rs.next(); + item.put("contacter", rs.getString(1)); + } + } + }); + this.insertHandle("crm_customeraddress", mapList); + } + + public void insertCustomerContacter(List> mapList, Map customer, int type) { + CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); + RecordSet rs = new RecordSet(); + String querySql = "select id from CRM_CustomerContacter where customerid = ? and fullname = ?"; + + if (type == 1) { + if (rs.executeQuery(querySql, Util.null2String(customer.get("customerId")), Util.null2String(customer.get("name"))) && rs.next()) { +// 已存在相关的联系人 + return; + } +// 表示需要创建联系人,但是没有指定联系人对应的流程字段,则默认将客户信息当做联系人信息,并且设置为主联系人 + Map map = new HashMap<>(); + map.put("customerid", Util.null2String(customer.get("customerId"))); + map.put("fullname", Util.null2String(customer.get("name"))); + map.put("firstname", Util.null2String(customer.get("name"))); + map.put("jobtitle", Util.null2String(customer.get("name"))); + map.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) customer.get("name"), 7)); + map.put("main", 1); + map.put("email", Util.null2String(customer.get("email"))); + map.put("mobilephone", Util.null2String(customer.get("phone"))); + map.put("manager", Util.null2String(customer.get("manager"))); + map.put("department", Util.null2String(customer.get("department"))); + map.put("createdate", Utils.getTime("yyyy-MM-dd")); + map.put("createtime", Utils.getTime("HH:mm:ss")); + map.put("createrid", this.request.getRequestManager().getCreater()); + map.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + map.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + this.insertHandle("crm_customercontacter", new ArrayList>() {{ + add(map); + }}); + return; + } + AtomicBoolean flag = new AtomicBoolean(true); + mapList.forEach(item -> { + if (flag.get()) { + item.put("main", 1); + flag.set(false); + } + if (!item.containsKey("fullname") && !item.containsKey("firstname")) { + item.put("fullname", Util.null2String(customer.get("name"))); + item.put("firstname", Util.null2String(customer.get("name"))); + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) customer.get("name"), 7)); + } + if (item.containsKey("fullname")) { + item.put("fullname", Util.null2String(item.get("fullname"))); + item.put("firstname", Util.null2String(item.get("fullname"))); + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) item.get("fullname"), 7)); + } + if (item.containsKey("firstname")) { + item.put("fullname", Util.null2String(item.get("firstname"))); + item.put("firstname", Util.null2String(item.get("firstname"))); + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) item.get("firstname"), 7)); + } + if (!item.containsKey("jobtitle")) { + item.put("jobtitle", Util.null2String(customer.get("name"))); + } + if (!item.containsKey("mobilephone")) { + item.put("mobilephone", Util.null2String(customer.get("phone"))); + } + if (!item.containsKey("email")) { + item.put("email", Util.null2String(customer.get("email"))); + } + if (rs.executeQuery(querySql, Util.null2String(customer.get("customerId")), Util.null2String(customer.get("name"))) && rs.next()) { +// 已存在相关的联系人 + this.updateCustomerContacter(item, rs.getString("id")); + } + item.put("customerid", Util.null2String(customer.get("customerId"))); + item.put("createdate", Utils.getTime("yyyy-MM-dd")); + item.put("createtime", Utils.getTime("HH:mm:ss")); + item.put("createrid", this.request.getRequestManager().getCreater()); + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + }); + this.insertHandle("crm_customercontacter", mapList); + CustomerContacterComInfo customerComInfo = new CustomerContacterComInfo(); + customerComInfo.removeCustomerContacterCache(); + customerComInfo.removeCache(); + } + + public Map insertCustomerInfo(List> mapList) { + RecordSet rs = new RecordSet(); + String managerId; + if (this.mainResult.getManagerType() == 0) { +// 客户经理根据流程字段绑定 + rs.executeQuery("select " + this.mainResult.getManagerField() + " from " + this.tableName + " where requestid = ?", + this.request.getRequestid()); + rs.next(); + managerId = Util.null2String(rs.getString(1)); + if (StringUtils.isNullOrEmpty(managerId) || "".equals(managerId)) { + managerId = String.valueOf(this.request.getRequestManager().getCreater()); + } + } else if (this.mainResult.getManagerType() == 1) { +// 客户经理为固定值 + managerId = String.valueOf(this.mainResult.getCustomerManager()); + } else { +// 客户经理为流程创建者或外部用户 + managerId = String.valueOf(this.request.getRequestManager().getCreater()); + } + String creditlevel = "0"; +// 表示含有信用保证金额,需要调用存储过程 + final Map cusMap = mapList.get(0); + if (!cusMap.containsKey("creditamount")) { + if (cusMap.get("creditamount") != null && !"".equals(cusMap.get("creditamount").toString().trim())) { + rs.executeProc("Sales_CRM_CreditInfo_Select", cusMap.get("creditamount") + ""); + if (rs.next()) { + creditlevel = rs.getString(1); + } + } + } +// TODO 添加必要参数 + CityComInfo cityComInfo = new CityComInfo(); + ResourceComInfo resourceComInfo = null; + try { + resourceComInfo = new ResourceComInfo(); + } catch (Exception e) { + e.printStackTrace(); + } + ResourceComInfo finalResourceComInfo = resourceComInfo; + ProvinceComInfo province = new ProvinceComInfo(); + String finalCreditlevel = creditlevel; + String finalManagerId = managerId; + CrmCommonUtil crmCommonUtil = new CrmCommonUtil(); + AtomicReference customerIdStr = new AtomicReference<>(); + try { + mapList.forEach(item -> { + +// 判断字段,特殊字段特殊处理 + if (item.containsKey("province")) { + if (!"".equals(item.get("province")) && Util.getIntValue((String) item.get("province"), 0) > 0) { + item.put("country", province.getProvincecountryid((String) item.get("province"))); + } + } + if (item.containsKey("city")) { + if (!"".equals(item.get("city")) && Util.getIntValue(item.get("city").toString(), 0) > 0) { +// 如果城市字段属于int类型的,则将城市字段进行替换,并且添加国家字段 + item.put("city", cityComInfo.getCityprovinceid((String) item.get("city"))); + item.put("country", cityComInfo.getCitycountryid((String) item.get("city"))); + } + } + if (item.containsKey("district")) { + if (!"".equals(item.get("district")) && Util.getIntValue((String) item.get("district"), 0) > 0) { + CitytwoComInfo citytwoComInfo = new CitytwoComInfo(); + item.put("city", citytwoComInfo.getCitypid((String) item.get("district"))); + item.put("province", cityComInfo.getCityprovinceid((String) item.get("city"))); + item.put("country", province.getProvincecountryid((String) item.get("province"))); + } + } + if (item.containsKey("type")) { + item.put("type", 1); + } + if (item.containsKey("mobilephone")) { + item.put("phone", item.get("mobilephone")); + item.remove("mobilephone"); + } + if (item.containsKey("contacteremail")) { + item.put("email", item.get("contacteremail")); + item.remove("contacteremail"); + } + + if (item.containsKey("engname")) { + item.put("name", item.get("engname")); + } + if (item.containsKey("name")) { + item.put("engname", item.get("name")); + } + + if (item.containsKey("location")) { + if (!"".equals(item.get("location"))) { + String lng = item.get("location").toString().split(",")[0]; + String lat = item.get("location").toString().split(",")[1]; + item.put("lng1", lng); + item.put("lat1", lat); + } + } + if (!item.containsKey("lastupdatedby")) { + item.put("lastupdatedby", this.request.getRequestManager().getCreater()); + } + if (!item.containsKey("status")) { + item.put("status", 1); + } + if (!item.containsKey("language")) { + item.put("language", 7); + } + if (!item.containsKey("fincode")) { + item.put("fincode", 0); + } + if (!item.containsKey("currency")) { + item.put("currency", 0); + } + if (!item.containsKey("contractlevel")) { + item.put("contractlevel", 0); + } + if (!item.containsKey("creditoffset")) { + item.put("creditoffset", 0); + } + if (!item.containsKey("discount")) { + item.put("discount", 100); + } + if (!item.containsKey("invoiceacount")) { + item.put("invoiceacount", 0); + } + if (!item.containsKey("deliverytype")) { + item.put("deliverytype", 0); + } + if (!item.containsKey("paymentterm")) { + item.put("paymentterm", 0); + } + if (!item.containsKey("paymentway")) { + item.put("paymentway", 0); + } + if (!item.containsKey("saleconfirm")) { + item.put("saleconfirm", 0); + } + if (!item.containsKey("PortalStatus")) { + item.put("PortalStatus", 0); + } + if (!item.containsKey("deleted")) { + item.put("deleted", 0); + } + if (item.containsKey("seclevel")) { + item.put("seclevel", (Integer) item.get("seclevel") >= 0 ? -1 : item.get("seclevel")); + } + if (item.containsKey("name")) { + // 判断客户是否存在,通过用户id和客户姓名 + String querySql = "select * from crm_customerInfo where deleted <> 1 and name = ? and manager =?"; + if (rs.executeQuery(querySql, item.get("name"), finalManagerId) && rs.next()) { + // TODO 如果客户名重复则特殊处理,如果如果该客户就进行更新 + customerIdStr.set(rs.getString("id")); + this.updateCustomerInfo(item, customerIdStr.get()); + throw new DataExistsException("break now forEach"); +// String newName = item.get("name") + String.valueOf(System.currentTimeMillis()); +// item.put("name", newName); +// item.put("engname", newName); + } + } + item.put("createdate", Utils.getTime("yyyy-MM-dd")); + item.put("createtime", Utils.getTime("HH:mm:ss")); + item.put("createrid", this.request.getRequestManager().getCreater()); + item.put("lastupdateddate", Utils.getTime("yyyy-MM-dd")); + item.put("lastupdatedtime", Utils.getTime("HH:mm:ss")); + item.put("department", finalResourceComInfo.getDepartmentID(finalManagerId)); + item.put("subcompanyid1", finalResourceComInfo.getSubCompanyID(finalManagerId)); + item.put("manager", finalManagerId); + item.put("creditlevel", finalCreditlevel); + item.put("typebegin", Utils.getTime("yyyy-MM-dd")); + item.put("ecology_pinyin_search", crmCommonUtil.getPinYin((String) item.get("name"), 7)); + + }); + } catch (DataExistsException e) { + cusMap.put("customerId", customerIdStr.get()); + this.customerID = customerIdStr.get(); + return cusMap; + } +// TODO 插入客户基本信息 + this.insertHandle("CRM_CustomerInfo", mapList); + CustomerInfoComInfo customerInfo = new CustomerInfoComInfo(); + customerInfo.removeCustomerInfoCache(); + customerInfo.removeCache(); + String queryIdSql = "select max(id) from CRM_CustomerInfo where name= ? and manager = ?"; + String customerId = ""; + rs.executeQuery(queryIdSql, cusMap.get("name"), managerId); + if (rs.next()) { + customerId = rs.getString(1); + if (!"".equals(customerId)) { + CustomerModifyLog customerModifyLog = new CustomerModifyLog(); + customerModifyLog.modify(customerId, String.valueOf(this.request.getRequestManager().getCreater()), managerId); + CrmShareBase crmShareBase = new CrmShareBase(); + try { + crmShareBase.setDefaultShare("" + customerId); + } catch (Exception e) { + e.printStackTrace(); + } + } + } else { + this.writeDebuggerLog("this not this customer in database, customer name is: " + cusMap.get("name")); + } + + customerInfo.removeCustomerInfoCache(); + customerInfo.removeCache(); + (new CustomerDescComInfo()).removeCache(); + (new CustomerRatingComInfo()).removeCache(); + (new CustomerSizeComInfo()).removeCache(); + (new CustomerStatusComInfo()).removeCache(); + customerInfo.addCustomerInfoCache(customerId); + if (cusMap.containsKey("agent") && !StringUtils.isNullOrEmpty(String.valueOf(cusMap.containsKey("agent")))) { + String finalCustomerId = customerId; + Map map = new HashMap() {{ + put("relateditemid", finalCustomerId); + put("sharetype", "9"); + put("sharelevel", "1"); + put("crmid", "0"); + put("contents", cusMap.containsKey("agent")); + put("deleted", "0"); + }}; + this.insertHandle("CRM_ShareInfo", map); + } + cusMap.put("customerId", customerId); + this.customerID = customerId; +// @debug +// cusMap.put("customerId", 1); + return cusMap; + } + + public void insertHandle(String tableName, List> mapList) { + RecordSet rs = new RecordSet(); + if (mapList.size() == 1) { +// TODO 单条数据插入 + this.insertHandle(tableName, mapList.get(0)); + } else { + mapList.forEach(item -> this.insertHandle(tableName, item)); + } + + } + + public void insertHandle(String tableName, Map map) { + RecordSet rs = new RecordSet(); +// TODO 单条数据插入 + SqlResult sqlResult = BuilderSqlUtil.builderInsertSql(tableName, map); + if (!Objects.isNull(sqlResult)) { +// TODO 插入数据库数据 +// Console.log(sqlResult.getSqlStr()); +// Console.log(Arrays.toString(sqlResult.getArgs()) + "\n"); + this.writeDebuggerLog(sqlResult.getSqlStr()); + this.writeDebuggerLog(Arrays.toString(sqlResult.getArgs()) + "\n"); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + } + + public void updateHandle(String tableName, List> mapList, PrepSQLWhere where) { + RecordSet rs = new RecordSet(); + + if (mapList.size() == 1) { +// TODO 单条数据插入 + this.updateHandle(tableName, mapList.get(0), where); + } else { + mapList.forEach(item -> this.updateHandle(tableName, item, where)); + } + + } + + public void updateHandle(String tableName, Map map, PrepSQLWhere where) { + RecordSet rs = new RecordSet(); +// TODO 单条数据插入 + SqlResult sqlResult = BuilderSqlUtil.builderUpdateSql(tableName, map, where); + // TODO 插入数据库数据 +// Console.log(sqlResult.getSqlStr()); +// Console.log(Arrays.toString(sqlResult.getArgs()) + "\n"); + this.writeDebuggerLog(sqlResult.getSqlStr()); + this.writeDebuggerLog(Arrays.toString(sqlResult.getArgs()) + "\n"); + rs.executeUpdate(sqlResult.getSqlStr(), sqlResult.getArgs()); + } + + +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/config/CRM_Config.java b/weaver/aiyh_pcn/workflow_to_customer/config/CRM_Config.java new file mode 100644 index 0000000..379aefb --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/config/CRM_Config.java @@ -0,0 +1,364 @@ +package weaver.aiyh_pcn.workflow_to_customer.config; + +import aiyh.utils.zwl.common.ToolUtil; +import org.h2.util.StringUtils; +import weaver.aiyh_pcn.workflow_to_customer.model.MainResult; +import weaver.aiyh_pcn.workflow_to_customer.model.TableFieldRelation; +import weaver.aiyh_pcn.workflow_to_customer.utils.Utils; +import weaver.conn.RecordSet; +import weaver.general.Util; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 客户信息字段与流程字段映射配置 + */ +public class CRM_Config extends ToolUtil { + private final String className = "CRM_Config"; + private final String workflowId; + private final String mainTable; + private final String requestId; + private MainResult mainResult = null; + private final Map>> configResult; + + + public CRM_Config(String workflowId, String mainTable, String requestId) { + this.workflowId = workflowId; + this.mainTable = mainTable; + this.requestId = requestId; + this.configResult = new HashMap<>(); + } + + /** + * 获取客户信息字段映射配置 + * + */ + public Map>> getConfigInfo() { + RecordSet rs = new RecordSet(); + Map> configMap = new HashMap<>(); + List configList = new ArrayList<>(); + +// 查询配置表基本信息 + String selectConfigBase = "select lf.id, lf.is_out_user,lf.is_sell_change,lf.will_write, " + + "wfvw.fieldname as will_write_field,wfvw.tablename as will_write_table, " + + "lf.is_customer_address,lf.workflow_type, lf.customer_id, " + + "lf.change_setting, wslu.selectvalue as update_mark, " + + "lf.manager_type, lf.customer_manager, wfvm.fieldname as manager_field, " + + "wsli.selectvalue as insert_mark,wfv.fieldname as update_insert, " + + "wfv.tablename as update_insert_table " + + "from uf_external_law_fir as lf " + + "left join workflow_selectitem as wslu on wslu.id = lf.update_mark " + + "left join workflow_selectitem as wsli on wsli.id = lf.insert_mark " + + "left join workflow_field_view as wfv on wfv.id = lf.update_insert " + + "left join workflow_field_view as wfvm on wfvm.id = lf.manager_field " + + "left join workflow_field_view as wfvw on wfvw.id = lf.will_write_field " + + "where workflow_type in " + + "(select id from workflow_base where activeVersionID in " + + "(select activeVersionID from workflow_base where id = ?) or id = ?)"; + rs.executeQuery(selectConfigBase, this.workflowId, this.workflowId); + while (rs.next()) { + int mainId = Util.getIntValue(rs.getInt("id")); +// 流程类型 + int workflowType = Util.getIntValue(rs.getString("workflow_type")); +// 是否创建联系人 + int isOutUser = Util.getIntValue(rs.getString("is_out_user")); +// 是否创建销售商机 + int isSellChange = Util.getIntValue(rs.getString("is_sell_change")); +// 是否创建客户地址 + int isCustomerAddress = Util.getIntValue(rs.getString("is_customer_address")); +// 流转设置 + int changeSetting = Util.getIntValue(rs.getInt("change_setting")); +// 更新客户信息对应主键字段 + String customerId = Util.null2String(rs.getString("customer_id")); +// 更新和插入标识 + String updateInsert = Util.null2String(rs.getString("update_insert")); +// 更新标识值 + int updateMark = Util.getIntValue(rs.getString("update_mark"),-1); +// 插入标识值 + int insertMark = Util.getIntValue(rs.getString("insert_mark"),-1); +// 客户经理类型 + int managerType = Util.getIntValue(rs.getString("manager_type"), -1); + //客户经理id + int customerManager = Util.getIntValue(rs.getString("customer_manager"),0); + //客户经理在流程中的字段 + String managerField = Util.null2String(rs.getString("manager_field")); + String updateInsertTable = Util.null2String(rs.getString("update_insert_table")); +// 是否回写到流程 + int willWrite = Util.getIntValue(rs.getString("will_write"),0); +// 会写到流程的某个字段 + String willWriteField = Util.null2String(rs.getString("will_write_field")); + String willWriteTable = Util.null2String(rs.getString("will_write_table")); +// 对查询数据进行一个实体类封装 + this.mainResult = MainResult.builder() + .mainId(mainId) + .workflowType(workflowType) + .isOutUser(isOutUser) + .isSellChange(isSellChange) + .isCustomerAddress(isCustomerAddress) + .customerId(customerId) + .updateInsert(updateInsert) + .updateMark(updateMark) + .insertMark(insertMark) + .changeSetting(changeSetting) + .managerType(managerType) + .customerManager(customerManager) + .managerField(managerField.toLowerCase()) + .updateInsertTable(updateInsertTable) + .willWrite(willWrite) + .willWriteField(willWriteField.toLowerCase()) + .willWriteTable(willWriteTable) + .build(); + } + + this.writeDebuggerLog(mainResult.toString()); + this.writeDebuggerLog("\n===============================================\n"); + +// 如果该条流程没有配置信息,则表示不用执行流转客户操作 + if (this.mainResult == null) { + return null; + } + +// 查询配置表明细表 + String selectConfigData = "select lfd.id,lfd.change_rules, cv.fieldname as customer_field," + + "lfd.rules_value,wv.fieldname as workflow_field, wv.tablename as workflow_table, " + + "cv.tablename as customer_table,lfd.customer_type,lfd.out_user_field " + + "from uf_external_law_fir_dt1 as lfd " + + "left join workflow_field_view as wv on wv.id = lfd.workflow_field " + + "left join customer_view as cv on cv.id = lfd.customer_field " + + "where lfd.mainid = ?"; + rs.executeQuery(selectConfigData, this.mainResult.getMainId()); + + while (rs.next()) { +// 明细表id + int id = Util.getIntValue(rs.getInt("id")); +// 转换规则 + int changeRules = Util.getIntValue(rs.getString("change_rules")); +// 客户模块类型 + int customerType = Util.getIntValue(rs.getString("customer_type")); +// 转换规则值 + String rulesValue = Util.null2String(rs.getString("rules_value")); +// 流程字段 + String workflowField = Util.null2String(rs.getString("workflow_field")); +// 客户模块字段 + String customerField = Util.null2String(rs.getString("customer_field")); +// 流程字段对应的流程表 + String workflowTable = Util.null2String(rs.getString("workflow_table")); +// 客户模块字段对应的客户模块表 + String customerTable = Util.null2String(rs.getString("customer_table")); +// 外部用户字段 + String outUserField = Util.null2String(rs.getString("out_user_field")); + TableFieldRelation tableFieldRelation = + TableFieldRelation.builder() + .id(id) + .changeRules(changeRules) + .customerType(customerType) + .rulesValue(rulesValue) + .workflowField(workflowField.toLowerCase()) + .customerField(customerField.toLowerCase()) + .outUserField(outUserField.toLowerCase()) + .workflowTable(workflowTable) + .customerTable(customerTable).build(); + configList.add(tableFieldRelation); + if (!configMap.containsKey(customerTable)) { + if (customerType == 1) { + configMap.put("hrmResource", new HashSet() {{ + add(workflowTable); + }}); + } else { + configMap.put(customerTable, new HashSet() {{ + add(workflowTable); + }}); + } + } else { + if (customerType == 1) { + configMap.get("hrmResource").add(workflowTable); + } else { + configMap.get(customerTable).add(workflowTable); + } + } + } + +// 获取客户基本信息 + this.configResult.put("CRM_CustomerInfo",this.getCRM_CustomerInfoSqlMapList(configList,configMap)); + +// 判断是否需要创建外部用户 + if (this.mainResult.getIsOutUser() == 0) { +// 需要创建外部用户,获取外部用户字段映射信息 + this.configResult.put("hrmResource",this.getHrmResourceSqlMapList(configList,configMap)); + }else if(this.mainResult.getIsOutUser() == 1){ +// 不需要创建外部用户,但是需要创建联系人,获取联系人字段映射信息 + this.configResult.put("CRM_CustomerContacter",this.getCRM_CustomerContacterSqlMapList(configList,configMap)); + } + +// 判断是否需要创建商机 + if(this.mainResult.getIsSellChange() == 0){ +// 需要创建商机,获取上级字段映射信息 + this.configResult.put("CRM_SellChance",this.getCRM_SellChanceSqlMapList(configList,configMap)); + } + +// 判断是否需要创建客户地址 + if(this.mainResult.getIsCustomerAddress() == 0){ +// 需要创建客户地址,获取客户地址字段映射信息 + this.configResult.put("CRM_CustomerAddress",this.getCRM_CustomerAddressSqlMapList(configList,configMap)); + } + + return this.configResult; + } + + public List> getHrmResourceSqlMapList(List configList,Map> configMap) { + List hrmResourceList = configList + .stream().filter(item -> item.getCustomerType() == 1) + .collect(Collectors.toList()); + List> hrmResourceSqlMapList = this.getSqlMapList(hrmResourceList, configMap.get("hrmResource")); + return hrmResourceSqlMapList; + } + + public List> getCRM_CustomerInfoSqlMapList(List configList,Map> configMap) { + List CRM_CustomerInfoList = configList + .stream().filter(item -> "CRM_CustomerInfo".equalsIgnoreCase(item.getCustomerTable())) + .collect(Collectors.toList()); + List> CRM_CustomerInfoSqlMapList = this.getSqlMapList(CRM_CustomerInfoList, configMap.get("CRM_CustomerInfo")); + return CRM_CustomerInfoSqlMapList; + } + + public List> getCRM_CustomerContacterSqlMapList(List configList,Map> configMap) { + List CRM_CustomerContacterList = configList + .stream().filter(item -> "CRM_CustomerContacter".equalsIgnoreCase(item.getCustomerTable())) + .collect(Collectors.toList()); + List> CRM_CustomerContacterSqlMapList = this.getSqlMapList(CRM_CustomerContacterList, configMap.get("CRM_CustomerContacter")); + return CRM_CustomerContacterSqlMapList; + } + + public List> getCRM_CustomerAddressSqlMapList(List configList,Map> configMap) { + List CRM_CustomerAddressList = configList + .stream().filter(item -> "CRM_CustomerAddress".equalsIgnoreCase(item.getCustomerTable())) + .collect(Collectors.toList()); + List> CRM_CustomerAddressSqlMapList = this.getSqlMapList(CRM_CustomerAddressList, configMap.get("CRM_CustomerAddress")); + return CRM_CustomerAddressSqlMapList; + } + + public List> getCRM_SellChanceSqlMapList(List configList,Map> configMap) { + List CRM_SellChanceList = configList + .stream().filter(item -> "CRM_SellChance".equalsIgnoreCase(item.getCustomerTable())) + .collect(Collectors.toList()); + List> CRM_SellChanceSqlMapList = this.getSqlMapList(CRM_SellChanceList, configMap.get("CRM_SellChance")); + return CRM_SellChanceSqlMapList; + } + + public List> getSqlMapList(List configList, Set set){ + if(Objects.isNull(configList) || configList.size() == 0 || Objects.isNull(set) || set.size() == 0){ + this.writeErrorLog("table mapping error,error args is configList = [" + configList + "] and set = [" + set + "]"); + return null; + } + RecordSet rs = new RecordSet(); + List> sqlMapList = new ArrayList<>(); + for (String tableName : set) { +// 过滤表数据 + List tableList = configList + .stream().filter(item -> tableName.equals(item.getWorkflowTable())) + .collect(Collectors.toList()); + String selectSql; +// 判断属于那个表 + if("main_table".equals(tableName)){ +// 表示数据来源于主表,通过表名查询数据信息 + selectSql = "select * from " + this.mainTable + " where requestid = ?"; + }else{ +// 属于明细表 + selectSql = "select * from " + tableName + " where mainid in " + + "(select id from " + this.mainTable + " where requestid = ?)"; + } + if(rs.executeQuery(selectSql, this.requestId)){ +// 获取查询所有数据 + while(rs.next()){ + Map sqlMap = new HashMap<>(); +// 循环获取字段和值的映射关系 + tableList.forEach(tableField -> { + String value = ""; + switch (tableField.getChangeRules()){ + case 0: +// 转换规则为不转换 + value = Util.null2String(rs.getString(tableField.getWorkflowField())); + break; + case 1: +// 转换规则为固定值 + value = tableField.getRulesValue(); + break; + case 2: +// 转换规则为自定义SQL + String customSql = tableField.getRulesValue(); + if (customSql.contains("delete") || customSql.contains("update") || + customSql.contains("exec") || customSql.contains("drop") || + customSql.contains("truncate")) { +// sql 不包含delete,update,exec,drop,truncate等危险关键字 + writeErrorLog("warning sql: " + customSql); + } else if (customSql.contains("select")) { +// 包含查询关键词 + try { + rs.executeQuery(customSql); + } catch (Exception e) { + writeErrorLog("execute custom sql error: " + customSql); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + rs.next(); + value = Util.null2String(rs.getString(1)); + } + break; + case 3: +// 转换规则为requestId + value = this.requestId; + break; + case 6: +// 转换规则是系统日期 + String format = getSystemParamValue("ExternalLawFirmsFormatDate"); + if(StringUtils.isNullOrEmpty(format)){ + format = "yyyy-MM-dd"; + } + try{ + value = Utils.getTime(format); + }catch(Exception e){ + writeErrorLog(className,"format date error, format string is: " + format); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + break; + case 7: +// 转换规则是系统日期时间 + String formatTime = getSystemParamValue("ExternalLawFirmsFormatDateTime"); + if(StringUtils.isNullOrEmpty(formatTime)){ + formatTime = "yyyy-MM-dd HH:mm:ss"; + } + try{ + value = Utils.getTime(formatTime); + }catch(Exception e){ + writeErrorLog(className,"format dateTime error, format string is: " + formatTime); + writeErrorLog("error info:" + e.getMessage() + "\n"); + } + break; + default: + break; + } + if(tableField.getCustomerType() == 0){ + sqlMap.put(tableField.getCustomerField().toLowerCase() + , value); + }else{ +// TODO bug,外部用户的字段不能出现在客户基本信息里面 + sqlMap.put(tableField.getOutUserField().toLowerCase() + , value); + } + }); + this.writeDebuggerLog("SqlMap:" + sqlMap); + sqlMapList.add(sqlMap); + } + }else{ + writeErrorLog("select workflow date error, error sql is: " + + selectSql + " args is: " + this.workflowId); + } + } + return sqlMapList; + } + + + public MainResult getMainResult() { + return mainResult; + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/exception/DataExistsException.java b/weaver/aiyh_pcn/workflow_to_customer/exception/DataExistsException.java new file mode 100644 index 0000000..5b29576 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/exception/DataExistsException.java @@ -0,0 +1,14 @@ +package weaver.aiyh_pcn.workflow_to_customer.exception; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/21 0021 14:05 + * reutrn method exception + */ + + +public class DataExistsException extends RuntimeException { + public DataExistsException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/weaver/aiyh_pcn/workflow_to_customer/exception/LoginIdRepeatException.java b/weaver/aiyh_pcn/workflow_to_customer/exception/LoginIdRepeatException.java new file mode 100644 index 0000000..aef704b --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/exception/LoginIdRepeatException.java @@ -0,0 +1,14 @@ +package weaver.aiyh_pcn.workflow_to_customer.exception; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/20 0020 18:48 + * exception + */ + + +public class LoginIdRepeatException extends RuntimeException { + public LoginIdRepeatException(String msg){ + super(msg); + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/model/MainResult.java b/weaver/aiyh_pcn/workflow_to_customer/model/MainResult.java new file mode 100644 index 0000000..e3dba27 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/model/MainResult.java @@ -0,0 +1,256 @@ +package weaver.aiyh_pcn.workflow_to_customer.model; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/11 0011 14:25 + * 配置主表信息 + */ + + +public class MainResult { + private int mainId; + private int workflowType; + private int isOutUser; + private int isSellChange; + private int isCustomerAddress; + private String customerId; + private String updateInsert; + private int updateMark; + private int insertMark; + private int changeSetting; + private int managerType; + private int customerManager; + private String managerField; + private String updateInsertTable; + private int willWrite; + private String willWriteField; + private String willWriteTable; + + public int getWillWrite() { + return willWrite; + } + + public String getWillWriteField() { + return willWriteField; + } + + public String getWillWriteTable() { + return willWriteTable; + } + + @Override + public String toString() { + return "MainResult{" + + "mainId=" + mainId + + ", workflowType=" + workflowType + + ", isOutUser=" + isOutUser + + ", isSellChange=" + isSellChange + + ", isCustomerAddress=" + isCustomerAddress + + ", customerId='" + customerId + '\'' + + ", updateInsert='" + updateInsert + '\'' + + ", updateMark=" + updateMark + + ", insertMark=" + insertMark + + ", changeSetting=" + changeSetting + + ", managerType=" + managerType + + ", customerManager=" + customerManager + + ", managerField='" + managerField + '\'' + + ", updateInsertTable='" + updateInsertTable + '\'' + + ", willWriteTable='" + willWriteTable + '\'' + + ", willWrite=" + willWrite + + ", willWriteField='" + willWriteField + '\'' + + '}'; + } + + public String getUpdateInsertTable() { + return updateInsertTable; + } + + public MainResult() { + } + + + public MainResult(Builder builder) { + this.mainId = builder.mainId; + this.workflowType = builder.workflowType; + this.isOutUser = builder.isOutUser; + this.isSellChange = builder.isSellChange; + this.isCustomerAddress = builder.isCustomerAddress; + this.customerId = builder.customerId; + this.updateInsert = builder.updateInsert; + this.updateMark = builder.updateMark; + this.insertMark = builder.insertMark; + this.changeSetting = builder.changeSetting; + this.managerType = builder.managerType; + this.customerManager = builder.customerManager; + this.managerField = builder.managerField; + this.updateInsertTable = builder.updateInsertTable; + this.willWrite = builder.willWrite; + this.willWriteField = builder.willWriteField; + this.willWriteTable = builder.willWriteTable; + } + + public static Builder builder(){ + return new Builder(); + } + + public static class Builder{ + private int mainId; + private int workflowType; + private int isOutUser; + private int isSellChange; + private int isCustomerAddress; + private String customerId; + private String updateInsert; + private int updateMark; + private int insertMark; + private int changeSetting; + private int managerType; + private int customerManager; + private String managerField; + private String updateInsertTable; + private int willWrite; + private String willWriteField; + private String willWriteTable; + + public Builder willWrite(int willWrite) { + this.willWrite = willWrite; + return this; + } + + public Builder willWriteTable(String willWriteTable) { + this.willWriteTable = willWriteTable; + return this; + } + + public Builder willWriteField(String willWriteField) { + this.willWriteField = willWriteField; + return this; + } + + public Builder managerType(int managerType) { + this.managerType = managerType; + return this; + } + + public Builder customerManager(int customerManager) { + this.customerManager = customerManager; + return this; + } + + public Builder managerField(String managerField) { + this.managerField = managerField; + return this; + } + + public Builder updateInsertTable(String updateInsertTable) { + this.updateInsertTable = updateInsertTable; + return this; + } + + public Builder mainId(int mainId) { + this.mainId = mainId; + return this; + } + + public Builder workflowType(int workflowType) { + this.workflowType = workflowType; + return this; + } + + public Builder isOutUser(int isOutUser) { + this.isOutUser = isOutUser; + return this; + } + + public Builder isSellChange(int isSellChange) { + this.isSellChange = isSellChange; + return this; + } + + public Builder isCustomerAddress(int isCustomerAddress) { + this.isCustomerAddress = isCustomerAddress; + return this; + } + + public Builder customerId(String customerId) { + this.customerId = customerId; + return this; + } + + public Builder updateInsert(String updateInsert) { + this.updateInsert = updateInsert; + return this; + } + + public Builder updateMark(int updateMark) { + this.updateMark = updateMark; + return this; + } + + public Builder insertMark(int insertMark) { + this.insertMark = insertMark; + return this; + } + public Builder changeSetting(int changeSetting) { + this.changeSetting = changeSetting; + return this; + } + + public MainResult build(){ + return new MainResult(this); + } + } + + public int getMainId() { + return mainId; + } + + public int getWorkflowType() { + return workflowType; + } + + public int getIsOutUser() { + return isOutUser; + } + + public int getIsSellChange() { + return isSellChange; + } + + public int getIsCustomerAddress() { + return isCustomerAddress; + } + + public String getCustomerId() { + return customerId; + } + + public String getUpdateInsert() { + return updateInsert; + } + + public int getUpdateMark() { + return updateMark; + } + + public int getInsertMark() { + return insertMark; + } + + public int getChangeSetting() { + return changeSetting; + } + + public int getManagerType() { + return managerType; + } + + public int getCustomerManager() { + return customerManager; + } + + public String getManagerField() { + return managerField; + } + +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/model/TableFieldRelation.java b/weaver/aiyh_pcn/workflow_to_customer/model/TableFieldRelation.java new file mode 100644 index 0000000..87cd9cf --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/model/TableFieldRelation.java @@ -0,0 +1,162 @@ +package weaver.aiyh_pcn.workflow_to_customer.model; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/11 0011 10:29 + * 表字段映射 + */ + + +public class TableFieldRelation { + private int id; + private int changeRules; + private String customerField; + private String rulesValue; + private String workflowField; + private String workflowTable; + private String customerTable; + private String outUserField; + private int customerType; + + public TableFieldRelation(int id, int changeRules, String customerField, String rulesValue, String workflowField, String workflowTable, String customerTable, String outUserField) { + this.id = id; + this.changeRules = changeRules; + this.customerField = customerField; + this.rulesValue = rulesValue; + this.workflowField = workflowField; + this.workflowTable = workflowTable; + this.customerTable = customerTable; + this.outUserField = outUserField; + } + + public TableFieldRelation(Builder builder) { + this.id = builder.id; + this.changeRules = builder.changeRules; + this.customerField = builder.customerField; + this.rulesValue = builder.rulesValue; + this.workflowField = builder.workflowField; + this.workflowTable = builder.workflowTable; + this.customerTable = builder.customerTable; + this.outUserField = builder.outUserField; + this.customerType = builder.customerType; + } + + + public static Builder builder(){ + return new Builder(); + } + + public static class Builder{ + private int id; + private int changeRules; + private String customerField; + private String rulesValue; + private String workflowField; + private String workflowTable; + private String customerTable; + private String outUserField; + private int customerType; + + public Builder() { + } + + public Builder id(int id) { + this.id = id; + return this; + } + public Builder customerType(int customerType) { + this.customerType = customerType; + return this; + } + + public Builder changeRules(int changeRules) { + this.changeRules = changeRules; + return this; + } + + public Builder customerField(String customerField) { + this.customerField = customerField; + return this; + } + + public Builder rulesValue(String rulesValue) { + this.rulesValue = rulesValue; + return this; + } + + public Builder workflowField(String workflowField) { + this.workflowField = workflowField; + return this; + } + + public Builder workflowTable(String workflowTable) { + this.workflowTable = workflowTable; + return this; + } + + public Builder customerTable(String customerTable) { + this.customerTable = customerTable; + return this; + } + + public Builder outUserField(String outUserField) { + this.outUserField = outUserField; + return this; + } + + public TableFieldRelation build() { + return new TableFieldRelation(this); + } + } + + public int getCustomerType() { + return customerType; + } + + public int getId() { + return id; + } + + public int getChangeRules() { + return changeRules; + } + + public String getCustomerField() { + return customerField; + } + + public String getRulesValue() { + return rulesValue; + } + + public String getWorkflowField() { + return workflowField; + } + + public String getWorkflowTable() { + return workflowTable; + } + + public String getCustomerTable() { + return customerTable; + } + + public String getOutUserField() { + return outUserField; + } + + @Override + public String toString() { + return "TableFieldRelation{" + + "id=" + id + + ", changeRules=" + changeRules + + ", customerField='" + customerField + '\'' + + ", rulesValue='" + rulesValue + '\'' + + ", workflowField='" + workflowField + '\'' + + ", workflowTable='" + workflowTable + '\'' + + ", customerTable='" + customerTable + '\'' + + ", outUserField='" + outUserField + '\'' + + ", customerType=" + customerType + + '}'; + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/BuilderSqlUtil.java b/weaver/aiyh_pcn/workflow_to_customer/utils/BuilderSqlUtil.java new file mode 100644 index 0000000..0cf64ec --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/BuilderSqlUtil.java @@ -0,0 +1,204 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import com.weaver.general.Util; +import org.h2.util.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/12 0012 13:20 + * 构建SQL工具类 + */ + + +public class BuilderSqlUtil { + public static String builderInsertFullSql(String tableName, Map fieldsValuesMap){ + if(Objects.isNull(fieldsValuesMap) || StringUtils.isNullOrEmpty(tableName)){ + return null; + } + fieldsValuesMap = Utils.createMap().uPutAll(fieldsValuesMap) + .filter((key, value) -> !Objects.isNull(value)); + if(fieldsValuesMap.size() == 0){ + return null; + } + StringBuilder sqlBuilder = new StringBuilder("insert into "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + StringBuilder sqlValueBuilder = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" ( "); + fieldsValuesMap.forEach((field,value) -> { + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(", "); + sqlValueBuilder.append("'"); + sqlValueBuilder.append(value); + sqlFieldBuilder.append("'"); + sqlValueBuilder.append(", "); + }); + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Utils.removeSeparator(sqlValueBuilder)); + sqlBuilder.append(" )"); + return sqlBuilder.toString(); + } + + public static SqlResult builderInsertSql(String tableName, Map fieldsValuesMap){ + if(Objects.isNull(fieldsValuesMap) || StringUtils.isNullOrEmpty(tableName)){ + return null; + } + StringBuilder sqlBuilder = new StringBuilder("insert into "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + StringBuilder sqlValueBuilder = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" ( "); + Object[] args = new Object[fieldsValuesMap.size()]; + AtomicInteger i = new AtomicInteger(); + fieldsValuesMap.forEach((field,value)->{ + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(", "); + sqlValueBuilder.append("?, "); + args[i.getAndIncrement()] = Util.null2String(String.valueOf(value)); + }); + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Utils.removeSeparator(sqlValueBuilder)); + sqlBuilder.append(" )"); + return new SqlResult(sqlBuilder.toString(),args); + } + + public static SqlResult builderBatchInsertSql(String tableName, List> fieldsValuesMapList){ + if(Objects.isNull(fieldsValuesMapList) || StringUtils.isNullOrEmpty(tableName)){ + return null; + } + StringBuilder sqlBuilder = new StringBuilder("insert into "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + StringBuilder sqlValueBuilder = new StringBuilder(); + List args = new ArrayList<>(); + sqlBuilder.append(tableName); + sqlBuilder.append(" ( "); + AtomicInteger i = new AtomicInteger(); + if(fieldsValuesMapList.size() >= 1){ + fieldsValuesMapList.forEach(item->{ + if(i.get() == 0){ + item.forEach((field,value)->{ + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(", "); + sqlValueBuilder.append("?, "); + }); + i.getAndIncrement(); + } + ArrayList list = new ArrayList<>(); + item.forEach((field,value)-> list.add(value)); + args.add(list); + }); + } + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" ) values ( "); + sqlBuilder.append(Utils.removeSeparator(sqlValueBuilder)); + sqlBuilder.append(" )"); + return new SqlResult(sqlBuilder.toString(),args); + } + + public static String builderUpdateFullSql(String tableName, Map fieldsValuesMap, String conditions){ + if(Objects.isNull(fieldsValuesMap) || StringUtils.isNullOrEmpty(tableName)){ + return null; + } + fieldsValuesMap = Utils.createMap().uPutAll(fieldsValuesMap) + .filter((key, value) -> !Objects.isNull(value)); + if(fieldsValuesMap.size() == 0){ + return null; + } + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + fieldsValuesMap.forEach((field, value)->{ + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(" = "); + sqlFieldBuilder.append("'"); + sqlFieldBuilder.append(value); + sqlFieldBuilder.append("'"); + sqlFieldBuilder.append(", "); + }); + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" where "); + sqlBuilder.append(conditions); + return sqlBuilder.toString(); + } + + public static String builderUpdateFullSql(String tableName, Map fieldsValuesMap, SQLWhere sqlWhere){ + if(Objects.isNull(fieldsValuesMap) || StringUtils.isNullOrEmpty(tableName)){ + return null; + } + fieldsValuesMap = Utils.createMap().uPutAll(fieldsValuesMap) + .filter((key, value) -> !Objects.isNull(value)); + if(fieldsValuesMap.size() == 0){ + return null; + } + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + fieldsValuesMap.forEach((field,value) -> { + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(" = "); + sqlFieldBuilder.append("'"); + sqlFieldBuilder.append(value); + sqlFieldBuilder.append("'"); + sqlFieldBuilder.append(", "); + }); + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" where "); + sqlBuilder.append(sqlWhere.getSqlWhere()); + return sqlBuilder.toString(); + } + public static SqlResult builderUpdateSql(String tableName, Map fieldsValuesMap, PrepSQLWhere prepSQLWhere){ + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + List args = new ArrayList<>(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + fieldsValuesMap.forEach((field, value)->{ + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(" = ? "); + sqlFieldBuilder.append(", "); + args.add(value); + }); + args.addAll(prepSQLWhere.getArgs()); + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" where "); + sqlBuilder.append(prepSQLWhere.getPstSqlWhere()); + return new SqlResult(sqlBuilder.toString(),args.toArray(new Object[args.size()])); + } + + public static SqlResult builderBatchUpdateSql(String tableName, List> fieldsValuesMapList, PrepSQLWhere prepSQLWhere){ + StringBuilder sqlBuilder = new StringBuilder("update "); + StringBuilder sqlFieldBuilder = new StringBuilder(); + sqlBuilder.append(tableName); + sqlBuilder.append(" set "); + List args = new ArrayList<>(); + fieldsValuesMapList.forEach(item->{ + item.forEach((field, value)->{ + sqlFieldBuilder.append(field); + sqlFieldBuilder.append(" = ? "); + sqlFieldBuilder.append(", "); + }); + ArrayList list = new ArrayList<>(); + item.forEach((field,value)-> list.add(value)); + list.addAll(prepSQLWhere.getArgs()); + args.add(list); + }); + sqlBuilder.append(Utils.removeSeparator(sqlFieldBuilder)); + sqlBuilder.append(" where "); + sqlBuilder.append(prepSQLWhere.getPstSqlWhere()); + + return new SqlResult(sqlBuilder.toString(),args); + } + + + +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/ParaMap.java b/weaver/aiyh_pcn/workflow_to_customer/utils/ParaMap.java new file mode 100644 index 0000000..4a72b4d --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/ParaMap.java @@ -0,0 +1,27 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/19 0019 19:40 + * map + */ + + +public class ParaMap extends HashMap implements Map { + + private ParaMap() { + } + + public static ParaMap create() { + return new ParaMap(); + } + + @Override + public ParaMap put(String name, Object value) { + super.put(name, value); + return this; + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/PrepSQLWhere.java b/weaver/aiyh_pcn/workflow_to_customer/utils/PrepSQLWhere.java new file mode 100644 index 0000000..4c8b1c5 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/PrepSQLWhere.java @@ -0,0 +1,170 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import java.util.ArrayList; +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/13 0013 17:06 + * SQLwhere 构建SQL的条件,并且以prepareStatement参数的形式返回 + */ + + +public class PrepSQLWhere { + private final StringBuilder pstSqlWhere; + private final List args; + + public PrepSQLWhere(PrepWhere where) { + this.pstSqlWhere = where.pstSqlWhere; + this.args = where.args; + } + + public StringBuilder getPstSqlWhere() { + return pstSqlWhere; + } + + public List getArgs() { + return args; + } + + public static PrepWhere creatPrepWhere() { + return new PrepWhere(); + } + + public static class PrepWhere { + private final StringBuilder pstSqlWhere; + private final PrepWhereOperator whereOperator; + private final List args; + + public PrepWhere() { + this.pstSqlWhere = new StringBuilder(" 1 = 1 "); + this.whereOperator = new PrepWhereOperator(this); + args = new ArrayList<>(); + } + + public PrepWhereOperator and(String key) { + this.pstSqlWhere.append(" and "); + this.pstSqlWhere.append(key); + return whereOperator; + } + + public PrepWhereOperator or(String key) { + this.pstSqlWhere.append(" or "); + this.pstSqlWhere.append(key); + return whereOperator; + } + + + public PrepSQLWhere create() { + return new PrepSQLWhere(this); + } + } + + public static class PrepWhereOperator { + private final PrepWhere where; + + public PrepWhereOperator(PrepWhere where) { + this.where = where; + } + + public PrepWhere isNull(String key) { + where.pstSqlWhere.append(" is null "); + return where; + } + + public PrepWhere isNotNUll(String key) { + where.pstSqlWhere.append(" is not null "); + where.pstSqlWhere.append(key); + return where; + } + + public PrepWhere equal(Object value) { + where.pstSqlWhere.append(" = ? "); + where.args.add(value); + return where; + } + + public PrepWhere noEqual(Object value) { + where.pstSqlWhere.append(" <> ? "); + where.args.add(value); + return where; + } + + public PrepWhere equalSql(Object value) { + where.pstSqlWhere.append(" in ( "); + where.pstSqlWhere.append(value); + where.pstSqlWhere.append(" ) "); + return where; + } + + public PrepWhere noEqualSql(Object value) { + where.pstSqlWhere.append(" not in ( "); + where.pstSqlWhere.append(value); + where.pstSqlWhere.append(" ) "); + return where; + } + + public PrepWhere in(List list) { + where.pstSqlWhere.append(" in ( "); + list.forEach(item -> where.pstSqlWhere.append(" ? ")); + where.pstSqlWhere.append(" ) "); + where.args.addAll(list); + return where; + } + + public PrepWhere in(Object ...list) { + where.pstSqlWhere.append(" in ( "); + for(Object obj : list){ + where.pstSqlWhere.append(" ? "); + where.args.add(obj); + } + where.pstSqlWhere.append(" ) "); + return where; + } + + public PrepWhere notIn(List list) { + where.pstSqlWhere.append(" not in ( "); + list.forEach(item -> where.pstSqlWhere.append(" ? ")); + where.pstSqlWhere.append(" ) "); + where.args.addAll(list); + return where; + } + + public PrepWhere notIn(Object ...list) { + where.pstSqlWhere.append(" not in ( "); + for(Object obj : list){ + where.pstSqlWhere.append(" ? "); + where.args.add(obj); + } + where.pstSqlWhere.append(" ) ");; + return where; + } + + public PrepWhere like(Object value) { + where.pstSqlWhere.append(" like ? "); + where.args.add(value); + return where; + } + + public PrepWhere greaterOrEqual(Object value) { + where.pstSqlWhere.append(" >= ? "); + where.args.add(value); + return where; + } + + public PrepWhere lessOrEqual(Object value) { + where.pstSqlWhere.append(" <= ? "); + where.args.add(value); + return where; + } + + public PrepWhere BetweenAnd(Object value1, Object value2) { + where.pstSqlWhere.append(" between ? "); + where.args.add(value1); + where.pstSqlWhere.append(" and ? "); + where.args.add(value2); + return where; + } + } + +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/SQLWhere.java b/weaver/aiyh_pcn/workflow_to_customer/utils/SQLWhere.java new file mode 100644 index 0000000..147f4f3 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/SQLWhere.java @@ -0,0 +1,198 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import java.util.List; + + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/13 0013 15:58 + * sqlWhere 构建SQL的条件 + */ + + +public class SQLWhere { + private final StringBuilder sqlWhere; + + + public SQLWhere(Where where) { + this.sqlWhere = where.sqlWhere; + } + + public StringBuilder getSqlWhere() { + return sqlWhere; + } + + + public static Where creatWhere() { + return new Where(); + } + + + public static class Where { + private final StringBuilder sqlWhere; + private final WhereOperator whereOperator; + + public Where() { + this.sqlWhere = new StringBuilder(" 1 = 1 "); + this.whereOperator = new WhereOperator(this); + } + + public WhereOperator and(String key) { + this.sqlWhere.append(" and "); + this.sqlWhere.append(key); + return whereOperator; + } + + public WhereOperator or(String key) { + this.sqlWhere.append(" or "); + this.sqlWhere.append(key); + return whereOperator; + } + + public SQLWhere create() { + return new SQLWhere(this); + } + } + + + public static class WhereOperator { + private final Where where; + + public WhereOperator(Where where) { + this.where = where; + } + + public Where isNull(String key) { + where.sqlWhere.append(" is null "); + return where; + } + + public Where isNotNUll(String key) { + where.sqlWhere.append(" is not null "); + where.sqlWhere.append(key); + return where; + } + + public Where equal(Object value) { + where.sqlWhere.append(" = "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value); + where.sqlWhere.append("'"); + return where; + } + + public Where noEqual(Object value) { + where.sqlWhere.append(" <> "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value); + where.sqlWhere.append("'"); + return where; + } + + public Where in(List list) { + where.sqlWhere.append(" in ( "); + for (int i = 0; i < list.size(); i++) { + where.sqlWhere.append("'"); + where.sqlWhere.append(list.get(i)); + where.sqlWhere.append("'"); + if (i != list.size() - 1) { + where.sqlWhere.append(" , "); + } + } + where.sqlWhere.append(" ) "); + return where; + } + + public Where in(Object ...list) { + where.sqlWhere.append(" in ( "); + for (int i = 0; i < list.length; i++) { + where.sqlWhere.append("'"); + where.sqlWhere.append(list[i]); + where.sqlWhere.append("'"); + if (i != list.length - 1) { + where.sqlWhere.append(" , "); + } + } + where.sqlWhere.append(" ) "); + return where; + } + + public Where noIn(List list) { + where.sqlWhere.append(" not in ( "); + for (int i = 0; i < list.size(); i++) { + where.sqlWhere.append("'"); + where.sqlWhere.append(list.get(i)); + where.sqlWhere.append("'"); + if (i != list.size() - 1) { + where.sqlWhere.append(" , "); + } + } + where.sqlWhere.append(" ) "); + return where; + } + public Where noIn(Object ...list) { + where.sqlWhere.append(" not in ( "); + for (int i = 0; i < list.length; i++) { + where.sqlWhere.append("'"); + where.sqlWhere.append(list[i]); + where.sqlWhere.append("'"); + if (i != list.length - 1) { + where.sqlWhere.append(" , "); + } + } + where.sqlWhere.append(" ) "); + return where; + } + + public Where equalSql(Object value) { + where.sqlWhere.append(" in ( "); + where.sqlWhere.append(value); + where.sqlWhere.append(" ) "); + return where; + } + + public Where noEqualSql(Object value) { + where.sqlWhere.append(" not in ( "); + where.sqlWhere.append(value); + where.sqlWhere.append(" ) "); + return where; + } + + public Where like(Object value) { + where.sqlWhere.append(" like "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value); + where.sqlWhere.append("'"); + return where; + } + + public Where greaterOrEqual(Object value) { + where.sqlWhere.append(" >= "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value); + where.sqlWhere.append("'"); + return where; + } + + public Where lessOrEqual(Object value) { + where.sqlWhere.append(" <= "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value); + where.sqlWhere.append("'"); + return where; + } + + public Where BetweenAnd(Object value1, Object value2) { + where.sqlWhere.append(" between "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value1); + where.sqlWhere.append("'"); + where.sqlWhere.append(" and "); + where.sqlWhere.append("'"); + where.sqlWhere.append(value2); + where.sqlWhere.append("'"); + return where; + } + + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/SqlResult.java b/weaver/aiyh_pcn/workflow_to_customer/utils/SqlResult.java new file mode 100644 index 0000000..18817aa --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/SqlResult.java @@ -0,0 +1,50 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import java.util.List; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/12 0012 16:57 + * sql参数和语句 + */ + + +public class SqlResult { + private String sqlStr; + private Object[] args; + private List batchList; + + public SqlResult(String sqlStr, Object[] args) { + this.sqlStr = sqlStr; + this.args = args; + } + + public SqlResult(String sqlStr, List batchList) { + this.sqlStr = sqlStr; + this.batchList = batchList; + } + + public String getSqlStr() { + return sqlStr; + } + + public void setSqlStr(String sqlStr) { + this.sqlStr = sqlStr; + } + + public Object[] getArgs() { + return args; + } + + public void setArgs(Object[] args) { + this.args = args; + } + + public List getBatchList() { + return batchList; + } + + public void setBatchList(List batchList) { + this.batchList = batchList; + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/UtilMap.java b/weaver/aiyh_pcn/workflow_to_customer/utils/UtilMap.java new file mode 100644 index 0000000..bb93468 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/UtilMap.java @@ -0,0 +1,42 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/19 0019 19:45 + * utilMap + */ + + +public class UtilMap extends HashMap implements Map { + public UtilMap(){ + super(); + } + public UtilMap uPut(K key, V value) { + this.put(key,value); + return this; + } + + + public UtilMap uPutAll(Map m) { + super.putAll(m); + return this; + } + + public UtilMap uReplace(K key, V value) { + super.replace(key, value); + return this; + } + + public UtilMap filter(UtilMapFilter predicate){ + UtilMap newMap = new UtilMap<>(); + for (Map.Entry entry : this.entrySet()){ + if(predicate.test(entry.getKey(), entry.getValue())){ + newMap.put(entry.getKey(),entry.getValue()); + } + } + return newMap; + } +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/UtilMapFilter.java b/weaver/aiyh_pcn/workflow_to_customer/utils/UtilMapFilter.java new file mode 100644 index 0000000..20fc985 --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/UtilMapFilter.java @@ -0,0 +1,11 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +/** + * @author @author EBU7-dev1-ay + * @create 2021/8/19 0019 21:18 + * utilMapFilter + */ + +public interface UtilMapFilter { + boolean test(K k,V v); +} diff --git a/weaver/aiyh_pcn/workflow_to_customer/utils/Utils.java b/weaver/aiyh_pcn/workflow_to_customer/utils/Utils.java new file mode 100644 index 0000000..ab2b9cc --- /dev/null +++ b/weaver/aiyh_pcn/workflow_to_customer/utils/Utils.java @@ -0,0 +1,44 @@ +package weaver.aiyh_pcn.workflow_to_customer.utils; + +import com.ibm.icu.text.SimpleDateFormat; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * @author EBU7-dev1-ayh + * @create 2021/8/10 0010 10:42 + * dao class + */ + + +public class Utils { + public static String getTime(String format) { + Date date = new Date(); + SimpleDateFormat formatter = new SimpleDateFormat(format); + return formatter.format(date); + } + + public static boolean conformSql(Map>> configInfoMap,String key){ + return configInfoMap.containsKey(key) && !Objects.isNull(configInfoMap.get(key)); + } + + public static UtilMap createMap(){ + return new UtilMap<>(); + } + + public static String removeSeparator(StringBuilder sqlBuilder){ + String str = sqlBuilder.toString().trim(); + String removeSeparator = ","; + if(str.endsWith(removeSeparator)){ +// 如果以分割号结尾,则去除分割号 + str = str.substring(0,str.length() - 1); + } + if(str.trim().startsWith(removeSeparator)){ + str = str.substring(1); + } + return str; + } +} diff --git a/weaver/aiyh_quanshi/QsAPI.java b/weaver/aiyh_quanshi/QsAPI.java new file mode 100644 index 0000000..28ff64d --- /dev/null +++ b/weaver/aiyh_quanshi/QsAPI.java @@ -0,0 +1,373 @@ +package weaver.aiyh_quanshi; + +import aiyh.utils.zwl.common.ToolUtil; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.protocol.HTTP; +import org.apache.http.util.EntityUtils; +import weaver.aiyh_quanshi.entity.QsConfParty; +import weaver.aiyh_quanshi.entity.QsConfSetting; +import weaver.aiyh_quanshi.entity.QsResponse; + +import javax.net.ssl.KeyManagerFactory; +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.TrustManagerFactory; +import java.io.FileInputStream; +import java.security.KeyStore; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class QsAPI { + + private static boolean initialized = false; + private static final ToolUtil logger = new ToolUtil(); + + private static final String KEY_STORE_TYPE_JKS = "jks"; + private static final String KEY_STORE_TYPE_P12 = "PKCS12"; + private static final String SCHEME_HTTPS = "https"; + private static final int HTTPS_PORT = 443; + + private static final String KEY_STORE_PASSWORD = "111111"; + private static final String KEY_STORE_TRUST_PASSWORD = "111111"; + + static SSLContext sslContext = null; + static HttpClient httpClient = new DefaultHttpClient(); + + private static Integer appId = 6; + private static String productId = ""; + private static String siteUrl = ""; + + /** + * 初始化 + */ + public static void init(String _appId, String _siteUrl, String _p12Path, String _trustPath) { +// logger.writeErrorLog("Init is beginning!"); + try { + appId = Integer.parseInt(_appId); + siteUrl = _siteUrl; + if (appId == 2) { + productId = "20000"; + } else if (appId == 5) { + productId = "50000"; + } else if (appId == 3) { + productId = "30000"; + } else if (appId == 4) { + productId = "40000"; + } else if (appId == 6) { + productId = "60000"; + } + + System.setProperty("javax.net.ssl.keyStore", _p12Path); + System.setProperty("javax.net.ssl.keyStorePassword", KEY_STORE_PASSWORD); + System.setProperty("javax.net.ssl.keyStoreType", KEY_STORE_TYPE_P12); + System.setProperty("javax.net.ssl.trustStore", _trustPath); + System.setProperty("javax.net.ssl.trustStorePassword", KEY_STORE_TRUST_PASSWORD); + System.setProperty("javax.net.ssl.trustStoreType", KEY_STORE_TYPE_JKS); + + KeyStore kstore = KeyStore.getInstance(KEY_STORE_TYPE_P12); + kstore.load(new FileInputStream(_p12Path), KEY_STORE_PASSWORD.toCharArray()); + //sunx509, IbmX509 + KeyManagerFactory keyFactory = KeyManagerFactory.getInstance("sunx509"); + keyFactory.init(kstore, KEY_STORE_PASSWORD.toCharArray()); + KeyStore tstore = KeyStore.getInstance(KEY_STORE_TYPE_JKS); + tstore.load(new FileInputStream(_trustPath), KEY_STORE_TRUST_PASSWORD.toCharArray()); + + TrustManager[] tm; + // sunx509 + TrustManagerFactory tmf = TrustManagerFactory.getInstance("sunx509"); + tmf.init(tstore); + tm = tmf.getTrustManagers(); + + sslContext = SSLContext.getInstance("SSL"); + sslContext.init(keyFactory.getKeyManagers(), tm, null); + + initialized = true; +// logger.writeErrorLog("Init is success!"); + } catch (Exception e) { + logger.writeErrorLog(e.getMessage(), e.toString()); + logger.writeErrorLog("Init error:please check cert path is set correctly"); + } + } + + /** + * 创建预约会议 + * + * @param email 创建人邮箱 + * @param confTitle 会议标题 + * @param confLen 会议时长,分钟为单位 + * @param startTime 会议开始时间 + * @param setting 会议设置 + * @param inviteeList 参会人员列表 + * @return + */ + public static QsResponse reservConference(String email, String confTitle, int confLen, String startTime, QsConfSetting setting, List inviteeList) { + String URL = "https://openapi.quanshi.com/conference/conference/reservConference"; + if (!initialized) { + return genError(QsErrorCode.CERT_ERROR); + } else { + Map param = new HashMap(); + param.put("appId", appId); + param.put("title", confTitle); + param.put("length", confLen); + param.put("starttime", startTime); + param.put("from", "OA"); +// param.put("userId", userId); + param.put("email", email); + param.put("inviteeList", inviteeList); + if (setting != null) { + Map settingMap = new HashMap(); + if (setting.isShowInfo() != null) { + settingMap.put("isShowInfo", setting.isShowInfo() ? 1 : 0); + } + if (setting.isAllowUnmute() != null) { + settingMap.put("isAllowUnmute", setting.isAllowUnmute() ? 1 : 0); + } +// settingMap.put("isShowVideo", setting.isShowVideo()!=null&&setting.isShowVideo() ? 1 : 0); 不用了 + if (setting.isOnly() != null) { + settingMap.put("isOnly", setting.isOnly() ? 1 : 0); + } + param.put("seting", settingMap); + if (setting.isSmsNotify() != null) { + param.put("sms_notify", setting.isSmsNotify()); + } + if (setting.isEmailNotify() != null) { + param.put("email_notify", setting.isEmailNotify()); + } + if (setting.getPasscodeType() != null) { + param.put("password_type", setting.getPasscodeType()); + } + if (setting.getAutoRecord() != null) { + param.put("autoRecord", setting.getAutoRecord()); + } + if (setting.getConfLevelMute() != null) { + param.put("confLevelMute", setting.getConfLevelMute()); + } + if (setting.getMustSelectAudio() != null) { + param.put("mustSelectAudio", setting.getMustSelectAudio()); + } + if (setting.getExtend() != null) { + param.put("extend", setting.getExtend()); + } + } + String result = httpPost(URL, QsUtil.jsonOTS(param)); + return parseResult(QsUtil.jsonSTM(result)); + } + } + + + /** + * 取消预约会议(参考接口文档3.3章节) + * + * @param conferenceId 会议ID + * @param email 会议主持人邮件 + * @return 服务器返回的JSON + */ + public static QsResponse cancelConference(String conferenceId, String email, Boolean emailNotify, Boolean smsNotify) { + String URL = "https://openapi.quanshi.com/conference/conference/cancelReservConference"; + if (!initialized) { + return genError(QsErrorCode.CERT_ERROR); + } else { + String url = URL + "/" + appId + "/" + conferenceId + "/zh-CN/" + email; + if (emailNotify != null && smsNotify != null) { + url += "//" + emailNotify + "/" + smsNotify; + } + String result = httpGet(url); + return parseResult(QsUtil.jsonSTM(result)); + } + } + + + /** + * 取消预约会议(参考接口文档3.3章节) + * + * @param conferenceId 会议ID + * @param userId 会议主持人ID + * @return 服务器返回的JSON + */ + public static QsResponse cancelConference(String conferenceId, Integer userId, Boolean emailNotify, Boolean smsNotify) { + String URL = "https://openapi.quanshi.com/conference/conference/cancelReservConference"; + if (!initialized) { + return genError(QsErrorCode.CERT_ERROR); + } else { + String url = URL + "/" + appId + "/" + conferenceId + "/zh-CN/" + userId; + if (emailNotify != null && smsNotify != null) { + url += "//" + emailNotify + "/" + smsNotify; + } + String result = httpGet(url); + return parseResult(QsUtil.jsonSTM(result)); + } + } + + /** + * 通过邮箱查询账号信息 + * @param emails 电子邮箱数组 + * @return 服务器返回的JSON + */ + public static QsResponse getUserIdsByEmails(List emails) { + String URL = "https://openapi.quanshi.com/confopenapi/account/getUsersByEmailsMobiles"; + if (!initialized) { + return genError(QsErrorCode.CERT_ERROR); + } + else { + Map param = new HashMap(); +// param.put("appId", appId); +// param.put("appKey", appKey); + param.put("emails", emails); + String result = httpPost(URL, QsUtil.jsonOTS(param)); + return parseResult(QsUtil.jsonSTM(result)); + } + } + + + /** + * 获取预约会议基本信息(参考接口文档3.5章节) + * + * @param conferenceId 会议ID + * @return 服务器返回的JSON + */ + public static QsResponse getConferenceInfo(String conferenceId) { + String URL = "https://openapi.quanshi.com/conference/conference/getConferenceBaseInfoById/6/"; + if (!initialized) { + return genError(QsErrorCode.CERT_ERROR); + } else { + String result = httpGet(URL + conferenceId); + return parseResult(QsUtil.jsonSTM(result)); + } + } + + /** + * 解析返回值 + * + * @param resultMap + * @return + */ + private static QsResponse parseResult(Map resultMap) { + QsResponse response = new QsResponse(); + if (resultMap != null && resultMap.containsKey("status")) { + String status = String.valueOf(resultMap.get("status")); + response.setStatus(status); + response.setReqid(String.valueOf(resultMap.get("reqid"))); + response.setResult(String.valueOf(resultMap.get("result"))); + } + return response; + } + + /** + * 返回错误码 + * + * @param errorCode 错误代码 + * @return JSON格式错误字符串 + */ + private static QsResponse genError(String errorCode) { + Map errorMap = new HashMap(); + errorMap.put("status", QsErrorCode.CERT_ERROR); + if (errorCode.equals(QsErrorCode.CERT_ERROR)) { + errorMap.put("desc", "please initialized API, check cert path!"); + } + errorMap.put("result", null); + return parseResult(errorMap); + } + + + /** + * Get方式请求 + * + * @param url 请求地址 + * @return 请求Response + */ + public static String httpGet(String url) { + try { + SSLSocketFactory socketFactory = new SSLSocketFactory(sslContext); + Scheme sch = new Scheme(SCHEME_HTTPS, HTTPS_PORT, socketFactory); + httpClient.getConnectionManager().getSchemeRegistry().register(sch); + HttpGet httpGet = new HttpGet(url); + httpGet.addHeader("Content-Type", "application/json"); + httpGet.addHeader("charset", HTTP.UTF_8); + +// logger.writeErrorLog("executing request " + httpGet.getRequestLine()); + + HttpResponse response = httpClient.execute(httpGet); + + HttpEntity entity = response.getEntity(); + if (entity != null) { + String result = EntityUtils.toString(entity, "utf-8"); +// System.out.println(result); +// logger.writeErrorLog("Response content length: " + result; +// logger.writeErrorLog("Response content: " + result); +/* BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(entity.getContent())); + String text; + StringBuffer buf = new StringBuffer(); + while ((text = bufferedReader.readLine()) != null) { + buf.append(text); + } + bufferedReader.close();*/ + return result; + } + EntityUtils.consume(entity); + } catch (Exception e) { + logger.writeErrorLog(e.getMessage(), e.toString()); + } + return "{}"; + } + + /** + * Post方式请求 + * + * @param url 请求地址 + * @param jsonParam 请求参数 + * @return 请求Response + */ + public static String httpPost(String url, String jsonParam) { + try { + httpClient = new DefaultHttpClient(); + SSLSocketFactory socketFactory = new SSLSocketFactory(sslContext); + Scheme sch = new Scheme(SCHEME_HTTPS, HTTPS_PORT, socketFactory); + httpClient.getConnectionManager().getSchemeRegistry().register(sch); + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("Content-Type", "application/json; charset=utf-8"); + httpPost.setHeader("Accept", "application/json"); + httpPost.addHeader("charset", HTTP.UTF_8); + httpPost.setEntity(new StringEntity(jsonParam.toString(), HTTP.UTF_8)); + +// logger.writeErrorLog("executing request " + httpPost.getRequestLine()); +// logger.writeErrorLog("executing params " + jsonParam.toString()); + HttpResponse response = httpClient.execute(httpPost); + HttpEntity entity = response.getEntity(); + if (entity != null) { +// EntityUtils.consume(entity); + String result = EntityUtils.toString(entity, "utf-8"); +// logger.writeErrorLog("Response content is : " + result); +// BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(entity.getContent())); +// String text; +// StringBuffer buf = new StringBuffer(); +// while ((text = bufferedReader.readLine()) != null ) { +// buf.append(text); +// } +// bufferedReader.close(); +// return buf.toString(); + return result; + } + } catch (Exception e) { + e.printStackTrace(); + logger.writeErrorLog(e.getMessage(), e.toString()); + } + return ""; + } + + static class QsErrorCode { + /** + * 客户端证书未配置 + **/ + public static final String CERT_ERROR = "50100"; + + } +} diff --git a/weaver/aiyh_quanshi/QsUtil.java b/weaver/aiyh_quanshi/QsUtil.java new file mode 100644 index 0000000..1143f23 --- /dev/null +++ b/weaver/aiyh_quanshi/QsUtil.java @@ -0,0 +1,103 @@ +package weaver.aiyh_quanshi; + +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import net.sf.json.JsonConfig; +import net.sf.json.util.JSONUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Map; + +public class QsUtil { + static JsonConfig jsonConfig = new JsonConfig(); + //设置默认忽略 + static { + jsonConfig.setIgnoreDefaultExcludes(false); + } + + /** + * @brief 将JSON字符串解析成Map类型 + * @param[in] json 需要解析的JSON字符串 + * @return Map 解析后的Map类型数据 + */ + @SuppressWarnings("unchecked") + public static Map jsonSTM(String json) { + return (Map) JSONObject.fromObject(json, jsonConfig); + } + + /** + * @brief 转换JSON字符串成JSONObject + * @param[in] json JSON字符串 + * @return JSONObject + */ + public static JSONObject jsonSTO(String json){ + return JSONObject.fromObject(json, jsonConfig); + } + + /** + * @brief 取得JSON字符串中key对应的JSONArray + * @param[in] json JSON字符串 + * @param[in] key JSONArray字符串对应的key + * @return key对应的JSONArray + */ + public static JSONArray jsonGetArray(String json, String key) throws Exception{ + return jsonSTO(json).getJSONArray(key); + } + + /** + * @brief 将Map类型数据转换成JSON字符串 + * @param[in] map 要封装成JSON字符串的Map类型数据 + * @return String 组装后的JSON串 + */ + public static String jsonMTS(Map map) { + return JSONObject.fromObject(map, jsonConfig).toString(); + } + + /** + * @brief 将Object类型数据转换成JSON字符串 + * @param object 要封装成JSON的Object类型数据对象 + * @return String 组装后的JSON串 + */ + public static String jsonOTS(Object object) { + if (JSONUtils.isArray(object)) { + return JSONArray.fromObject(object, jsonConfig).toString(); + } + return JSONObject.fromObject(object, jsonConfig).toString(); + } + + /** + * @brief 将Object类型数据组装成Map类型数据 + * @details + * -# 首先调用jsonOTS转换对象成JSON String类型 + * -# 再调用jsonSTM转成JSON String类型为Map + * + * @param[in] object 要封装成Map类型数据的对象 + * @return Map 解析后的JSON数据 + */ + @SuppressWarnings("unchecked") + public static Map jsonOTM(Object object) { + return (Map)JSONObject.fromObject(object, jsonConfig); + } + + /** + * 判断字符串是否为JSON格式 + */ + public static boolean mayBeJSON(String jsonStr) { + return JSONUtils.mayBeJSON(jsonStr); + } + + public static String getStringFromDate(Date date) { + if (date == null) return null; + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return sdf.format(date); + } + public static Date addTimes(Date date, Long times) { + if (null == date || null == times) + return null; + + long resultTime = date.getTime() + times; + Date resultDate = new Date(resultTime); + return resultDate; + } +} \ No newline at end of file diff --git a/weaver/aiyh_quanshi/RequestApi.java b/weaver/aiyh_quanshi/RequestApi.java new file mode 100644 index 0000000..4c4dc24 --- /dev/null +++ b/weaver/aiyh_quanshi/RequestApi.java @@ -0,0 +1,51 @@ +package weaver.aiyh_quanshi; + +import weaver.aiyh_quanshi.entity.QsAccount; +import weaver.aiyh_quanshi.entity.QsConfParty; +import weaver.aiyh_quanshi.entity.QsResponse; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/16 0016 16:04 + * qinqiujiekou + */ + + +public class RequestApi { + public RequestApi(){ + String keyPath = Objects.requireNonNull(this.getClass().getResource("")).getPath(); + QsAPI.init("6", "configtest.quanshi.com" + , keyPath + "key_store" + File.separator + "mg.client.p12" + , keyPath + "key_store" + File.separator + "server.truststore"); + } + + /** + * 创建预约会议 + * @param email 创建人邮箱 + * @param title 会议标题 + * @param length 会议时长,分钟为单位 + * @param startTime 会议开始时间 + * @param list 参会人员列表 + * @return + */ + public QsResponse createMeting(String email, String title, int length, String startTime, List list){ + return QsAPI.reservConference(email,title,length,startTime, null, list); + } + + public QsResponse cancelConference(String conferenceId, String email){ + return QsAPI.cancelConference(conferenceId,email, false,false); + } + + public QsResponse getQuanShiInfo(String conferenceId){ + return QsAPI.getConferenceInfo(conferenceId); + } + + public QsResponse getInfoByEmail(List list){ + return QsAPI.getUserIdsByEmails(list); + } +} diff --git a/weaver/aiyh_quanshi/entity/QsAccount.java b/weaver/aiyh_quanshi/entity/QsAccount.java new file mode 100644 index 0000000..da87b4d --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsAccount.java @@ -0,0 +1,195 @@ +package weaver.aiyh_quanshi.entity; + +public class QsAccount { + private String accountType; + private String userId = ""; + private String userName = ""; + private String userEmail = ""; + private String userTel = ""; + private String userPassword = ""; + private String userMobile = ""; + private String userCompany = ""; + private String collectInfoId = ""; + private String billInfoId = ""; + private Integer confScale ; + private String hostUserId = ""; + private String callbackUrl =""; + + public Integer getConfScale() { + return confScale; + } + + public void setConfScale(Integer confScale) { + this.confScale = confScale; + } + + /** + * @return the accountType + */ + public String getAccountType() { + return accountType; + } + + /** + * @param accountType the accountType to set + */ + public void setAccountType(String accountType) { + this.accountType = accountType; + } + + + /** + * @return the userId + */ + public String getUserId() { + return userId; + } + + /** + * @param userId the userId to set + */ + public void setUserId(String userId) { + this.userId = userId; + } + + /** + * @return the userName + */ + public String getUserName() { + return userName; + } + + /** + * @param userName + * the userName to set + */ + public void setUserName(String userName) { + this.userName = userName; + } + + /** + * @return the userEmail + */ + public String getUserEmail() { + return userEmail; + } + + /** + * @param userEmail + * the userEmail to set + */ + public void setUserEmail(String userEmail) { + this.userEmail = userEmail; + } + + /** + * @return the userTel + */ + public String getUserTel() { + return userTel; + } + + /** + * @param userTel + * the userTel to set + */ + public void setUserTel(String userTel) { + this.userTel = userTel; + } + + /** + * @return the userPassword + */ + public String getUserPassword() { + return userPassword; + } + + /** + * @param userPassword + * the userPassword to set + */ + public void setUserPassword(String userPassword) { + this.userPassword = userPassword; + } + + /** + * @return the userMobile + */ + public String getUserMobile() { + return userMobile; + } + + /** + * @param userMobile + * the userMobile to set + */ + public void setUserMobile(String userMobile) { + this.userMobile = userMobile; + } + + /** + * @return the userCompany + */ + public String getUserCompany() { + return userCompany; + } + + /** + * @param userCompany the userCompany to set + */ + public void setUserCompany(String userCompany) { + this.userCompany = userCompany; + } + + /** + * @return the collectInfoId + */ + public String getCollectInfoId() { + return collectInfoId; + } + + /** + * @param collectInfoId the collectInfoId to set + */ + public void setCollectInfoId(String collectInfoId) { + this.collectInfoId = collectInfoId; + } + + /** + * @return the billInfoId + */ + public String getBillInfoId() { + return billInfoId; + } + + /** + * @param billInfoId the billInfoId to set + */ + public void setBillInfoId(String billInfoId) { + this.billInfoId = billInfoId; + } + + + /** + * @return the hostUserId + */ + public String getHostUserId() { + return hostUserId; + } + + /** + * @param hostUserId the hostUserId to set + */ + public void setHostUserId(String hostUserId) { + this.hostUserId = hostUserId; + } + + public String getCallbackUrl() { + return callbackUrl; + } + + public void setCallbackUrl(String callbackUrl) { + this.callbackUrl = callbackUrl; + } + +} diff --git a/weaver/aiyh_quanshi/entity/QsConfParty.java b/weaver/aiyh_quanshi/entity/QsConfParty.java new file mode 100644 index 0000000..370de64 --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsConfParty.java @@ -0,0 +1,86 @@ +package weaver.aiyh_quanshi.entity; + +public class QsConfParty { + private String name; + private String mobile; + private String email; + private Long userId; +/* + private String extName; + private Integer extType; //扩展名类型 1,微信号,2,QQ 号 +*/ + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + +/* + public String getExtName() { + return extName; + } +*/ + +/* + public void setExtName(String extName) { + this.extName = extName; + } + + public Integer getExtType() { + return extType; + } + + public void setExtType(Integer extType) { + this.extType = extType; + } +*/ + + /** + * @return the name + */ + public String getName() { + return name; + } + + /** + * @param name + * the name to set + */ + public void setName(String name) { + this.name = name; + } + + /** + * @return the mobile + */ + public String getMobile() { + return mobile; + } + + /** + * @param mobile + * the mobile to set + */ + public void setMobile(String mobile) { + this.mobile = mobile; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email + * the email to set + */ + public void setEmail(String email) { + this.email = email; + } + +} diff --git a/weaver/aiyh_quanshi/entity/QsConfSetting.java b/weaver/aiyh_quanshi/entity/QsConfSetting.java new file mode 100644 index 0000000..7fb47d7 --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsConfSetting.java @@ -0,0 +1,169 @@ +package weaver.aiyh_quanshi.entity; + +public class QsConfSetting { + + private Boolean showInfo; + private Boolean showVideo; + private Boolean allowUnmute; + private Boolean only; + private Boolean emailNotify; + private Boolean smsNotify; + //0:不自动录音,1:自动录音,默认 0 + private Integer autoRecord; + private Integer passcodeType; + //1:会议级别允许参会人解除静音 2:会议级别不允许参会人自我解除静音 值默认为 0 + private Integer confLevelMute; + //0: 用户可以关闭音频选择框 (默认值)1: 用户不能关闭音频选择框(如果 api 传入这个值,这个用户即使有其他端已经入会并连入音频,还是会让他选择音频) + private Integer mustSelectAudio; + //会议级别视频清晰度 1:标清,2:高清,4:超 清 选填,默认 0 表示未设置 + private Integer confLevelVideoStandard; + //参会人邮箱后缀扩展字段,支持当参会人为非邮箱格式时,拼接此扩展字段设定有效邮箱。 例如:参会人中某一数据为“zhangsan”,该扩展字段为 + //“quanshi.com”或者“@quanshi.com”,则拼接后的实际参会人邮箱为“zhangsan@quanshi.com” + private String extend; + + public String getExtend() { + return extend; + } + + public void setExtend(String extend) { + this.extend = extend; + } + + public Integer getAutoRecord() { + return autoRecord; + } + + public void setAutoRecord(Integer autoRecord) { + this.autoRecord = autoRecord; + } + + public Integer getConfLevelMute() { + return confLevelMute; + } + + public void setConfLevelMute(Integer confLevelMute) { + this.confLevelMute = confLevelMute; + } + + public Integer getMustSelectAudio() { + return mustSelectAudio; + } + + public void setMustSelectAudio(Integer mustSelectAudio) { + this.mustSelectAudio = mustSelectAudio; + } + + public Integer getConfLevelVideoStandard() { + return confLevelVideoStandard; + } + + public void setConfLevelVideoStandard(Integer confLevelVideoStandard) { + this.confLevelVideoStandard = confLevelVideoStandard; + } + + /** + * @return the showInfo + */ + public Boolean isShowInfo() { + return showInfo; + } + + /** + * @param showInfo + * the showInfo to set + */ + public void setShowInfo(Boolean showInfo) { + this.showInfo = showInfo; + } + + /** + * @return the showVideo + */ + public Boolean isShowVideo() { + return showVideo; + } + + /** + * @param showVideo + * the showVideo to set + */ + public void setShowVideo(Boolean showVideo) { + this.showVideo = showVideo; + } + + /** + * @return the allowUnmute + */ + public Boolean isAllowUnmute() { + return allowUnmute; + } + + /** + * @param allowUnmute + * the allowUnmute to set + */ + public void setAllowUnmute(Boolean allowUnmute) { + this.allowUnmute = allowUnmute; + } + + /** + * @return the only + */ + public Boolean isOnly() { + return only; + } + + /** + * @param only + * the only to set + */ + public void setOnly(Boolean only) { + this.only = only; + } + + /** + * @return the emailNotify + */ + public Boolean isEmailNotify() { + return emailNotify; + } + + /** + * @param emailNotify + * the emailNotify to set + */ + public void setEmailNotify(Boolean emailNotify) { + this.emailNotify = emailNotify; + } + + /** + * @return the smsNotify + */ + public Boolean isSmsNotify() { + return smsNotify; + } + + /** + * @param smsNotify + * the smsNotify to set + */ + public void setSmsNotify(Boolean smsNotify) { + this.smsNotify = smsNotify; + } + + /** + * @return the passcodeType + */ + public Integer getPasscodeType() { + return passcodeType; + } + + /** + * @param passcodeType + * the passcodeType to set + */ + public void setPasscodeType(Integer passcodeType) { + this.passcodeType = passcodeType; + } + +} diff --git a/weaver/aiyh_quanshi/entity/QsConfig.java b/weaver/aiyh_quanshi/entity/QsConfig.java new file mode 100644 index 0000000..ede2c0c --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsConfig.java @@ -0,0 +1,148 @@ +package weaver.aiyh_quanshi.entity; + +public class QsConfig { + private Integer isFreeJoin;//参会人提前入会设置 0:主持人入会后方可入会;1:不限(默认) + private Integer allowMobile;//允许手机入会 0:禁止参会人手机端入会,1:允许参会人手机端入会(默认) + private Integer videoConferenceMode;//视频入会,0:入会不自动开视频(默认),1:入会自动开视频 + private Integer videoControl;//视频权限 1:会中由主持人控制,2:参会人会中可自由开关(默认) + private Integer videoStandardSet;//视频清晰度 1:标清(默认),2:高清,4:超清 + private Integer relieveMute;//解除静音 0:仅主持人才能解除(默认),1:允许参会人自己解除 + private Integer enableDoc;//共享文档 0:不允许共享文档(默认), 1:仅主持人共享文档,2:所有人都可以共享文档 + private Integer enableWhiteboard;//共享白板 0:不允许共享白板(默认), 1:仅主持人共享白板,2:所有人都可以共享白板 + private Integer shareNotes;//共享批注 0:不允许参会人批注 1:允许自由批注(默认) + private Integer sharePageTurn;//共享翻页 0:不允许参会人翻页 1:允许自由翻页(默认) + private Integer watermark;//查看共享桌面 0:不加水印(默认) 1:加水印 + private Integer saveShare;//保存共享 0:不允许保存共享 1:允许保存共享(默 认) + private Integer autoRecord;//录制 0:手动开启录制(默认) 1:入会自动开启录制 + private Integer showWholeAttendList;//参会列表 0:对参会人隐藏参会列表 1:显示完整参会列表(默认) + private Integer isFreeChat;//会中聊天 0:仅与主持人聊天,1:允许自由聊天(默认) + private Integer muteSoundMsg;//提示语音 0:关闭语音提示, 1:开启语音提示(默 认) + + public Integer getIsFreeJoin() { + return isFreeJoin; + } + + public void setIsFreeJoin(Integer isFreeJoin) { + this.isFreeJoin = isFreeJoin; + } + + public Integer getAllowMobile() { + return allowMobile; + } + + public void setAllowMobile(Integer allowMobile) { + this.allowMobile = allowMobile; + } + + public Integer getVideoConferenceMode() { + return videoConferenceMode; + } + + public void setVideoConferenceMode(Integer videoConferenceMode) { + this.videoConferenceMode = videoConferenceMode; + } + + public Integer getVideoControl() { + return videoControl; + } + + public void setVideoControl(Integer videoControl) { + this.videoControl = videoControl; + } + + public Integer getVideoStandardSet() { + return videoStandardSet; + } + + public void setVideoStandardSet(Integer videoStandardSet) { + this.videoStandardSet = videoStandardSet; + } + + public Integer getRelieveMute() { + return relieveMute; + } + + public void setRelieveMute(Integer relieveMute) { + this.relieveMute = relieveMute; + } + + public Integer getEnableDoc() { + return enableDoc; + } + + public void setEnableDoc(Integer enableDoc) { + this.enableDoc = enableDoc; + } + + public Integer getEnableWhiteboard() { + return enableWhiteboard; + } + + public void setEnableWhiteboard(Integer enableWhiteboard) { + this.enableWhiteboard = enableWhiteboard; + } + + public Integer getShareNotes() { + return shareNotes; + } + + public void setShareNotes(Integer shareNotes) { + this.shareNotes = shareNotes; + } + + public Integer getSharePageTurn() { + return sharePageTurn; + } + + public void setSharePageTurn(Integer sharePageTurn) { + this.sharePageTurn = sharePageTurn; + } + + public Integer getWatermark() { + return watermark; + } + + public void setWatermark(Integer watermark) { + this.watermark = watermark; + } + + public Integer getSaveShare() { + return saveShare; + } + + public void setSaveShare(Integer saveShare) { + this.saveShare = saveShare; + } + + public Integer getAutoRecord() { + return autoRecord; + } + + public void setAutoRecord(Integer autoRecord) { + this.autoRecord = autoRecord; + } + + public Integer getShowWholeAttendList() { + return showWholeAttendList; + } + + public void setShowWholeAttendList(Integer showWholeAttendList) { + this.showWholeAttendList = showWholeAttendList; + } + + public Integer getIsFreeChat() { + return isFreeChat; + } + + public void setIsFreeChat(Integer isFreeChat) { + this.isFreeChat = isFreeChat; + } + + public Integer getMuteSoundMsg() { + return muteSoundMsg; + } + + public void setMuteSoundMsg(Integer muteSoundMsg) { + this.muteSoundMsg = muteSoundMsg; + } +} diff --git a/weaver/aiyh_quanshi/entity/QsConsts.java b/weaver/aiyh_quanshi/entity/QsConsts.java new file mode 100644 index 0000000..1b63469 --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsConsts.java @@ -0,0 +1,12 @@ +package weaver.aiyh_quanshi.entity; + +public class QsConsts { + /** (MAX)用户类型-账号 **/ + public static final String ACCOUNT_TYPE_ACCOUNT = "1"; + /** (MAX)用户类型-用户 **/ + public static final String ACCOUNT_TYPE_USER = "2"; + /** (MAX)产品版本-标准版**/ + public static final String VERSIONMODE_STANDARD = "0"; + /** (MAX)产品版本-简约版**/ + public static final String VERSIONMODE_SIMPLE = "1"; +} diff --git a/weaver/aiyh_quanshi/entity/QsDialoutParty.java b/weaver/aiyh_quanshi/entity/QsDialoutParty.java new file mode 100644 index 0000000..df580da --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsDialoutParty.java @@ -0,0 +1,20 @@ +package weaver.aiyh_quanshi.entity; + +public class QsDialoutParty { + private String phone; + private String role; + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + public String getRole() { + return role; + } + public void setRole(String role) { + this.role = role; + } + + +} diff --git a/weaver/aiyh_quanshi/entity/QsResponse.java b/weaver/aiyh_quanshi/entity/QsResponse.java new file mode 100644 index 0000000..0d06e1e --- /dev/null +++ b/weaver/aiyh_quanshi/entity/QsResponse.java @@ -0,0 +1,68 @@ +package weaver.aiyh_quanshi.entity; + +public class QsResponse { + + private String status; + private String result; + private String reqid; + private String msg; + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getReqid() { + return reqid; + } + + public void setReqid(String reqid) { + this.reqid = reqid; + } + + public boolean isSuccess() { + return status != null && status.equals("0"); + } + + /** + * @return the status + */ + public String getStatus() { + return status; + } + + /** + * @param status + * the status to set + */ + public void setStatus(String status) { + this.status = status; + } + + /** + * @return the result + */ + public String getResult() { + return result; + } + + /** + * @param result + * the result to set + */ + public void setResult(String result) { + this.result = result; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return "QsResponse [status=" + status + ", result=" + result + ", reqid=" + reqid +"]"; + } + +} diff --git a/weaver/aiyh_quanshi/key_store/mg.client.p12 b/weaver/aiyh_quanshi/key_store/mg.client.p12 new file mode 100644 index 0000000..ed9870a Binary files /dev/null and b/weaver/aiyh_quanshi/key_store/mg.client.p12 differ diff --git a/weaver/aiyh_quanshi/key_store/mg.client_cert.pem b/weaver/aiyh_quanshi/key_store/mg.client_cert.pem new file mode 100644 index 0000000..c0d2d2c --- /dev/null +++ b/weaver/aiyh_quanshi/key_store/mg.client_cert.pem @@ -0,0 +1,83 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 71 (0x47) + Signature Algorithm: sha256WithRSAEncryption + Issuer: C=CN, ST=BJ, L=BJ, O=quanshi, OU=quanshi, CN=openapi.quanshi.com/emailAddress=openapi@quanshi.com + Validity + Not Before: Sep 6 08:32:15 2021 GMT + Not After : Sep 1 08:32:15 2041 GMT + Subject: C=CN, ST=BJ, O=015095, OU=015095, CN=openapi-quanshi.mg.com/emailAddress=openapi-quanshi@mg.com + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + RSA Public-Key: (2048 bit) + Modulus: + 00:d8:c5:74:d9:a6:98:27:50:a9:82:5b:27:b3:30: + 6f:f1:e2:17:e2:02:a7:d6:9e:e8:d5:55:ed:67:3a: + 5a:ee:dc:52:12:b9:92:ca:ba:86:f7:9a:68:5d:8f: + de:29:6e:4a:c5:58:a6:3d:75:7b:61:53:13:ab:32: + 8a:da:7a:50:d5:5c:97:29:c2:ee:bc:96:57:0a:c9: + a0:6b:dd:d2:c5:2a:24:d2:68:08:af:4f:6d:da:75: + a8:e7:a9:0d:2c:7e:25:8a:b3:96:72:01:74:30:fc: + 7a:41:50:e1:2a:b1:63:69:61:fb:8f:05:4c:c8:aa: + e2:1f:ac:99:03:10:ac:11:df:a0:dc:65:1c:0f:bd: + de:42:0d:b6:57:14:73:d6:ac:b1:75:1e:26:10:b8: + 0b:b0:a2:e4:98:34:a6:b8:04:4a:11:b0:8d:15:13: + 5e:75:a6:1b:0b:53:95:3a:61:fd:d2:a4:b6:83:0b: + af:7c:90:70:5d:ae:d2:d2:db:09:ec:90:35:d9:f8: + 7b:a3:c6:01:1c:67:17:f3:46:61:dd:35:25:dc:84: + 1a:05:1a:29:f2:2e:bd:7c:92:cb:20:a0:ff:08:4b: + b3:d6:92:ed:8d:09:c5:f8:1a:a1:af:39:b9:a2:89: + 79:82:94:17:de:34:ff:dd:11:34:c2:c9:cd:32:de: + 1c:bf + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:TRUE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + 5A:64:4D:EE:07:58:6D:2B:21:7E:33:03:91:2D:63:AA:2C:18:58:87 + X509v3 Authority Key Identifier: + keyid:8A:72:94:93:B9:A5:84:F8:D8:00:0B:34:E7:23:74:A7:BC:5A:A9:4F + + Signature Algorithm: sha256WithRSAEncryption + c6:f1:0d:bf:4a:bb:e7:e4:51:1f:d8:c0:80:42:3f:6c:f0:cb: + 92:b9:ea:3a:3b:31:3b:29:79:51:4f:10:83:33:1b:27:51:57: + f0:73:7a:59:e4:0d:1e:80:c6:16:3e:c3:88:88:22:24:45:94: + 50:79:c6:59:82:04:13:3c:66:c8:00:0d:bd:76:0b:7f:7a:03: + da:6f:23:5d:6f:bd:41:c9:ba:25:0f:b4:43:78:0e:f9:c4:84: + 08:d1:33:72:49:39:55:c9:09:6f:03:89:fd:11:f7:c0:2f:1f: + 55:c3:7e:4c:33:45:e4:36:bf:c7:cb:1d:4f:36:ee:b6:6b:71: + 78:2d:da:e3:5c:b5:97:e5:2e:9a:f6:17:99:d9:08:6b:f1:9f: + 7b:f6:41:0d:36:19:6b:8d:9d:59:b5:9f:21:75:30:b9:af:2a: + 2c:42:1c:a8:01:c7:ae:90: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z1pLtjQnF+Bqhrzm5ool5gpQX3jT/3RE0 +wsnNMt4cvwIDAQABo34wfDAMBgNVHRMEBTADAQH/MCwGCWCGSAGG+EIBDQQfFh1P +cGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUWmRN7gdYbSsh +fjMDkS1jqiwYWIcwHwYDVR0jBBgwFoAUinKUk7mlhPjYAAs05yN0p7xaqU8wDQYJ +KoZIhvcNAQELBQADggEBAMbxDb9Ku+fkUR/YwIBCP2zwy5K56jo7MTspeVFPEIMz +GydRV/BzelnkDR6AxhY+w4iIIiRFlFB5xlmCBBM8ZsgADb12C396A9pvI11vvUHJ +uiUPtEN4DvnEhAjRM3JJOVXJCW8Dif0R98AvH1XDfkwzReQ2v8fLHU827rZrcXgt +2uNctZflLpr2F5nZCGvxn3v2QQ02GWuNnVm1nyF1MLmvKixCHKgBx66QlQrzm9JY +WgDjZ0GQAZQO/VX8syHI6kFKTtKUTUwYGvnQGR+CEElkHXAnhiQTE/qcItc1lvOx +0XH0bVzxQ/VxtmA4oKVsu+u+0siq+2RaRqUOy1QgjKA= +-----END CERTIFICATE----- diff --git a/weaver/aiyh_quanshi/key_store/mg.client_key.pem b/weaver/aiyh_quanshi/key_store/mg.client_key.pem new file mode 100644 index 0000000..e883645 --- /dev/null +++ b/weaver/aiyh_quanshi/key_store/mg.client_key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA2MV02aaYJ1CpglsnszBv8eIX4gKn1p7o1VXtZzpa7txSErmS +yrqG95poXY/eKW5KxVimPXV7YVMTqzKK2npQ1VyXKcLuvJZXCsmga93SxSok0mgI +r09t2nWo56kNLH4lirOWcgF0MPx6QVDhKrFjaWH7jwVMyKriH6yZAxCsEd+g3GUc +D73eQg22VxRz1qyxdR4mELgLsKLkmDSmuARKEbCNFRNedaYbC1OVOmH90qS2gwuv +fJBwXa7S0tsJ7JA12fh7o8YBHGcX80Zh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cfIkh7ssclRJMHvtPPSft2zQmyd0OYtkUqyRFzOT3OSg3jUPpZC0+d2756u ++x2QhZapAoGAMACaXX7xK4dTYrNFKxBPbnTHkKX6rASBWK6GAWSCOTrOnyS13Ol/ +x2M2Um6jy08iwxXpT7oGM7lkbz+oajdepGla6xRTGF9O78SWcymhssknu82o4n3A +tFzRpPa9uwJ2q7+v38qnIp4Rqcjowc6KdpSOhS7yYrDZZhUVN9DVhYM= +-----END RSA PRIVATE KEY----- diff --git a/weaver/aiyh_quanshi/key_store/server.truststore b/weaver/aiyh_quanshi/key_store/server.truststore new file mode 100644 index 0000000..896e2bb Binary files /dev/null and b/weaver/aiyh_quanshi/key_store/server.truststore differ diff --git a/weaver/alioss/AliOSSObjectManager.java b/weaver/alioss/AliOSSObjectManager.java new file mode 100644 index 0000000..3387f28 --- /dev/null +++ b/weaver/alioss/AliOSSObjectManager.java @@ -0,0 +1,369 @@ +/* +* Created on 2014-11-04 +* Copyright (c) 2001-2014 泛微软件 +* 泛微协同商务系统,版权所有。 +* +*/ + +package weaver.alioss; + +import weaver.alioss.AliOSSObjectUtil; +import weaver.conn.RecordSet; +import weaver.file.AESCoder; +import weaver.file.Prop; +import weaver.general.BaseBean; +import weaver.general.IpUtils; +import weaver.general.Util; + +import javax.servlet.http.HttpServletRequest; +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.zip.ZipInputStream; + +/** + * Description: 阿里云基本类 + * @author 方观生 + * @date 2014-11-04 + */ + +public class AliOSSObjectManager extends BaseBean { + + + /** + * 构造函数 + */ + public AliOSSObjectManager() { + try { + + } catch (Exception ex) { + } + } + + /** + * 上传文件到阿里云 + * @param filerealpath 文件存储路径 + * @param filename 文件名称 + * @param iszip 是否压缩 + * @param isaesencrypt 是否加密 + * @param aescode 加密串 + */ + public void uploadFile(final String filerealpath,final String filename,final String iszip,final String isaesencrypt,final String aescode){ + //判断阿里云工具类能否正常加载 + if(!isexistAliOSSObjectUtil()){ + return ; + } + //判断是否启用了阿里云 + if(!AliOSSObjectUtil.isEnable()){ + return ; + } + + try { + if(isonlyAliOSS()){ + uploadFileThread(filerealpath, filename, iszip, isaesencrypt,aescode); + }else{ + new Thread(new Runnable() { + public void run() { + uploadFileThread(filerealpath, filename, iszip, isaesencrypt,aescode); + } + }).start(); + } + + } catch (Exception ex) { + } + } + /** + * 上传文件到阿里云 线程方法 + * @param filerealpath 文件存储路径 + * @param filename 文件名称 + * @param iszip 是否压缩 + * @param isaesencrypt 是否加密 + * @param aescode 加密串 + */ + private void uploadFileThread(String filerealpath,String filename,String iszip,String isaesencrypt,String aescode){ + + InputStream imagefile = null; + try { + String tokenKey=this.getTokenKeyByFileRealPath(filerealpath); + File thefile = new File(filerealpath) ; + + if(iszip.equals("1")) { + ZipInputStream zin = new ZipInputStream(new FileInputStream(thefile)) ; + if(zin.getNextEntry() != null) + imagefile = new BufferedInputStream(zin); + } else{ + imagefile = new BufferedInputStream(new FileInputStream(thefile)) ; + } + if(isaesencrypt.equals("1")){ + imagefile = AESCoder.decrypt(imagefile, aescode); + } + AliOSSObjectUtil.autoUploadFile(tokenKey, filename,imagefile); + + } catch (Exception ex) { + }finally{ + try{ + if(imagefile!=null){ + imagefile.close() ; + } + }catch(Exception ex){ + } + } + } + /** + * 根据文件存储路径获取存储Key + * @param filerealpath 文件存储路径 + * @return 存储Key + */ + public static String getTokenKeyByFileRealPath(String filerealpath){ + String tokenKey=""; + try { + if(filerealpath==null||filerealpath.trim().equals("")){ + return tokenKey; + } + int i = filerealpath.lastIndexOf("/"); + int j = filerealpath.lastIndexOf("\\"); + int index = i >j?i:j; + if(index<0){ + return tokenKey; + } + int point = 0; + String tempstr = filerealpath.substring(index,filerealpath.length()); + if(tempstr.indexOf(".")!=-1){ + point = index + tempstr.lastIndexOf("."); + }else{ + point = filerealpath.length(); + } + tokenKey = filerealpath.substring(index-8,point)+".wfile"; + tokenKey = tokenKey.replaceAll("\\\\", "/"); + + } catch (Exception ex) { + } + return tokenKey; + } + + /** + * 判断当前用户是否通过云盘查看文档 + * @param req 页面请求信息 + * @return 是否能够通过云盘查看文档 + */ + public static boolean isEnableForDsp(HttpServletRequest req){ + boolean isEnableForDsp=false; + try { + if(!isexistAliOSSObjectUtil()){ + return isEnableForDsp; + } + boolean isEnable=AliOSSObjectUtil.isEnable(); + if(!isEnable){ + return isEnableForDsp; + } + String ip=Util.getIpAddr(req); + boolean checktmp = checkIpInner(ip); + if(isEnable&&(!checktmp)){ + isEnableForDsp=true; + } + + } catch (Exception ex) { + } + return isEnableForDsp; + } + + /** + * 判断该附件能否通过云盘查看 + * @param imageFileId 附件id + * @return 是否能够通过云盘查看文档 + */ + public static boolean isEnableForImageFile(int imageFileId){ + boolean isEnableForImageFile=false; + try { + String tokenKey=""; + String storageStatus=""; + RecordSet rs=new RecordSet(); + rs.executeSql("select TokenKey,StorageStatus from ImageFile where imageFileId="+imageFileId); + if(rs.next()){ + tokenKey=Util.null2String(rs.getString("TokenKey")); + storageStatus=Util.null2String(rs.getString("StorageStatus")); + } + if(!tokenKey.equals("")&&storageStatus.equals("1")){ + isEnableForImageFile=true; + } + } catch (Exception ex) { + } + return isEnableForImageFile; + } + + /** + * 根据附件id获取tokenKey + * @param imageFileId 附件id + * @return tokenKey 注:storageStatus不为1时tokenKey为空 + */ + public static String getTokenKeyByImageFileId(int imageFileId){ + String tokenKey=""; + try { + String storageStatus=""; + RecordSet rs=new RecordSet(); + rs.executeSql("select TokenKey,StorageStatus from ImageFile where imageFileId="+imageFileId); + if(rs.next()){ + tokenKey=Util.null2String(rs.getString("TokenKey")); + storageStatus=Util.null2String(rs.getString("StorageStatus")); + } + if(!storageStatus.equals("1")){ + tokenKey=""; + } + } catch (Exception ex) { + } + return tokenKey; + } + + /** + * 判断网址是否为内网地址 + * @param ipaddress + * @return boolean true :是 false:否 + */ + private static boolean checkIpInner(String ipaddress) { + boolean checktmp = false; + String isInner = Util.null2String(Prop.getPropValue("alioss","isInner")); + if(isInner.equals("false")){ + return checktmp; + } + + ipaddress=Util.null2String(ipaddress); + long ipNum = IpUtils.ip2number(ipaddress); + long a1=IpUtils.ip2number("10.0.0.0"); + long a2=IpUtils.ip2number("10.255.255.255"); + long b1=IpUtils.ip2number("172.16.0.0"); + long b2=IpUtils.ip2number("172.31.255.255"); + long c1=IpUtils.ip2number("192.168.0.0"); + long c2=IpUtils.ip2number("192.168.255.255"); + + if(isInner(ipNum,a1,a2) || isInner(ipNum,b1,b2) || isInner(ipNum,c1,c2) || ipaddress.equals("127.0.0.1")){ + checktmp=true; + } + + return checktmp; + } + + private static boolean isInner(long userIp,long begin,long end){ + return (userIp>=begin) && (userIp<=end); + } + + + /** + * 判断当前用户是否通过Safari浏览器查看文档 + * @param req 页面请求信息 + * @return isEnableForDsp + */ + public static boolean isSafari(HttpServletRequest req){ + boolean isSafari=false; + try { + String userAgent=Util.null2String(req.getHeader("USER-AGENT")); + if(userAgent.indexOf("Safari") > -1 && userAgent.indexOf("Chrome") < 1 && userAgent.indexOf("Edge") < 1){ + isSafari=true; + } + + } catch (Exception ex) { + } + return isSafari; + } + /** + * 判断阿里云工具类能否正常加载 + * @return isexist + */ + public static boolean isexistAliOSSObjectUtil(){ + boolean isexist= true; + try{ + Class.forName("weaver.alioss.AliOSSObjectUtil"); + }catch(ExceptionInInitializerError e){ + isexist = false; //判断云存储是否正常 + }catch(IllegalArgumentException e){ + isexist = false; //判断云存储是否正常 + }catch(NoClassDefFoundError e){ + isexist = false; //判断云存储是否正常 + }catch(Exception e){ + isexist = false; //判断云存储是否正常 + } + return isexist; + } + + /** + * 判断是否将数据流传输到服务器再下载 + * + * @return isexist + */ + public static boolean isAliOSSToServer(String comefrom){ + boolean isAliOSSToServer= false; + if(comefrom==null||comefrom.trim().equals("")){ + return isAliOSSToServer; + } + try{ + //判断阿里云工具类能否正常加载 + if(!isexistAliOSSObjectUtil()){ + return isAliOSSToServer; + } + //判断是否启用了阿里云 + if(!AliOSSObjectUtil.isEnable()){ + return isAliOSSToServer; + } + + //判断是否配置的是阿里云的内网地址 + if(AliOSSObjectUtil.getAliossServerAddress().contains("internal.aliyuncs")){ + isAliOSSToServer = true; + } + + String AliOSSToServerComeFrom = Util.null2String(Prop.getPropValue("alioss","AliOSSToServerComeFrom")); + if(AliOSSToServerComeFrom.trim().equals("")){ + AliOSSToServerComeFrom="WorkflowToDoc"; + } + if((","+AliOSSToServerComeFrom+",").indexOf(","+comefrom+",")>=0){ + isAliOSSToServer=true; + } + + }catch(Exception e){ + isAliOSSToServer = false; //判断云存储是否正常 + } + return isAliOSSToServer; + } + + /** + * 判断是否仅启用阿里云 + * + * @return true: + */ + public static boolean isonlyAliOSS(){ + boolean isonlyAliOSS= false; + + try{ + //判断阿里云工具类能否正常加载 + if(!isexistAliOSSObjectUtil()){ + return isonlyAliOSS; + } + //判断是否启用了阿里云 + if(!AliOSSObjectUtil.isEnable()){ + return isonlyAliOSS; + } + + String onlyAliOSS = Util.null2String(Prop.getPropValue("alioss","onlyAliOSS")); + if(onlyAliOSS.trim().equals("1")){ + isonlyAliOSS=true; + } + }catch(Exception e){ + isonlyAliOSS = false; //判断云存储是否正常 + } + return isonlyAliOSS; + } + + /** + * 是否启用阿里云oss服务 + * @return + */ + public static boolean isEnable(){ + boolean isEnable=false; + //判断阿里云工具类能否正常加载 + if(!isexistAliOSSObjectUtil()){ + return isEnable; + } + isEnable=Prop.getPropValue("alioss","status").equalsIgnoreCase("1"); + return isEnable; + } + +} \ No newline at end of file diff --git a/weaver/aoyh_guijiu/VerifyWorkflow.java b/weaver/aoyh_guijiu/VerifyWorkflow.java new file mode 100644 index 0000000..ff08abd --- /dev/null +++ b/weaver/aoyh_guijiu/VerifyWorkflow.java @@ -0,0 +1,20 @@ +package weaver.aoyh_guijiu; + +import weaver.interfaces.workflow.action.Action; +import weaver.soa.workflow.request.RequestInfo; + +/** + * @author EBU7-dev1-ayh + * @create 2021/9/9 0009 17:40 + * verify action + */ + + +public class VerifyWorkflow implements Action { + + + @Override + public String execute(RequestInfo requestInfo) { + return null; + } +} diff --git a/weaver/docs/docs/DocManager.java b/weaver/docs/docs/DocManager.java new file mode 100644 index 0000000..058a2d8 --- /dev/null +++ b/weaver/docs/docs/DocManager.java @@ -0,0 +1,9998 @@ +package weaver.docs.docs; + +import com.api.doc.detail.service.DocSaveService; +import com.api.doc.detail.util.DocDownloadCheckUtil; +import weaver.conn.RecordSet; +import weaver.conn.RecordSetData; +import weaver.conn.constant.DBConstant; +import weaver.crm.Maint.CustomerInfoComInfo; +import weaver.docs.DocDetailLog; +import weaver.docs.category.DocTreeDocFieldComInfo; +import weaver.docs.category.DocTreeDocFieldManager; +import weaver.docs.category.SecCategoryComInfo; +import weaver.docs.category.SubCategoryComInfo; +import weaver.docs.docs.reply.DocReplyManager; +import weaver.docs.util.DocTriggerUtils; +import weaver.file.FileUpload; +import weaver.file.ImageFileManager; +import weaver.general.*; +import weaver.hrm.User; +import weaver.hrm.appdetach.AppDetachComInfo; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.contract.ContractTypeComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.share.ShareManager; +import weaver.system.SendToAllForNew; +import weaver.system.SysRemindWorkflow; +import weaver.system.ThreadForAllForNew; +import weaver.systeminfo.SysMaintenanceLog; +import weaver.systeminfo.setting.HrmUserSettingComInfo; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.http.HttpSession; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Title: 文档处理基本类 + * Company: weaver + * + * @author zh + * @version 1.0 + */ + + + + +public class DocManager extends BaseBean { + + private static DocIdUpdate docIdUpdate = new DocIdUpdate(); + + private static ImageFileIdUpdate imageFileIdUpdate = new ImageFileIdUpdate(); + + private static VersionIdUpdate versionIdUpdate = new VersionIdUpdate(); + + private ResourceComInfo hrc; + + private CustomerInfoComInfo cici; + + private DepartmentComInfo dci; + + private SecCategoryComInfo scc; + + private SubCategoryComInfo subc; + + + private DocComInfo dc; + + + private RecordSetData rs = new RecordSetData(); + + private RecordSetData tmprs = new RecordSetData(); + + private RecordSetData recorder = new RecordSetData(); + + private RecordSetData record = new RecordSetData(); + + + private DocDetailLog log; + + private DocImageManager imgManger; + + private ContractTypeComInfo ctci = new ContractTypeComInfo(); + + private String action; + + private String clientip; + + private int userid; + + private int languageid; + + private String sql_where; + + private int id; /* 文档id */ + + private int oldVersionId;//文件版本id + + private int maincategory; /* 文档主目录 */ + + private int subcategory; /* 文档分目录 */ + + private int seccategory; /* 文档子目录 */ + + private int doclangurage; /* 文档语言 */ + + private String docapprovable; /* 是否需要审批 0:否 1:是 */ + + private String docreplyable; /* 可否回复 0:否 1:是 */ + + private String isreply; /* 是否回复文档 0:否 1:是 */ + + private int replydocid; /* 回复文件id */ + + private String docsubject; /* 文档主题 */ + + private String doccontent; /* 文档内容 HTML格式 */ + + private String docpublishtype; + + /* + * 文档发布类型 1:正常(不发布) 2:新闻 3:标题新闻 + */ + private String docpublishtypeold; + + private int itemid; /* 文档中选择的物品id */ + + private int itemmaincategoryid; /* 文档中选择的物品种类id */ + + private int hrmresid; /* 文档中选择的人力资源id */ + + private int assetid; // 文档中选择资产id + + private int ownerid; // 创建人id 调整为 文档所有者id + + private int crmid; /* 文档中选择的CRM id */ + + private int projectid; /* 文档中选择的项目id */ + + private int financeid; /* 文档中选择的财务-交易id */ + + private int doccreaterid; /* 文档创建者id */ + + private int docdepartmentid; /* 文档创建者所在部门id */ + + private String doccreatedate; /* 文档创建日期 */ + + private String doccreatetime; /* 文档创建时间 */ + + private int doclastmoduserid; /* 文档最后修改者id */ + + private String doclastmoddate; /* 文档最后修改日期 */ + + private String doclastmodtime; /* 文档最后修改时间 */ + + private int docapproveuserid; /* 文档审批者id */ + + private String docapprovedate; /* 文档审批日期 */ + + private String docapprovetime; /* 文档审批时间 */ + + private int docarchiveuserid; /* 文档归档者id */ + + private String docarchivedate; /* 文档归档日期 */ + + private String docarchivetime; /* 文档归档时间 */ + + private String docstatus; /* 文档状态:0:草稿,1:生效/正常(不需要审批,归档重新打开),2: 生效/正常(审批后,发布后),3:审批,4:退回(草稿),5:归档,6:待发布,7:失效,8:作废 */ + + private String parentids; /* 文档父节点 */ + + private String keyword; /* 文档的关键字 */ + + private int accessorycount; /* 附件总数 */ + + private int replaydoccount; /* 回复文档总数 */ + + private String usertype; /* 创建的用户类型 1: 内部 2: 外部 */ //该字段调整为:当前操作用户的用户类型 1: 内部用户 2: 外部用户 + + private int id2; /* remark表的id */ + + private String approveremark; /* 批复意见 */ + + private String isapprover; /* 是否批谁通过:是-1,否(退回)-0 */ + + private String docno; + + private String topage; // link other module + + private String oldstatus; // check if the pre status is return : "4" + + private int oldownerid; + + private String contractman = ""; // 合同人 + + private String contractstartdate = ""; // 合同开始日期 + + private String contractenddate = ""; // 合同结束日期 + + private String docmodule = ""; // 文档模板 + + private String proenddate = ""; // 试用期结束日期 + + private int typeid = 0; // contract type id + + private String urlfrom = ""; // 用于判断来自以及返回的页面 + + // add by 王金永 + private int docType = 1; + + private int newsid = 0;// 杨国生2003-09-05加用于解决网站传递新闻组的接口 + + private String canCopy = "1"; // 1:表示在查看状态下此文档不能够拷贝; 2:表示在查看状态下此文档可以拷贝 + + private String canRemind = "1"; // 1:表示是否回复提醒; 1:没有回复提醒;2:有回复提醒 + + // add by 董平 + private String userCatalogId = "0"; // 用户目录 + + private String orderable = "0"; // 此目录下的文档是否可订阅 0,不可以 1,可以 + + private String docextendname = ""; // 文档的扩展名 html doc xls ppt wps + + private String opreateType = ""; // 操作者的ID + + // add by wdl + private String docCode = ""; //文档编码 + private int docEdition = -1; //文档版本 + private int docEditionId = -1; //文档版本ID + private int isHistory = 0;//是否历史版本 + private int approveType = 0;//审批类型(1:生效审批,2:失效审批) + + private int mainDoc = -1; //主文档(默认当前文档) + private int readOpterCanPrint = 0; //允许只读操作人打印 0,不允许 1,允许 + private int selectedPubMouldId = 0; //发布时所选的显示模版ID + private int canPrintedNum = 0;//可打印份数 + + private int docValidUserId = 0;//生效操作人 + private String docValidDate = "";//生效日期 + private String docValidTime = "";//生效时间 + + private int docPubUserId = 0;//发布操作人 + private String docPubDate = "";//发布日期 + private String docPubTime = "";//发布时间 + + private int docReOpenUserId = 0;//重新打开操作人 + private String docReOpenDate = "";//重新打开日期 + private String docReOpenTime = "";//重新打开时间 + + private int docInvalUserId = 0;//失效操作人 + private String docInvalDate = "";//失效日期 + private String docInvalTime = "";//失效时间 + + private String dummycata = "";//虚拟目录 + + private int docCancelUserId = 0;//作废操作人 + private String docCancelDate = "";//作废日期 + private String docCancelTime = "";//作废时间 + + private String invalidationDate = "";//失效时间 + + private String checkOutStatus = "0";//签出状态 1:签出,0:未签出 + private int checkOutUserId = 0;//签出用户 + private String checkOutUserType = "";//签出用户类型 1:内部用户,2:外部用户 + private String checkOutDate = "";//签出日期 + private String checkOutTime = "";//签出时间 + + private String hasUsedTemplet = "";//是否已经套红 + + private String docCreaterType; // 文档创建者类型(1:内部用户 2:外部用户) + private String docLastModUserType; // 文档最后修改者类型(1:内部用户 2:外部用户) + private String docApproveUserType; // 文档审批者类型(1:内部用户 2:外部用户) + private String docValidUserType; // 生效操作人类型(1:内部用户 2:外部用户) + private String docInvalUserType; // 失效操作人类型(1:内部用户 2:外部用户) + private String docArchiveUserType; // 文档归档者类型(1:内部用户 2:外部用户) + private String docCancelUserType; // 作废操作人类型(1:内部用户 2:外部用户) + private String docPubUserType; // 发布操作人类型(1:内部用户 2:外部用户) + private String docReopenUserType; // 重新打开操作人类型(1:内部用户 2:外部用户) + private String ownerType; // 文档拥有者类型(1:内部用户 2:外部用户) + private int secretLevel; //文档密级 + private String secretValidity; //文档密级期限 + + private String[] customDataIdMapping; //自定义字段映射关系:"id1_id2" + + private int hrmContractId;//合同id + + private FileUpload fileUpload;//FileUpload对象 + + private ShareManager ShareManager; + + private SysMaintenanceLog SysMaintenanceLog; + + private List imageFileIdOfPicChangeList; + + private int editMouldId=0;//文档编辑模板id + + private int replyremind=0;//回复提醒 + + private int docVestIn; + + private String source; + + private HrmUserSettingComInfo userSetting=null; + + public static final int DEFAILT_SECRET_LEVEL = 4; + + /** + * 构造函数 + */ + public DocManager() { + try { + userSetting=new HrmUserSettingComInfo(); + hrc = new ResourceComInfo(); + dci = new DepartmentComInfo(); + cici = new CustomerInfoComInfo(); + scc = new SecCategoryComInfo(); + subc= new SubCategoryComInfo(); + log = new DocDetailLog(); + imgManger = new DocImageManager(); + ShareManager = new ShareManager(); + SysMaintenanceLog = new SysMaintenanceLog(); + dc = new DocComInfo(); + resetParameter(); + } catch (Exception ex) { + writeLog(ex); + } + } + + /** + * 重置各参数的值 + */ + public void resetParameter() { + imgManger.resetParameter(); + this.action = ""; + clientip = ""; + userid = 0; + languageid = 0; + id = 0; + this.oldVersionId=0; + sql_where = ""; + this.maincategory = 0; + this.subcategory = 0; + this.seccategory = 0; + this.doclangurage = 0; + this.docapprovable = ""; + this.docreplyable = ""; + this.isreply = ""; + this.replydocid = 0; + this.docsubject = ""; + this.doccontent = ""; + this.docpublishtype = ""; + this.docpublishtypeold = ""; + this.itemid = 0; + this.itemmaincategoryid = 0; + this.hrmresid = 0; + this.assetid = 0; + this.ownerid = 0; + this.crmid = 0; + this.projectid = 0; + this.financeid = 0; + this.doccreaterid = 0; + this.docdepartmentid = 0; + this.doccreatedate = ""; + this.doccreatetime = ""; + this.doclastmoduserid = 0; + this.doclastmoddate = ""; + this.doclastmodtime = ""; + this.docapproveuserid = 0; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docarchivedate = ""; + this.docarchivetime = ""; + this.docstatus = ""; + this.parentids = ""; + this.keyword = ""; /* 文档的关键字 */ + this.accessorycount = 0; /* 附件总数 */ + this.replaydoccount = 0; /* 回复文档总数 */ + this.usertype = ""; /* 创建的用户类型 1: 内部 2: 外部 */ //该字段调整为:当前操作用户的用户类型 1: 内部用户 2: 外部用户 + this.opreateType = ""; + + this.id2 = 0; /* remark表的id */ + this.approveremark = ""; /* 批复意见 */ + this.isapprover = ""; /* 是否批谁通过:是-1,否(退回)-0 */ + this.docno = ""; + this.oldstatus = ""; + this.oldownerid = 0; + + this.contractman = ""; + this.contractstartdate = ""; + this.contractenddate = ""; + this.proenddate = ""; + this.typeid = 0; + this.urlfrom = ""; + this.newsid = 0; + this.userCatalogId = "0"; + this.docextendname = "html"; + + + + this.docCode = ""; + this.docEdition = -1; + this.docEditionId = -1; + this.isHistory = 0; + this.mainDoc = -1; + this.readOpterCanPrint = 0; + + this.docValidUserId = 0; + this.docValidDate = ""; + this.docValidTime = ""; + + this.docPubUserId = 0; + this.docPubDate = ""; + this.docPubTime = ""; + + this.docReOpenUserId = 0; + this.docReOpenDate = ""; + this.docReOpenTime = ""; + + this.docInvalUserId = 0; + this.docInvalDate = ""; + this.docInvalTime = ""; + + this.docCancelUserId = 0; + this.docCancelDate = ""; + this.docCancelTime = ""; + + this.invalidationDate = ""; + this.dummycata = ""; + this.canPrintedNum=0; + + this.checkOutStatus = "0"; + this.checkOutUserId = 0; + this.checkOutUserType = ""; + this.checkOutDate = ""; + this.checkOutTime = ""; + + this.hasUsedTemplet="0"; + + this.docCreaterType="1"; + this.docLastModUserType=""; + this.docApproveUserType=""; + this.docValidUserType=""; + this.docInvalUserType=""; + this.docArchiveUserType=""; + this.docCancelUserType=""; + this.docPubUserType=""; + this.docReopenUserType=""; + this.ownerType=""; + + this.hrmContractId=0; + this.fileUpload=null; + + this.imageFileIdOfPicChangeList=null; + this.editMouldId=0; + this.docVestIn = 0; + this.secretLevel = DEFAILT_SECRET_LEVEL; + this.secretValidity = ""; + this.replyremind = 0; + } + + /** + * 设置个人文档目录 + * + * @param userCatalogId 个人文档目录 + */ + public void setUserCatalogId(String userCatalogId) { + this.userCatalogId = userCatalogId; + } + + /** + * 返回个人文档目录 + * + * @return 个人文档目录 + */ + public String getUserCatalogId() { + return this.userCatalogId; + } + + /** + * 设置 sql条件语句 + * + * @param sql sql条件语句 + */ + public void setSql_where(String sql) { + this.sql_where = sql; + } + + /** + * 设置文档id + * + * @param id 文档id + */ + public void setId(int id) { + this.id = id; + } + + /** + * 设置用户语言ID + * + * @param id 用户语言ID + */ + public void setLanguageid(int id) { + this.languageid = id; + } + + /** + * 设置文档主目录 + * + * @param maincategory 文档主目录 + */ + public void setMaincategory(int maincategory) { + this.maincategory = maincategory; + } + + /** + * 设置文档分目录 + * + * @param subcategory 文档分目录 + */ + public void setSubcategory(int subcategory) { + this.subcategory = subcategory; + } + + /** + * 设置文档子目录 + * + * @param seccategory 文档子目录 + */ + public void setSeccategory(int seccategory) { + this.seccategory = seccategory; + } + + /** + * 设置文档语言 + * + * @param doclangurage 文档语言 + */ + public void setDoclangurage(int doclangurage) { + this.doclangurage = doclangurage; + } + + /** + * 设置 是否需要审批 0:否 1:是 + * + * @param docapprovable 是否需要审批 0:否 1:是 + */ + public void setDocapprovable(String docapprovable) { + this.docapprovable = docapprovable; + } + + /** + * 设置可否回复 + * + * @param docreplyable 可否回复 0:否 1:是 + */ + public void setDocreplyable(String docreplyable) { + this.docreplyable = docreplyable; + } + + /** + * 是否回复文档 + * + * @param isreply 是否回复文档 + */ + public void setIsreply(String isreply) { + this.isreply = isreply; + } + + /** + * 回复文件id + * + * @param replydocid 回复文件id + */ + public void setReplydocid(int replydocid) { + this.replydocid = replydocid; + } + + /** + * 设置文档主题 + * + * @param docsubject 文档主题 + */ + public void setDocsubject(String docsubject) { + this.docsubject = docsubject; + } + + /** + * 设置文档内容 + * + * @param doccontent 文档内容 + */ + public void setDoccontent(String doccontent) { + this.doccontent = doccontent; + } + + /** + * 设置文档发布类型 + * + * @param docpublishtype 文档发布类型 1:正常(不发布) 2:新闻 3:标题新闻 + */ + public void setDocpublishtype(String docpublishtype) { + if ("".equals(docpublishtype)) + docpublishtype = "1"; + this.docpublishtype = docpublishtype; + } + + /** + * 设置 文档中选择的物品id + * + * @param itemid 文档中选择的物品id + */ + public void setItemid(int itemid) { + this.itemid = itemid; + } + + /** + * 设置文档中选择的物品种类id + * + * @param itemmaincategoryid 文档中选择的物品种类id + */ + public void setItemmaincategoryid(int itemmaincategoryid) { + this.itemmaincategoryid = itemmaincategoryid; + } + + /** + * 设置文档中选择的人力资源id + * + * @param hrmresid 文档中选择的人力资源id + */ + public void setHrmresid(int hrmresid) { + this.hrmresid = hrmresid; + } + + /** + * 设置文档中选择资产id + * + * @param assetid 文档中选择资产id + */ + public void setAssetid(int assetid) { + this.assetid = assetid; + } + + /** + * 设置 所有者id + * + * @param ownerid 所有者id + */ + public void setOwnerid(int ownerid) { + this.ownerid = ownerid; + } + + /** + * 设置 文档中选择的CRM id + * + * @param crmid 文档中选择的CRM id + */ + public void setCrmid(int crmid) { + this.crmid = crmid; + } + + /** + * 设置文档中选择的项目id + * + * @param projectid 文档中选择的项目id + */ + public void setProjectid(int projectid) { + this.projectid = projectid; + } + + /** + * 设置文档中选择的财务-交易id + * + * @param financeid 文档中选择的财务-交易id + */ + public void setFinanceid(int financeid) { + this.financeid = financeid; + } + + /** + * 设置文档创建者id + * + * @param doccreaterid 文档创建者id + */ + public void setDoccreaterid(int doccreaterid) { + this.doccreaterid = doccreaterid; + } + + /** + * 设置文档创建者所在部门id + * + * @param docdepartmentid 文档创建者所在部门id + */ + public void setDocdepartmentid(int docdepartmentid) { + this.docdepartmentid = docdepartmentid; + } + + /** + * 设置文档创建日期 + * + * @param doccreatedate 文档创建日期 + */ + public void setDoccreatedate(String doccreatedate) { + this.doccreatedate = doccreatedate; + } + + /** + * 设置文档创建时间 + * + * @param doccreatetime 文档创建时间 + */ + public void setDoccreatetime(String doccreatetime) { + this.doccreatetime = doccreatetime; + } + + /** + * 设置文档最后修改者id + * + * @param doclastmoduserid 文档最后修改者id + */ + public void setDoclastmoduserid(int doclastmoduserid) { + this.doclastmoduserid = doclastmoduserid; + } + + /** + * 设置文档最后修改日期 + * + * @param doclastmoddate 文档最后修改日期 + */ + public void setDoclastmoddate(String doclastmoddate) { + this.doclastmoddate = doclastmoddate; + } + + /** + * 设置文档最后修改时间 + * + * @param doclastmodtime 文档最后修改时间 + */ + public void setDoclastmodtime(String doclastmodtime) { + this.doclastmodtime = doclastmodtime; + } + + /** + * 设置文档审批者id + * + * @param docapproveuserid 文档审批者id + */ + public void setDocapproveuserid(int docapproveuserid) { + this.docapproveuserid = docapproveuserid; + } + + /** + * 设置文档审批日期 + * + * @param docapprovedate 文档审批日期 + */ + public void setDocapprovedate(String docapprovedate) { + this.docapprovedate = docapprovedate; + } + + /** + * 设置文档审批时间 + * + * @param docapprovetime 文档审批时间 + */ + public void setDocapprovetime(String docapprovetime) { + this.docapprovetime = docapprovetime; + } + + /** + * 设置文档归档者id + * + * @param docarchiveuserid 文档归档者id + */ + public void setDocarchiveuserid(int docarchiveuserid) { + this.docarchiveuserid = docarchiveuserid; + } + + /** + * 设置文档归档日期 + * + * @param docarchivedate 文档归档日期 + */ + public void setDocarchivedate(String docarchivedate) { + this.docarchivedate = docarchivedate; + } + + /** + * 设置文档归档时间 + * + * @param docarchivetime 文档归档时间 + */ + public void setDocarchivetime(String docarchivetime) { + this.docarchivetime = docarchivetime; + } + + /** + * 设置文档状态 + * + * @param docstatus 文档状态 + */ + public void setDocstatus(String docstatus) { + this.docstatus = docstatus; + } + + /** + * 设置文档父节点 + * + * @param parentids 文档父节点 + */ + public void setParentids(String parentids) { + this.parentids = parentids; + } + + /** + * 设置文档的关键字 + * + * @param keyword 文档的关键字 + */ + public void setKeyword(String keyword) { + this.keyword = keyword; + } + + /** + * 设置 附件总数 + * + * @param accessorycount 附件总数 + */ + public void setAccessorycount(int accessorycount) { + this.accessorycount = accessorycount; + } + + /** + * 设置回复文档总数 + * + * @param replaydoccount 回复文档总数 + */ + public void setReplaydoccount(int replaydoccount) { + this.replaydoccount = replaydoccount; + } + + /** + * 设置创建的用户类型 + * + * @param usertype 创建的用户类型 + */ + public void setUsertype(String usertype) { + this.usertype = usertype; + } + + /** + * 设置remark表的id + * + * @param id2 remark表的id + */ + public void setId2(int id2) { + this.id2 = id2; + } + + /** + * 设置 + * + * @param approveremark + */ + public void setApproveremark(String approveremark) { + this.approveremark = approveremark; + } + + /** + * 设置批复意见 + * + * @param isapprover 批复意见 + */ + public void setIsapprover(String isapprover) { + this.isapprover = isapprover; + } + + /** + * 设置跳转页面 + * + * @param topage 跳转页面 + */ + public void setToPage(String topage) { + this.topage = topage; + } + + /** + * 设置文档归档编号 + * + * @param docno 文档归档编号 + */ + public void setDocno(String docno) { + this.docno = docno; + } + + /** + * 设置合同人 + * + * @param contractman 合同人 + */ + public void setContractMan(String contractman) { + this.contractman = contractman; + } + + /** + * 设置合同开始日期 + * + * @param contractstartdate 合同开始日期 + */ + public void setContractStartDate(String contractstartdate) { + this.contractstartdate = contractstartdate; + } + + /** + * 设置合同结束日期 + * + * @param contractenddate 合同结束日期 + */ + public void setContractEndDate(String contractenddate) { + this.contractenddate = contractenddate; + } + + /** + * 设置文档模板 + * + * @param docmodule 文档模板 + */ + public void setDocModule(String docmodule) { + this.docmodule = docmodule; + } + + /** + * 设置试用期结束日期 + * + * @param proenddate 试用期结束日期 + */ + public void setProEndDate(String proenddate) { + this.proenddate = proenddate; + } + + /** + * 设置客户类型ID + * + * @param typeid 客户类型ID + */ + public void setContractType(int typeid) { + this.typeid = typeid; + } + + /** + * 设置用于判断来自以及返回的页面 + * + * @param urlfrom 用于判断来自以及返回的页面 + */ + public void setUrlFrom(String urlfrom) { + this.urlfrom = urlfrom; + } + + /** + * 设置解决网站传递新闻组的接口 + * + * @param newsid 解决网站传递新闻组的接口 + */ + public void setNewsId(int newsid) { + this.newsid = newsid; + } + + /** + * 设置 能否拷贝 + * + * @param canCopy 能否拷贝 1:表示在查看状态下此文档不能够拷贝; 2:表示在查看状态下此文档可以拷贝 + */ + public void setCanCopy(String canCopy) { + this.canCopy = canCopy; + } + + /** + * 设置能否提醒 + * + * @param canRemind 能否提醒 1:表示是否回复提醒; 1:没有回复提醒;2:有回复提醒 + */ + public void setCanRemind(String canRemind) { + this.canRemind = canRemind; + } + + /** + * 设置文件扩展名 + * + * @param docextendname 文件扩展名 + */ + public void setDocextendname(String docextendname) { + this.docextendname = docextendname; + } + + /** + * 返回文件扩展名 + * + * @return 文件扩展名 + */ + public String getDocextendname() { + return this.docextendname; + } + + /** + * 返回文档id + * + * @return 文档id + */ + public int getId() { + return id; + } + + /** + * 返回新闻ID + * + * @return 新闻ID + * @throws Exception + */ + public int getNewsId() throws Exception { + return this.newsid; + } + + public int getSecretLevel() throws Exception{ + return this.secretLevel; + } + public void setSecretLevel(int secretLevel){ + this.secretLevel = secretLevel; + } + + public String getSecretValidity() { + return secretValidity; + } + + public void setSecretValidity(String secretValidity) { + this.secretValidity = secretValidity; + } + + public int getDocSecretLevel() throws Exception{ + return rs.getInt("secretLevel"); + } + public String getDocSecretValidity() throws Exception{ + return rs.getString("secretValidity"); + } + public int getReplyremind() { + return this.replyremind; + } + + public void setReplyremind(int replyremind) { + this.replyremind = replyremind; + } + + public int getDocReplyremind() { + return rs.getInt("replyremind"); + } + /** + * 返回 文档ID + * + * @return 文档ID + * @throws Exception + */ + public int getDocid() throws Exception { + return rs.getInt("id"); + } + + /** + * 返回文档类型 + * + * @return 文档类型 + * @throws Exception + */ + public int getDocType() throws Exception { + return rs.getInt("doctype"); + } + + /** + * 返回能否拷贝 + * + * @return 能否拷贝 + * @throws Exception + */ + public String getCanCopy() throws Exception { + return rs.getString("cancopy"); + } + + /** + * 返回能否提醒 + * + * @return 能否提醒 + * @throws Exception + */ + public String getCanRemind() throws Exception { + return rs.getString("canremind"); + } + + /** + * 返回文档主目录 + * + * @return 文档主目录 + * @throws Exception + */ + public int getMaincategory() throws Exception { + return rs.getInt("maincategory"); + } + + /** + * 返回文档分目录 + * + * @return 文档分目录 + * @throws Exception + */ + public int getSubcategory() throws Exception { + return rs.getInt("subcategory"); + } + + /** + * 返回文档子目录 + * + * @return 文档子目录 + * @throws Exception + */ + public int getSeccategory() throws Exception { + return rs.getInt("seccategory"); + } + + /** + * 返回文档语言 + * + * @return 文档语言 + * @throws Exception + */ + public int getDoclangurage() throws Exception { + return rs.getInt("doclangurage"); + } + + /** + * 返回是否需要审批 + * + * @return 是否需要审批 0:否 1:是 + * @throws Exception + */ + public String getDocapprovable() throws Exception { + return rs.getString("docapprovable"); + } + + /** + * 返回 可否回复 + * + * @return 可否回复 0:否 1:是 + * @throws Exception + */ + public String getDocreplyable() throws Exception { + return rs.getString("docreplyable"); + } + + /** + * 返回是否回复文档 + * + * @return 是否回复文档 + * @throws Exception + */ + public String getIsreply() throws Exception { + return rs.getString("isreply"); + } + + /** + * 返回回复文件id + * + * @return 回复文件id + * @throws Exception + */ + public int getReplydocid() throws Exception { + return rs.getInt("replydocid"); + } + + /** + * 返回文档主题 + * + * @return 文档主题 + * @throws Exception + */ + public String getDocsubject() throws Exception { + String docsubject_tmp = Util.null2String(rs.getString("docsubject")); + docsubject_tmp = docsubject_tmp.replaceAll("\n", "");//TD11607 + return docsubject_tmp; + } + + /** + * 返回文档内容 + * + * @return 文档内容 + * @throws Exception + */ + public String getDoccontent() throws Exception { + return Util.toBaseEncoding(rs.getString("doccontent"), languageid, "1"); + } + + /** + * 返回 文档发布类型 + * + * @return 文档发布类型 + * @throws Exception + */ + public String getDocpublishtype() throws Exception { + String tempDocpublishtype = Util.null2String(rs.getString("docpublishtype")); + if ("".equals(tempDocpublishtype)) + tempDocpublishtype = "1"; + return tempDocpublishtype; + } + + /** + * 返回文档中选择的物品id + * + * @return 文档中选择的物品id + * @throws Exception + */ + public int getItemid() throws Exception { + return rs.getInt("itemid"); + } + + /** + * 返回文档中选择的物品种类id + * + * @return 文档中选择的物品种类id + * @throws Exception + */ + public int getItemmaincategoryid() throws Exception { + return rs.getInt("itemmaincategoryid"); + } + + /** + * 返回 + * + * @return + * @throws Exception + */ + public int getHrmresid() throws Exception { + return rs.getInt("hrmresid"); + } + + /** + * 返回文档中选择的人力资源id + * + * @return 文档中选择的人力资源id + * @throws Exception + */ + public int getCrmid() throws Exception { + return rs.getInt("crmid"); + } + + /** + * 返回文档中选择的项目id + * + * @return 返回文档中选择的项目id + * @throws Exception + */ + public int getProjectid() throws Exception { + return rs.getInt("projectid"); + } + + /** + * 返回文档中选择的财务-交易id + * + * @return 文档中选择的财务-交易id + * @throws Exception + */ + public int getFinanceid() throws Exception { + return rs.getInt("financeid"); + } + + /** + * 返回文档创建者id + * + * @return 文档创建者id + * @throws Exception + */ + public int getDoccreaterid() throws Exception { + return rs.getInt("doccreaterid"); + } + /** + * 获取阅读次数 + * @return + * @throws Exception + */ + public int getReadCount() throws Exception { + return rs.getInt("readCount"); + } + /** + * 返回 文档创建者所在部门id + * + * @return 文档创建者所在部门id + * @throws Exception + */ + public int getDocdepartmentid() throws Exception { + return rs.getInt("docdepartmentid"); + } + + /** + * 返回文档创建日期 + * + * @return 文档创建日期 + * @throws Exception + */ + public String getDoccreatedate() throws Exception { + return rs.getString("doccreatedate"); + } + + /** + * 返回文档创建时间 + * + * @return 文档创建时间 + * @throws Exception + */ + public String getDoccreatetime() throws Exception { + return rs.getString("doccreatetime"); + } + + /** + * 返回文档最后修改者id + * + * @return 文档最后修改者id + * @throws Exception + */ + public int getDoclastmoduserid() throws Exception { + return rs.getInt("doclastmoduserid"); + } + + /** + * 返回文档最后修改日期 + * + * @return 文档最后修改日期 + * @throws Exception + */ + public String getDoclastmoddate() throws Exception { + return rs.getString("doclastmoddate"); + } + + /** + * 返回文档最后修改时间 + * + * @return 文档最后修改时间 + * @throws Exception + */ + public String getDoclastmodtime() throws Exception { + return rs.getString("doclastmodtime"); + } + + /** + * 返回文档审批者id + * + * @return 文档审批者id + * @throws Exception + */ + public int getDocapproveuserid() throws Exception { + return rs.getInt("docapproveuserid"); + } + + /** + * 返回文档审批日期 + * + * @return 文档审批日期 + * @throws Exception + */ + public String getDocapprovedate() throws Exception { + return rs.getString("docapprovedate"); + } + + /** + * 返回文档审批时间 + * + * @return 文档审批时间 + * @throws Exception + */ + public String getDocapprovetime() throws Exception { + return rs.getString("docapprovetime"); + } + + /** + * 返回文档归档者id + * + * @return 文档归档者id + * @throws Exception + */ + public int getDocarchiveuserid() throws Exception { + return rs.getInt("docarchiveuserid"); + } + + /** + * 返回文档归档日期 + * + * @return 文档归档日期 + * @throws Exception + */ + public String getDocarchivedate() throws Exception { + return rs.getString("docarchivedate"); + } + + /** + * 返回文档归档时间 + * + * @return 文档归档时间 + * @throws Exception + */ + public String getDocarchivetime() throws Exception { + return rs.getString("docarchivetime"); + } + + /** + * 返回文档状态 + * + * @return 文档状态 + * @throws Exception + */ + public String getDocstatus() throws Exception { + return rs.getString("docstatus"); + } + + /** + * 返回文档父节点 + * + * @return 文档父节点 + * @throws Exception + */ + public String getParentids() throws Exception { + return rs.getString("parentids"); + } + + /** + * 返回Assetid + * + * @return Assetid + * @throws Exception + */ + public int getAssetid() throws Exception { + return rs.getInt("assetid"); + } + + /** + * 返回 文档所有者ID + * + * @return 文档所有者ID + * @throws Exception + */ + public int getOwnerid() throws Exception { + return rs.getInt("ownerid"); + } + + /** + * 返回文档的关键字 + * + * @return 文档的关键字 + * @throws Exception + */ + public String getKeyword() throws Exception { + return rs.getString("keyword"); + } + + /** + * 返回附件总数 + * + * @return 附件总数 + * @throws Exception + */ + public int getAccessorycount() throws Exception { + return rs.getInt("accessorycount"); + } + + /** + * 返回回复文档总数 + * + * @return 回复文档总数 + * @throws Exception + */ + public int getReplaydoccount() throws Exception { + return rs.getInt("replaydoccount"); + } + + /** + * 返回创建的用户类型 + * + * @return 创建的用户类型 + * @throws Exception + */ + public String getUsertype() throws Exception { + return rs.getString("usertype"); + } + + /** + * 返回文档归档编号 + * + * @return 文档归档编号 + * @throws Exception + */ + public String getDocno() throws Exception { + return rs.getString("docno"); + } + + /** + * 返回remark表的id + * + * @return remark表的id + * @throws Exception + */ + public int getId2() throws Exception { + return rs.getInt("id"); + } + + /** + * 返回批复意见 + * + * @return 批复意见 + * @throws Exception + */ + public String getApproveremark() throws Exception { + return rs.getString("approveremark"); + } + + /** + * 返回可打印份数 + * + * @return 可打印份数 + * @throws Exception + */ + public int getCanPrintedNum() throws Exception { + return Util.getIntValue(rs.getString("canPrintedNum"),0); + } + + /** + * 返回 编辑模板id + * + * @return 编辑模板id + * @throws Exception + */ + public int getEditMouldId() throws Exception { + return Util.getIntValue(rs.getString("editMouldId"),0); + } + + /** + * 返回是否批谁通过:是-1,否(退回)-0 + * + * @return 是否批谁通过:是-1,否(退回)-0 + * @throws Exception + */ + public String getIsapprover() throws Exception { + return rs.getString("isapprover"); + } + + /** + * 返回文档主目录 + * + * @return 文档主目录 + * @throws Exception + */ + public int getMaincategory2() throws Exception { + return this.maincategory; + } + + /** + * 返回文档分目录 + * + * @return 文档分目录 + * @throws Exception + */ + public int getSubcategory2() throws Exception { + return this.subcategory; + } + + /** + * 返回文档子目录 + * + * @return 文档子目录 + * @throws Exception + */ + public int getSeccategory2() throws Exception { + return this.seccategory; + } + + /** + * 返回文档语言 + * + * @return 文档语言 + * @throws Exception + */ + public int getDoclangurage2() throws Exception { + return this.doclangurage; + } + + /** + * 返回是否需要审批 + * + * @return 是否需要审批 + * @throws Exception + */ + public String getDocapprovable2() throws Exception { + return this.docapprovable; + } + + /** + * 返回可否回复 + * + * @return 可否回复 + * @throws Exception + */ + public String getDocreplyable2() throws Exception { + return this.docreplyable; + } + + /** + * 返回是否回复文档 + * + * @return 是否回复文档 + * @throws Exception + */ + public String getIsreply2() throws Exception { + return this.isreply; + } + + /** + * 返回回复文件id + * + * @return 回复文件id + * @throws Exception + */ + public int getReplydocid2() throws Exception { + return this.replydocid; + } + + /** + * 返回文档主题 + * + * @return 文档主题 + * @throws Exception + */ + public String getDocsubject2() throws Exception { + String docsubject_tmp = Util.null2String(this.docsubject); + docsubject_tmp = docsubject_tmp.replaceAll("\n", "");//TD11607 + return docsubject_tmp; + } + + /** + * 返回文档内容 + * + * @return 文档内容 + * @throws Exception + */ + public String getDoccontent2() throws Exception { + return this.doccontent; + } + + /** + * 返回文档发布类型 + * + * @return 文档发布类型 + * @throws Exception + */ + public String getDocpublishtype2() throws Exception { + return this.docpublishtype; + } + + /** + * 返回文档的发布类型 + * + * @return 文档的发布类型 + * @throws Exception + */ + public String getDocpublishtypeold() throws Exception { + return this.docpublishtypeold; + } + + /** + * 返回文档中选择的物品id + * + * @return 文档中选择的物品id + * @throws Exception + */ + public int getItemid2() throws Exception { + return this.itemid; + } + + /** + * 返回文档中选择的物品种类id + * + * @return 文档中选择的物品种类id + * @throws Exception + */ + public int getItemmaincategoryid2() throws Exception { + return this.itemmaincategoryid; + } + + /** + * 返回文档中选择的人力资源id + * + * @return 文档中选择的人力资源id + * @throws Exception + */ + public int getHrmresid2() throws Exception { + return this.hrmresid; + } + + /** + * 文档中选择的CRM id + * + * @return 文档中选择的CRM id + * @throws Exception + */ + public int getCrmid2() throws Exception { + return this.crmid; + } + + /** + * 返回文档中选择的项目id + * + * @return 文档中选择的项目id + * @throws Exception + */ + public int getProjectid2() throws Exception { + return this.projectid; + } + + /** + * 返回档中选择的财务-交易id + * + * @return 档中选择的财务-交易id + * @throws Exception + */ + public int getFinanceid2() throws Exception { + return this.financeid; + } + + /** + * 返回文档创建者id + * + * @return 文档创建者id + * @throws Exception + */ + public int getDoccreaterid2() throws Exception { + return this.doccreaterid; + } + + /** + * 返回文档创建者所在部门id + * + * @return 文档创建者所在部门id + * @throws Exception + */ + public int getDocdepartmentid2() throws Exception { + return this.docdepartmentid; + } + + /** + * 返回文档创建日期 + * + * @return 文档创建日期 + * @throws Exception + */ + public String getDoccreatedate2() throws Exception { + return this.doccreatedate; + } + + /** + * 返回文档创建时间 + * + * @return 文档创建时间 + * @throws Exception + */ + public String getDoccreatetime2() throws Exception { + return this.doccreatetime; + } + + /** + * 返回文档最后修改者id + * + * @return 文档最后修改者id + * @throws Exception + */ + public int getDoclastmoduserid2() throws Exception { + return this.doclastmoduserid; + } + + /** + * 返回文档最后修改日期 + * + * @return 文档最后修改日期 + * @throws Exception + */ + public String getDoclastmoddate2() throws Exception { + return this.doclastmoddate; + } + + /** + * 返回文档最后修改时间 + * + * @return 文档最后修改时间 + * @throws Exception + */ + public String getDoclastmodtime2() throws Exception { + return this.doclastmodtime; + } + + /** + * 返回文档审批者id + * + * @return 文档审批者id + * @throws Exception + */ + public int getDocapproveuserid2() throws Exception { + return this.docapproveuserid; + } + + /** + * 返回文档审批日期 + * + * @return 文档审批日期 + * @throws Exception + */ + public String getDocapprovedate2() throws Exception { + return this.docapprovedate; + } + + /** + * 返回文档审批时间 + * + * @return 文档审批时间 + * @throws Exception + */ + public String getDocapprovetime2() throws Exception { + return this.docapprovetime; + } + + /** + * 返回文档归档者id + * + * @return 文档归档者id + * @throws Exception + */ + public int getDocarchiveuserid2() throws Exception { + return this.docarchiveuserid; + } + + /** + * 返回文档归档日期 + * + * @return 文档归档日期 + * @throws Exception + */ + public String getDocarchivedate2() throws Exception { + return this.docarchivedate; + } + + /** + * 返回文档归档时间 + * + * @return 文档归档时间 + * @throws Exception + */ + public String getDocarchivetime2() throws Exception { + return this.docarchivetime; + } + + /** + * 返回文档状态 + * + * @return 文档状态 + * @throws Exception + */ + public String getDocstatus2() throws Exception { + return this.docstatus; + } + + /** + * 返回文档父节点 + * + * @return 文档父节点 + * @throws Exception + */ + public String getParentids2() throws Exception { + return this.parentids; + } + + /** + * 返回Assetid + * + * @return Assetid + * @throws Exception + */ + public int getAssetid2() throws Exception { + return this.assetid; + } + + /** + * 返回 文档所有者ID + * + * @return 文档所有者 + * @throws Exception + */ + public int getOwnerid2() throws Exception { + return this.ownerid; + } + + /** + * 返回文档的关键字 + * + * @return 文档的关键字 + * @throws Exception + */ + public String getKeyword2() throws Exception { + return this.keyword; + } + + /** + * 返回附件总数 + * + * @return 附件总数 + * @throws Exception + */ + public int getAccessorycount2() throws Exception { + return this.accessorycount; + } + + /** + * 返回回复文档总数 + * + * @return 回复文档总数 + * @throws Exception + */ + public int getReplaydoccount2() throws Exception { + return this.replaydoccount; + } + + /** + * 返回创建的用户类型 + * + * @return 创建的用户类型 + * @throws Exception + */ + public String getUsertype2() throws Exception { + return this.usertype; + } + + /** + * 返回remark表的id + * + * @return remark表的id + * @throws Exception + */ + public String getDocno2() throws Exception { + return this.docno; + } + + /** + * 返回批复意见 + * + * @return 批复意见 + * @throws Exception + */ + public String getApproveremark2() throws Exception { + return this.approveremark; + } + + /** + * 返回 是否批谁通过:是-1,否(退回)-0 + * + * @return 是否批谁通过:是-1,否(退回)-0 + * @throws Exception + */ + public String getIsapprover2() throws Exception { + return this.isapprover; + } + + /** + * 返回合同人 + * + * @return 合同人 + */ + public String getContractMan() { + return this.contractman; + } + + /** + * 返回合同开始日期 + * + * @return 合同开始日期 + */ + public String getContractStartDate() { + return this.contractstartdate; + } + + /** + * 返回合同结束日期 + * + * @return 合同结束日期 + */ + public String getContractEndDate() { + return this.contractenddate; + } + + /** + * 返回文档模板 + * + * @return 文档模板 + */ + public String getDocModule() { + return this.docmodule; + } + + /** + * 返回试用期结束日期 + * + * @return 试用期结束日期 + */ + public String getProEndDate() { + return this.proenddate; + } + + /** + * 返回联系人类型ID + * + * @return 联系人类型ID + */ + public int getContractType() { + return this.typeid; + } + + /** + * 返回需返回的页面URL + * + * @return 需返回的页面URL + */ + public String getUrlFrom() { + return this.urlfrom; + } + + /** + * 返回需返回的页面URL + * + * @return 需返回的页面URL + */ + public String getToPage() { + if(this.topage==null||this.topage.trim().equals("")){ + this.topage=""; + } + return topage; + } + + /** + * 返回上一次的状态 + * + * @return 上一次的状态 + */ + public String getOldstatus() { + return oldstatus; + } + + /** + * 返回上一次的所有者的ID + * + * @return 上一次的所有者的ID + */ + public int getOldownerid() { + return oldownerid; + } + + /** + * 设置操作类型 + * + * @param action 操作类型 + */ + public void setAction(String action) { + this.action = Util.null2String(action); + } + + /** + * 设置当前客户端IP + * + * @param ip 客户端IP + */ + public void setClientAddress(String ip) { + this.clientip = ip; + } + + /** + * 设置当前用户ID + * + * @param id 当前用户ID + */ + public void setUserid(int id) { + this.userid = id; + } + + /** + * 返回FileUpload对象 + * + * @return FileUpload对象 + * @throws Exception + */ + public FileUpload getFileUpload2() { + return this.fileUpload; + } + + + public int getDocVestIn() { + return rs.getInt("docVestIn"); + } + + public void setDocVestIn(int docVestIn) { + this.docVestIn = docVestIn; + } + + /** + * 选择新闻信息 + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocInfo(String newsclause, User user) throws Exception { + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + + String userid = "" + user.getUID(); + String logintype = Util.null2String(user.getLogintype()); + String usertype = "" + user.getType(); + String seclevel = user.getSeclevel(); + + String sql = ""; + + if (isoracle || ismysql) { + sql = " select a.id,a.docsubject,b.doccontent,a.doccreatedate,a.doccreaterid, a.usertype,a.doclastmoddate,a.doclastmodtime from DocDetail a,DocDetailContent b " + + " where id in (select distinct t1.id from " + + " DocDetail t1," + + ShareManager.getShareDetailTableByUserNew("doc", user) + + " t2,DocDetailContent t3 " + + " where t1.id=t2.sourceid and t1.id = t3.docid " + + newsclause+this.getDateDuringSql(this.getDateDuringForHp()) + + ") and a.id=b.docid order by doclastmoddate desc, doclastmodtime desc"; + } else { + sql = " select id,docsubject,doccontent,doccreatedate,doccreaterid, usertype from DocDetail " + + " where id in (select distinct t1.id from " + " DocDetail t1," + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2 " + " where t1.id=t2.sourceid " + + newsclause + this.getDateDuringSql(this.getDateDuringForHp())+") order by doclastmoddate desc, doclastmodtime desc"; + } + rsSql.executeSql(sql); + rs = rsSql.getData(); + } + /** + * 和selectNewsDocInfo 的唯一区别就是只返回id + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocIdInfo(String newsclause, User user) throws Exception { + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + +// String userid = "" + user.getUID(); +// String logintype = Util.null2String(user.getLogintype()); +// String usertype = "" + user.getType(); +// String seclevel = user.getSeclevel(); + + String sql = ""; + + if (isoracle || ismysql) { + sql = " select a.id from DocDetail a,DocDetailContent b " + + " where id in (select distinct t1.id from " + + " DocDetail t1," + + ShareManager.getShareDetailTableByUserNew("doc", user) + + " t2,DocDetailContent t3 " + + " where t1.id=t2.sourceid and t1.id = t3.docid " + + newsclause+this.getDateDuringSql(this.getDateDuringForHp()) + + ") and a.id=b.docid order by doclastmoddate desc, doclastmodtime desc"; + } else { + sql = " select id from DocDetail " + + " where id in (select distinct t1.id from " + " DocDetail t1," + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2 " + " where t1.id=t2.sourceid " + + newsclause + this.getDateDuringSql(this.getDateDuringForHp())+") order by doclastmoddate desc, doclastmodtime desc"; + } + rsSql.executeSql(sql); + rs = rsSql.getData(); + } + + /** + * 选择文档信息 + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocInfo(String newsclause, User user, int perpage, int pagenum) throws Exception { + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + SplitPageParaBean sppb = new SplitPageParaBean(); + SplitPageUtil spu = new SplitPageUtil(); + String belongtoshow = userSetting.getBelongtoshowByUserId(user.getUID()+""); + String belongtoids = user.getBelongtoids(); + String account_type = user.getAccount_type(); + if (isoracle || ismysql) { // oralce + + //sppb .setBackFields("a.id,a.docsubject,b.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid, a.usertype,a.doccreatedate,a.doccreatetime"); + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") limit 1),0) as readCount"); + + }else{ + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" limit 1),0) as readCount"); + } + sppb.setBackFields("t1.id,t1.docsubject,t1.doccreaterid,t1.istop,t1.topdate,t1.toptime,t1.doccreatedate,t1.doccreatetime,t1.doclastmoddate,t1.doclastmodtime,t1.usertype"); + sppb.setSqlFrom(" DocDetail t1, " + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2 "); + sppb.setSqlWhere(" where " + + "t1.id=t2.sourceid " + newsclause +this.getDateDuringSql(this.getDateDuringForHp())); + sppb.setOutsqlform("DocDetailContent b"); + + sppb.setOutsqlwhere("where b.docid=r.id"); + sppb.setDistinct(true); + sppb.setPrimaryKey("t1.id"); + //sppb.setSqlOrderBy("a.istop,a.topdate,a.toptime,a.doclastmoddate,a.doclastmodtime"); + sppb.setSqlOrderBy("(case when t1.istop is null then 0 else t1.istop end),(case when t1.topdate is null or t1.istop is null then '1900-01-01' else t1.topdate end),(case when t1.toptime is null or t1.istop is null then '00:00:00' else t1.toptime end),t1.doclastmoddate,t1.doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } else { + //sppb.setBackFields("id,docsubject,doccontent,doclastmoddate,doclastmodtime,doccreaterid,usertype"); + //sppb.setSqlFrom("from DocDetail"); + //sppb.setSqlWhere(" where id in (select distinct t1.id from DocDetail t1, " + // + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2 where " + "t1.id=t2.sourceid" + // + newsclause + ")"); + + //sppb.setPrimaryKey("id"); + //sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + //sppb.setSortWay(sppb.DESC); + + sppb.setBackFields("id,istop,topdate,toptime,doclastmoddate,doclastmodtime"); + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid in("+belongtoids+") ),0) as readCount"); + }else{ + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select top 1 readcount from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid="+user.getUID()+"),0) as readCount"); + } + sppb.setSqlFrom("from DocDetail t1, " + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2"); + sppb.setOutsqlform("DocDetail a"); + sppb.setSqlWhere(" where " + "t1.id=t2.sourceid"+ newsclause +this.getDateDuringSql(this.getDateDuringForHp())); + sppb.setOutsqlwhere("where a.id=r.id"); + + sppb.setDistinct(true); + sppb.setPrimaryKey("id"); + sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } + if(pagenum==1) spu.setRecordCount(perpage); + spu.setSpp(sppb); + rsSql = spu.getCurrentPageRs(pagenum, perpage); + rs = rsSql.getData(); + } + + /** + * 选择文档信息 + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocInfo4Synergy(String newsfrom,String newsclause, User user, int perpage, int pagenum) throws Exception { + RecordSet rsSQL = new RecordSet(); + String dbtype = rsSQL.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + SplitPageParaBean sppb = new SplitPageParaBean(); + SplitPageUtil spu = new SplitPageUtil(); + String belongtoshow = userSetting.getBelongtoshowByUserId(user.getUID()+""); + String belongtoids = user.getBelongtoids(); + String account_type = user.getAccount_type(); + if (isoracle || ismysql) { // oralce + + //sppb .setBackFields("a.id,a.docsubject,b.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid, a.usertype,a.doccreatedate,a.doccreatetime"); + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") limit 1),0) as readCount"); + + }else{ + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" limit 1),0) as readCount"); + } + sppb.setBackFields("t1.id,t1.docsubject,t1.doccreaterid,t1.istop,t1.topdate,t1.toptime,t1.doccreatedate,t1.doccreatetime,t1.doclastmoddate,t1.doclastmodtime,t1.usertype"); + sppb.setSqlFrom(" DocDetail t1, " + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2 "); + sppb.setSqlWhere(" where "+ "t1.id=t2.sourceid " + newsclause +this.getDateDuringSql(this.getDateDuringForHp())); + sppb.setOutsqlform("DocDetailContent b"); + + sppb.setOutsqlwhere("where b.docid=r.id"); + sppb.setDistinct(true); + sppb.setPrimaryKey("t1.id"); + //sppb.setSqlOrderBy("a.istop,a.topdate,a.toptime,a.doclastmoddate,a.doclastmodtime"); + sppb.setSqlOrderBy("(case when t1.istop is null then 0 else t1.istop end),(case when t1.topdate is null or t1.istop is null then '1900-01-01' else t1.topdate end),(case when t1.toptime is null or t1.istop is null then '00:00:00' else t1.toptime end),t1.doclastmoddate,t1.doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } else { + //sppb.setBackFields("id,docsubject,doccontent,doclastmoddate,doclastmodtime,doccreaterid,usertype"); + //sppb.setSqlFrom("from DocDetail"); + //sppb.setSqlWhere(" where id in (select distinct t1.id from DocDetail t1, " + // + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2 where " + "t1.id=t2.sourceid" + // + newsclause + ")"); + + //sppb.setPrimaryKey("id"); + //sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + //sppb.setSortWay(sppb.DESC); + + sppb.setBackFields("t1.id,istop,topdate,toptime,doclastmoddate,doclastmodtime"); + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid in("+belongtoids+") ),0) as readCount"); + }else{ + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select top 1 readcount from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid="+user.getUID()+"),0) as readCount"); + } + String sqlfrom = "from DocDetail t1, " + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2"; + if(!newsfrom.equals("")) + sqlfrom += newsfrom; + sppb.setSqlFrom(sqlfrom); + sppb.setOutsqlform("DocDetail a"); + String sqlwhere = " where " + "t1.id=t2.sourceid"+ newsclause +this.getDateDuringSql(this.getDateDuringForHp()); + if(!newsfrom.equals("")) + sqlwhere += " and t3.scope = 'DocCustomFieldBySecCategory' and t1.id = t3.id "; + sppb.setSqlWhere(sqlwhere); + sppb.setOutsqlwhere("where a.id=r.id"); + + sppb.setDistinct(true); + sppb.setPrimaryKey("id"); + sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } + if(pagenum==1) spu.setRecordCount(perpage); + spu.setSpp(sppb); + rsSQL = spu.getCurrentPageRs(pagenum, perpage); + + rs = rsSQL.getData(); + } + + /** + * 选择文档信息(带有虚拟目录的) + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocInfo(String newsclause, User user, int perpage, int pagenum,String dummyids) throws Exception { + if(",".equals(dummyids.substring(0,1))) dummyids=dummyids.substring(1); + + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + SplitPageParaBean sppb = new SplitPageParaBean(); + SplitPageUtil spu = new SplitPageUtil(); + if (isoracle || ismysql) { // oralce + sppb + .setBackFields("a.id,a.docsubject,b.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid, a.usertype,a.doccreatedate,a.doccreatetime"); + sppb.setSqlFrom("from DocDetail a, DocDetailContent b"); + sppb.setSqlWhere(" where a.id in (select distinct t1.id from DocDetail t1, " + + ShareManager.getShareDetailTableByUser("doc", user) + " t2,DocDummyDetail t3 where " + + "t1.id=t2.sourceid and t1.id = t3.docid and t3.catelogid in("+dummyids+") " + newsclause + this.getDateDuringSql(this.getDateDuringForHp())+") and a.id=b.docid"); + sppb.setPrimaryKey("a.id"); + sppb.setSqlOrderBy("(case when a.istop is null then 0 else a.istop end),(case when a.topdate is null or a.istop is null then '1900-01-01' else a.topdate end),(case when a.toptime is null or a.istop is null then '00:00:00' else a.toptime end),a.doclastmoddate,a.doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } else { + sppb.setBackFields("id,docsubject,doccontent,doclastmoddate,doclastmodtime,doccreaterid,usertype"); + sppb.setSqlFrom("from DocDetail"); + sppb.setSqlWhere(" where id in (select distinct t1.id from DocDetail t1, " + + ShareManager.getShareDetailTableByUser("doc", user) + " t2,DocDummyDetail t3 where t1.id=t2.sourceid and t1.id=t3.docid and t3.catelogid in("+dummyids+") " + + newsclause + this.getDateDuringSql(this.getDateDuringForHp())+")"); + + sppb.setPrimaryKey("id"); + sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } + if(pagenum==1) spu.setRecordCount(perpage); + spu.setSpp(sppb); + rsSql = spu.getCurrentPageRs(pagenum, perpage); + + rs = rsSql.getData(); + } + /** + * 选择文档信息(带有虚拟目录的) + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocInfoForHp(String newsclause, User user, int perpage, int pagenum,String dummyids) throws Exception { + if(",".equals(dummyids.substring(0,1))) dummyids=dummyids.substring(1); + + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + SplitPageParaBean sppb = new SplitPageParaBean(); + SplitPageUtil spu = new SplitPageUtil(); + String belongtoshow = userSetting.getBelongtoshowByUserId(user.getUID()+""); + String belongtoids = user.getBelongtoids(); + String account_type = user.getAccount_type(); + if (isoracle || ismysql) { // oralce + //sppb.setOutfields("b.doccontent, nvl((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid="+user.getUID()+" and rownum=1),0) as readCount"); + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") limit 1),0) as readCount"); + }else{ + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" limit 1),0) as readCount"); + } + sppb.setDistinct(true); + sppb.setBackFields(" t1.istop,t1.topdate,t1.toptime,t1.id,t1.docsubject,t1.doclastmoddate,t1.doclastmodtime,t1.doccreaterid, t1.usertype,t1.doccreatedate,t1.doccreatetime"); + sppb.setSqlFrom("from DocDetail t1, " + + ShareManager.getShareDetailTableByUser("doc", user) + " t2,DocDummyDetail t3"); + sppb.setOutsqlform("DocDetailContent b"); + sppb.setSqlWhere(" where " + + "t1.id=t2.sourceid and t1.id = t3.docid and t3.catelogid in("+dummyids+") " + newsclause + this.getDateDuringSql(this.getDateDuringForHp()) ); + sppb.setOutsqlwhere("where b.docid=r.id"); + sppb.setPrimaryKey("t1.id"); + sppb.setSqlOrderBy("(case when t1.istop is null then 0 else t1.istop end),(case when t1.topdate is null or t1.istop is null then '1900-01-01' else t1.topdate end),(case when t1.toptime is null or t1.istop is null then '00:00:00' else t1.toptime end),t1.doclastmoddate,t1.doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } else { + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid in("+belongtoids+") ),0) as readCount"); + }else{ + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select top 1 readcount from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid="+user.getUID()+"),0) as readCount"); + } + + sppb.setBackFields("t1.id,t1.doclastmoddate,t1.doclastmodtime,t1.istop,t1.topdate,t1.toptime"); + sppb.setSqlFrom("from DocDetail t1, " + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2,DocDummyDetail t3 "); + sppb.setOutsqlform("DocDetail a"); + sppb.setSqlWhere("where t1.id=t2.sourceid and t1.id=t3.docid and t3.catelogid in("+dummyids+") "+ newsclause+this.getDateDuringSql(this.getDateDuringForHp()) ); + sppb.setOutsqlwhere("where a.id=r.id"); + sppb.setPrimaryKey("t1.id"); + sppb.setDistinct(true); + sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } + if(pagenum==1) spu.setRecordCount(perpage); + spu.setSpp(sppb); + rsSql = spu.getCurrentPageRs(pagenum, perpage); + rs = rsSql.getData(); + } + + /** + * 选择文档信息(带有虚拟目录的) + * + * @param newsclause sql条件 + * @param user user对象 + * @throws Exception + */ + public void selectNewsDocInfoForHpSynergy(String newsfrom, String newsclause, User user, int perpage, int pagenum,String dummyids) throws Exception { + if(",".equals(dummyids.substring(0,1))) dummyids=dummyids.substring(1); + + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + SplitPageParaBean sppb = new SplitPageParaBean(); + SplitPageUtil spu = new SplitPageUtil(); + String belongtoshow = userSetting.getBelongtoshowByUserId(user.getUID()+""); + String belongtoids = user.getBelongtoids(); + String account_type = user.getAccount_type(); + if (isoracle || ismysql) { // oralce + //sppb.setOutfields("b.doccontent, nvl((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid="+user.getUID()+" and rownum=1),0) as readCount"); + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid in("+belongtoids+") limit 1),0) as readCount"); + }else{ + if(isoracle) + sppb.setOutfields("b.doccontent, nvl((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" and rownum=1),0) as readCount"); + else + sppb.setOutfields("b.doccontent, ifnull((select readcount from docReadTag where userType ="+user.getLogintype()+" and docid=r.id and userid="+user.getUID()+" limit 1),0) as readCount"); + } + + sppb.setBackFields("t1.id,t1.docsubject,t1.doclastmoddate,t1.doclastmodtime,t1.doccreaterid, t1.usertype,t1.doccreatedate,t1.doccreatetime"); + sppb.setSqlFrom("from DocDetail t1, " + + ShareManager.getShareDetailTableByUser("doc", user) + " t2,DocDummyDetail t3"); + sppb.setOutsqlform("DocDetailContent b"); + sppb.setSqlWhere(" where " + + "t1.id=t2.sourceid and t1.id = t3.docid and t3.catelogid in("+dummyids+") " + newsclause + this.getDateDuringSql(this.getDateDuringForHp()) ); + sppb.setOutsqlwhere("where b.docid=r.id"); + sppb.setPrimaryKey("t1.id"); + sppb.setSqlOrderBy("(case when t1.istop is null then 0 else t1.istop end),(case when t1.topdate is null or t1.istop is null then '1900-01-01' else t1.topdate end),(case when t1.toptime is null or t1.istop is null then '00:00:00' else t1.toptime end),t1.doclastmoddate,t1.doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } else { + if(belongtoshow.equals("1")&&account_type.equals("0")&&!belongtoids.equals("")){ + belongtoids+=","+user.getUID(); + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select sum(readcount) from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid in("+belongtoids+") ),0) as readCount"); + }else{ + sppb.setOutfields("a.id,a.docsubject,a.doccontent,a.doclastmoddate,a.doclastmodtime,a.doccreaterid,a.usertype, isnull((select top 1 readcount from docReadTag where userType ="+user.getLogintype()+" and docid=a.id and userid="+user.getUID()+"),0) as readCount"); + } + + sppb.setBackFields("t1.id,t1.doclastmoddate,t1.doclastmodtime,t1.istop,t1.topdate,t1.toptime"); + sppb.setSqlFrom("from DocDetail t1, " + + ShareManager.getShareDetailTableByUserNew("doc", user) + " t2,DocDummyDetail t3 "); + sppb.setOutsqlform("DocDetail a"); + sppb.setSqlWhere("where t1.id=t2.sourceid and t1.id=t3.docid and t3.catelogid in("+dummyids+") "+ newsclause+this.getDateDuringSql(this.getDateDuringForHp()) ); + sppb.setOutsqlwhere("where a.id=r.id"); + sppb.setPrimaryKey("t1.id"); + sppb.setDistinct(true); + sppb.setSqlOrderBy("istop,topdate,toptime,doclastmoddate,doclastmodtime"); + sppb.setSortWay(sppb.DESC); + } + if(pagenum==1) spu.setRecordCount(perpage); + spu.setSpp(sppb); + rsSql = spu.getCurrentPageRs(pagenum, perpage); + rs = rsSql.getData(); + } + + /** + * 选择文档信息 + * + * @throws Exception + */ + public void selectDocInfo() throws Exception { + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + + String sql = ""; + // TD2401 外部新闻页显示出现异常。 + if (!"and".equalsIgnoreCase(sql_where.substring(0, 4).trim())) + sql_where = " and " + sql_where; + if (isoracle || ismysql) { + sql = "select t1.* , t2.doccontent from DocDetail t1 , DocDetailContent t2 where t1.id = t2.docid " + + sql_where + " order by doclastmoddate desc, doclastmodtime desc"; + } else + sql = "select * from DocDetail where id<>0 " + sql_where + " order by doclastmoddate desc, doclastmodtime desc"; + + rsSql.executeSql(sql); + rs = rsSql.getData(); + } + /** + * 获取文档最新版本content字段 + * @param docid + * @param ischeck + * @return + */ + public String getNewDocid(String docid,boolean ischeck) + { + String sDoceditionid="-1"; + String doccontent = ""; + if("".equals(docid)) return ""; + RecordSet rs= new RecordSet(); + rs.executeSql("select doceditionid,doccontent from docdetail where id="+docid); + if(rs.next()) + { + sDoceditionid=Util.null2String(rs.getString("doceditionid")); + doccontent=Util.null2String(rs.getString("doccontent")); + } + if("-1".equals(sDoceditionid) || "".equals(sDoceditionid)) return doccontent; + rs.executeSql("select id,doccontent from docdetail where docedition=(select max(docedition) from docdetail where doceditionid="+sDoceditionid+") " + + "and doceditionid="+sDoceditionid); + + if(rs.next()) + { + doccontent=Util.null2String(rs.getString("doccontent")); + } + + return doccontent; + } + /** + * 移到下一条记录并判断是否还有下一条记录 + * + * @return 判断是否还有下一条记录 + * @throws Exception + */ + public boolean next() throws Exception { + return rs.next(); + } + + /** + * 选择出来的得到文档总数 + * + * @return 选择出来的文档总数 + * @throws Exception + */ + public int getCount() throws Exception { + return rs.getCounts(); + } + + /** + * 关闭连结 + */ + public void closeStatement() { + try { + // statement.close(); + } catch (Exception ex) { + } + } + + /** + * 通过文档ID得到相应的文档信息 + * + * @throws Exception + */ + public void getDocInfoById() throws Exception { + + RecordSet rsSql = new RecordSet(); + String dbtype = rsSql.getDBType(); + boolean isoracle = dbtype.equals(DBConstant.DB_TYPE_ORACLE); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + + String sql = ""; + + if (isoracle || ismysql) { + sql = "select t1.* , t2.doccontent from DocDetail t1 , DocDetailContent t2 where t1.id = t2.docid and id = " + + id; + } else + sql = "select * from DocDetail where id = " + id; + + rsSql.executeSql(sql); + rs = rsSql.getData(); + rs.next(); + } + + /** + * 添加一个文档 + * + * @throws Exception + */ + public void AddDocInfo() throws Exception { + + String sql = ""; + RecordSet statement = new RecordSet(); + boolean isoracle = (statement.getDBType()).equals("oracle"); + if(this.doccontent.contains("/FCKEditor/FlashVideo.jpg")){ + doccontent+=""; + + } + if (isoracle ||(statement.getDBType()).equals("mysql")) { + + sql = "insert into DocDetail(" + + "id,maincategory,subcategory,seccategory,doclangurage," + + "docapprovable,docreplyable,isreply,replydocid,docsubject," + + "docpublishtype,itemid,itemmaincategoryid,hrmresid,crmid," + + "projectid,financeid,doccreaterid,docdepartmentid,doccreatedate," + + "doccreatetime,doclastmoduserid,doclastmoddate,doclastmodtime,docapproveuserid," + + "docapprovedate,docapprovetime,docarchiveuserid,docarchivedate,docarchivetime," + + "docstatus,parentids,assetid,ownerid,keyword," + + "accessorycount,replaydoccount,usertype,doctype,cancopy," + + "canremind,orderable,docextendname" + + + ",doccode,docedition,doceditionid,ishistory,approveType,maindoc," + + "readoptercanprint,docvaliduserid,docvaliddate,docvalidtime,invalidationdate" + + + ",docCreaterType,docLastModUserType,docApproveUserType,docValidUserType,docInvalUserType" + + ",docArchiveUserType,docCancelUserType,docPubUserType,docReopenUserType,ownerType" + + ",canPrintedNum,editMouldId" + + ",secretLevel" + + ",replyremind" + + ",secretValidity" + + + ") values(" + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?" + + + ",?,?,?,?,?,?" + + ",?,?,?,?,?" + + + ",?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?" + + ",?" + + ",?" + + ",?" + + + ")"; + + try { + + + + statement.executeUpdate(sql + , this.id + , this.maincategory + , this.subcategory + , this.seccategory + , this.doclangurage + , this.docapprovable + , this.docreplyable + , this.isreply + , this.replydocid + , this.docsubject + , this.docpublishtype + , this.itemid + , this.itemmaincategoryid + , this.hrmresid + , this.crmid + , this.projectid + , this.financeid + , this.doccreaterid + , this.docdepartmentid + , this.doccreatedate + , this.doccreatetime + , this.doclastmoduserid + , this.doclastmoddate + , this.doclastmodtime + , this.docapproveuserid + , this.docapprovedate + , this.docapprovetime + , this.docarchiveuserid + , this.docarchivedate + , this.docarchivetime + , this.docstatus + , this.parentids + + + , this.assetid + , this.ownerid + , this.keyword + , this.accessorycount + , this.replaydoccount + //38, this.usertype + , this.docCreaterType + + + , this.docType + , this.canCopy + , this.canRemind + , this.orderable + , this.docextendname + , this.docCode + + , this.docEdition + , this.docEditionId + , this.isHistory + , this.approveType + , this.mainDoc + , this.readOpterCanPrint + , this.docValidUserId + + , this.docValidDate + , this.docValidTime + + , this.invalidationDate + + , this.docCreaterType + , this.docLastModUserType + , this.docApproveUserType + , this.docValidUserType + , this.docInvalUserType + , this.docArchiveUserType + , this.docCancelUserType + , this.docPubUserType + , this.docReopenUserType + , this.ownerType + , this.canPrintedNum + , this.editMouldId + , this.secretLevel + , this.replyremind + , this.secretValidity + ); + // 执行触发器docdetail_getpinyin + DocTriggerUtils docTriggerUtils = new DocTriggerUtils(); + docTriggerUtils.docdetail_getpinyin(new RecordSet()); + + sql = "insert into DocDetailContent (docid, doccontent) values(?,?) "; + statement.executeUpdate(sql,this.id,this.doccontent); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("1"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + //log.setCreatertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + } catch (Exception e) { + writeLog(e); + throw e; + } finally { + } + + } else { + + sql = "insert into DocDetail(" + + "id,maincategory,subcategory,seccategory,doclangurage," + + "docapprovable,docreplyable,isreply,replydocid,docsubject," + + "doccontent,docpublishtype,itemid,itemmaincategoryid,hrmresid," + + "crmid,projectid,financeid,doccreaterid,docdepartmentid," + + "doccreatedate,doccreatetime,doclastmoduserid,doclastmoddate,doclastmodtime," + + "docapproveuserid,docapprovedate,docapprovetime,docarchiveuserid,docarchivedate," + + "docarchivetime,docstatus,parentids,assetid,ownerid," + + "keyword,accessorycount,replaydoccount,usertype,doctype," + + "cancopy,canremind,orderable,docextendname" + + + ",doccode,docedition,doceditionid,ishistory,approveType,maindoc," + + "readoptercanprint,docvaliduserid,docvaliddate,docvalidtime,invalidationdate" + + + ",docCreaterType,docLastModUserType,docApproveUserType,docValidUserType,docInvalUserType" + + ",docArchiveUserType,docCancelUserType,docPubUserType,docReopenUserType,ownerType" + + ",canPrintedNum,editMouldId" + + ",secretLevel" + + ",replyremind" + + ",secretValidity" + + ") values(" + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?,?,?,?,?,?,?," + + "?,?,?,?" + + + ",?,?,?,?,?,?" + + ",?,?,?,?,?" + + + ",?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?" + + ",?" + + ",?" + + ",?" + + + ")"; + + try { + + statement.executeUpdate(sql + , this.id + , this.maincategory + , this.subcategory + , this.seccategory + , this.doclangurage + , this.docapprovable + , this.docreplyable + , this.isreply + , this.replydocid + , this.docsubject + , this.doccontent + , this.docpublishtype + , this.itemid + , this.itemmaincategoryid + , this.hrmresid + , this.crmid + , this.projectid + , this.financeid + , this.doccreaterid + , this.docdepartmentid + , this.doccreatedate + , this.doccreatetime + , this.doclastmoduserid + , this.doclastmoddate + , this.doclastmodtime + , this.docapproveuserid + , this.docapprovedate + , this.docapprovetime + , this.docarchiveuserid + , this.docarchivedate + , this.docarchivetime + , this.docstatus + , this.parentids + , this.assetid + , this.ownerid + , this.keyword + , this.accessorycount + , this.replaydoccount + //39, this.usertype + , this.docCreaterType + , this.docType + , this.canCopy + , this.canRemind + , this.orderable + , this.docextendname + + , this.docCode + , this.docEdition + , this.docEditionId + , this.isHistory + , this.approveType + + , this.mainDoc + , this.readOpterCanPrint + , this.docValidUserId + , this.docValidDate + , this.docValidTime + + , this.invalidationDate + + , this.docCreaterType + , this.docLastModUserType + , this.docApproveUserType + , this.docValidUserType + , this.docInvalUserType + , this.docArchiveUserType + , this.docCancelUserType + , this.docPubUserType + , this.docReopenUserType + , this.ownerType + , this.canPrintedNum + , this.editMouldId + , this.secretLevel + , this.replyremind + , this.secretValidity + ); + + + // 执行触发器docdetail_getpinyin + DocTriggerUtils docTriggerUtils = new DocTriggerUtils(); + docTriggerUtils.docdetail_getpinyin(new RecordSet()); + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("1"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setCreatertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + + log.setDocLogInfo(); + + } catch (Exception e) { + writeLog(e); + throw e; + } finally { + } + } + RecordSet rsDummyDoc=new RecordSet(); + if (isreply.equals("1")) { + String realReplyDocId = ""; + if (parentids != null) { + String tempStrs[] = Util.TokenizerString2(parentids, ","); + if (tempStrs.length >= 2) + realReplyDocId = tempStrs[tempStrs.length - 2]; + } + + DocTreeDocFieldManager dtdfm=new DocTreeDocFieldManager(); + this.dummycata=dtdfm.getDummyStr(Util.getIntValue(realReplyDocId)); + } + if(this.dummycata!=null && !"".equals(dummycata)){ + ArrayList dummyCataList=Util.TokenizerString(dummycata,","); + for(int i=0;i= 2) +// realReplyDocId = tempStrs[tempStrs.length - 2]; +// } +// +// DocTreeDocFieldManager dtdfm=new DocTreeDocFieldManager(); +// this.dummycata=dtdfm.getDummyStr(Util.getIntValue(realReplyDocId)); +// } + + RecordSet rsDummyDoc=new RecordSet(); + rsDummyDoc.executeSql("delete DocDummyDetail where docid="+this.id); + if(this.dummycata!=null && !"".equals(dummycata)){ + ArrayList dummyCataList=Util.TokenizerString(dummycata,","); + for(int i=0;i= file.length()) { + return ""; + } else { + return file.substring(idx + 1); + } + } + } + } + + /** + * add by wjy 保存自定义数据 + * + * @param fu + * @param docId + */ + private void addCustomData(FileUpload fu, int docId) { + int secid = Util.getIntValue(fu.getParameter("seccategory"), 0); + CustomFieldManager cfm = new CustomFieldManager("DocCustomFieldBySecCategory", secid); + cfm.getCustomFields(); + String sql = "insert into cus_fielddata"; + String nameStr = ""; + String valueStr = ""; + while (cfm.next()) { + nameStr += "," + cfm.getFieldName(""+cfm.getId()); + if (cfm.getFieldDbType().startsWith("text") || cfm.getFieldDbType().startsWith("char") + || cfm.getFieldDbType().startsWith("varchar")|| cfm.getFieldDbType().startsWith("browser")) { + valueStr += ",'" + Util.null2String(fu.getParameter("customfield" + cfm.getId())) + "'"; + } else { + if (Util.null2String(fu.getParameter("customfield" + cfm.getId())).equals("")) { + valueStr += ",null"; + } else { + valueStr += "," + Util.null2String(fu.getParameter("customfield" + cfm.getId())); + } + } + } + if (!nameStr.equals("")) { + nameStr = nameStr.substring(1); + valueStr = valueStr.substring(1); + + sql += "(scope,scopeid,id," + nameStr + ") values('DocCustomFieldBySecCategory'," + secid + "," + docId + + "," + valueStr + ")"; + // System.out.println("sql = " + sql); + RecordSet rs=new RecordSet(); + rs.executeSql(sql); + } + + } + + /** + * add by wjy 编辑自定义数据 + * + * @param fu + * @param docId + */ + private void editCustomData(FileUpload fu, int docId) { + int secid = Util.getIntValue(fu.getParameter("seccategory"), 0); + RecordSet rsSql = new RecordSet(); + rsSql.executeSql("select id from cus_fielddata where scope='DocCustomFieldBySecCategory' and scopeid=" + secid + + " and id=" + docId); + int rsCount=rsSql.getCounts(); + if (rsSql.next()&&rsCount==1) { + CustomFieldManager cfm = new CustomFieldManager("DocCustomFieldBySecCategory", secid); + cfm.getCustomFields(); + String sql = "update cus_fielddata set "; + String setStr = ""; + while (cfm.next()) { + setStr += "," + cfm.getFieldName(""+cfm.getId()) + "="; + if (cfm.getFieldDbType().startsWith("text") || cfm.getFieldDbType().startsWith("char") + || cfm.getFieldDbType().startsWith("varchar")|| cfm.getFieldDbType().startsWith("browser")) { + setStr += "'" + Util.null2String(fu.getParameter("customfield" + cfm.getId())) + "'"; + } else { + if (Util.null2String(fu.getParameter("customfield" + cfm.getId())).equals("")) { + setStr += "null"; + } else { + setStr += Util.null2String(fu.getParameter("customfield" + cfm.getId())); + } + } + } + if (!setStr.equals("")) { + setStr = setStr.substring(1); + + sql += setStr + " where scope='DocCustomFieldBySecCategory' and scopeid=" + secid + " and id=" + docId; + // System.out.println("sql = " + sql); + rsSql.executeSql(sql); + } + } else { + if(rsCount<=0){ + addCustomData(fu, docId); + }else{ + rsSql.executeSql("delete from cus_fielddata where scope='DocCustomFieldBySecCategory' and scopeid=" + secid + + " and id=" + docId); + addCustomData(fu, docId); + } + } + + } + + /** + * add by wjy 删除自定义数据 + * + * @param docId + */ + private void deleteCustomData(int docId) { + setId(docId); + try { + getDocInfoById(); + RecordSet rsSql = new RecordSet(); + rsSql.executeSql("delete from cus_fielddata where scope='DocCustomFieldBySecCategory' and scopeid=" + + getSeccategory() + " and id=" + docId); + } catch (Exception e) { + writeLog(this.getClass().getName(), e); + } + } + + + /** + * 用来识别编辑器中文本内的图片的标记. #2007-08-24 add by yeriwei! + * @param i as int + * @return ' alt="docimages_$i" ' + */ + public static String getImgAltFlag(int i){ + return " alt=\"docimages_" + i + "\" "; + } + + /** + * 新建文档 + * @param fu FileUpload对象 + * @param opera 操作类型 + * @throws Exception + */ + public void addDoc(FileUpload fu,String opera) throws Exception { + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(fu.getParameter("docId"), 0); + + if (this.id == 0) { + // 获得下一个可用的文档id + this.id = getNextDocId(rs); + this.docType = 1; + this.docextendname = "html"; + } else { + docType = 2; + + // Get Doc Extend Name + //isextfile <> '1'是正文 TD8782 + String strSql = "select imagefilename from docimagefile where (isextfile <> '1' or isextfile is null) and docid=" + this.id; + RecordSet rsForExtendName = new RecordSet(); + rsForExtendName.executeSql(strSql); + if (rsForExtendName.next()) { + String imageFileName = Util.null2String(rsForExtendName.getString(1)); + int tempPos = imageFileName.lastIndexOf("."); + if (tempPos != -1) { + this.docextendname = imageFileName.substring(tempPos + 1); + } + } + } + + // add by wjy for add custom data + addCustomData(fu, this.id); + + // 开始进行存储附件的操作 + int accessorynum = Util.getIntValue(fu.getParameter("accessorynum"), 0); + String[] needuploads = new String[accessorynum]; + + for (int i = 0; i < accessorynum; i++) { + needuploads[i] = "accessory" + (i + 1); + } + + // 上传附件并返回存储到数据库中后附件的对应id + String[] fileids = fu.uploadFiles(needuploads); + // 返回附件的对应文件名称 + String[] filenames = fu.getFileNames(); + + int accessorynumtrue = 0; + + + /*附加新的附件,通过swfupload方法传上来的附件*/ + String imageidsExt=Util.null2String(fu.getParameter("imageidsExt")); + String imagenamesExt=Util.null2String(fu.getParameter("imagenamesExt")); + ArrayList fildIdList_ext=Util.TokenizerString(imageidsExt,","); + ArrayList fildNameList_ext=Util.TokenizerString(imagenamesExt,"|"); + + ArrayList fileidList=new ArrayList(); + ArrayList filenameList=new ArrayList(); + + for(int i=0;i 0) { + int tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid="); + while (tmppos != -1) { + int startpos = doccontent.lastIndexOf("\"", tmppos); + if ((tmppos - startpos) > 1) { + String tmpcontent = doccontent.substring(0, startpos + 1); + tmpcontent += doccontent.substring(tmppos); + doccontent = tmpcontent; + tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid=", tmppos + 1); + } else + tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid=", tmppos + 1); + } + } + + for (int i = 0; i < docimages_num; i++) { + int pos = doccontent.indexOf(getImgAltFlag(i)); + // 如果此文档有相关的图片 则把其组合成正确的下载路径 + if (pos != -1) { + int temppos = pos; + String tmpcontent = doccontent.substring(0, pos); + tmpcontent += " alt=\"" + filenames[i] + "\" "; + + pos = doccontent.indexOf("src=\"", pos); + int endpos = doccontent.indexOf("\"", pos + 5); + + tmpcontent += doccontent.substring(temppos + getImgAltFlag(i).length(), pos); + tmpcontent += "src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + Util.getFileidOut(fileids[i]); + tmpcontent += "\""; + tmpcontent += doccontent.substring(endpos + 1); + doccontent = tmpcontent; + } + // 如果没有这个相关的图片文件,则删除和此文档相关地这个图片的数据 + else { + imgManger.resetParameter(); + imgManger.setImagefileid(fileids[i]); + imgManger.setDocid(this.id); + imgManger.DeleteSingleDocImageInfo(); + } + } + + // ... + if (moduleimages != null) { + for (int i = 0; i < moduleimages.length; i++) { + String moduleimageid = moduleimages[i]; + rs.executeProc("imagefile_AddByDoc", moduleimageid); + } + } + + // 下面的操作可以得到此知识文档的相关资料 + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + this.doclangurage = Util.getIntValue(fu.getParameter("doclangurage"), 0); + //this.docapprovable = fu.getParameter("docapprovable"); + this.docreplyable = fu.getParameter("docreplyable"); + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.ownerid = Util.getIntValue(fu.getParameter("ownerid"), 0); + this.ownerType = this.usertype; + this.docsubject = Util.toHtml2(fu.getParameter("docsubject")); + this.docsubject = interceptString(this.docsubject,400); + + this.docpublishtype = fu.getParameter("docpublishtype"); + if (docpublishtype.equals("2")) { + //String docmain = fu.getParameter("docmain"); + String docmain = Util.toHtml2(Util.encodeAnd(Util.null2String(fu.getParameter("docmain")))); + this.doccontent = docmain + "!@#$%^&*" + this.doccontent; + } + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = this.userid; + this.docCreaterType=this.usertype; + // TD1715 新建或者编辑文档时,更改文档的所有者,促使文档所在的部门被清除 DP +// this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + ownerid)); + // this.docdepartmentid = + // Util.getIntValue(fu.getParameter("docdepartmentid"), 0); + + if("2".equals(this.ownerType)){ + this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + cici.getCustomerInfomanager(""+ownerid))); + }else{ + this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + ownerid)); + } + + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.userid; + this.docLastModUserType=this.usertype; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docApproveUserType = ""; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docArchiveUserType = ""; + this.docarchivedate = ""; + this.docarchivetime = ""; + this.newsid = Util.getIntValue(fu.getParameter("newsid"), 0); + + rs = new RecordSet(); + SysRemindWorkflow srw = new SysRemindWorkflow(); + String sql = ""; + if (replydocid != 0) { + sql = "select id,canremind,docsubject,doccreaterid from DocDetail where id=" + replydocid; + //System.out.println("sql = " + sql); + String canRemind = ""; + rs.executeSql(sql); + if (rs.next()) { + canRemind = rs.getString("canremind"); + if (canRemind.equals("2")) { + srw.setSysRemindInfo("回复提醒:" + rs.getString("docsubject"), this.id, 0, 0, 0, this.userid, + rs.getString("doccreaterid") + "", ""); + } + } + } + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else { + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + } + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + int docid = this.id; + + this.accessorycount = accessorynumtrue; + + if (isreply.equals("1")) { + AddReplayDocCount(rs); // 修改回复记录条数 + } + + /* 回复文档总数 */ + this.replaydoccount = 0; + /* 创建的用户类型 1: 内部 2: 外部 */ + //this.usertype = Util.null2String(fu.getParameter("usertype")); + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.canCopy = "" + Util.getIntValue(fu.getParameter("cancopy"), 1); + this.canRemind = "" + Util.getIntValue(fu.getParameter("canremind"), 1); + + // get catagory's orderable + this.orderable = "" + scc.getSecOrderable(this.seccategory); + + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + this.mainDoc = Util.getIntValue(Util.null2String(fu.getParameter("maindoc")),-1); + if(this.mainDoc==-1) this.mainDoc = this.id; + + // added by wdl + this.docCode = Util.null2String(fu.getParameter("doccode")); + if(this.docCode.equals("")){ + DocCoder dc = new DocCoder(); + if(this.mainDoc == this.id){ + this.docCode = dc.getDocCoder(""+this.seccategory); + }else{ + this.docCode = dc.getSecDocCoder(""+mainDoc,""+this.seccategory); + } + } + + this.readOpterCanPrint = Util.getIntValue(fu.getParameter("readoptercanprint"), 0); + + this.invalidationDate = Util.null2String(fu.getParameter("invalidationdate")); + this.dummycata = Util.null2String(fu.getParameter("dummycata")); + + if(scc.isNoRepeatedName(this.seccategory)){ + // TODO + + } + + this.docstatus = fu.getParameter("docstatus"); + + // 如果在目录上设置了 创建者对此目录下的文档无权限查看则此文档被直接置为正常 TD4111 TD4112 begin + RecordSet rsCreater = new RecordSet(); + int pcreater = 3; + String strCreaterSql = "select pcreater from secCreaterDocPope where secid=" + this.seccategory; + + rsCreater.executeSql(strCreaterSql); + if (rsCreater.next()) { + pcreater = Util.getIntValue(rsCreater.getString("pcreater"), 0); + } + + /* + if (pcreater <= 0) { // 创建者对文档无权限 + if("1".equals(this.docapprovable)) + docstatus = "3"; // 需要审批则置成审批状态 + else + docstatus = "1"; // 不需要审批直接置成正常状态 + } + */ + // end + // 判断新建的是不是个人文档 + String from = Util.null2String(fu.getParameter("from")); + + //保存草稿//预览 + if(opera.equals("adddraft") || opera.equals("addpreview")){ + this.docstatus = "0"; + } else if(!"personalDoc".equals(from)){//提交 + if(scc.needApprove(this.seccategory)) {//如果需要审批 + this.docstatus = "-3"; + this.approveType = 1; + } else if(scc.needPubOperation(this.seccategory)) {//如果需要发布 + this.docstatus = "-6"; + } else {//生效/正常 + this.docstatus = "-1"; + this.docValidUserId = this.userid; + this.docValidUserType=this.usertype; + this.docValidDate = formatdate; + this.docValidTime = formattime; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId == -1){// 如果不存在历史版本 + this.docEditionId = this.getNextEditionId(rs); + } else { + // TODO 否则,通过版本ID找到同文档的版本 + //新建文档不存在以前有版本 + } + this.docEdition = dc.getEdition(this.docEditionId)+1; + } + } + + if(this.invalidationDate!=null&&!"".equals(this.invalidationDate)){ + java.text.DateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); + Date tmpidate = sdf.parse(this.invalidationDate); + if(tmpidate.getTime()0&&!"0".equals(this.oldstatus)) { + //if(scc.isEditionOpen(this.seccategory)&&!"0".equals(this.oldstatus)&&!"4".equals(this.oldstatus)) { + if(scc.isEditionOpen(this.seccategory)&&((!"0".equals(this.oldstatus)&&!"4".equals(this.oldstatus))||(this.docEditionId>0&&this.docEdition>0))) { + + needAddNewEdition = true; + oldDocId = this.id; + // 获得一个新版本的文档id + this.id = getNextDocId(rs); + + if(this.docEditionId<=0) {//之前一个版本为非版本管理 + this.docEditionId = this.getNextEditionId(rs); + this.docEdition = 1; + rs.executeSql("update DocDetail set docEditionId="+this.docEditionId+",docEdition="+this.docEdition+" where id="+oldDocId); + rs.executeSql("update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition <= " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + }else if(this.docEdition<=0){//之前一个版本没有设置版本号 如为审批状态 + this.docEdition = dc.getEdition(this.docEditionId)+1; + rs.executeSql("update DocDetail set docEditionId="+this.docEditionId+",docEdition="+this.docEdition+" where id="+oldDocId); + rs.executeSql("update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition <= " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + }else if(this.docEditionId>0&&this.docEdition>0){ + rs.executeSql("update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition <= " + this.docEdition + " and doceditionid > 0 and docstatus in (0,4,-6,-3,-1) and doceditionid = " + this.docEditionId); + } + + //拷贝原文档到新文档 + addNewDocForEdition(oldDocId,deleteaccessory); + + RecordSet rs1 = new RecordSet(); + List isExistedImageFileIds = new ArrayList(); + rs1.executeSql("select * from DocImageFile where docid ="+oldDocId); + while(rs1.next()){ + isExistedImageFileIds.add(Util.null2String(rs1.getString("imagefileid"))); + } + + /*附加新的附件,通过swfupload方法传上来的附件*/ + String imageidsExt=Util.null2String(fu.getParameter("imageidsExt")); + String imagenamesExt=Util.null2String(fu.getParameter("imagenamesExt")); + ArrayList fildIdList_ext=Util.TokenizerString(imageidsExt,","); + ArrayList fildNameList_ext=Util.TokenizerString(imagenamesExt,"|"); + ArrayList fileidList=new ArrayList(); + ArrayList filenameList=new ArrayList(); + for(int i=0;i-1) continue; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue((String)fileidList.get(i), 0)); + imgManger.setImagefilename((String)filenameList.get(i)); + imgManger.setIsextfile("1"); + String ext = getFileExt((String)filenameList.get(i)); + if (ext.equalsIgnoreCase("doc")) { + imgManger.setDocfiletype("3"); + } else if (ext.equalsIgnoreCase("xls")) { + imgManger.setDocfiletype("4"); + } else if (ext.equalsIgnoreCase("ppt")) { + imgManger.setDocfiletype("5"); + } else if (ext.equalsIgnoreCase("wps")) { + imgManger.setDocfiletype("6"); + } else if (ext.equalsIgnoreCase("docx")) { + imgManger.setDocfiletype("7"); + } else if (ext.equalsIgnoreCase("xlsx")) { + imgManger.setDocfiletype("8"); + } else if (ext.equalsIgnoreCase("pptx")) { + imgManger.setDocfiletype("9"); + } else if (ext.equalsIgnoreCase("et")) { + imgManger.setDocfiletype("10"); + } else { + imgManger.setDocfiletype("2"); + } + imgManger.AddDocImageInfo(); + + //将附件从上传临时表中删除 + rs.executeSql("delete from imagefiletemp where imagefileid = " + Util.getIntValue((String)fileidList.get(i), 0) + " and docid = "+oldDocId); + rs.executeSql(" update docdetail set accessorycount = (select count(distinct id) from DocImageFile where isextfile = '1' and docid = " + this.id + " and docfiletype <> '1' and docfiletype <> '11' ) where id = " + this.id); + } + + this.docEdition = -1; + } else if(Util.getIntValue(Util.null2String(fu.getParameter("isFromAccessory")))==1 || (scc.isEditionOpen(this.seccategory)&&("0".equals(this.oldstatus)||"4".equals(this.oldstatus)))){ + RecordSet rs1 = new RecordSet(); + List isExistedImageFileIds = new ArrayList(); + rs1.executeSql("select * from DocImageFile where docid ="+this.id); + while(rs1.next()){ + isExistedImageFileIds.add(Util.null2String(rs1.getString("imagefileid"))); + } + /*附加新的附件,通过swfupload方法传上来的附件*/ + String isSubmit = Util.null2String(fu.getParameter("isSubmit")); + String imageidsExt=Util.null2String(fu.getParameter("imageidsExt")); + String imagenamesExt=Util.null2String(fu.getParameter("imagenamesExt")); + ArrayList fildIdList_ext=Util.TokenizerString(imageidsExt,","); + ArrayList fildNameList_ext=Util.TokenizerString(imagenamesExt,"|"); + ArrayList fileidList=new ArrayList(); + ArrayList filenameList=new ArrayList(); + for(int i=0;i-1) continue; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue((String)fileidList.get(i), 0)); + imgManger.setImagefilename((String)filenameList.get(i)); + imgManger.setIsextfile("1"); + String ext = getFileExt((String)filenameList.get(i)); + if (ext.equalsIgnoreCase("doc")) { + imgManger.setDocfiletype("3"); + } else if (ext.equalsIgnoreCase("xls")) { + imgManger.setDocfiletype("4"); + } else if (ext.equalsIgnoreCase("ppt")) { + imgManger.setDocfiletype("5"); + } else if (ext.equalsIgnoreCase("wps")) { + imgManger.setDocfiletype("6"); + } else if (ext.equalsIgnoreCase("docx")) { + imgManger.setDocfiletype("7"); + } else if (ext.equalsIgnoreCase("xlsx")) { + imgManger.setDocfiletype("8"); + } else if (ext.equalsIgnoreCase("pptx")) { + imgManger.setDocfiletype("9"); + } else if (ext.equalsIgnoreCase("et")) { + imgManger.setDocfiletype("10"); + } else { + imgManger.setDocfiletype("2"); + } + imgManger.AddDocImageInfo(); + //将附件从上传临时表中删除 + rs.executeSql("delete from imagefiletemp where imagefileid = " + Util.getIntValue((String)fileidList.get(i), 0) + " and docid = "+this.id); + rs.executeSql(" update docdetail set accessorycount = (select count(distinct id) from DocImageFile where isextfile = '1' and docid = " + this.id + " and docfiletype <> '1' and docfiletype <> '11') where id = " + this.id); + } + String[] deleteaccessoryArray = deleteaccessory.split(","); + for(int j = 0;j '1' and docfiletype <> '11') where id = " + this.id); + }else if(!scc.isEditionOpen(this.seccategory)) { //版本管理尚未启用,复制生成的正文被编辑时 + + int tempImageFileId=0; + rs.executeSql("select imagefileid from docimagefile where versionId = " + this.oldVersionId + " and docid = " + this.id); + if(rs.next()){ + tempImageFileId = Util.getIntValue(Util.null2String(rs.getString("imagefileid"))); + } + + boolean otherrelated = false; + rs.executeSql("select imagefileused from imagefile where imagefileid = " + tempImageFileId); + if(rs.next()&&Util.getIntValue(Util.null2String(rs.getString(1)))>1) { + otherrelated = true; + } + if(otherrelated){ + rs.executeSql(" delete from docimagefile where docid = " + this.id + " and imagefileid in (select imagefiledesc from docimagefile where isextfile = '1' and docid = -" + this.id + ")"); + rs.executeSql(" update imagefile set imagefileused = imagefileused - 1 where imagefileid in (select imagefiledesc from docimagefile where isextfile = '1' and docid = -" + this.id + ")"); + rs.executeSql(" update docimagefile set imagefiledesc = '' where isextfile = '1' and docid = -" + this.id); + rs.executeSql(" update docimagefile set docid = " + this.id + " where docid = -" + this.id); + rs.executeSql(" update docdetail set accessorycount = (select count(distinct id) from DocImageFile where isextfile = '1' and docid = " + this.id + " and docfiletype <> '1' and docfiletype <> '11') where id = " + this.id); + } + } + + // add by wjy for edit custom data + editCustomData(fu, this.id); + + this.doccontent = Util.fromBaseEncoding(fu.getParameter("doccontent"), languageid); + this.doccontent =Util.htmlFilter4UTF8(this.doccontent ); + int doccontentflag = Util.getIntValue(fu.getParameter("doccontentflag"),-1); + if(doccontentflag==1){//草稿状态提交的时候 不改变文档内容 + DocManager dm2=new DocManager(); + dm2.resetParameter(); + dm2.setId(this.id); + dm2.getDocInfoById(); + this.doccontent=dm2.getDoccontent(); + } + //替换文档内容中可能存在的 textarea|input|form 标签 + String rex_html = "<(textarea|input|form)[^>]*>"; + String rex_html2 = ""; + + Pattern p_script = Pattern.compile(rex_html, Pattern.CASE_INSENSITIVE); + Matcher m_html = p_script.matcher(this.doccontent); + this.doccontent = m_html.replaceAll(""); + + p_script = Pattern.compile(rex_html2, Pattern.CASE_INSENSITIVE); + m_html = p_script.matcher(this.doccontent); + this.doccontent = m_html.replaceAll(""); + + if(this.imageFileIdOfPicChangeList!=null&&this.imageFileIdOfPicChangeList.size()>0){ + Map imageFileIdOfPicChangeMap=null; + int oldImageFileId=0; + int newImageFileId=0; + for(int i=0;i 1) { + String tmpcontent = doccontent.substring(0, startpos + 1); + tmpcontent += doccontent.substring(tmppos); + doccontent = tmpcontent; + tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid=", tmppos + 1); + } else + tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid=", tmppos + 1); + } + + int olddocimagesnum = Util.getIntValue(fu.getParameter("olddocimagesnum"), 0); + if(needAddNewEdition){ + olddocimagesnum=0; + } + // 删除老的文档图片数据 + for (int i = 0; i < olddocimagesnum; i++) { + String tmpid = Util.null2String(fu.getParameter("olddocimages" + i)); + String tmpid1 = "/weaver/weaver.file.FileDownload?fileid=" + tmpid + "\""; + if (doccontent.indexOf(tmpid1) == -1) { + imgManger.resetParameter(); + imgManger.setImagefileid(tmpid); + imgManger.setDocid(this.id); + imgManger.DeleteSingleDocImageInfo(); + } + } + + // 增加新的文档附件数据 + int accessorynum = Util.getIntValue(fu.getParameter("accessorynum"), 0); + String[] needuploads = new String[accessorynum]; + for (int i = 0; i < accessorynum; i++) { + needuploads[i] = "accessory" + (i + 1); + } + + String[] fileids = fu.uploadFiles(needuploads); + String[] filenames = fu.getFileNames(); + + int accessorynumtrue = 0; + for (int i = 0; i < accessorynum; i++) { + if (Util.getIntValue(fileids[i], 0) == 0) + continue; + accessorynumtrue++; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids[i], 0)); + imgManger.setImagefilename(filenames[i]); + imgManger.setIsextfile("1"); + String ext = getFileExt(filenames[i]); + if (ext.equals("doc")) { + imgManger.setDocfiletype("3"); + } else if (ext.equals("xls")) { + imgManger.setDocfiletype("4"); + } else if (ext.equalsIgnoreCase("ppt")) { + imgManger.setDocfiletype("5"); + } else if (ext.equalsIgnoreCase("wps")) { + imgManger.setDocfiletype("6"); + } else if (ext.equalsIgnoreCase("docx")) { + imgManger.setDocfiletype("7"); + } else if (ext.equalsIgnoreCase("xlsx")) { + imgManger.setDocfiletype("8"); + } else if (ext.equalsIgnoreCase("pptx")) { + imgManger.setDocfiletype("9"); + } else if (ext.equalsIgnoreCase("et")) { + imgManger.setDocfiletype("10"); + } else { + imgManger.setDocfiletype("2"); + } + imgManger.AddDocImageInfo(); + } + + // 增加新的文档图片信息 + int docimages_num = Util.getIntValue(fu.getParameter("docimages_num"), 0); + needuploads = new String[docimages_num]; + + for (int i = 0; i < docimages_num; i++) { + needuploads[i] = "docimages_" + i; + } + + fu.needImagewidth(true); + fileids = fu.uploadFiles(needuploads); + filenames = fu.getFileNames(); + int[] imagesizes = fu.getFileSizes(); + int[] imagewidths = fu.getWidths(); + int[] imageheights = fu.getHeights(); + + for (int i = 0; i < docimages_num; i++) { + if (Util.getIntValue(fileids[i], 0) == 0) + continue; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids[i], 0)); + imgManger.setImagefilename(filenames[i]); + imgManger.setDocfiletype("1"); + + imgManger.setImagefielsize(imagesizes[i]); + imgManger.setimagefilewidth(imagewidths[i]); + imgManger.setImagefileheight(imageheights[i]); + + imgManger.AddDocImageInfo(); + } + + for (int i = 0; i < docimages_num; i++) { + int pos = doccontent.indexOf(getImgAltFlag(i)); + if (pos != -1) { + int temppos = pos; + String tmpcontent = doccontent.substring(0, pos); + tmpcontent += " alt=\"" + filenames[i] + "\" "; + + pos = doccontent.indexOf("src=\"", pos); + int endpos = doccontent.indexOf("\"", pos + 6); + + tmpcontent += doccontent.substring(temppos + getImgAltFlag(i).length(), pos); + tmpcontent += "src=\""+weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + Util.getFileidOut(fileids[i]); + tmpcontent += "\""; + tmpcontent += doccontent.substring(endpos + 1); + doccontent = tmpcontent; + } else { + imgManger.resetParameter(); + imgManger.setImagefileid(fileids[i]); + imgManger.setDocid(this.id); + imgManger.DeleteSingleDocImageInfo(); + } + } + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.doclangurage = Util.getIntValue(fu.getParameter("doclangurage"), 0); + //this.docapprovable = Util.null2String(fu.getParameter("docapprovable")); + this.docreplyable = Util.null2String(fu.getParameter("docreplyable")); + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + + + this.oldownerid = Util.getIntValue(fu.getParameter("oldownerid"), 0); + + this.docpublishtype = Util.null2String(fu.getParameter("docpublishtype")); + this.docpublishtypeold = Util.null2String(fu.getParameter("docpublishtypeold")); + + if (docpublishtype.equals("")) + docpublishtype = "1"; + if (docpublishtypeold.equals("")) + docpublishtypeold = "1"; + + if (docpublishtype.equals("2")&&doccontentflag!=1) { + //String docmain = fu.getParameter("docmain"); + String docmain = Util.toHtml2(Util.encodeAnd(Util.null2String(fu.getParameter("docmain")))); + this.doccontent = docmain + "!@#$%^&*" + this.doccontent; + } + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.ownerid = Util.getIntValue(fu.getParameter("ownerid"), 0); + this.ownerType = Util.null2String(fu.getParameter("ownerType")); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = Util.getIntValue(fu.getParameter("doccreaterid"), 0); + this.docCreaterType = Util.null2String(fu.getParameter("docCreaterType")); + // TD1715 新建或者编辑文档时,更改文档的所有者,促使文档所在的部门被清除 DP +// this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + ownerid)); + // this.docdepartmentid = + // Util.getIntValue(fu.getParameter("docdepartmentid"), 0); + + if("2".equals(this.ownerType)){ + this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + cici.getCustomerInfomanager(""+ownerid))); + }else{ + this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + ownerid)); + } + + if(needAddNewEdition){ + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + } else { + this.doccreatedate = Util.null2String(fu.getParameter("doccreatedate")); + this.doccreatetime = Util.null2String(fu.getParameter("doccreatetime")); + } + this.doclastmoduserid = this.userid; + this.docLastModUserType = this.usertype; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = Util.getIntValue(fu.getParameter("docapproveuserid"), 0); + this.docapprovedate = Util.null2String(fu.getParameter("docapprovedate")); + this.docapprovetime = Util.null2String(fu.getParameter("docapprovetime")); + this.docarchiveuserid = Util.getIntValue(fu.getParameter("docarchiveuserid"), 0); + this.docarchivedate = Util.null2String(fu.getParameter("docarchivedate")); + this.docarchivetime = Util.null2String(fu.getParameter("docarchivetime")); + this.newsid = Util.getIntValue(fu.getParameter("newsid"), 0); + + this.keyword = Util.null2String(fu.getParameter("keyword")); // 文档的关键字 + + this.accessorycount = accessorynumtrue; + this.replaydoccount = Util.getIntValue(fu.getParameter("replaydoccount"), 0); // 回复文档总数 + //this.usertype = Util.null2String(fu.getParameter("usertype")); // 创建的用户类型 + // 1: + // 内部 + // 2: + // 外部 + this.opreateType = Util.null2String(fu.getParameter("opreateType")); + if ("".equals(opreateType)) { + this.opreateType = this.usertype; + } + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + + this.canCopy = "" + Util.getIntValue(fu.getParameter("cancopy"), 1); + this.canRemind = "" + Util.getIntValue(fu.getParameter("canremind"), 1); + + // added by wdl + this.mainDoc = Util.getIntValue(Util.null2String(fu.getParameter("maindoc")),-1); + if(this.mainDoc==oldDocId || this.mainDoc==-1){ + this.mainDoc = this.id; + } + + this.readOpterCanPrint = Util.getIntValue(fu.getParameter("readoptercanprint"), 0); + + this.invalidationDate = Util.null2String(fu.getParameter("invalidationdate")); + this.dummycata = Util.null2String(fu.getParameter("dummycata")); + + this.hrmContractId = Util.getIntValue(fu.getParameter("hrmContractId"), 0); + + if(scc.isNoRepeatedName(this.seccategory)){ + // TODO + + } + + //this.docstatus = fu.getParameter("docstatus"); + + //保存草稿//预览 + if(opera.equals("editdraft") || opera.equals("editpreview")){ + this.docstatus = "0"; + } else {//提交 + rs.executeSql("update DocDetail set checkOutStatus='0',checkOutUserId=-1,checkOutUserType='',checkOutDate='',checkOutTime='' where id ="+this.id); + if(scc.needApprove(this.seccategory)) {//如果需要审批 + if(this.oldstatus!=null&&(this.oldstatus.equals("0")||this.oldstatus.equals("4")||Util.getIntValue(this.oldstatus,0)<=0)) this.docstatus = "-3"; + else this.docstatus = "3"; + this.approveType = 1; + } else if(scc.needPubOperation(this.seccategory)) {//如果需要发布 + if(this.oldstatus!=null&&(this.oldstatus.equals("0")||this.oldstatus.equals("4")||Util.getIntValue(this.oldstatus,0)<=0)) this.docstatus = "-6"; + else this.docstatus = "6"; + } else {//生效/正常 + if(this.oldstatus!=null&&(this.oldstatus.equals("0")||this.oldstatus.equals("4")||Util.getIntValue(this.oldstatus,0)<=0)) this.docstatus = "-1"; + else this.docstatus = "1"; + this.docValidUserId = this.userid; + this.docValidDate = formatdate; + this.docValidTime = formattime; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + this.docEdition = dc.getEdition(this.docEditionId)+1; + } + } + + if(this.invalidationDate!=null&&!"".equals(this.invalidationDate)){ + java.text.DateFormat sdf = new java.text.SimpleDateFormat("yyyy-MM-dd"); + Date tmpidate = sdf.parse(this.invalidationDate); + if(tmpidate.getTime()1){ + + //关联子文档 + relateSonDocWithNewDoc(this.id); + + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + + log.resetParameter(); + log.setDocId(oldDocId); + log.setDocSubject(this.docsubject); + log.setOperateType("14"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setDocLogInfo(); + } + if(this.docstatus.equals("0")){ + relateSonDocWithNewDoc(this.id); + } + } + + private void copyDocToNewDoc(int oldDocId) throws Exception { + copyDocToNewDoc(oldDocId,true,""); + } + + private void copyDocToNewDoc(int oldDocId,String deleteaccessory) throws Exception { + copyDocToNewDoc(oldDocId,true,deleteaccessory); + } + + private void copyDocToNewDoc(int oldDocId,String deleteaccessory,boolean copyfile,boolean copyreallyfile) throws Exception { + copyDocToNewDoc(oldDocId,copyfile,deleteaccessory,false,true,"'1'",false,copyreallyfile); + } + + private void copyDocToNewDoc(int oldDocId,boolean copyfile) throws Exception { + copyDocToNewDoc(oldDocId,copyfile,""); + } + + private void copyDocToNewDoc(int oldDocId,boolean copyfile,String deleteaccessory) throws Exception { + copyDocToNewDoc(oldDocId,copyfile,deleteaccessory,false); + } + + private void copyDocToNewDoc(int oldDocId,boolean copyfile,String deleteaccessory,boolean isNewDocEditionId) throws Exception { + //copyDocToNewDoc(oldDocId,copyfile,deleteaccessory,isNewDocEditionId,true,"'1'"); + copyDocToNewDoc(oldDocId,copyfile,deleteaccessory,isNewDocEditionId,true,"'1'",false,false); + } + private void copyDocToNewDoc(int oldDocId,boolean copyfile,String deleteaccessory,boolean isNewDocEditionId,boolean copyRight,String newStatus,boolean isLatestOnly) throws Exception { + copyDocToNewDoc(oldDocId,copyfile,deleteaccessory,isNewDocEditionId,copyRight,newStatus,isLatestOnly,false); + } + /** + * 复制文档到新文档 + * @param oldDocId 被复制文档 + * @param copyfile 是否复制附件信息 + * @param deleteaccessory 被删除附件 + * @param isNewDocEditionId 是否作为新的文档,即不作为原文档的新版本。 + * @param copyRight 是否复制权限 + * @param newStatus 新文档的状态,若为""则复制原来文档的状态 + * @param isLatestOnly 是否只复制最新版本的文档 + * @param copyReallyFile 是否复制附件文件 + */ + private void copyDocToNewDoc(int oldDocId,boolean copyfile,String deleteaccessory,boolean isNewDocEditionId,boolean copyRight,String newStatus,boolean isLatestOnly,boolean copyReallyFile) throws Exception { + copyDocToNewDoc(oldDocId,copyfile,deleteaccessory,isNewDocEditionId,copyRight,newStatus,isLatestOnly,copyReallyFile,true); + } + + private void copyDocToNewDoc(int oldDocId,boolean copyfile,String deleteaccessory,boolean isNewDocEditionId,boolean copyRight,String newStatus,boolean isLatestOnly,boolean copyReallyFile,boolean updatereplydoc) throws Exception { + DocViewer dv = new DocViewer(); + RecordSet rs = new RecordSet(); + RecordSet recorder = new RecordSet(); + + int oldid = oldDocId; + String dbtype = rs.getDBType(); + boolean isoracle = dbtype.equals("oracle"); + boolean ismysql = dbtype.equals(DBConstant.DB_TYPE_MYSQL); + + String sql = ""; + String sqllog = ""; + + String docStatusString="docstatus"; + newStatus=Util.null2String(newStatus); + if(newStatus.equals("'0'")||newStatus.equals("'1'")||newStatus.equals("'2'")||newStatus.equals("'3'")||newStatus.equals("'4'")||newStatus.equals("'5'") + ||newStatus.equals("'6'")||newStatus.equals("'7'")||newStatus.equals("'8'")||newStatus.equals("'9'")){ + docStatusString=newStatus; + } + + + if (isoracle || ismysql) { + sql = "insert into DocDetail(" + + "id,maincategory,subcategory," + + "seccategory,doclangurage,docapprovable," + + "docreplyable,isreply,replydocid,docsubject," + + "docpublishtype,itemid,itemmaincategoryid,hrmresid,crmid,projectid," + + "financeid,doccreaterid,docdepartmentid,doccreatedate,doccreatetime," + + "doclastmoduserid,doclastmoddate,doclastmodtime,docapproveuserid," + + "docapprovedate,docapprovetime,docarchiveuserid,docarchivedate," + + "docarchivetime,docstatus,parentids,assetid,ownerid,keyword," + + "accessorycount,replaydoccount,usertype,doctype,cancopy,canremind,docextendname" + + + ",doccode,doceditionid,ishistory,approveType,readoptercanprint,invalidationdate,docvaliduserid,docvaliddate,docvalidtime," + + "docpubuserid,docpubdate,docpubtime,docreopenuserid,docreopendate,docreopentime," + + "docinvaluserid,docinvaldate,docinvaltime,doccanceluserid,doccanceldate,doccanceltime" + + +",docCreaterType,docLastModUserType,docApproveUserType,docValidUserType,docInvalUserType" + +",docArchiveUserType,docCancelUserType,docPubUserType,docReopenUserType,ownerType" + +",hasUsedTemplet" + +",canPrintedNum,editMouldId,orderable" + +",secretLevel" + +",secretValidity" + +",replyremind" + + + ") " + + "select " + this.id + "," + (this.maincategory==0?"maincategory":this.maincategory) + "," + (this.subcategory==0?"subcategory":this.subcategory) + "," + (this.seccategory==0?"seccategory":this.seccategory) + + ",doclangurage,docapprovable,docreplyable,isreply,replydocid," + + "docsubject,docpublishtype,itemid,itemmaincategoryid,hrmresid,crmid," + + "projectid,financeid,doccreaterid,docdepartmentid,doccreatedate," + + "doccreatetime,doclastmoduserid,doclastmoddate,doclastmodtime," + + "docapproveuserid,docapprovedate,docapprovetime,docarchiveuserid," + + "docarchivedate,docarchivetime," + //+ "'1'," + + docStatusString+"," + + // docstatus + "parentids,assetid,ownerid,keyword,accessorycount,replaydoccount," + + "usertype ,doctype,cancopy,canremind,docextendname" + + + ",doccode,doceditionid,ishistory,approveType,readoptercanprint,invalidationdate,docvaliduserid,docvaliddate,docvalidtime," + + "docpubuserid,docpubdate,docpubtime,docreopenuserid,docreopendate,docreopentime," + + "docinvaluserid,docinvaldate,docinvaltime,doccanceluserid,doccanceldate,doccanceltime" + + +",docCreaterType,docLastModUserType,docApproveUserType,docValidUserType,docInvalUserType" + +",docArchiveUserType,docCancelUserType,docPubUserType,docReopenUserType,ownerType" + + +",hasUsedTemplet" + +",canPrintedNum,editMouldId,orderable" + +",secretLevel" + +",secretValidity" + +",replyremind" + + + " from DocDetail where id = " + + oldid; + //writeLog(sql); + rs.executeSql(sql); + + // 执行触发器docdetail_getpinyin + DocTriggerUtils docTriggerUtils = new DocTriggerUtils(); + docTriggerUtils.docdetail_getpinyin(rs); + sql = "insert into DocDetailContent(docid,doccontent) select " + this.id + ",doccontent " + + "from DocDetailContent where docid = " + oldid; + //writeLog(sql); + rs.executeSql(sql); + sql = "insert into DocDummyDetail(catelogid,docid,importdate,importtime,publicdate,publictime,status) select catelogid,"+this.id + +",importdate,importtime,publicdate,publictime,status from DocDummyDetail where docid="+oldDocId; + rs.execute(sql); + } else { + sql = "insert into DocDetail(id,maincategory,subcategory,seccategory,doclangurage," + + "docapprovable,docreplyable,isreply,replydocid,docsubject,doccontent," + + "docpublishtype,itemid,itemmaincategoryid,hrmresid,crmid,projectid," + + "financeid,doccreaterid,docdepartmentid,doccreatedate,doccreatetime," + + "doclastmoduserid,doclastmoddate,doclastmodtime,docapproveuserid," + + "docapprovedate,docapprovetime,docarchiveuserid,docarchivedate," + + "docarchivetime,docstatus,parentids,assetid,ownerid,keyword," + + "accessorycount,replaydoccount,usertype,doctype,cancopy,canremind,docextendname" + + + ",doccode,doceditionid,ishistory,approveType,readoptercanprint,invalidationdate,docvaliduserid,docvaliddate,docvalidtime," + + "docpubuserid,docpubdate,docpubtime,docreopenuserid,docreopendate,docreopentime," + + "docinvaluserid,docinvaldate,docinvaltime,doccanceluserid,doccanceldate,doccanceltime" + + +",docCreaterType,docLastModUserType,docApproveUserType,docValidUserType,docInvalUserType" + +",docArchiveUserType,docCancelUserType,docPubUserType,docReopenUserType,ownerType" + + +",hasUsedTemplet" + +",canPrintedNum,editMouldId,orderable" + +",secretLevel" + +",secretValidity" + +",replyremind" + + + ") " + + "select " + this.id + "," + (this.maincategory==0?"maincategory":this.maincategory) + "," + (this.subcategory==0?"subcategory":this.subcategory) + "," + (this.seccategory==0?"seccategory":this.seccategory) + + ",doclangurage,docapprovable,docreplyable,isreply,replydocid," + + "docsubject,doccontent,docpublishtype,itemid,itemmaincategoryid," + + "hrmresid,crmid,projectid,financeid,doccreaterid,docdepartmentid," + + "doccreatedate,doccreatetime,doclastmoduserid,doclastmoddate,doclastmodtime," + + "docapproveuserid,docapprovedate,docapprovetime,docarchiveuserid," + //+ "docarchivedate,docarchivetime,'1'," + + "docarchivedate,docarchivetime," + + docStatusString+"," + + // docstatus + "parentids,assetid,ownerid,keyword,accessorycount,replaydoccount," + + "usertype ,doctype,cancopy,canremind,docextendname" + + + ",doccode,doceditionid,ishistory,approveType,readoptercanprint,invalidationdate,docvaliduserid,docvaliddate,docvalidtime," + + "docpubuserid,docpubdate,docpubtime,docreopenuserid,docreopendate,docreopentime," + + "docinvaluserid,docinvaldate,docinvaltime,doccanceluserid,doccanceldate,doccanceltime" + + +",docCreaterType,docLastModUserType,docApproveUserType,docValidUserType,docInvalUserType" + +",docArchiveUserType,docCancelUserType,docPubUserType,docReopenUserType,ownerType" + + +",hasUsedTemplet" + +",canPrintedNum,editMouldId,orderable" + +",secretLevel" + +",secretValidity" + +",replyremind" + + + " from DocDetail where id = " + oldid; + //writeLog(sql); + rs.executeSql(sql); + // 执行触发器docdetail_getpinyin + DocTriggerUtils docTriggerUtils = new DocTriggerUtils(); + docTriggerUtils.docdetail_getpinyin(rs); + sql = "insert into DocDummyDetail(catelogid,docid,importdate,importtime,publicdate,publictime,status) select catelogid,"+this.id + +",importdate,importtime,publicdate,publictime,status from DocDummyDetail where docid="+oldDocId; + rs.execute(sql); + } + + //copy主题图片 + rs.executeQuery("select themeshowpic from DocDetail where id=?",oldDocId); + if(rs.next()){ + int themeshowpic = rs.getInt("themeshowpic"); + if(themeshowpic > 0){ + int newthemeshowpic = ImageFileManager.copyImageFile(themeshowpic); + if(newthemeshowpic > 0){ + rs.executeUpdate("update DocDetail set themeshowpic=? where id=?",newthemeshowpic,this.id); + } + } + } + + RecordSet rsIn=new RecordSet(); //reply doc + //rs.executeSql("select id,parentids from docdetail where ','+parentids+',' like '%,"+oldid+",%'"); + if(isoracle){ + rs.executeSql("select id,parentids from docdetail where ','||parentids||',' like '%,"+oldid+",%'"); + }else{ + rs.executeSql("select id,parentids from docdetail where ','+parentids+',' like '%,"+oldid+",%'"); + } + while(rs.next()){ + String newParentids=""; + String tempId=Util.null2String(rs.getString(1)); + String oldParentids=Util.null2String(rs.getString(2)); + + ArrayList oPList=Util.TokenizerString(oldParentids, ","); + for(int i=0;i oldFileidArr = getImgByContent(newDocContent); + + if(copyfile){ + // 写文档附件信息 + + int imagefileid = 0; + String imagefilename = ""; + String imagefiledesc = ""; + int imagefilewidth = 0; + int imagefileheight = 0; + int imagefielsize = 0; + String docfiletype = ""; + int imagefileused = 0; + String versionid = ""; + String versionDetail = ""; + String isextfile = ""; + String hasUsedTemplet = ""; + int isaesencrypt = 0; + String aescode = ""; + String operateuserid = ""; + String operatedate = ""; + String operatetime = ""; + + + String sqlstr = "select * from docimagefile where docid=" + oldid + " and imagefileid not in (select imagefiledesc from docimagefile where docid = -"+oldid+") "; + deleteaccessory=this.getAllDeleteaccessory(oldid,deleteaccessory); + if(deleteaccessory!=null&&!"".equals(deleteaccessory)){ + sqlstr+=" and imagefileid not in (" + deleteaccessory + ")"; + } + //sqlstr+=" order by id asc,versionId desc "; + if(isLatestOnly){ + sqlstr+=" order by id asc,versionId desc "; + }else{ + sqlstr+=" order by id asc,versionId asc "; + } + //boolean hasFirst=false; + int oldDocImageFileId=0; + ArrayList oldDocImageFileIdList=new ArrayList(); + Map docimagefileidMap=new HashMap(); + Map oldFileidMap = new HashMap<>(); + rs.executeSql(sqlstr); + //用来记录html正文中的图片新生成的图片id + Map newfileidmap = new HashMap<>(); + while (rs.next()) { + + oldDocImageFileId = rs.getInt("id"); + if(isLatestOnly&&oldDocImageFileIdList.indexOf(""+oldDocImageFileId)>=0){ + continue; + } + + //int docimagefileid = imgManger.getNextDocImageFileId(); + int docimagefileid=Util.getIntValue((String)docimagefileidMap.get(""+oldDocImageFileId),-1); + if(docimagefileid<=0){ + docimagefileid = imgManger.getNextDocImageFileId(); + docimagefileidMap.put(""+oldDocImageFileId,""+docimagefileid); + } + + RecordSet rs1 = new RecordSet(); + docfiletype = rs.getString("docfiletype"); + if(copyReallyFile){ + + imagefileid = rs.getInt("imagefileid"); + int oldfileidval = imagefileid; + int imageid =ImageFileManager.copyImageFile(imagefileid); + if(imageid>0) { + + + +// rs1.executeProc("SequenceIndex_SelectVersionId", ""); +// if (rs1.next()) { +// versionid = rs1.getString(1); +// } + versionid=""+versionIdUpdate.getVersionNewId(); + + if(imageFileIdOfPicChangeList!=null){ + Map imageFileIdOfPicChangeMap=new HashMap(); + imageFileIdOfPicChangeMap.put("oldImageFileId",""+imagefileid); + imageFileIdOfPicChangeMap.put("newImageFileId",""+imageid); + imageFileIdOfPicChangeList.add(imageFileIdOfPicChangeMap); + } + + imagefileid = imageid; + } + if("1".equals(docfiletype) || "11".equals(docfiletype)){ + newfileidmap.put(oldfileidval+"",imagefileid+""); + for(int j=0;j entry : oldFileidMap.entrySet()){ + + if(entry.getKey().equals(oldfileval1) && entry.getKey().equals(oldfileval1)){ + newDocContent = newDocContent.replaceAll(oldfileval1,entry.getValue()); + } + } + } + if (isoracle || ismysql) { + recorder.executeUpdate("update DocDetailContent set doccontent=? where docid=?", newDocContent, this.id); + }else{ + recorder.executeUpdate("update DocDetail set doccontent=? where id=?",newDocContent,""+this.id); + } + } + if(copyRight){ + // 写文档共享信息 + rs.executeProc("DocShare_SelectByDocId", "" + oldid); + while (rs.next()) { + String ProcPara = ""; + char flag = 2; + String docid = "" + this.id; + String sharetype = Util.null2String(rs.getString("sharetype")); + String seclevel = Util.null2String(rs.getString("seclevel")); + String rolelevel = Util.null2String(rs.getString("rolelevel")); + String sharelevel = Util.null2String(rs.getString("sharelevel")); + String userid = Util.null2String(rs.getString("userid")); + String subcompanyid = Util.null2String(rs.getString("subcompanyid")); + String departmentid = Util.null2String(rs.getString("departmentid")); + String roleid = Util.null2String(rs.getString("roleid")); + String foralluser = Util.null2String(rs.getString("foralluser")); + String crmid = Util.null2String(rs.getString("crmid")); + String orgGroupId = Util.null2String(rs.getString("orgGroupId")); + + String sharesource = Util.null2String(rs.getString("sharesource")); + String isSecDefaultShare = Util.null2String(rs.getString("isSecDefaultShare")); + + + int orgid = Util.getIntValue(rs.getString("orgid"),0); + int seclevelmax = Util.getIntValue(rs.getString("seclevelmax"),255); + int includesub = Util.getIntValue(rs.getString("includesub"),0); + int allmanagers = Util.getIntValue(rs.getString("allmanagers"),0); + + String joblevel=Util.getIntValue(rs.getString("joblevel"),0)+""; + String jobdepartment=Util.getIntValue(rs.getString("jobdepartment"),0)+""; + String jobsubcompany=Util.getIntValue(rs.getString("jobsubcompany"),0)+""; + String jobids=Util.getIntValue(rs.getString("jobids"),0)+""; + + + ProcPara = docid; + ProcPara += flag + sharetype; + ProcPara += flag + seclevel; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userid; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmid; // CRMID + ProcPara += flag + orgGroupId; // orgGroupId + + //recorder.executeProc("DocShare_IFromDocSecCategory", ProcPara); + /** TD12005 =========文档下载权限 开始=============*/ + String downloadlevel = String.valueOf(Util.getIntValue(rs.getString("downloadlevel"), 0));//TD12005 + ProcPara += flag + downloadlevel; // 文档下载权限 + /** TD12005 =========文档下载权限 结束=============*/ + recorder.executeProc("DocShare_IFromDocSecCat_G", ProcPara); + + if (!"".equals(isSecDefaultShare)) { + if(recorder.next()){ + String newid = Util.null2String(recorder.getString(1)); + RecordSet tmpcopyrs = new RecordSet(); + tmpcopyrs.executeSql("update docshare set isSecDefaultShare=" + isSecDefaultShare + ",allmanagers='"+allmanagers+"',includesub='"+includesub+"', orgid='"+orgid+"',seclevelmax='"+seclevelmax+"',joblevel='"+joblevel+"',jobdepartment='"+jobdepartment+"',jobsubcompany='"+jobsubcompany+"',jobids='"+jobids+"' where id=" + + newid); + if(!"".equals(sharesource)){ + tmpcopyrs.executeSql("update docshare set sharesource="+sharesource+" where id="+ newid); + } + } + }else{ + + if(recorder.next()){ + String newid = Util.null2String(recorder.getString(1)); + RecordSet tmpcopyrs = new RecordSet(); + tmpcopyrs.executeSql("update docshare set allmanagers='"+allmanagers+"',includesub='"+includesub+"', orgid='"+orgid+"',seclevelmax='"+seclevelmax+"',joblevel='"+joblevel+"',jobdepartment='"+jobdepartment+"',jobsubcompany='"+jobsubcompany+"',jobids='"+jobids+"' where id=" + + newid); + if(!"".equals(sharesource)){ + tmpcopyrs.executeSql("update docshare set sharesource="+sharesource+" where id="+ newid); + } + } + + + + } + + + } + dv.setDocShareByDoc("" + this.id); + } + + //复制自定义信息 + if(customDataIdMapping==null || customDataIdMapping.length == 0) { + CustomFieldManager cfm = new CustomFieldManager("DocCustomFieldBySecCategory", this.seccategory); + cfm.getCustomFields(); + String nameStr = ""; + while (cfm.next()) { + nameStr += "," + cfm.getFieldName(""+cfm.getId()); + } + if (!nameStr.equals("")) { + nameStr = nameStr.substring(1); + + sql = "insert into cus_fielddata(scope,scopeid,id," + nameStr + ") " + +" select 'DocCustomFieldBySecCategory'," + this.seccategory + "," + this.id+ "," + nameStr + + " from cus_fielddata where scope='DocCustomFieldBySecCategory' and id="+oldid; + //System.out.println("sql = " + sql);//test + rs.executeSql(sql); + } + } else { + String srcNameStr = ""; + List srcNameList=new ArrayList(); + int srcFieldId=-1; + String srcFieldValue=null; + String srcFieldShowName=null; + + String objNameStr = ""; + List objNameList=new ArrayList(); + int objFieldId=-1; + String objFieldValue=null; + String cusFieldDataObjSql=null; + String cusFieldDataObjStr=""; + + Map objNameSrcNameMap=new HashMap(); + Map srcFieldValueAndFieldShowNameMap=null; + RecordSet rsCus=new RecordSet(); + //customDataIdMapping = removedouble(customDataIdMapping); + for(int i=0;i=0&&fieldDbType.indexOf(")")>fieldDbType.indexOf("(")+1){ + fieldLength=Util.getIntValue(fieldDbType.substring(fieldDbType.indexOf("(")+1,fieldDbType.indexOf(")")),0); + } + if(fieldLength>0){ + cusFieldDataObjStr += ",'" + Util.toHtml100(interceptString(objFieldValue,fieldLength)) + "'"; + }else{ + cusFieldDataObjStr += ",'" + Util.toHtml100(objFieldValue) + "'"; + } + } else { + if(fieldHtmlType.equals("5")){ + objFieldValue=this.getNewSelectValue(srcFieldShowName,objFieldValue,objFieldId); + } + cusFieldDataObjStr += ","+Util.getIntValue(objFieldValue,-1); + } + + } + + if (!cusFieldDataObjStr.equals("")) { + cusFieldDataObjStr = cusFieldDataObjStr.substring(1); + cusFieldDataObjSql += "(scope,scopeid,id," + objNameStr + ") values('DocCustomFieldBySecCategory'," + this.seccategory + "," + this.id + + "," + cusFieldDataObjStr + ")"; + rs.executeSql(cusFieldDataObjSql); + } + } + } + } + + public static String[] removedouble(String[] arrStr) { + String[] result = null; + List list = new ArrayList(); + for (int i = 0; i < arrStr.length; i++) { + if (!list.contains(arrStr[i])) { + list.add(arrStr[i]); + } + } + // 返回一个包含所有对象的指定类型的数组 + if (list.size() >= 1) { + result = list.toArray(new String[1]); + } + return result; + } + public static List getImgByContent(String content){ + List lists = new ArrayList(); + List resultLists = new ArrayList(); + + if(content == null || content.isEmpty()) return lists; + + + String reg = "/weaver/weaver.file.FileDownload\\?fileid=([0-9A-Za-z]+)"; + Pattern pattern = Pattern.compile(reg); + Matcher matcher = pattern.matcher(content); + while(matcher.find()){ + lists.add(matcher.group()); + } + for (int i=0;i '1' and docfiletype <> '11') where id = " + this.id); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("16"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + } + + + + /** + * 存储文档内容 + * + * @param request 一个HttpServletRequest对象存储了文档地所有信息 + * @return 文档的操作类型 + * @throws Exception 抛出异常 + */ + public String UploadDoc(HttpServletRequest request) throws Exception { + + String opera = ""; + String docmain = ""; + RecordSet rsSql = new RecordSet(); + + try { + FileUpload fu = new FileUpload(request); + + this.fileUpload=fu; + + // add by 王金永 + // 1 代表html类型;2代表 world 或者 excel 类型 + opera = fu.getParameter("operation"); + + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + + this.source = Util.null2String(fu.getParameter("source")); + + // 新建时候的进行的操作 + if (opera.equals("addsave") || opera.equals("adddraft") || opera.equals("addpreview")) { + + addDoc(fu,opera); + + } else if (opera.equals("editsave") || opera.equals("editdraft") || opera.equals("editpreview")) { + + editDoc(fu,opera); + + } else if (opera.equals("publish")) { + + publishDoc(fu); + + } else if (opera.equals("invalidate")) { + + invalidateDoc(fu); + + } else if (opera.equals("archive")) { + + archiveDoc(fu); + + } else if (opera.equals("cancel")) { + + cancelDoc(fu); + + } else if (opera.equals("reopen")) { + + reopenDoc(fu); + + } else if (opera.equals("reload")) { + // 刷新时进行的操作 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + this.docsubject = fu.getParameter("docsubject"); + this.docsubject = interceptString(this.docsubject,400); + //this.docapprovable = Util.null2String(fu.getParameter("docapprovable")); + //if (docapprovable.equals("1")) { + if(scc.needApprove(this.seccategory)) {//如果需要审批 + this.docstatus = "2"; + } else { + this.docstatus = "1"; + } + + ReloadDocInfo(); + /* + } else if (opera.equals("reopen")) { + // 从新打开时进行的操作 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + this.docsubject = fu.getParameter("docsubject"); + + this.docstatus = "0"; + + ReopenDocInfo(); + */ + } else if (opera.equals("delete")) { + RecordSet rs_del=new RecordSet(); + int docsrecycle=0; + rs_del.executeSql("select propvalue from doc_prop where propkey='docsrecycle' "); + if(rs_del.next()){ + docsrecycle=rs_del.getInt("propvalue"); + } + User recycleuser=new User(userid); + if(docsrecycle==1&&"1".equals(recycleuser.getLogintype())){//开启回收站 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + DocRecycleManager docRecycleManager=new DocRecycleManager(); + docRecycleManager.moveDocToRecycle(userid, this.usertype, this.id, this.clientip); + }else{ + // 删除此文档的操作 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + // add by wjy for delete custom data + deleteCustomData(this.id); + + /* 需要注意删除该文档所有图片时候的情况 */ + + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.DeleteAllDocImageInfo(); + + this.docsubject = fu.getParameter("docsubject"); + this.docsubject = interceptString(this.docsubject,400); + + this.doccontent = Util.fromBaseEncoding(fu.getParameter("doccontent"), languageid); + this.doccontent =Util.htmlFilter4UTF8(this.doccontent ); + + //DeleteReplayDocCount(); // 需对前级文档的回复文档记录数减1,才可删此文档(DeleteDocInfo()实现) + DeleteDocInfo(); + deleteHrmContract(); + } + + } else if (opera.equals("delpic")) { + // 删除图片时进行的操作 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + int imgid = Util.getIntValue(Util.getFileidOut(fu.getParameter("delimgid")), 0); + String sql = "delete from docimagefile where imagefileid=" + imgid + " and docid = " + this.id; + rsSql.executeSql(sql); + + imgManger.resetParameter(); + imgManger.setImagefileid(imgid); + imgManger.setDocid(this.id); + imgManger.DeleteSingleDocImageInfo(); + //更新附件数 isextfile = '1' 是附件条件 TD8782 + rsSql.executeSql("update docdetail set accessorycount = (select count(distinct id) from DocImageFile where isextfile = '1' and docid = " + this.id + " and docfiletype <> '1' and docfiletype <> '11') where id = " + this.id); + + }else if(opera.equals("checkOut")){ + //签出 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + rsSql.executeSql("select 1 from DocDetail where id="+this.id+" and ((checkOutStatus<>'1' and checkOutStatus<>'2')or checkOutStatus is null)"); + if(!rsSql.next()){ + return opera; + } + + + Calendar today = Calendar.getInstance(); + String formatDate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formatTime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + //rs.executeSql("update DocDetail set checkOutStatus='1',checkOutUserId="+this.userid+",checkOutUserType='"+this.usertype+"',checkOutDate='"+formatDate+"',checkOutTime='"+formatTime+"' where id="+this.id); + rsSql.executeSql("update DocDetail set checkOutStatus='2',checkOutUserId="+this.userid+",checkOutUserType='"+this.usertype+"',checkOutDate='"+formatDate+"',checkOutTime='"+formatTime+"' where id="+this.id); + + this.opreateType = Util.null2String(fu.getParameter("opreateType"));//1:内部 2:外部 + if ("".equals(opreateType)) { + this.opreateType = this.usertype; + } + rsSql.executeSql("select docSubject,docCreaterId,docCreaterType from DocDetail where id="+this.id); + if(rsSql.next()){ + this.docsubject=Util.null2String(rsSql.getString("docSubject")); + this.docsubject = interceptString(this.docsubject,400); + this.doccreaterid=Util.getIntValue(rsSql.getString("docCreaterId"),0); + docCreaterType=Util.null2String(rsSql.getString("docCreaterType")); + } + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("17"); + log.setOperateUserid(userid); + log.setUsertype(this.opreateType); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + }else if(opera.equals("checkIn")){ + //签入 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + rsSql.executeSql("select 1 from DocDetail where id="+this.id+" and (checkOutStatus='1' or checkOutStatus='2')"); + if(!rsSql.next()){ + return opera; + } + + rsSql.executeSql("update DocDetail set checkOutStatus='0',checkOutUserId=-1,checkOutUserType='',checkOutDate='',checkOutTime='' where id ="+this.id); + + this.opreateType = Util.null2String(fu.getParameter("opreateType"));//1:内部 2:外部 + if ("".equals(opreateType)) { + this.opreateType = this.usertype; + } + rsSql.executeSql("select docSubject,docCreaterId,docCreaterType from DocDetail where id="+this.id); + if(rsSql.next()){ + this.docsubject=Util.null2String(rsSql.getString("docSubject")); + this.docsubject = interceptString(this.docsubject,400); + this.doccreaterid=Util.getIntValue(rsSql.getString("docCreaterId"),0); + docCreaterType=Util.null2String(rsSql.getString("docCreaterType")); + } + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("19"); + log.setOperateUserid(userid); + log.setUsertype(this.opreateType); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + }else if(opera.equals("useTemplet")){ + //套红 + this.id = Util.getIntValue(fu.getParameter("id"), 0); + this.topage = Util.null2String(fu.getParameter("topage")); + this.docstatus = fu.getParameter("docstatus"); + this.oldstatus = docstatus; + editDoc(fu,opera); + rsSql.executeSql("update DocDetail set hasUsedTemplet='1' where id ="+this.id); + //rs.executeSql("update docimagefile set docId=-docId where docId<0 and docId=-"+this.id); + } + + + // 判断新建的是不是个人文档 + String from = Util.null2String(fu.getParameter("from")); + String userId = Util.null2String(fu.getParameter("userId")); + if ("personalDoc".equals(from)) { + DocUserSelfUtil dusu = new DocUserSelfUtil(); + String userCatalogId = Util.null2String(fu.getParameter("userCategory")); + String userType = Util.null2String(fu.getParameter("userType")); + + if(opera.equals("addsave")){ + // 修改表DocUserselfDocs + String strSql = "insert into DocUserselfDocs (docid,usercatalogid,userid,doctype,usertype) values (" + + id + "," + userCatalogId + "," + userId + "," + docType + "," + userType + ")"; + rsSql.executeSql(strSql); + dusu.writDocShare("" + id, userId, userType, "2"); + } + + setUserCatalogId(userCatalogId); + opera = "addPersonalDoc"; + } + } catch (Exception e) { + writeLog(e); + return opera + "_1"; + } + // 返回进行的操作类型 + return opera; + + } + + /** + * 存储文档内容 + * + * @param fu 一个FileUpload对象存储了文档地所有信息 + * @param createrid 创建者ID + * @param doccontent 文档内容 + * @param userneed 附件个数 + * @return 文档的操作类型 + * @throws Exception + */ + public String UploadDocHtmlAndFile(FileUpload fu, int createrid, String doccontent, int userneed) throws Exception { + String opera = ""; + String docmain = ""; + RecordSet rsSql = new RecordSet(); + ResourceComInfo rc = new ResourceComInfo(); + try { + + this.id = getNextDocId(rsSql); + int accessorynum = userneed; + String[] needuploads = new String[accessorynum]; + + for (int i = 0; i < accessorynum; i++) { + needuploads[i] = "accessory" + (i + 1); + } + + String[] fileids = fu.uploadFiles(needuploads); + String[] filenames = fu.getFileNames(); + + int accessorynumtrue = 0; + + for (int i = 0; i < accessorynum; i++) { + if (Util.getIntValue(fileids[i], 0) == 0) + continue; + accessorynumtrue++; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids[i], 0)); + imgManger.setImagefilename(filenames[i]); + imgManger.setDocfiletype("2"); + imgManger.setIsextfile("1"); + imgManger.AddDocImageInfo(); + } + + int docimages_num = Util.getIntValue(fu.getParameter("docimages_num"), 0); + + needuploads = new String[docimages_num]; + for (int i = 0; i < docimages_num; i++) { + needuploads[i] = "docimages_" + i; + } + + fileids = fu.uploadFiles(needuploads); + filenames = fu.getFileNames(); + for (int i = 0; i < docimages_num; i++) { + if (Util.getIntValue(fileids[i], 0) == 0) + continue; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids[i], 0)); + imgManger.setImagefilename(filenames[i]); + imgManger.setDocfiletype("1"); + imgManger.AddDocImageInfo(); + } + + int tmppos = doccontent.indexOf("src="); + while (tmppos != -1) { + int startpos = doccontent.indexOf("\"", tmppos); + int endpos = doccontent.indexOf("\"", startpos + 1); + String tempStr = doccontent.substring(startpos + 1, endpos); + + for (int i = 1; i < docimages_num; i++) { + if (tempStr.indexOf(filenames[i]) != -1) { + String replaceStr = weaver.general.GCONST.getContextPath()+"/weaver/weaver.file.FileDownload?fileid=" + fileids[i]; + doccontent = Util.StringReplace(doccontent, tempStr, replaceStr); + + } + } + + tmppos = doccontent.indexOf("src=", endpos); + } + + doccontent = Util.toScreen(doccontent, 7, "0"); + // System.out.println("doccontent" + doccontent) ; + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.maincategory = Util.getIntValue(fu.getParameter("mainCatoryid"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subCatoryid"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("secCatoryid"), 0); + this.doclangurage = 7; + this.docapprovable = "0"; + this.docreplyable = fu.getParameter("docreplyable"); + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.docsubject = fu.getParameter("docSubject"); + this.docsubject = interceptString(this.docsubject,400); + this.doccontent = doccontent; + this.docpublishtype = "0"; + if (docpublishtype.equals("2")) { + //docmain = fu.getParameter("docmain"); + docmain = Util.toHtml2(Util.encodeAnd(Util.null2String(fu.getParameter("docmain")))); + this.doccontent = docmain + "!@#$%^&*" + this.doccontent; + } + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.ownerid = createrid; + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = createrid; + this.docdepartmentid = Util.getIntValue(rc.getDepartmentID("" + createrid), 0); + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.userid; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docarchivedate = ""; + this.docarchivetime = ""; + + this.docstatus = Util.null2String(fu.getParameter("docStatus")); + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + int docid = this.id; + + this.accessorycount = accessorynumtrue; + + if (isreply.equals("1")) { + AddReplayDocCount(rsSql); // 修改回复记录条数 + } + + this.replaydoccount = 0; /* 回复文档总数 */ + this.usertype = "1"; /* 创建的用户类型 1: 内部 2: 外部 */ + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.orderable = "" + scc.getSecOrderable(this.seccategory); + AddDocInfo(); + AddShareInfo(); + if (!contractman.equals("")) { + addHrmContract(); + } + + String note = Util.null2String(fu.getParameter("note")); + String sql_note = "update docdetail set note = '" + note + "' where id =" + id; + rsSql.executeSql(sql_note); + + DocViewer DocViewer = new DocViewer(); + DocViewer.setDocShareByDoc("" + id); + + } catch (Exception e) { + writeLog(e); + return "err_Exception"; + } + + return "err_uploadSuccess"; + + } + + /** + * 存储文档内容 + * + * @param fu 一个FileUpload对象存储了文档地所有信息 + * @param docid_html 文档ID + */ + public void UploadImage(FileUpload fu, String docid_html) { + + String opera = ""; + String doccontent = " "; + String docmain = ""; + String newdoccontent = ""; + // rs = new RecordSet(); + + int docimages_num = Util.getIntValue(fu.getParameter("docimages_num"), 0); + this.id = Util.getIntValue(docid_html); + String[] needuploads = new String[docimages_num]; + for (int i = 0; i < docimages_num; i++) { + needuploads[i] = "docimages_" + i; + } + + String[] fileids = fu.uploadFiles(needuploads); + String[] filenames = fu.getFileNames(); + for (int i = 0; i < docimages_num; i++) { + if (Util.getIntValue(fileids[i], 0) == 0) + continue; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids[i], 0)); + imgManger.setImagefilename(filenames[i]); + imgManger.setDocfiletype("1"); + imgManger.AddDocImageInfo(); + } + } + + /** + * 存储文档内容 + * + * @param fu 一个FileUpload对象存储了文档地所有信息 + * @param createrid 创建者ID + * @return 文档的操作类型 + * @throws Exception + */ + public String UploadDoc(FileUpload fu, int createrid) throws Exception { + + String opera = ""; + String docmain = ""; + RecordSet rsSql = new RecordSet(); + + try { + opera = fu.getParameter("operation"); + + if (opera.equals("addsave") || opera.equals("adddraft")) { + + this.id = getNextDocId(rsSql); + + int accessorynum = Util.getIntValue(fu.getParameter("accessorynum"), 1); + + String filenames; + String fileids; + fileids = fu.uploadFiles("accessory1"); + filenames = fu.getFileName(); + + int accessorynumtrue = 0; + + for (int i = 0; i < accessorynum; i++) { + if (Util.getIntValue(fileids, 0) == 0) + continue; + accessorynumtrue++; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids, 0)); + imgManger.setImagefilename(filenames); + imgManger.setDocfiletype("2"); + imgManger.setIsextfile("1"); + imgManger.AddDocImageInfo(); + } + + this.doccontent = Util.fromBaseEncoding(fu.getParameter("doccontent"), languageid); + this.doccontent =Util.htmlFilter4UTF8(this.doccontent ); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + this.doclangurage = Util.getIntValue(fu.getParameter("doclangurage"), 7); + this.docapprovable = fu.getParameter("docapprovable"); + this.docreplyable = fu.getParameter("docreplyable"); + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.docsubject = fu.getParameter("docsubject"); + this.docsubject = interceptString(this.docsubject,400); + this.docpublishtype = "0"; + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = createrid; + this.ownerid = this.doccreaterid; + + ResourceComInfo rc = new ResourceComInfo(); + this.docdepartmentid = Util.getIntValue(rc.getDepartmentID("createrid"), 0); + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.doccreaterid; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docarchivedate = ""; + this.docarchivetime = ""; + + String tmpstatus = "0"; + if (tmpstatus.equals("1") && docapprovable.equals("1") && !isreply.equals("1")) { // 是保存的非回复文档,要审批,还没有审批的(isreply可能为空),置为需审批状态 + tmpstatus = "3"; + } + if (tmpstatus.equals("1") && isreply.equals("1")) { // 是保存的回复文档的(是不要审批,直接置成1) + tmpstatus = "1"; + } + this.docstatus = tmpstatus; + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + int docid = this.id; + + this.accessorycount = accessorynumtrue; + + if (isreply.equals("1")) { + AddReplayDocCount(rsSql); // 修改回复记录条数 + } + + this.replaydoccount = 0; /* 回复文档总数 */ + this.usertype = Util.null2String(fu.getParameter("usertype")); + /* 创建的用户类型 1: 内部 2: 外部 */ + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.orderable = "" + scc.getSecOrderable(this.seccategory); + AddDocInfo(); + AddShareInfo(); + } + } catch (Exception e) { + writeLog(e); + return opera + "_1"; + } + + return opera; + + } + + /** + * 存储文档内容 + * + * @param userName 用户ID + * @param passwd 用户密码 + * @param docSubject 文档主题 + * @param mainCatory 主目录ID + * @param secCatory 分目录ID + * @param subCatory 子目录ID + * @param content 文档内容 + * @param filenames 上传附件文本框的名称 + * @param req HttpServletRequest 对象 + * @param res HttpServletResponse 对象 + * @param fu FileUpload对象存储了文档地所有信息 + * @param creatid 创建者ID + * @param docStatus 文档状态 + * @return 文档的操作类型 + * @throws Exception + */ + public String UploadDoc(String userName, String passwd, String docSubject, String mainCatory, String secCatory, + String subCatory, String content, String filenames, HttpServletRequest req, HttpServletResponse res, + FileUpload fu, int creatid, String docStatus) throws Exception { + + String opera = ""; + String docmain = ""; + RecordSet rsSql = new RecordSet(); + // System.out.println("creatid is " +creatid) ; + + try { + opera = "addsave"; + + if (opera.equals("addsave") || opera.equals("adddraft")) { + + this.id = getNextDocId(rsSql); + + int accessorynum = 1; + String fileids; + fileids = "0"; + + int accessorynumtrue = 0; + + for (int i = 0; i < accessorynum; i++) { + if (Util.getIntValue(fileids, 0) == 0) + continue; + accessorynumtrue++; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids, 0)); + imgManger.setImagefilename(filenames); + imgManger.setDocfiletype("2"); + imgManger.setIsextfile("1"); + imgManger.AddDocImageInfo(); + } + + this.doccontent = Util.toScreen(content, 7, "0"); + // System.out.println("newcontent is " +doccontent) ; + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.maincategory = Util.getIntValue(mainCatory, 0); + this.subcategory = Util.getIntValue(secCatory, 0); + this.seccategory = Util.getIntValue(subCatory, 0); + this.doclangurage = 7; + this.docapprovable = " "; + this.docreplyable = " "; + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.docsubject = docSubject; + this.docsubject = interceptString(this.docsubject,400); + // System.out.println("docsubject is :" + docsubject) ; + + this.docpublishtype = "0"; + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = creatid; + this.ownerid = this.doccreaterid; + + ResourceComInfo rc = new ResourceComInfo(); + this.docdepartmentid = Util.getIntValue(rc.getDepartmentID("" + creatid), 0); + // System.out.println(docdepartmentid) ; + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.doccreaterid; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docarchivedate = ""; + this.docarchivetime = ""; + + /* + * String tmpstatus = "0" ; if(tmpstatus.equals("1") && docapprovable.equals("1") && + * !isreply.equals("1"))//是保存的非回复文档,要审批,还没有审批的(isreply可能为空),置为需审批状态 {tmpstatus="3";} + * if(tmpstatus.equals("1") && isreply.equals("1"))//是保存的回复文档的(是不要审批,直接置成1) {tmpstatus="1";} + */ + this.docstatus = docStatus; + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + int docid = this.id; + + this.accessorycount = accessorynumtrue; + + if (isreply.equals("1")) { + AddReplayDocCount(rsSql); // 修改回复记录条数 + } + + this.replaydoccount = 0; /* 回复文档总数 */ + this.usertype = "1"; /* 创建的用户类型 1: 内部 2: 外部 */ + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.orderable = "" + scc.getSecOrderable(this.seccategory); + AddDocInfo(); + AddShareInfo(); + } + } catch (Exception e) { + writeLog(e); + return opera + "_1"; + } + + return opera; + // System.out.println("doccontent is :" + doccontent) ; + + } + + /** + * 上传文档到一个文件 + * + * @param userName 用户ID + * @param passwd 用户密码 + * @param docSubject 文档主题 + * @param mainCatory 主目录ID + * @param secCatory 分目录ID + * @param subCatory 子目录ID + * @param content 文档内容 + * @param filenames 上传附件文本框的名称 + * @param req HttpServletRequest 对象 + * @param res HttpServletResponse 对象 + * @param fu FileUpload对象存储了文档地所有信息 + * @param creatid 创建者ID + * @param docStatus 文档状态 + * @param isNeedReturnDocid 是否需要返回文档ID + * @param note 文档的备注信息 + * @return 文档的操作类型 + * @throws Exception + */ + public String UploadDocToFile(String userName, String passwd, String docSubject, String mainCatory, + String subCatory, String secCatory, String content, String filenames, HttpServletRequest req, + HttpServletResponse res, FileUpload fu, int createrid, String docStatus, boolean isNeedReturnDocid, + String note) throws Exception { + + String opera = ""; + String docmain = ""; + RecordSet rsSql = new RecordSet(); + + try { + opera = "addsave"; + + if (opera.equals("addsave") || opera.equals("adddraft")) { + + this.id = getNextDocId(rsSql); + + //writeLog(" doc id is " + id); + + int accessorynum = 1; + + String fileids; + fileids = fu.uploadFiles("accessory1"); + filenames = fu.getFileName(); + + //writeLog(" fileids is " + fileids); + //writeLog(" filenames is " + filenames); + + int accessorynumtrue = 0; + + for (int i = 0; i < accessorynum; i++) { + if (Util.getIntValue(fileids, 0) == 0) + continue; + accessorynumtrue++; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids, 0)); + imgManger.setImagefilename(filenames); + imgManger.setDocfiletype("2"); + imgManger.setIsextfile("1"); + imgManger.AddDocImageInfo(); + } + + this.doccontent = Util.fromBaseEncoding(fu.getParameter("doccontent"), languageid); + this.doccontent =Util.htmlFilter4UTF8(this.doccontent ); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.maincategory = Util.getIntValue(mainCatory); + this.subcategory = Util.getIntValue(subCatory); + this.seccategory = Util.getIntValue(secCatory); + this.doclangurage = 7; + this.docapprovable = "0"; + this.docreplyable = fu.getParameter("docreplyable"); + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.docsubject = docSubject; + this.docsubject = interceptString(this.docsubject,400); + + this.docpublishtype = "0"; + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = createrid; + this.ownerid = this.doccreaterid; + + ResourceComInfo rc = new ResourceComInfo(); + this.docdepartmentid = Util.getIntValue(rc.getDepartmentID("" + createrid), 0); + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.doccreaterid; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docarchivedate = ""; + this.docarchivetime = ""; + + String tmpstatus = "0"; + if (tmpstatus.equals("1") && docapprovable.equals("1") && !isreply.equals("1")) { // 是保存的非回复文档,要审批,还没有审批的(isreply可能为空),置为需审批状态 + tmpstatus = "3"; + } + if (tmpstatus.equals("1") && isreply.equals("1")) { // 是保存的回复文档的(是不要审批,直接置成1) + tmpstatus = "1"; + } + this.docstatus = docStatus; + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + /* + * if (isNeedReturnDocid) { return ""+docid ; } + */ + + this.accessorycount = accessorynumtrue; + + if (isreply.equals("1")) { + AddReplayDocCount(rsSql); // 修改回复记录条数 + } + + this.replaydoccount = 0; /* 回复文档总数 */ + this.usertype = "1"; /* 创建的用户类型 1: 内部 2: 外部 */ + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.orderable = "" + scc.getSecOrderable(this.seccategory); + AddDocInfo(); + AddShareInfo(); + + } + } catch (Exception e) { + writeLog(e); + return ""; + } + + return "" + id; + + } + + /** + * 上传文档到一个文件 + * + * @param userName 用户ID + * @param passwd 用户密码 + * @param docSubject 文档主题 + * @param mainCatory 主目录ID + * @param secCatory 分目录ID + * @param subCatory 子目录ID + * @param content 文档内容 + * @param filenames 上传附件文本框的名称 + * @param req HttpServletRequest 对象 + * @param res HttpServletResponse 对象 + * @param fu FileUpload对象存储了文档地所有信息 + * @param creatid 创建者ID + * @param docStatus 文档状态 + * @param isNeedReturnDocid 是否需要返回文档ID + * @param note 文档的备注信息 + * @return 文档的操作类型 + * @throws Exception + */ + public String UploadDocToContent(String userName, String passwd, String docSubject, String mainCatory, + String subCatory, String secCatory, String content, String filenames, HttpServletRequest req, + HttpServletResponse res, FileUpload fu, int creatid, String docStatus, String note) throws Exception { + + String opera = ""; + String docmain = ""; + RecordSet rsSql = new RecordSet(); + // System.out.println("creatid is " +creatid) ; + + try { + opera = "addsave"; + + if (opera.equals("addsave") || opera.equals("adddraft")) { + + this.id = getNextDocId(rsSql); + + //writeLog(" doc id is " + id); + + int accessorynum = 1; + String fileids; + fileids = "0"; + + + int accessorynumtrue = 0; + + for (int i = 0; i < accessorynum; i++) { + if (Util.getIntValue(fileids, 0) == 0) + continue; + accessorynumtrue++; + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileids, 0)); + imgManger.setImagefilename(filenames); + imgManger.setDocfiletype("2"); + imgManger.setIsextfile("1"); + imgManger.AddDocImageInfo(); + } + + this.doccontent = Util.toScreen(content, 7, "0"); + // System.out.println("newcontent is " +doccontent) ; + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.maincategory = Util.getIntValue(mainCatory, 0); + this.subcategory = Util.getIntValue(secCatory, 0); + this.seccategory = Util.getIntValue(subCatory, 0); + this.doclangurage = 7; + this.docapprovable = " "; + this.docreplyable = " "; + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.docsubject = docSubject; + this.docsubject = interceptString(this.docsubject,400); + // System.out.println("docsubject is :" + docsubject) ; + + this.docpublishtype = "0"; + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = creatid; + this.ownerid = this.doccreaterid; + + ResourceComInfo rc = new ResourceComInfo(); + this.docdepartmentid = Util.getIntValue(rc.getDepartmentID("" + creatid), 0); + // System.out.println(docdepartmentid) ; + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.doccreaterid; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docarchivedate = ""; + this.docarchivetime = ""; + + /* + * String tmpstatus = "0" ; if(tmpstatus.equals("1") && docapprovable.equals("1") && + * !isreply.equals("1"))//是保存的非回复文档,要审批,还没有审批的(isreply可能为空),置为需审批状态 {tmpstatus="3";} + * if(tmpstatus.equals("1") && isreply.equals("1"))//是保存的回复文档的(是不要审批,直接置成1) {tmpstatus="1";} + */ + this.docstatus = docStatus; + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + int docid = this.id; + + this.accessorycount = accessorynumtrue; + + if (isreply.equals("1")) { + AddReplayDocCount(rsSql); // 修改回复记录条数 + } + + this.replaydoccount = 0; /* 回复文档总数 */ + this.usertype = "1"; /* 创建的用户类型 1: 内部 2: 外部 */ + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.orderable = "" + scc.getSecOrderable(this.seccategory); + AddDocInfo(); + AddShareInfo(); + } + } catch (Exception e) { + writeLog(e); + return " "; + } + + return "" + id; + // System.out.println("doccontent is :" + doccontent) ; + + } + + /** + * 上传文档到一个文件2 + * + * @param userName 用户ID + * @param passwd 用户密码 + * @param docSubject 文档主题 + * @param mainCatory 主目录ID + * @param secCatory 分目录ID + * @param subCatory 子目录ID + * @param content 文档内容 + * @param filenames 上传附件文本框的名称 + * @param req HttpServletRequest 对象 + * @param res HttpServletResponse 对象 + * @param fu FileUpload对象存储了文档地所有信息 + * @param creatid 创建者ID + * @param docStatus 文档状态 + * @param isNeedReturnDocid 是否需要返回文档ID + * @param note 文档的备注信息 + */ + public void UploadDocToFile2(String userName, String passwd, String docSubject, String mainCatory, + String subCatory, String secCatory, String content, String filenames, HttpServletRequest req, + HttpServletResponse res, FileUpload fu, int creatid, String docStatus, String docid, String note) { + String docid_new = ""; + String content_new = " "; + boolean isNeedReturnDocid = true; + try { + docid_new = UploadDocToFile(userName, passwd, docSubject, mainCatory, subCatory, secCatory, content, + filenames, req, res, fu, creatid, docStatus, isNeedReturnDocid, note); + } catch (Exception e) { + //System.out.println(e.getMessage()); + writeLog(e); + } + RecordSet rsSql = new RecordSet(); + String sql_updateImagefile = "update docimagefile set docid = " + docid + " where docid =" + docid_new; + String sql_deldocdetail = "delete docdetail where id = " + docid_new; + String sql_updatedocdetail = "update docdetail set accessorycount = 1 where id =" + docid; + + rsSql.executeSql(sql_updateImagefile); + rsSql.executeSql(sql_deldocdetail); + rsSql.executeSql(sql_updatedocdetail); + + // System.out.println("sql_updateImagefile is : "+sql_updateImagefile) ; + // System.out.println("sql_deldocdetail is : "+sql_deldocdetail) ; + // System.out.println("sql_updatedocdetail is : "+sql_updatedocdetail) ; + + } + + /** + * 文档移动 + * + * @throws Exception + */ + public void moveDoc() throws Exception { + int oldsecid = dc.getDocSecCategory(id+""); + + String sql = "update DocDetail set maincategory=?,subcategory=?,seccategory=? where id = " + id; + String sqlDummy = "update DocDummyDetail set docid =? where docid="+id; + String sqllog = "update DocDetail set maincategory=" + maincategory + ",subcategory=" + subcategory + + ",seccategory=" + seccategory + " where id = " + id; + String sqlShareinnerdoc = " update shareinnerdoc set sec_category = "+seccategory +" where sourceid = "+id; + new RecordSet().executeUpdate(sqlShareinnerdoc); + RecordSet statement = new RecordSet(); + try { + statement.executeUpdate(sql,maincategory,subcategory,seccategory); + + statement.executeUpdate(sqlDummy,id); + + if(customDataIdMapping==null || customDataIdMapping.length == 0) { + RecordSet rsSql = new RecordSet(); + rsSql.executeSql("update cus_fielddata set scopeId="+this.seccategory+" where scope='DocCustomFieldBySecCategory' and id="+this.id); + int tempDocEditionId=-1; + rsSql.executeSql("select docEditionId from DocDetail where id="+this.id); + if(rsSql.next()){ + tempDocEditionId=Util.getIntValue(rsSql.getString("docEditionId")); + } + if(tempDocEditionId>0){ + rsSql.executeSql("update cus_fielddata set scopeId="+this.seccategory+" where scope='DocCustomFieldBySecCategory' and exists (select 1 from DocDetail where id=cus_fielddata.id and docEditionId="+tempDocEditionId+")"); + rsSql.executeSql("update docdetail set seccategory=" + this.seccategory+" where docEditionId="+tempDocEditionId); + } + } else { + String srcNameStr = ""; + List srcNameList=new ArrayList(); + int srcFieldId=-1; + String srcFieldValue=null; + String srcFieldShowName=null; + String cusFieldDataSrcSql=null; + String cusFieldDataSrcStr=""; + + String objNameStr = ""; + List objNameList=new ArrayList(); + int objFieldId=-1; + String objFieldValue=null; + String cusFieldDataObjSql=null; + String cusFieldDataObjStr=""; + + Map objNameSrcNameMap=new HashMap(); + Map srcFieldValueAndFieldShowNameMap=null; + + RecordSet rsCus=new RecordSet(); + //customDataIdMapping = removedouble(customDataIdMapping); + for(int i=0;i0){ + rsSql.executeSql("update docdetail set seccategory=" + this.seccategory+" where docEditionId="+tempDocEditionId); + sql = "select * from cus_fielddata where scope='DocCustomFieldBySecCategory' and scopeid=" + oldsecid + " and exists (select 1 from DocDetail where id=cus_fielddata.id and docEditionId="+tempDocEditionId+")"; + }else{ + sql = "select * from cus_fielddata where scope='DocCustomFieldBySecCategory' and scopeid=" + oldsecid + " and id="+this.id; + } + rsSql.executeSql(sql); + while(rsSql.next()){ + seqorder = Util.getIntValue(rsSql.getString("seqorder"),-1); + if(seqorder>0){ + seqorderList.add(""+seqorder); + } + } + + Map cusFormDictDataMap=new HashMap(); + rsSql.executeSql("select id,fieldDbType,fieldHtmlType,type,fieldname from cus_formdict"); + while(rsSql.next()){ + cusFormDictDataMap.put("fieldDbType"+Util.null2String(rsSql.getString("id")),Util.null2String(rsSql.getString("fieldDbType"))); + cusFormDictDataMap.put("fieldHtmlType"+Util.null2String(rsSql.getString("id")),Util.null2String(rsSql.getString("fieldHtmlType"))); + cusFormDictDataMap.put("type"+Util.null2String(rsSql.getString("id")),Util.null2String(rsSql.getString("type"))); + cusFormDictDataMap.put("fieldName"+Util.null2String(rsSql.getString("id")),Util.null2String(rsSql.getString("fieldname"))); + + } + + for(int seqorderIndex=0;seqorderIndex=0&&fieldDbType.indexOf(")")>fieldDbType.indexOf("(")+1){ + fieldLength=Util.getIntValue(fieldDbType.substring(fieldDbType.indexOf("(")+1,fieldDbType.indexOf(")")),0); + } + if(fieldLength>0){ + cusFieldDataObjStr += "'" + interceptString(objFieldValue,fieldLength) + "'"; + }else{ + cusFieldDataObjStr += "'" + objFieldValue + "'"; + } + } else { + if(fieldHtmlType.equals("5")){ + objFieldValue=this.getNewSelectValue(srcFieldShowName,objFieldValue,objFieldId); + } + cusFieldDataObjStr += Util.getIntValue(objFieldValue,-1); + } + } + + } + + if (!cusFieldDataSrcStr.equals("")) { + cusFieldDataSrcStr = cusFieldDataSrcStr.substring(1); + cusFieldDataSrcSql += cusFieldDataSrcStr + " where seqorder= "+seqorder; + rsSql.executeSql(cusFieldDataSrcSql); + } + + if (!cusFieldDataObjStr.equals("")) { + cusFieldDataObjStr = cusFieldDataObjStr.substring(1); + cusFieldDataObjSql += cusFieldDataObjStr + " where seqorder= "+seqorder; + rsSql.executeSql(cusFieldDataObjSql); + } + + } + } + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("11"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setDocLogInfo(); + + dc.updateDocInfoCache("" + id); + } catch (Exception e) { + writeLog(e); + throw e; + } finally { + } + } + + /** + * 文档复制 + * + * @throws Exception + */ + public int copyDoc() throws Exception { + RecordSet rs = new RecordSet(); + int oldid = this.id; + this.id = getNextDocId(rs); + + //copyDocToNewDoc(oldid); + copyDocToNewDoc(oldid,true,"",true,true,"'1'",true,true,false); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("12"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setDocLogInfo(); + return this.id; + } + + /** + * 文档复制 + * aiyh 新增 + * @throws Exception + */ + public int copyDoc(boolean copyAttachment) throws Exception { + RecordSet rs = new RecordSet(); + int oldid = this.id; + this.id = getNextDocId(rs); + + if(copyAttachment){ + copyDocToNewDoc(oldid,true,"",true,true,"'1'",true,true,false); + }else{ + copyDocToNewDoc(oldid,true,"",true,true,"",true,false,false); + } + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("12"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setDocLogInfo(); + return this.id; + } + + /** + * 文档复制 + * + * @throws Exception + */ + public void copyDocNew() throws Exception { + RecordSet rs = new RecordSet(); + int oldid = this.id; + this.id = getNextDocId(rs); + + //copyDocToNewDoc(oldid); + copyDocToNewDoc(oldid,true,"",true,true,"'1'",false,true,true); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("12"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setDocLogInfo(); + } + /** + * 文档复制 + * + * 触发子流程时专用, + * + * 不复制权限,不改变状态,只复制最新版本的文档 + * + * @throws Exception + */ + public void copyDocForNoRightAndNoChangeStatus() throws Exception { + RecordSet rs = new RecordSet(); + int oldid = this.id; + this.id = getNextDocId(rs); + + //copyDocToNewDoc(oldid,true,"",true,false,""); + copyDocToNewDoc(oldid,true,"",true,true,"",true,true,false); + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("12"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setDocLogInfo(); + } + + + /** + * 得到最新文档的ID+1 + * + * @param rs RecordSet对象 + * @return 最新文档的ID+1 + * @throws Exception + */ + public synchronized int getNextDocId(RecordSet rs) throws Exception { +// int docindex = 0; +// rs.executeProc("SequenceIndex_SelectNextID", "docid"); +// if (rs.next()) +// docindex = rs.getInt(1); + + int docindex=docIdUpdate.getDocNewId(); + + return docindex; + } + + /** + * 得到最新文档Edition的ID+1 + * + * @param rs RecordSet对象 + * @return 最新文档Edition的ID+1 + * @throws Exception + */ + public synchronized int getNextEditionId(RecordSet rs) throws Exception { + int docindex = 0; + rs.executeProc("SequenceIndex_SelectNextID", "doceditionid"); + if (rs.next()) + docindex = rs.getInt(1); + + return docindex; + } + + /** + * 让文档的回复数自动加1 + * + * @param rs RecordSet对象 + * @throws Exception + */ + public void AddReplayDocCount(RecordSet rs) throws Exception { + String pare = this.parentids; + String sql = "update docdetail set replaydoccount=replaydoccount+1 where id in (" + pare + ")"; + rs.executeSql(sql); + } + + /** + * 据文档id得其parentids,再据parentids对其前级ID减1 + * + * @throws Exception + */ + public void DeleteReplayDocCount() throws Exception { + RecordSet recordersql = new RecordSet(); + + int replydoccount = 1; + String pare = ""; + String maindoc = ""; + int docid = this.id; + + String sql = "select maindoc, parentids from docdetail where id=" + docid; + recordersql.executeSql(sql); + if (recordersql.next()) { + pare = recordersql.getString("parentids"); + maindoc = recordersql.getString("maindoc"); + } + //TD19610 + if(pare!=null&&!pare.equals("")){ + //是否是最新版本的删除,老版本删除不对前级ID处理 + if(("" + docid).equals(maindoc)) { + String sql2 = "update docdetail set replaydoccount=replaydoccount-" + replydoccount + " where id in (" + pare + + ")" + " and replaydoccount > 0"; + recordersql.executeSql(sql2); + } + } + } + + /** + * 添加文档的共享信息 + * + * @throws Exception + */ + public void AddShareInfo() throws Exception { + char flag = Util.getSeparator(); + RecordSet recordersql = new RecordSet(); + RecordSet recordsql = new RecordSet(); + String secid = "" + this.seccategory; + + AppDetachComInfo adci = new AppDetachComInfo(); + + //recorder.executeProc("DocSecCategoryShare_SBySecCate", secid); + recordersql.executeSql(" select * from DocSecCategoryShare where seccategoryid = "+secid); + while (recordersql.next()) { + String ProcPara = ""; + + String docid = "" + this.id; + String sharetype = Util.null2String(recordersql.getString("sharetype")); + String seclevel = Util.null2String(recordersql.getString("seclevel")); + String rolelevel = Util.null2String(recordersql.getString("rolelevel")); + String sharelevel = Util.null2String(recordersql.getString("sharelevel")); + String userid = Util.null2String(recordersql.getString("userid")); + String subcompanyid = Util.null2String(recordersql.getString("subcompanyid")); + String departmentid = Util.null2String(recordersql.getString("departmentid")); + String roleid = Util.null2String(recordersql.getString("roleid")); + String foralluser = Util.null2String(recordersql.getString("foralluser")); + String crmid = Util.null2String(recordersql.getString("crmid")); + String orgGroupId = Util.null2String(recordersql.getString("orgGroupId")); + + String operategroup = Util.null2String(recordersql.getString("operategroup")); + int orgid = Util.getIntValue(recordersql.getString("orgid"),0); + int seclevelmax = Util.getIntValue(recordersql.getString("seclevelmax"),255); + int includesub = Util.getIntValue(recordersql.getString("includesub"),0); + String custype = Util.null2String(recordersql.getString("custype")); + String allmanagers="0"; + String joblevel=Util.getIntValue(recordersql.getString("joblevel"),0)+""; + String jobdepartment=Util.getIntValue(recordersql.getString("jobdepartment"),0)+""; + String jobsubcompany=Util.getIntValue(recordersql.getString("jobsubcompany"),0)+""; + String jobids=Util.getIntValue(recordersql.getString("jobids"),0)+""; + if(operategroup.equals("1")){ + userid = "" + this.userid; + if(!this.docCreaterType.equals("1")){ + continue; + } + if(Util.null2String(recordersql.getString("sharetype")).equals("1")){ + sharetype="80"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("2")){ + sharetype="81"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("3")){ + sharetype="81"; + allmanagers="1"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("4")){ + sharetype="84"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("5")){ + sharetype="85"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("6")){ + sharetype="11"; + jobids=Util.getIntValue(hrc.getJobTitle(userid),0)+""; + jobsubcompany=Util.getIntValue(hrc.getSubCompanyID(userid),0)+""; + jobdepartment=Util.getIntValue(this.docdepartmentid+"",0)+""; + + + } + + }else if(operategroup.equals("2")){ + + userid = "" + this.userid; + if(!this.docCreaterType.equals("2")){ + continue; + } + if(Util.null2String(recordersql.getString("sharetype")).equals("1")){ + sharetype="-80"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("2")){ + sharetype="-81"; + } + + + }else{ + + if(Util.null2String(recordersql.getString("sharetype")).equals("7")){ + + sharetype="9"; + }else if(Util.null2String(recordersql.getString("sharetype")).equals("8")){ + + sharetype="-"+custype; + } + + } + + + + if (sharetype.equals("3") && departmentid.equals("0")) + departmentid = "" + docdepartmentid; + + + List scopes = adci.getAppDetachScopes(this.userid+""); + + + ProcPara = docid; + ProcPara += flag + sharetype; + ProcPara += flag + seclevel; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userid; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmid; // CRMID + ProcPara += flag + orgGroupId; // orgGroupId + + //record.executeProc("DocShare_IFromDocSecCategory", ProcPara); + /** TD12005 =========文档下载权限 开始=============*/ + String downloadlevel = String.valueOf(Util.getIntValue(recordersql.getString("downloadlevel"), 0));//TD12005 + ProcPara += flag + downloadlevel; // 文档下载权限 + /** TD12005 =========文档下载权限 结束=============*/ + recordsql.executeProc("DocShare_IFromDocSecCat_G", ProcPara); + recordsql.next(); + int shareid = recordsql.getInt(1); + recordsql.executeSql("update docshare set isSecDefaultShare=1,allmanagers='"+allmanagers+"',includesub='"+includesub+"', orgid='"+orgid+"',seclevelmax='"+seclevelmax+"',joblevel='"+joblevel+"',jobdepartment='"+jobdepartment+"',jobsubcompany='"+jobsubcompany+"',jobids='"+jobids+"' where id=" + shareid); + + } + // setAboutCreaterShare(secid); + + // 得到实际回复的文档ID,是指被回复文档,而不是主文档,保留主文档的相关共享 + String realReplyDocId = ""; + if (parentids != null) { + String tempStrs[] = Util.TokenizerString2(parentids, ","); + if (tempStrs.length >= 2) + realReplyDocId = tempStrs[tempStrs.length - 2]; + } + if(!realReplyDocId.equals("")){ + recordersql.executeProc("DocShare_SelectByDocId", "" + realReplyDocId); + // recorder.executeProc("DocShare_SelectByDocId", "" + replydocid); + + while (recordersql.next()) { + String ProcPara = ""; + String docid = "" + this.id; + String sharetype = Util.null2String(recordersql.getString("sharetype")); + String seclevel = Util.null2String(recordersql.getString("seclevel")); + String rolelevel = Util.null2String(recordersql.getString("rolelevel")); + String sharelevel = Util.null2String(recordersql.getString("sharelevel")); + String userid = Util.null2String(recordersql.getString("userid")); + String subcompanyid = Util.null2String(recordersql.getString("subcompanyid")); + String departmentid = Util.null2String(recordersql.getString("departmentid")); + String roleid = Util.null2String(recordersql.getString("roleid")); + String foralluser = Util.null2String(recordersql.getString("foralluser")); + String crmid = Util.null2String(recordersql.getString("crmid")); + String orgGroupId = Util.null2String(recordersql.getString("orgGroupId")); + + int orgid = Util.getIntValue(recordersql.getString("orgid"),0); + int seclevelmax = Util.getIntValue(recordersql.getString("seclevelmax"),255); + int includesub = Util.getIntValue(recordersql.getString("includesub"),0); + int allmanagers = Util.getIntValue(recordersql.getString("allmanagers"),0); + String downloadlevel = Util.null2String(recordersql.getString("downloadlevel")); + + + if ("80".equals(sharetype)) { // 本人 + sharetype = "1"; + + String strtempSql = "select count(id) from docshare where docid='" + docid + + "' and sharetype=1 and userid=" + userid + " and sharelevel=" + sharelevel; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + } else if ("81".equals(sharetype)) { // 上级 + sharetype = "1"; + if(orgid==0){ + if(allmanagers==0){ + userid = hrc.getManagerID(userid); + + if(Util.getIntValue(userid,-1)<=0){ + continue; + } + + String strtempSql = "select count(id) from docshare where docid=" + docid + + " and sharetype=1 and userid=" + userid + " and sharelevel=" + sharelevel+" and allmanagers=0"; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + }else if(allmanagers==1){ + String managerids= hrc.getManagersIDs(""+userid); + if(managerids.equals("")){ + continue; + } + String[] shareids = Util.TokenizerString2(managerids, ","); + for(int i=0;i 0) + continue; + } + + + ProcPara = docid; + ProcPara += flag + sharetype; + ProcPara += flag + seclevel; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + shareids[i]; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmid; // CRMID + ProcPara += flag + orgGroupId; // orgGroupId + + //record.executeProc("DocShare_IFromDocSecCategory", ProcPara); + /** TD12005 =========文档下载权限 开始=============*/ + downloadlevel = String.valueOf(Util.getIntValue(recordersql.getString("downloadlevel"), 0));//TD12005 + ProcPara += flag + downloadlevel; // 文档下载权限 + /** TD12005 =========文档下载权限 结束=============*/ + recordsql.executeProc("DocShare_IFromDocSecCat_G", ProcPara); + recordsql.next(); + int shareid = recordsql.getInt(1); + recordsql.executeSql("update docshare set isSecDefaultShare=1,allmanagers=0,includesub='"+includesub+"', orgid=0,seclevelmax='"+seclevelmax+"' where id=" + shareid); + + + } + + continue; + + } + }else if(orgid<0){ + recordsql.executeSql("select * from HrmResourceVirtual where virtualtype= "+orgid+" and resourceid="+userid); + String managerids2=""; + if(recordsql.next()){ + userid = recordsql.getString("managerid"); + managerids2=recordsql.getString("managerstr"); + } + + + if(allmanagers==0){ + if(userid.equals("")){ + continue; + } + String strtempSql = "select count(id) from docshare where docid=" + docid + + " and sharetype=1 and userid=" + userid + " and sharelevel=" + sharelevel+" and allmanagers=0"; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + + + }else if(allmanagers==1){ + if(managerids2.equals("")){ + continue; + } + + String[] shareids = Util.TokenizerString2(managerids2, ","); + for(int i=0;i 0) + continue; + } + + + ProcPara = docid; + ProcPara += flag + sharetype; + ProcPara += flag + seclevel; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + shareids[i]; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmid; // CRMID + ProcPara += flag + orgGroupId; // orgGroupId + + //record.executeProc("DocShare_IFromDocSecCategory", ProcPara); + /** TD12005 =========文档下载权限 开始=============*/ + downloadlevel = String.valueOf(Util.getIntValue(recordersql.getString("downloadlevel"), 0));//TD12005 + ProcPara += flag + downloadlevel; // 文档下载权限 + /** TD12005 =========文档下载权限 结束=============*/ + recordsql.executeProc("DocShare_IFromDocSecCat_G", ProcPara); + recordsql.next(); + int shareid = recordsql.getInt(1); + recordsql.executeSql("update docshare set isSecDefaultShare=1,allmanagers=0,includesub='"+includesub+"', orgid=0,seclevelmax='"+seclevelmax+"' where id=" + shareid); + + + } + + continue; + + } + + + + } + } else if ("84".equals(sharetype)) { // 同分部 + sharetype = "2"; + if(orgid==0){ + subcompanyid = Util.null2String(dci.getSubcompanyid1(hrc.getDepartmentID(userid))); + + }else if(orgid<0){ + recordsql.executeSql("select * from HrmResourceVirtual where virtualtype= "+orgid+" and resourceid="+userid); + if(recordsql.next()){ + subcompanyid = recordsql.getString("subcompanyid"); + + } + + } + + if(subcompanyid.equals("")||subcompanyid.equals("0")){ + continue; + } + + String strtempSql = "select count(id) from docshare where docid=" + docid + + " and sharetype=2 and subcompanyid=" + subcompanyid + "" + " and seclevel=" + seclevel+" and seclevelmax='"+seclevelmax+"' and includesub='"+includesub+"'" + + " and sharelevel=" + sharelevel; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + } else if ("85".equals(sharetype)) { // 同部门 + sharetype = "3"; + if(orgid==0){ + departmentid = Util.null2String(hrc.getDepartmentID(userid)); + + }else if(orgid<0){ + recordsql.executeSql("select * from HrmResourceVirtual where virtualtype= "+orgid+" and resourceid="+userid); + if(recordsql.next()){ + departmentid = recordsql.getString("departmentid"); + + } + + } + if(departmentid.equals("")||departmentid.equals("0")){ + continue; + } + + String strtempSql = "select count(id) from docshare where docid=" + docid + + " and sharetype=3 and departmentid=" + departmentid + "" + " and seclevel=" + seclevel+" and seclevelmax='"+seclevelmax+"' and includesub='"+includesub+"'" + + " and sharelevel=" + sharelevel; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + } else if ("-80".equals(sharetype)) { // 创建人本人 + sharetype = "9"; + crmid = userid; + + String strtempSql = "select count(id) from docshare where docid=" + docid + + " and sharetype=9 and crmid=" + crmid + " and sharelevel=" + sharelevel; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + } else if ("-81".equals(sharetype)) { // 创建人经理 + sharetype = "1"; + userid = cici.getCustomerInfomanager(userid); + + String strtempSql = "select count(id) from docshare where docid=" + docid + + " and sharetype=1 and userid=" + userid + " and sharelevel=" + sharelevel; + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + } else{ + String strtempSql=""; + if("4".equals(sharetype)){ + strtempSql = "select count(id) from docshare where docid='" +docid+ "' and sharetype='"+sharetype+"' and rolelevel='"+rolelevel+"' and userid='"+userid+"' and subcompanyid='"+subcompanyid+"' and departmentid='" + departmentid + "' and roleid='"+roleid+"' and"+" foralluser='"+foralluser+"' and crmid='"+crmid+"' and orgGroupid='"+orgGroupId+"' and downloadlevel='"+downloadlevel+"' and seclevel='" + seclevel+"' and seclevelmax='"+seclevelmax+"' and includesub='"+includesub+"'"+ " and sharelevel='" + sharelevel+"' and allmanagers='"+allmanagers+"'"; + + }else if("1".equals(sharetype)||"9".equals(sharetype)){ + strtempSql = "select count(id) from docshare where docid='" +docid+ "' and sharetype='"+sharetype+"' and userid='"+userid+"' and subcompanyid='"+subcompanyid+"' and departmentid='" + departmentid + "' and roleid='"+roleid+"' and"+" foralluser='"+foralluser+"' and crmid='"+crmid+"' and orgGroupid='"+orgGroupId+"' and downloadlevel='"+downloadlevel+"' and includesub='"+includesub+"'"+ " and sharelevel='" + sharelevel+"' and allmanagers='"+allmanagers+"'"; + }else{ + strtempSql = "select count(id) from docshare where docid='" +docid+ "' and sharetype='"+sharetype+"' and userid='"+userid+"' and subcompanyid='"+subcompanyid+"' and departmentid='" + departmentid + "' and roleid='"+roleid+"' and"+" foralluser='"+foralluser+"' and crmid='"+crmid+"' and orgGroupid='"+orgGroupId+"' and downloadlevel='"+downloadlevel+"' and seclevel='" + seclevel+"' and seclevelmax='"+seclevelmax+"' and includesub='"+includesub+"'"+ " and sharelevel='" + sharelevel+"' and allmanagers='"+allmanagers+"'"; + } + recordsql.executeSql(strtempSql); + if (recordsql.next()) { + if (recordsql.getInt(1) > 0) + continue; + } + } + + + + List scopes = adci.getAppDetachScopes(this.userid+""); + if(sharetype.equals("5")&&scopes!=null&&scopes.size()>0){ + + for(int i=0;i0){ + stat.executeUpdate(sql_HrmContractId + , this.docsubject + , Util.getIntValue(this.contractman, 0) + , this.typeid + , this.contractstartdate + , this.contractenddate + , this.proenddate + , this.hrmContractId + , Util.getIntValue(conId,this.id) + ); + }else{ + + stat.executeUpdate(sql + , this.docsubject + , Util.getIntValue(this.contractman, 0) + , this.typeid + , this.contractstartdate + , this.contractenddate + , this.proenddate + , Util.getIntValue(conId,this.id) + ); + } + + SysMaintenanceLog.resetParameter(); + SysMaintenanceLog.setRelatedId(this.id); + SysMaintenanceLog.setRelatedName(this.docsubject); + SysMaintenanceLog.setOperateType("2"); + SysMaintenanceLog.setOperateDesc("HrmContract_Edit,"+this.docsubject+Util.getIntValue(this.contractman, 0)); + SysMaintenanceLog.setOperateItem("105"); + SysMaintenanceLog.setOperateUserid(this.userid); + SysMaintenanceLog.setClientAddress(this.clientip); + SysMaintenanceLog.setSysLogInfo(); + + if (ctci.isHireContract(this.typeid)) { + stathrm.executeUpdate(sqlhrm + , this.contractstartdate + , this.contractenddate + , this.proenddate + , Util.getIntValue(this.contractman, 0) + ); + } + } catch (Exception e) { + writeLog(e); + writeLog(sql); + } finally { + } + } + + /** + * 删除人力资源合同信息 + * + * @throws Exception + */ + private synchronized void deleteHrmContract() throws Exception { + String sql = "delete from HrmContract where contractdocid = " + this.id; + RecordSet rssql = new RecordSet(); + try { + rssql.executeSql(sql); + + SysMaintenanceLog.resetParameter(); + SysMaintenanceLog.setRelatedId(this.id); + SysMaintenanceLog.setRelatedName(this.docsubject); + SysMaintenanceLog.setOperateType("3"); + SysMaintenanceLog.setOperateDesc("HrmContract_del,"+this.docsubject+Util.getIntValue(this.contractman, 0)); + SysMaintenanceLog.setOperateItem("105"); + SysMaintenanceLog.setOperateUserid(this.userid); + SysMaintenanceLog.setClientAddress(this.clientip); + SysMaintenanceLog.setSysLogInfo(); + + } catch (Exception e) { + writeLog(e); + } + } + + /** + * 得到文档是否可被订阅 + * + * @return 文档是否可被订阅 + */ + public String getOrderable() { + return orderable; + } + + /** + * 设置文档是否可被订阅 + * + * @param orderable 文档是否可被订阅 + */ + public void setOrderable(String orderable) { + this.orderable = orderable; + } + + /* + * 修改与创建人相关的默认共享 80:创建人本人 81:创建人直接上级 82:创建人间接上级 83:创建人下属 84:创建人同分部成员 85:创建人同部门成员 -80:外部用户创建人本人 -81:外部用户创建人经理 + * -82:外部用户创建人经理的上级 + */ + /** + * 添加文档所在目录的默认共享 + * + * @param secId 分目录ID + */ + public void setAboutCreaterShare(String secId) { + int docId = this.id; + String userId = "" + this.userid; + RecordSet rsCreater = new RecordSet(); + char flag = 2; + String ProcPara = ""; + + String sharetype = "0"; + String seclevel = "0"; + String rolelevel = "0"; + String sharelevel = "0"; + String subcompanyid = "0"; + String departmentid = "0"; + String roleid = "0"; + String foralluser = "0"; + String crmId = "0"; + String orgGroupId = "0"; + + int PCreater = 3; + int PCreaterManager = 1; + int PCreaterSubComp = 0; + int PCreaterDepart = 0; + int PCreaterSubCompLS = 0; + int PCreaterDepartLS = 0; + + int PCreaterW = 3; + int PCreaterManagerW = 1; + + /** TD12005 开始*/ + String PCreaterDL = "1"; + String PCreaterManagerDL = "1"; + String PCreaterSubCompDL = "0"; + String PCreaterDepartDL = "0"; + String PCreaterWDL = "1"; + String PCreaterManagerWDL = "1"; + /** TD12005 结束*/ + + String strCreaterSql = "select * from secCreaterDocPope where secid=" + secId; + rsCreater.executeSql(strCreaterSql); + if (rsCreater.next()) { + PCreater = rsCreater.getInt("PCreater"); + PCreaterManager = rsCreater.getInt("PCreaterManager"); + PCreaterSubComp = rsCreater.getInt("PCreaterSubComp"); + PCreaterDepart = rsCreater.getInt("PCreaterDepart"); + + PCreaterSubCompLS = rsCreater.getInt("PCreaterSubCompLS"); // 安全级别开始数 + PCreaterDepartLS = rsCreater.getInt("PCreaterDepartLS"); + + PCreaterW = rsCreater.getInt("PCreaterW"); + PCreaterManagerW = rsCreater.getInt("PCreaterManagerW"); + /** TD12005 开始*/ + PCreaterDL = String.valueOf(Util.getIntValue(rsCreater.getString("PCreaterDL"), 1)); + PCreaterManagerDL = String.valueOf(Util.getIntValue(rsCreater.getString("PCreaterManagerDL"), 1)); + PCreaterSubCompDL = String.valueOf(Util.getIntValue(rsCreater.getString("PCreaterSubCompDL"), 0)); + PCreaterDepartDL = String.valueOf(Util.getIntValue(rsCreater.getString("PCreaterDepartDL"), 0)); + PCreaterWDL = String.valueOf(Util.getIntValue(rsCreater.getString("PCreaterWDL"), 1)); + PCreaterManagerWDL = String.valueOf(Util.getIntValue(rsCreater.getString("PCreaterManagerWDL"), 1)); + /** TD12005 结束*/ + } + + // 权限 0: 无权限 1:查看权限 2:编辑权限 3:完全控制权限(包括删除等权限) + if ("1".equals(this.usertype)) { + // 1 对创建者本人的处理 (shareType:80) + sharetype = "80"; + + switch (PCreater) { + case 0: + break; + case 1: + sharelevel = "1"; + break; + case 2: + sharelevel = "2"; + break; + case 3: + sharelevel = "3"; + break; + } + if (PCreater != 0) { + ProcPara = "" + docId; + ProcPara += flag + sharetype; + ProcPara += flag + seclevel; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userId; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmId; // CRMID + ProcPara += flag + orgGroupId; // orgGroupId + + //rsCreater.executeProc("DocShare_IFromDocSecCategory", ProcPara); + /** TD12005 开始*/ + ProcPara += flag + PCreaterDL; + /** TD12005 结束*/ + rsCreater.executeProc("DocShare_IFromDocSecCat_G", ProcPara); + rsCreater.next(); + int shareid = rsCreater.getInt(1); + rsCreater.executeSql("update docshare set isSecDefaultShare=1 where id=" + shareid); + + } + + // 2 对创建者直接上级的处理 (shareType:81) + sharetype = "81"; + switch (PCreaterManager) { + case 0: + break; + case 1: + sharelevel = "1"; + break; + case 2: + sharelevel = "2"; + break; + case 3: + sharelevel = "3"; + break; + } + if (PCreaterManager != 0) { + ProcPara = "" + docId; + ProcPara += flag + sharetype; + ProcPara += flag + seclevel; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userId; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmId; // CRMID + ProcPara += flag + orgGroupId; + /** TD12005 开始*/ +// rsCreater.executeProc("DocShare_IFromDocSecCategory", ProcPara); + ProcPara += flag + PCreaterManagerDL; + rsCreater.executeProc("DocShare_IFromDocSecCategoryDL", ProcPara); + /** TD12005 结束*/ + rsCreater.next(); + int shareid = rsCreater.getInt(1); + rsCreater.executeSql("update docshare set isSecDefaultShare=1 where id=" + shareid); + } + // 5 对创建者同分部的处理 (shareType:84) + sharetype = "84"; + switch (PCreaterSubComp) { + case 0: + break; + case 1: + sharelevel = "1"; + break; + case 2: + sharelevel = "2"; + break; + case 3: + sharelevel = "3"; + break; + } + if (PCreaterSubComp != 0) { + ProcPara = "" + docId; + ProcPara += flag + sharetype; + ProcPara += flag + "" + PCreaterSubCompLS; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userId; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmId; // CRMID + ProcPara += flag + orgGroupId; + /** TD12005 开始*/ +// rsCreater.executeProc("DocShare_IFromDocSecCategory", ProcPara); + ProcPara += flag + PCreaterSubCompDL; + rsCreater.executeProc("DocShare_IFromDocSecCategoryDL", ProcPara); + /** TD12005 结束*/ + rsCreater.next(); + int shareid = rsCreater.getInt(1); + rsCreater.executeSql("update docshare set isSecDefaultShare=1 where id=" + shareid); + } + // 6 对创建都同部门的处理 (shareType:85) + sharetype = "85"; + switch (PCreaterDepart) { + case 0: + break; + case 1: + sharelevel = "1"; + break; + case 2: + sharelevel = "2"; + break; + case 3: + sharelevel = "3"; + break; + } + if (PCreaterDepart != 0) { + ProcPara = "" + docId; + ProcPara += flag + sharetype; + ProcPara += flag + "" + PCreaterDepartLS; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userId; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmId; // CRMID + ProcPara += flag + orgGroupId; + /** TD12005 开始*/ +// rsCreater.executeProc("DocShare_IFromDocSecCategory", ProcPara); + ProcPara += flag + PCreaterDepartDL; + rsCreater.executeProc("DocShare_IFromDocSecCategoryDL", ProcPara); + /** TD12005 结束*/ + rsCreater.next(); + int shareid = rsCreater.getInt(1); + rsCreater.executeSql("update docshare set isSecDefaultShare=1 where id=" + shareid); + } + } else { + // 7 对外部创建者的处理 (shareType:-80) + sharetype = "-80"; + switch (PCreaterW) { + case 0: + break; + case 1: + sharelevel = "1"; + break; + case 2: + sharelevel = "2"; + break; + case 3: + sharelevel = "3"; + break; + } + if (PCreaterW != 0) { + ProcPara = "" + docId; + ProcPara += flag + sharetype; + ProcPara += flag + "" + PCreaterW; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userId; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmId; // CRMID + ProcPara += flag + orgGroupId; + /** TD12005 开始*/ +// rsCreater.executeProc("DocShare_IFromDocSecCategory", ProcPara); + ProcPara += flag + PCreaterWDL; + rsCreater.executeProc("DocShare_IFromDocSecCategoryDL", ProcPara); + /** TD12005 结束*/ + rsCreater.next(); + int shareid = rsCreater.getInt(1); + rsCreater.executeSql("update docshare set isSecDefaultShare=1 where id=" + shareid); + } + // 8 对外部创建者的经理的处理 (shareType:-81) + sharetype = "-81"; + switch (PCreaterManagerW) { + case 0: + break; + case 1: + sharelevel = "1"; + break; + case 2: + sharelevel = "2"; + break; + case 3: + sharelevel = "3"; + break; + } + if (PCreaterManagerW != 0) { + ProcPara = "" + docId; + ProcPara += flag + sharetype; + ProcPara += flag + "" + PCreaterManagerW; + ProcPara += flag + rolelevel; + ProcPara += flag + sharelevel; + ProcPara += flag + userId; + ProcPara += flag + subcompanyid; + ProcPara += flag + departmentid; + ProcPara += flag + roleid; + ProcPara += flag + foralluser; + ProcPara += flag + crmId; // CRMID + ProcPara += flag + orgGroupId; + /** TD12005 开始*/ +// rsCreater.executeProc("DocShare_IFromDocSecCategory", ProcPara); + ProcPara += flag + PCreaterManagerWDL; + rsCreater.executeProc("DocShare_IFromDocSecCategoryDL", ProcPara); + /** TD12005 结束*/ + rsCreater.next(); + int shareid = rsCreater.getInt(1); + rsCreater.executeSql("update docshare set isSecDefaultShare=1 where id=" + shareid); + } + } + } + + /** + * 返回操作类型 + * + * @return 操作类型 + */ + public String getOpreateType() { + return opreateType; + } + + /** + * 设置操作类型 + * + * @param opreateType + */ + public void setOpreateType(String opreateType) { + this.opreateType = opreateType; + } + + + + /** + * @return the docCancelDate + */ + public String getDocCancelDate() { + return rs.getString("docCancelDate"); + } + + /** + * @return the docCancelTime + */ + public String getDocCancelTime() { + return rs.getString("docCancelTime"); + } + + /** + * @return the docCancelUserId + */ + public int getDocCancelUserId() { + return rs.getInt("docCancelUserId"); + } + + /** + * @return the docCode + */ + public String getDocCode() { + return rs.getString("docCode"); + } + + /** + * @return the docEdition + */ + public int getDocEdition() { + return rs.getInt("docEdition"); + } + + /** + * @return the docEditionId + */ + public int getDocEditionId() { + return rs.getInt("docEditionId"); + } + + /** + * @return the isHistory + */ + public int getIsHistory() { + return Util.getIntValue(rs.getString("isHistory"),0); + } + + /** + * @return the approveType + */ + public int getApproveType() { + return Util.getIntValue(rs.getString("approveType"),0); + } + + /** + * @return the selectedPubMouldId + */ + public int getSelectedPubMouldId() { + return Util.getIntValue(rs.getString("selectedPubMouldId"),0); + } + + /** + * @return the docInvalDate + */ + public String getDocInvalDate() { + return rs.getString("docInvalDate"); + } + + /** + * @return the docInvalTime + */ + public String getDocInvalTime() { + return rs.getString("docInvalTime"); + } + + /** + * @return the docInvalUserId + */ + public int getDocInvalUserId() { + return rs.getInt("docInvalUserId"); + } + + /** + * @return the docReOpenDate + */ + public String getDocReOpenDate() { + return rs.getString("docReOpenDate"); + } + + /** + * @return the docReOpenTime + */ + public String getDocReOpenTime() { + return rs.getString("docReOpenTime"); + } + + /** + * @return the docReOpenUserId + */ + public int getDocReOpenUserId() { + return rs.getInt("docReOpenUserId"); + } + + /** + * @return the docPubDate + */ + public String getDocPubDate() { + return rs.getString("docPubDate"); + } + + /** + * @return the docPubTime + */ + public String getDocPubTime() { + return rs.getString("docPubTime"); + } + + /** + * @return the docPubUserId + */ + public int getDocPubUserId() { + return rs.getInt("docPubUserId"); + } + + /** + * @return the docValidDate + */ + public String getDocValidDate() { + return rs.getString("docValidDate"); + } + + /** + * @return the docValidTime + */ + public String getDocValidTime() { + return rs.getString("docValidTime"); + } + + /** + * @return the docValidUserId + */ + public int getDocValidUserId() { + return rs.getInt("docValidUserId"); + } + + /** + * @return the mainDoc + */ + public int getMainDoc() { + return rs.getInt("mainDoc"); + } + + /** + * @return the readOpterCanPrint + */ + public int getReadOpterCanPrint() { + return rs.getInt("readOpterCanPrint"); + } + + /** + * @return the invalidationDate + */ + public String getInvalidationDate() { + return rs.getString("invalidationdate"); + } + + + /** + * @return the checkOutStatus + */ + public String getCheckOutStatus() { + return rs.getString("checkOutStatus"); + } + + /** + * @return the checkOutUserId + */ + public int getCheckOutUserId() { + return rs.getInt("checkOutUserId"); + } + + /** + * @return the checkOutUserType + */ + public String getCheckOutUserType() { + return rs.getString("checkOutUserType"); + } + + /** + * @return the checkOutDate + */ + public String getCheckOutDate() { + return rs.getString("checkOutDate"); + } + + /** + * @return the checkOutTime + */ + public String getCheckOutTime() { + return rs.getString("checkOutTime"); + } + + /** + * @return the hasUsedTemplet 返回 是否已经套红 + */ + public String getHasUsedTemplet() { + return rs.getString("hasUsedTemplet"); + } + + /** + * @return the docCreaterType 返回 文档创建者类型(1:内部用户 2:外部用户) + */ + public String getDocCreaterType() { + return rs.getString("docCreaterType"); + } + + /** + * @return the docLastModUserType 返回 文档最后修改者类型(1:内部用户 2:外部用户) + */ + public String getDocLastModUserType() { + return rs.getString("docLastModUserType"); + } + + /** + * @return the docApproveUserType 返回 文档审批者类型(1:内部用户 2:外部用户) + */ + public String getDocApproveUserType() { + return rs.getString("docApproveUserType"); + } + + /** + * @return the docValidUserType 返回 生效操作人类型(1:内部用户 2:外部用户) + */ + public String getDocValidUserType() { + return rs.getString("docValidUserType"); + } + + /** + * @return the docInvalUserType 返回 失效操作人类型(1:内部用户 2:外部用户) + */ + public String getDocInvalUserType() { + return rs.getString("docInvalUserType"); + } + + /** + * @return the docArchiveUserType 返回 文档归档者类型(1:内部用户 2:外部用户) + */ + public String getDocArchiveUserType() { + return rs.getString("docArchiveUserType"); + } + + /** + * @return the docCancelUserType 返回 作废操作人类型(1:内部用户 2:外部用户) + */ + public String getDocCancelUserType() { + return rs.getString("docCancelUserType"); + } + + /** + * @return the docPubUserType 返回 发布操作人类型(1:内部用户 2:外部用户) + */ + public String getDocPubUserType() { + return rs.getString("docPubUserType"); + } + + /** + * @return the docReopenUserType 返回 重新打开操作人类型(1:内部用户 2:外部用户) + */ + public String getDocReopenUserType() { + return rs.getString("docReopenUserType"); + } + + /** + * @return the ownerType 返回 文档拥有者类型(1:内部用户 2:外部用户) + */ + public String getOwnerType() { + return rs.getString("ownerType"); + } + + /** + * @return the docCancelDate + */ + public String getDocCancelDate2() { + return docCancelDate; + } + + /** + * @return the docCancelTime + */ + public String getDocCancelTime2() { + return docCancelTime; + } + + /** + * @return the docCancelUserId + */ + public int getDocCancelUserId2() { + return docCancelUserId; + } + + /** + * @return the docCode + */ + public String getDocCode2() { + return docCode; + } + + /** + * @return the docEdition + */ + public int getDocEdition2() { + return docEdition; + } + + /** + * @return the isHistory + */ + public int getIsHistory2() { + return isHistory; + } + + /** + * @return the approveType + */ + public int getApproveType2() { + return approveType; + } + + /** + * @return the selectedPubMouldId + */ + public int getSelectedPubMouldId2() { + return selectedPubMouldId; + } + + /** + * @return the docEditionId + */ + public int getDocEditionId2() { + return docEditionId; + } + + /** + * @return the docInvalDate + */ + public String getDocInvalDate2() { + return docInvalDate; + } + + /** + * @return the docInvalTime + */ + public String getDocInvalTime2() { + return docInvalTime; + } + + /** + * @return the docInvalUserId + */ + public int getDocInvalUserId2() { + return docInvalUserId; + } + + /** + * @return the docReOpenDate + */ + public String getDocReOpenDate2() { + return docReOpenDate; + } + + /** + * @return the docReOpenTime + */ + public String getDocReOpenTime2() { + return docReOpenTime; + } + + /** + * @return the docReOpenUserId + */ + public int getDocReOpenUserId2() { + return docReOpenUserId; + } + + /** + * @return the docPubDate + */ + public String getDocPubDate2() { + return docPubDate; + } + + /** + * @return the docPubTime + */ + public String getDocPubTime2() { + return docPubTime; + } + + /** + * @return the docPubUserId + */ + public int getDocPubUserId2() { + return docPubUserId; + } + + /** + * @return the docValidDate + */ + public String getDocValidDate2() { + return docValidDate; + } + + /** + * @return the docValidTime + */ + public String getDocValidTime2() { + return docValidTime; + } + + /** + * @return the docValidUserId + */ + public int getDocValidUserId2() { + return docValidUserId; + } + + /** + * @return the mainDoc + */ + public int getMainDoc2() { + return mainDoc; + } + + /** + * @return the readOpterCanPrint + */ + public int getReadOpterCanPrint2() { + return readOpterCanPrint; + } + + /** + * @return the invalidationDate + */ + public String getInvalidationDate2() { + return invalidationDate; + } + + + + /** + * @param docCancelDate the docCancelDate to set + */ + public void setDocCancelDate(String docCancelDate) { + this.docCancelDate = docCancelDate; + } + + /** + * @param docCancelTime the docCancelTime to set + */ + public void setDocCancelTime(String docCancelTime) { + this.docCancelTime = docCancelTime; + } + + /** + * @param docCancelUserId the docCancelUserId to set + */ + public void setDocCancelUserId(int docCancelUserId) { + this.docCancelUserId = docCancelUserId; + } + + /** + * @param docCode the docCode to set + */ + public void setDocCode(String docCode) { + this.docCode = docCode; + } + + /** + * @param docEdition the docEdition to set + */ + public void setDocEdition(int docEdition) { + this.docEdition = docEdition; + } + + /** + * @param docEdition the docEditionId to set + */ + public void setDocEditionId(int docEditionId) { + this.docEditionId = docEditionId; + } + + /** + * @param isHistory the isHistory to set + */ + public void setIsHistory(int isHistory) { + this.isHistory = isHistory; + } + + /** + * @param approveType the approveType to set + */ + public void setApproveType(int approveType) { + this.approveType = approveType; + } + + /** + * @param selectedPubMouldId the selectedPubMouldId to set + */ + public void setSelectedPubMouldId(int selectedPubMouldId) { + this.selectedPubMouldId = selectedPubMouldId; + } + + /** + * @param docInvalDate the docInvalDate to set + */ + public void setDocInvalDate(String docInvalDate) { + this.docInvalDate = docInvalDate; + } + + /** + * @param docInvalTime the docInvalTime to set + */ + public void setDocInvalTime(String docInvalTime) { + this.docInvalTime = docInvalTime; + } + + /** + * @param docInvalUserId the docInvalUserId to set + */ + public void setDocInvalUserId(int docInvalUserId) { + this.docInvalUserId = docInvalUserId; + } + + /** + * @param docReOpenDate the docReOpenDate to set + */ + public void setDocReOpenDate(String docReOpenDate) { + this.docReOpenDate = docReOpenDate; + } + + /** + * @param docReOpenTime the docReOpenTime to set + */ + public void setDocReOpenTime(String docReOpenTime) { + this.docReOpenTime = docReOpenTime; + } + + /** + * @param docReOpenUserId the docReOpenUserId to set + */ + public void setDocReOpenUserId(int docReOpenUserId) { + this.docReOpenUserId = docReOpenUserId; + } + + /** + * @param docPubDate the DocPubDate to set + */ + public void setDocPubDate(String docPubDate) { + this.docPubDate = docPubDate; + } + + /** + * @param DocPubTime the DocPubTime to set + */ + public void setDocPubTime(String docPubTime) { + this.docPubTime = docPubTime; + } + + /** + * @param DocPubUserId the DocPubUserId to set + */ + public void setDocPubUserId(int docPubUserId) { + this.docPubUserId = docPubUserId; + } + + /** + * @param docValidDate the docValidDate to set + */ + public void setDocValidDate(String docValidDate) { + this.docValidDate = docValidDate; + } + + /** + * @param docValidTime the docValidTime to set + */ + public void setDocValidTime(String docValidTime) { + this.docValidTime = docValidTime; + } + + /** + * @param docValidUserId the docValidUserId to set + */ + public void setDocValidUserId(int docValidUserId) { + this.docValidUserId = docValidUserId; + } + + /** + * @param mainDoc the mainDoc to set + */ + public void setMainDoc(int mainDoc) { + this.mainDoc = mainDoc; + } + + /** + * @param readOpterCanPrint the readOpterCanPrint to set + */ + public void setReadOpterCanPrint(int readOpterCanPrint) { + this.readOpterCanPrint = readOpterCanPrint; + } + + /** + * @param invalidationDate the invalidationDate to set + */ + public void setInvalidationDate(String invalidationDate) { + this.invalidationDate = invalidationDate; + } + + public void setDummycata(String dummycata) { + this.dummycata = dummycata; + } + + + /** + * @param docCreaterType 设置 文档创建者类型(1:内部用户 2:外部用户) + */ + public void setDocCreaterType(String paraValue) { + this.docCreaterType=paraValue; + } + + /** + * @param docLastModUserType 设置 文档最后修改者类型(1:内部用户 2:外部用户) + */ + public void setDocLastModUserType(String paraValue) { + this.docLastModUserType=paraValue; + } + + /** + * @param docApproveUserType 设置 文档审批者类型(1:内部用户 2:外部用户) + */ + public void setDocApproveUserType(String paraValue) { + this.docApproveUserType=paraValue; + } + + /** + * @param docValidUserType 设置 生效操作人类型(1:内部用户 2:外部用户) + */ + public void setDocValidUserType(String paraValue) { + this.docValidUserType=paraValue; + } + + /** + * @param docInvalUserType 设置 失效操作人类型(1:内部用户 2:外部用户) + */ + public void setDocInvalUserType(String paraValue) { + this.docInvalUserType=paraValue; + } + + /** + * @param docArchiveUserType 设置 文档归档者类型(1:内部用户 2:外部用户) + */ + public void setDocArchiveUserType(String paraValue) { + this.docArchiveUserType=paraValue; + } + + /** + * @param docCancelUserType 设置 作废操作人类型(1:内部用户 2:外部用户) + */ + public void setDocCancelUserType(String paraValue) { + this.docCancelUserType=paraValue; + } + + /** + * @param docPubUserType 设置 发布操作人类型(1:内部用户 2:外部用户) + */ + public void setDocPubUserType(String paraValue) { + this.docPubUserType=paraValue; + } + + /** + * @param docReopenUserType 设置 重新打开操作人类型(1:内部用户 2:外部用户) + */ + public void setDocReopenUserType(String paraValue) { + this.docReopenUserType=paraValue; + } + + /** + * @param ownerType 设置 文档拥有者类型(1:内部用户 2:外部用户) + */ + public void setOwnerType(String paraValue) { + this.ownerType=paraValue; + } + + + /** + * 流程审批文档 + * @param type 审批类型("reject","approve") + * @param docId 文档ID + * @param approveDate 审批日期 + * @param approveTime 审批时间 + * @param userId 审批用户 + */ + public void approveDocFromWF(String type,String docId,String approveDate,String approveTime,String userId) throws Exception { + + //安全性检查 + if(type==null + ||(!"reject".equals(type)&&!"approve".equals(type)) + ||docId==null + ||Util.getIntValue(docId,-1)<=0 + ){ + return ; + } + + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(docId); + this.getDocInfoById(); + this.maincategory = this.getMaincategory(); + this.subcategory = this.getSubcategory(); + this.seccategory = this.getSeccategory(); + this.docstatus = this.getDocstatus(); + this.docEdition = this.getDocEdition(); + this.docEditionId = this.getDocEditionId(); + this.approveType = this.getApproveType(); + this.docsubject=this.getDocsubject(); + this.doccreaterid=this.getDoccreaterid(); + //String createrType=this.getUsertype(); + this.docCreaterType=this.getDocCreaterType(); + + this.usertype=(this.usertype==null||this.usertype.trim().equals(""))?"1":this.usertype; + + String operateType="4"; + + if(type.equals("reject")){ + //this.docstatus = "4"; + //如果为失效审批,则退回后文档状态为“2:生效/正常”,否则为“4:退回” + if(this.approveType==2){ + this.docstatus="2"; + }else{ + this.docstatus="4"; + } + operateType="5";//操作的类型:5:退回 + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + " WHERE ID = " + this.id + ); + }else if(type.equals("approve")){ + operateType="4";//操作的类型:4:批准 + if(this.approveType==1){//生效审批 + if(scc.needPubOperation(this.seccategory)) {//如果需要发布 + this.docstatus = "6"; + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + " WHERE ID = " + this.id + ); + } else {//生效/正常 + this.docstatus = "2"; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + this.docEdition = dc.getEdition(this.docEditionId)+1; + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + + rs.executeSql(" select id from docdetail where id <> " + this.id + " and docedition < " + this.docEdition + " and doceditionid = " + this.docEditionId + " order by docEdition desc "); + if(rs.next()){ + int oldDocId = rs.getInt("id"); + + log.resetParameter(); + log.setDocId(oldDocId); + log.setDocSubject(this.docsubject); + log.setOperateType("14"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + //log.setCreatertype(createrType); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + } + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + ",docvaliduserid = " + userId + + ",docValidUserType = '" + this.usertype + "'" + + ",docvaliddate = '" + approveDate + "'" + + ",docvalidtime = '" + approveTime + "'" + + " WHERE ID = " + docId + ); + + + } + } else if(this.approveType==2){//失效审批 + this.docstatus = "7"; + this.docInvalUserId = this.userid; + this.docInvalUserType = this.usertype; + this.docInvalDate = approveDate; + this.docInvalTime = approveTime; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + //this.docEdition = dc.getEdition(this.docEditionId)+1; + this.docEdition = dc.getEdition(this.docEditionId); + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",approvetype = " + this.approveType + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + ",docinvaluserid = " + this.docInvalUserId + + ",docInvalUserType = '" + this.docInvalUserType + "'" + + ",docinvaldate = '" + this.docInvalDate + "'" + + ",docinvaltime = '" + this.docInvalTime + "'" + + " WHERE ID = " + this.id + ); + } + } + + //char flag=Util.getSeparator(); + //String para=userId+flag+this.docstatus+flag+approveDate+flag+approveTime+flag+docId; + //rs.executeProc("DocDetail_Approve",para); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType(operateType); + log.setOperateUserid(this.userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + //log.setCreatertype(createrType); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + if(this.docstatus.equals("2") || this.docstatus.equals("1") || this.docstatus.equals("5")){ + //RecordSet rsforsend = new RecordSet(); + // rsforsend.executeSql("select shareids from sendtoalltemp where status = 0 and docid=" + docId); + // while (rsforsend.next()) { + // String shareids = Util.null2String(rsforsend.getString("shareids")); + ThreadForAllForNew sendToAllfornew = new ThreadForAllForNew(docId,"",userId); + sendToAllfornew.start(); + // } + } + + } + + + public void approveDocFromWFGD(String type,String docId,String approveDate,String approveTime,String userId) throws Exception { + + //安全性检查 + if(type==null + ||(!"reject".equals(type)&&!"approve".equals(type)) + ||docId==null + ||Util.getIntValue(docId,-1)<=0 + ){ + return ; + } + + RecordSet rs = new RecordSet(); + rs.writeLog("++++++++++++++++approveDocFromWF.type=="+type); + rs.writeLog("++++++++++++++++approveDocFromWF.docId=="+docId); + rs.writeLog("++++++++++++++++approveDocFromWF.approveDate=="+approveDate); + rs.writeLog("++++++++++++++++approveDocFromWF.approveTime=="+approveTime); + rs.writeLog("++++++++++++++++approveDocFromWF.userId=="+userId); + + this.id = Util.getIntValue(docId); + this.getDocInfoById(); + this.maincategory = this.getMaincategory(); + this.subcategory = this.getSubcategory(); + this.seccategory = this.getSeccategory(); + this.docstatus = this.getDocstatus(); + this.docEdition = this.getDocEdition(); + this.docEditionId = this.getDocEditionId(); + this.approveType = this.getApproveType(); + this.docsubject=this.getDocsubject(); + this.doccreaterid=this.getDoccreaterid(); + //String createrType=this.getUsertype(); + this.docCreaterType=this.getDocCreaterType(); + + this.usertype=(this.usertype==null||this.usertype.trim().equals(""))?"1":this.usertype; + + String operateType="4"; + + if(type.equals("approve")){ + operateType="4";//操作的类型:4:批准 + if(this.approveType==1){//生效审批 + if(scc.needPubOperation(this.seccategory)) {//如果需要发布 + this.docstatus = "6"; + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + " WHERE ID = " + this.id + ); + rs.writeLog("++++++++++++++++ fabusql== UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + " WHERE ID = " + this.id + ); + + } else {//生效/正常 + this.docstatus = "2"; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + rs.writeLog("++++++++++++++++isEditionOpen"); + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + this.docEdition = dc.getEdition(this.docEditionId)+1; + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + + rs.executeSql(" select id from docdetail where id <> " + this.id + " and docedition < " + this.docEdition + " and doceditionid = " + this.docEditionId + " order by docEdition desc "); + if(rs.next()){ + int oldDocId = rs.getInt("id"); + + log.resetParameter(); + log.setDocId(oldDocId); + log.setDocSubject(this.docsubject); + log.setOperateType("14"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + //log.setCreatertype(createrType); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + } + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + ",docvaliduserid = " + userId + + ",docValidUserType = '" + this.usertype + "'" + + ",docvaliddate = '" + approveDate + "'" + + ",docvalidtime = '" + approveTime + "'" + + ",docarchiveuserid = " + userId + + ",docArchiveUserType = '" + this.usertype + "'" + + ",docarchivedate = '" + approveDate + "'" + + ",docarchivetime = '" + approveTime + "'" + + " WHERE ID = " + docId + ); + rs.writeLog("++++++++++++++++zhengchangsql=== UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + ",docvaliduserid = " + userId + + ",docValidUserType = '" + this.usertype + "'" + + ",docvaliddate = '" + approveDate + "'" + + ",docvalidtime = '" + approveTime + "'" + + " WHERE ID = " + docId + ); + + } + } else if(this.approveType==2){//失效审批 + this.docstatus = "7"; + this.docInvalUserId = this.userid; + this.docInvalUserType = this.usertype; + this.docInvalDate = approveDate; + this.docInvalTime = approveTime; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + //this.docEdition = dc.getEdition(this.docEditionId)+1; + this.docEdition = dc.getEdition(this.docEditionId); + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",approvetype = " + this.approveType + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docapproveuserid = " + userId + + ",docApproveUserType = '" + this.usertype + "'" + + ",docapprovedate = '" + approveDate + "'" + + ",docapprovetime = '" + approveTime + "'" + + ",docinvaluserid = " + this.docInvalUserId + + ",docInvalUserType = '" + this.docInvalUserType + "'" + + ",docinvaldate = '" + this.docInvalDate + "'" + + ",docinvaltime = '" + this.docInvalTime + "'" + + " WHERE ID = " + this.id + ); + } + } + + //char flag=Util.getSeparator(); + //String para=userId+flag+this.docstatus+flag+approveDate+flag+approveTime+flag+docId; + //rs.executeProc("DocDetail_Approve",para); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType(operateType); + log.setOperateUserid(this.userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + //log.setCreatertype(createrType); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + if(this.docstatus.equals("2") || this.docstatus.equals("1") || this.docstatus.equals("5")){ + // RecordSet rsforsend = new RecordSet(); + // rsforsend.executeSql("select shareids from sendtoalltemp where status = 0 and docid=" + this.id); + // while (rsforsend.next()) { + // String shareids = Util.null2String(rsforsend.getString("shareids")); + ThreadForAllForNew sendToAllfornew = new ThreadForAllForNew(this.id+"", "",this.userid+""); + sendToAllfornew.start(); + // } + } + + } + + /** + * 发布文档 + * @param fu FileUpload对象 + * @throws Exception + */ + public void publishDoc(FileUpload fu) throws Exception { + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + + this.docstatus = fu.getParameter("docstatus"); + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + this.docsubject = Util.null2String(fu.getParameter("docsubject")); + this.doccreaterid = Util.getIntValue(fu.getParameter("doccreaterid"),0); + this.docCreaterType = Util.null2String(fu.getParameter("docCreaterType")); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.docPubUserId = this.userid; + this.docPubUserType = this.usertype; + this.docPubDate = formatdate; + this.docPubTime = formattime; + + this.docValidUserId = this.userid; + this.docValidUserType = this.usertype; + this.docValidDate = formatdate; + this.docValidTime = formattime; + + this.selectedPubMouldId = Util.getIntValue(fu.getParameter("selectedpubmouldid"),-1); + + //if(scc.needPubOperation(this.seccategory)&&Util.getIntValue(this.docstatus)==6){ + if(Util.getIntValue(this.docstatus)==6){ + //生效/正常 + this.docstatus = "2"; + + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + this.docEdition = dc.getEdition(this.docEditionId)+1; + + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + + rs.executeSql(" select id from docdetail where id <> " + this.id + " and docedition < " + this.docEdition + " and doceditionid = " + this.docEditionId + " order by docEdition desc "); + if(rs.next()){ + int oldDocId = rs.getInt("id"); + + //关联子文档 + relateSonDocWithNewDoc(this.id); + + log.resetParameter(); + log.setDocId(oldDocId); + log.setDocSubject(this.docsubject); + log.setOperateType("14"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + } + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",selectedpubmouldid = " + this.selectedPubMouldId + + ",docpubuserid = " + this.docPubUserId + + ",docPubUserType = '" + this.docPubUserType + "'" + + ",docpubdate = '" + this.docPubDate + "'" + + ",docpubtime = '" + this.docPubTime + "'" + + ",docvaliduserid = " + this.docValidUserId + + ",docValidUserType = '" + this.docValidUserType + "'" + + ",docvaliddate = '" + this.docValidDate + "'" + + ",docvalidtime = '" + this.docValidTime + "'" + + " WHERE ID = " + this.id + ); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("13"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + if (this.docstatus.equals("2")) { + // RecordSet rsforsend = new RecordSet(); + // rsforsend.executeSql("select shareids from sendtoalltemp where status = 0 and docid=" + this.id); + // while (rsforsend.next()) { + // String shareids = Util.null2String(rsforsend.getString("shareids")); + + + + + ThreadForAllForNew sendToAllfornew = new ThreadForAllForNew(this.id+"", "",this.userid+""); + sendToAllfornew.start(); + // } + } + } + } + + /** + * 归档文档 + * @param fu FileUpload对象 + * @throws Exception + */ + public void archiveDoc(FileUpload fu) throws Exception { + // 归档时进行的操作 + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + + this.docstatus = fu.getParameter("docstatus"); + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + + + this.doccreaterid = Util.getIntValue(fu.getParameter("doccreaterid"),0); + this.docCreaterType = Util.null2String(fu.getParameter("docCreaterType")); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + + this.docarchiveuserid = this.userid; + this.docArchiveUserType = this.usertype; + this.docsubject = fu.getParameter("docsubject"); + this.docno = fu.getParameter("docno"); + this.docarchivedate = formatdate; + this.docarchivetime = formattime; + + if(Util.getIntValue(this.docstatus)==1||Util.getIntValue(this.docstatus)==2){ + //归档 + this.docstatus = "5"; + + //ArchiveDocInfo(); + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + //this.docEdition = dc.getEdition(this.docEditionId)+1; + this.docEdition = dc.getEdition(this.docEditionId); + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docno = '" + this.docno + "'" + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docarchiveuserid = " + this.userid + + ",docArchiveUserType = '" + this.docArchiveUserType + "'" + + ",docarchivedate = '" + this.docarchivedate + "'" + + ",docarchivetime = '" + this.docarchivetime + "'" + + " WHERE ID = " + this.id + ); + + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("7"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + + } + } + + + /** + * 失效文档 + * @param fu FileUpload对象 + * @throws Exception + */ + public void invalidateDoc(FileUpload fu) throws Exception { + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + + this.docstatus = fu.getParameter("docstatus"); + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + this.docsubject = Util.null2String(fu.getParameter("docsubject")); + this.doccreaterid = Util.getIntValue(fu.getParameter("doccreaterid"),0); + this.docCreaterType = Util.null2String(fu.getParameter("docCreaterType")); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.docInvalUserId = this.userid; + this.docInvalUserType = this.usertype; + this.docInvalDate = formatdate; + this.docInvalTime = formattime; + + if(Util.getIntValue(this.docstatus)==1||Util.getIntValue(this.docstatus)==2){ + + if(scc.needApprove(this.seccategory,2)) {//如果需要审批 + this.docstatus = "3"; + this.approveType = 2; + } else {//失效 + this.docstatus = "7"; + //this.docInvalUserId = this.userid; + //this.docInvalDate = formatdate; + //this.docInvalTime = formattime; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + //this.docEdition = dc.getEdition(this.docEditionId)+1; + this.docEdition = dc.getEdition(this.docEditionId); + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + } + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",approvetype = " + this.approveType + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docinvaluserid = " + this.docInvalUserId + + ",docInvalUserType = '" + this.docInvalUserType + "'" + + ",docinvaldate = '" + this.docInvalDate + "'" + + ",docinvaltime = '" + this.docInvalTime + "'" + + " WHERE ID = " + this.id + ); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("14"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + } + } + + /** + * 作废文档 + * @param fu FileUpload对象 + * @throws Exception + */ + public void cancelDoc(FileUpload fu) throws Exception { + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + + this.docstatus = fu.getParameter("docstatus"); + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + this.docsubject = Util.null2String(fu.getParameter("docsubject")); + this.doccreaterid = Util.getIntValue(fu.getParameter("doccreaterid"),0); + this.docCreaterType = Util.null2String(fu.getParameter("docCreaterType")); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.docCancelUserId = this.userid; + this.docCancelUserType = this.usertype; + this.docCancelDate = formatdate; + this.docCancelTime = formattime; + + if(Util.getIntValue(this.docstatus)==1||Util.getIntValue(this.docstatus)==2||Util.getIntValue(this.docstatus)==5||Util.getIntValue(this.docstatus)==7){ + //作废 + this.docstatus = "8"; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + //this.docEdition = dc.getEdition(this.docEditionId)+1; + this.docEdition = dc.getEdition(this.docEditionId); + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",doccanceluserid = " + this.docCancelUserId + + ",docCancelUserType = '" + this.docCancelUserType + "'" + + ",doccanceldate = '" + this.docCancelDate + "'" + + ",doccanceltime = '" + this.docCancelTime + "'" + + " WHERE ID = " + this.id + ); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("15"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + } + } + + /** + * 重新打开文档 + * @param fu FileUpload对象 + * @throws Exception + */ + public void reopenDoc(FileUpload fu) throws Exception { + RecordSet rs = new RecordSet(); + + this.id = Util.getIntValue(fu.getParameter("id"), 0); + + this.maincategory = Util.getIntValue(fu.getParameter("maincategory"), 0); + this.subcategory = Util.getIntValue(fu.getParameter("subcategory"), 0); + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + + this.docstatus = fu.getParameter("docstatus"); + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + this.docsubject = Util.null2String(fu.getParameter("docsubject")); + this.doccreaterid = Util.getIntValue(fu.getParameter("doccreaterid"),0); + this.docCreaterType = Util.null2String(fu.getParameter("docCreaterType")); + + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.docReOpenUserId = this.userid; + this.docReopenUserType=this.usertype; + this.docReOpenDate = formatdate; + this.docReOpenTime = formattime; + this.docInvalUserId = this.userid; + this.docInvalUserType = this.usertype; + this.docInvalDate = formatdate; + this.docInvalTime = formattime; + + if(Util.getIntValue(this.docstatus)==5||Util.getIntValue(this.docstatus)==8){ + //重新打开 + if(Util.getIntValue(this.docstatus)==5) + this.docstatus = "2"; + if(Util.getIntValue(this.docstatus)==8) + this.docstatus = "7"; + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId==-1) + this.docEditionId = this.getNextEditionId(rs); + //this.docEdition = dc.getEdition(this.docEditionId)+1; + this.docEdition = dc.getEdition(this.docEditionId); + rs.executeSql(" update docdetail set docstatus = 7,ishistory = 1 where id <> " + this.id + " and docedition > 0 and docedition < " + this.docEdition + " and doceditionid > 0 and doceditionid = " + this.docEditionId); + } + + rs.executeSql( + " UPDATE DocDetail SET " + + " docstatus = " + this.docstatus + + ",docEdition = " + this.docEdition + + ",docEditionId = " + this.docEditionId + + ",docreopenuserid = " + this.docReOpenUserId + + ",docReopenUserType = '" + this.docReopenUserType +"'"+ + ",docreopendate = '" + this.docReOpenDate + "'" + + ",docreopentime = '" + this.docReOpenTime + "'" + + ",docinvaluserid = " + this.docInvalUserId + + ",docInvalUserType = '" + this.docInvalUserType + "'" + + ",docinvaldate = '" + this.docInvalDate + "'" + + ",docinvaltime = '" + this.docInvalTime + "'" + + " WHERE ID = " + this.id + ); + + log.resetParameter(); + log.setDocId(this.id); + log.setDocSubject(this.docsubject); + log.setOperateType("6"); + log.setOperateUserid(userid); + log.setUsertype(this.usertype); + log.setClientAddress(this.clientip); + log.setDocCreater(this.doccreaterid); + log.setCreatertype(this.docCreaterType); + log.setDocLogInfo(); + + } + } + //关联子文档 + public void relateSonDocWithNewDoc(int newDocId){ + RecordSet rs1 = new RecordSet(); + RecordSet rs2 = new RecordSet(); + + rs1.executeSql(" select doceditionid from docdetail where id = " + newDocId); + if(rs1.next()){ + String doceditionid = Util.null2String(rs1.getString("doceditionid")); + String docids = ""; + if("-1".equals(doceditionid)||"".equals(doceditionid) ){ //不应该查询所有非版本管理的文档 + return; + } + rs2.executeSql(" select id from docdetail where doceditionid = " + doceditionid); + while(rs2.next()){ + docids += ","; + docids += Util.null2String(rs2.getString("id")); + } + if(docids.startsWith(",")) docids=docids.substring(1); + if(docids!=null&&!"".equals(docids)) + rs2.executeSql("update docdetail set maindoc = " + newDocId + " where maindoc in (" + docids + ")"); + } + } + public String getNewDocids(String docids){ + String sNewDocids=""; + ArrayList lstDocid=Util.TokenizerString(docids, ","); + for(int i=0;i0) + filename_bak=filename.substring(0,filename.lastIndexOf(".")); + + rs.execute("select * from DocSecCategory where id="+seccategory+" and norepeatedname=1"); + if(rs.next()) + { + rs.execute("select * from DocDetail where seccategory="+seccategory+" and docsubject='"+filename_bak+"'"); + if(rs.next()) + { + String msg_str = ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(10003405,weaver.general.ThreadVarLanguage.getLang())+""; + HttpSession session =request.getSession(); + session.setAttribute("msg_str", msg_str); + return; + } + } + + // add by wjy for add custom data + addCustomData(fu, this.id); + + // 开始进行存储附件的操作 + imgManger.resetParameter(); + imgManger.setDocid(this.id); + imgManger.setImagefileid(Util.getIntValue(fileid, 0)); + imgManger.setImagefilename(filename); + imgManger.setIsextfile("1"); + imgManger.setVersionDetail("128095"); + imgManger.setOperateuserid(userid); + String ext = getFileExt(filename); + if (ext.equalsIgnoreCase("doc")) { + imgManger.setDocfiletype("3"); + } else if (ext.equalsIgnoreCase("xls")) { + imgManger.setDocfiletype("4"); + } else if (ext.equalsIgnoreCase("ppt")) { + imgManger.setDocfiletype("5"); + } else if (ext.equalsIgnoreCase("wps")) { + imgManger.setDocfiletype("6"); + } else if (ext.equalsIgnoreCase("docx")) { + imgManger.setDocfiletype("7"); + } else if (ext.equalsIgnoreCase("xlsx")) { + imgManger.setDocfiletype("8"); + } else if (ext.equalsIgnoreCase("pptx")) { + imgManger.setDocfiletype("9"); + } else if (ext.equalsIgnoreCase("et")) { + imgManger.setDocfiletype("10"); + } else { + imgManger.setDocfiletype("2"); + } + imgManger.AddDocImageInfo(); + + // 存储文档的内容 + this.doccontent = Util.fromBaseEncoding(fu.getParameter("doccontent"), languageid); + this.doccontent =Util.htmlFilter4UTF8(this.doccontent ); + + // 下面的操作可以得到此知识文档的相关资料 + Calendar today = Calendar.getInstance(); + String formatdate = Util.add0(today.get(Calendar.YEAR), 4) + "-" + + Util.add0(today.get(Calendar.MONTH) + 1, 2) + "-" + + Util.add0(today.get(Calendar.DAY_OF_MONTH), 2); + String formattime = Util.add0(today.get(Calendar.HOUR_OF_DAY), 2) + ":" + + Util.add0(today.get(Calendar.MINUTE), 2) + ":" + Util.add0(today.get(Calendar.SECOND), 2); + + this.seccategory = Util.getIntValue(fu.getParameter("seccategory"), 0); + this.subcategory=Util.getIntValue(scc.getSubCategoryid(""+this.seccategory)); + this.maincategory=Util.getIntValue(subc.getMainCategoryid(""+this.subcategory)); + + this.doclangurage = Util.getIntValue(fu.getParameter("doclangurage"), 0); + this.docreplyable = fu.getParameter("docreplyable"); + this.isreply = Util.null2String(fu.getParameter("isreply")); + this.replydocid = Util.getIntValue(fu.getParameter("replydocid"), 0); + this.ownerid = Util.getIntValue(fu.getParameter("ownerid"), 0); + this.ownerType = this.usertype; + + this.doclangurage = Util.getIntValue(fu.getParameter("doclangurage"), 0); + + int tempPos=filename.lastIndexOf("."); + if(tempPos==-1) this.docsubject = filename; + else this.docsubject = filename.substring(0, tempPos); + + this.docpublishtype = fu.getParameter("docpublishtype"); + if (docpublishtype.equals("2")) { + //String docmain = fu.getParameter("docmain"); + String docmain = Util.toHtml2(Util.encodeAnd(Util.null2String(fu.getParameter("docmain")))); + this.doccontent = docmain + "!@#$%^&*" + this.doccontent; + } + + this.itemid = Util.getIntValue(fu.getParameter("itemid"), 0); + this.itemmaincategoryid = Util.getIntValue(fu.getParameter("itemmaincategoryid"), 0); + this.hrmresid = Util.getIntValue(fu.getParameter("hrmresid"), 0); + this.assetid = Util.getIntValue(fu.getParameter("assetid"), 0); + this.crmid = Util.getIntValue(fu.getParameter("crmid"), 0); + this.projectid = Util.getIntValue(fu.getParameter("projectid"), 0); + this.financeid = Util.getIntValue(fu.getParameter("financeid"), 0); + this.doccreaterid = this.userid; + this.docCreaterType=this.usertype; + // TD1715 新建或者编辑文档时,更改文档的所有者,促使文档所在的部门被清除 DP + this.docdepartmentid = Util.getIntValue(hrc.getDepartmentID("" + ownerid)); + // this.docdepartmentid = + // Util.getIntValue(fu.getParameter("docdepartmentid"), 0); + this.doccreatedate = formatdate; + this.doccreatetime = formattime; + this.doclastmoduserid = this.userid; + this.docLastModUserType=this.usertype; + this.doclastmoddate = formatdate; + this.doclastmodtime = formattime; + this.docapproveuserid = 0; + this.docApproveUserType = ""; + this.docapprovedate = ""; + this.docapprovetime = ""; + this.docarchiveuserid = 0; + this.docArchiveUserType = ""; + this.docarchivedate = ""; + this.docarchivetime = ""; + this.newsid = Util.getIntValue(fu.getParameter("newsid"), 0); + + rs = new RecordSet(); + SysRemindWorkflow srw = new SysRemindWorkflow(); + String sql = ""; + if (replydocid != 0) { + sql = "select id,canremind,docsubject,doccreaterid from DocDetail where id=" + replydocid; + //System.out.println("sql = " + sql); + String canRemind = ""; + rs.executeSql(sql); + if (rs.next()) { + canRemind = rs.getString("canremind"); + if (canRemind.equals("2")) { + srw.setSysRemindInfo("回复提醒:" + rs.getString("docsubject"), this.id, 0, 0, 0, this.userid, + rs.getString("doccreaterid") + "", ""); + } + } + } + + if (Util.null2String(fu.getParameter("parentids")).equals("")) { + this.parentids = this.id + ""; + } else { + this.parentids = Util.null2String(fu.getParameter("parentids")) + "," + this.id; + } + + this.keyword = Util.null2String(fu.getParameter("keyword")); + /* 文档的关键字 */ + + int docid = this.id; + + this.accessorycount = 1; + + if (isreply.equals("1")) { + AddReplayDocCount(rs); // 修改回复记录条数 + } + + /* 回复文档总数 */ + this.replaydoccount = 0; + /* 创建的用户类型 1: 内部 2: 外部 */ + //this.usertype = Util.null2String(fu.getParameter("usertype")); + this.topage = Util.null2String(fu.getParameter("topage")); + + this.contractman = Util.null2String(fu.getParameter("contractman")); + this.contractstartdate = Util.null2String(fu.getParameter("contractstartdate")); + this.contractenddate = Util.null2String(fu.getParameter("contractenddate")); + this.docmodule = Util.null2String(fu.getParameter("docmodule")); + this.proenddate = Util.null2String(fu.getParameter("proenddate")); + this.typeid = Util.getIntValue(fu.getParameter("typeid"), 0); + this.urlfrom = Util.null2String(fu.getParameter("urlfrom")); + this.canCopy = "" + Util.getIntValue(fu.getParameter("cancopy"), 1); + this.canRemind = "" + Util.getIntValue(fu.getParameter("canremind"), 1); + + // get catagory's orderable + this.orderable = "" + scc.getSecOrderable(this.seccategory); + + this.docEdition = Util.getIntValue(fu.getParameter("docedition"),-1); + this.docEditionId = Util.getIntValue(fu.getParameter("doceditionid"),-1); + + if(scc.isEditionOpen(this.seccategory)) {//如果版本管理开启 + if(this.docEditionId == -1){// 如果不存在历史版本 + this.docEditionId = this.getNextEditionId(rs); + } else { + // TODO 否则,通过版本ID找到同文档的版本 + //新建文档不存在以前有版本 + } + this.docEdition = dc.getEdition(this.docEditionId)+1; + } + + this.mainDoc = Util.getIntValue(Util.null2String(fu.getParameter("maindoc")),-1); + if(this.mainDoc==-1) this.mainDoc = this.id; + + // added by wdl + this.docCode = Util.null2String(fu.getParameter("doccode")); + if(this.docCode.equals("")){ + DocCoder dc = new DocCoder(); + if(this.mainDoc == this.id){ + this.docCode = dc.getDocCoder(""+this.seccategory); + }else{ + this.docCode = dc.getSecDocCoder(""+mainDoc,""+this.seccategory); + } + } + + this.readOpterCanPrint = Util.getIntValue(fu.getParameter("readoptercanprint"), 0); + + this.invalidationDate = Util.null2String(fu.getParameter("invalidationdate")); + this.dummycata = Util.null2String(fu.getParameter("dummycata")); + + if(scc.isNoRepeatedName(this.seccategory)){ + // TODO + + } + + this.docstatus = "1"; + + // 如果在目录上设置了 创建者对此目录下的文档无权限查看则此文档被直接置为正常 TD4111 TD4112 begin + RecordSet rsCreater = new RecordSet(); + int pcreater = 3; + String strCreaterSql = "select pcreater from secCreaterDocPope where secid=" + this.seccategory; + + rsCreater.executeSql(strCreaterSql); + if (rsCreater.next()) { + pcreater = Util.getIntValue(rsCreater.getString("pcreater"), 0); + } + + if (!contractman.equals("")) { + this.docstatus = "1"; + docCreaterType=""; + } + + this.secretLevel = Util.getIntValue(fu.getParameter("secretLevel"),DEFAILT_SECRET_LEVEL); + this.secretValidity = Util.null2s(fu.getParameter("secretValidity"),""); + + this.replyremind = Util.getIntValue(fu.getParameter("replyremind"),0); + + AddDocInfo(); + AddShareInfo(); + + DocViewer DocViewer = new DocViewer(); + DocViewer.setDocShareByDoc("" + this.id); + + DocComInfo docComInfo =new DocComInfo(); + RecordSet rsforsend = new RecordSet(); + SendToAllForNew sendToAllForNew = new SendToAllForNew(); + String sendToAll = sendToAllForNew.checkeSendingRightForDocid( this.id+""); + int docId = this.id; + //设置推送提醒 start + String docstatus = docComInfo.getDocStatus(this.id+""); + if("1".equals(sendToAll)){ + if("3".equals(docstatus)||"6".equals(docstatus)||"9".equals(docstatus)){ + if("-1".equals(sendToAllForNew.checkIsExist(docId+""))){ + rsforsend.executeSql("insert into sendtoalltemp (docid,shareids,status) values ("+docId+",'',0)"); + } + }else if("1".equals(docstatus) || "2".equals(docstatus)){ + User user = new User(this.userid); + ThreadForAllForNew sendToAllfornew = new ThreadForAllForNew(docId+"","",user); + sendToAllfornew.start(); + } + + } + //设置推送提醒 end + } + + /** + * 截取不大于指定字节长度的字符串 + * @param initString 初始字符串 + * @param byteLength 指定字节长度 + * @return String 不大于指定字节长度的字符串 + */ + private static String interceptString(String initString,int byteLength) { + try{ + + String returnString=""; + int counterOfDoubleByte = 0; + byte[] b = initString.getBytes("UTF-8"); + if(b.length <= byteLength) + return initString; + for(int i = 0; i < byteLength; i++){ + if(b[i] < 0) + counterOfDoubleByte++; + } + + if(counterOfDoubleByte % 2 == 0){ + returnString=new String(b, 0, byteLength, "UTF-8"); + }else{ + returnString=new String(b, 0, byteLength - 1, "UTF-8"); + } + + List noInterceptStringList =new ArrayList(); + noInterceptStringList.add("<"); + noInterceptStringList.add(">"); + noInterceptStringList.add("""); + noInterceptStringList.add("
"); + + List partList=new ArrayList(); + List allList=new ArrayList(); + + String noInterceptString=null; + for(int i=0;i0) + { + date2during = Util.getIntValue(date2duringTokens[0],0); + } + if(date2during<0||date2during>36) + { + date2during = 0; + } + return date2during; + } + + /** + * 获取门户文档中心查询间期 + * @return + */ + public int getDateDuringForHp(){ + BaseBean baseBean = new BaseBean(); + int date2during = 0; + String date2durings = ""; + try + { + date2durings = Util.null2String(baseBean.getPropValue("docdateduring", "date2duringforhp")); + } + catch(Exception e) + {} + + date2during = Util.getIntValue(date2durings,0); + + if(date2during<0||date2during>36) + { + date2during = 0; + } + return date2during; + } + /** + * 返回文档期间查询sql + * @param date2during + * @return + */ + public String getDateDuringSql(int date2during) + { + String strResult = ""; + Calendar now = Calendar.getInstance(); + String today=Util.add0(now.get(Calendar.YEAR), 4) +"-"+ + Util.add0(now.get(Calendar.MONTH) + 1, 2) +"-"+ + Util.add0(now.get(Calendar.DAY_OF_MONTH), 2) ; + int year=now.get(Calendar.YEAR); + int month=now.get(Calendar.MONTH); + int day=now.get(Calendar.DAY_OF_MONTH); + if(date2during>0&&date2during<37) + { + Calendar tempday = Calendar.getInstance(); + tempday.clear(); + tempday.set(year,month,day-30*date2during); + + String lastday=Util.add0(tempday.get(Calendar.YEAR), 4) +"-"+Util.add0(tempday.get(Calendar.MONTH) + 1, 2) +"-"+Util.add0(tempday.get(Calendar.DAY_OF_MONTH), 2) ; + strResult+=" and doclastmoddate>'"+lastday+"' "; + } + return strResult; + } + + /** + * 更新文档图片对应关系 + * + * @param docid 文档id + * @param doccontent 文档内容 + * + */ + private void updateDocImageFileOfPic(int docid,String doccontent){ + List existsimagefileidlist=new ArrayList(); + List htmlimagefileidlist=new ArrayList(); + List deletedimagefileidlist=new ArrayList(); + int imagefileid=0; + RecordSet rsTwo=new RecordSet(); + rsTwo.executeSql("select imagefileid from docimagefile where docid="+docid+" and docfiletype='1'"); + while(rsTwo.next()){ + imagefileid=Util.getIntValue(rsTwo.getString("imagefileid"),-1); + existsimagefileidlist.add(""+imagefileid); + } + List newimagefileidlist=new ArrayList(); + int tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid="); + while (tmppos != -1) { + int imagefileidbeginpos=tmppos+"/weaver/weaver.file.FileDownload?fileid=".length(); + int imagefileidendpos1=doccontent.indexOf("\"",tmppos); + int imagefileidendpos2=doccontent.indexOf("&",tmppos); + //int imagefileidendpos=imagefileidendpos1imagefileidendpos2&&imagefileidendpos2>tmppos){ + imagefileidendpos=imagefileidendpos2; + } + + if(imagefileidendpos>imagefileidbeginpos){ + imagefileid=Util.getIntValue(doccontent.substring(imagefileidbeginpos,imagefileidendpos)); + if(imagefileid>0){ + htmlimagefileidlist.add(""+imagefileid); + } + if(existsimagefileidlist.indexOf(""+imagefileid)==-1){ + newimagefileidlist.add(""+imagefileid); + } + } + tmppos = doccontent.indexOf("/weaver/weaver.file.FileDownload?fileid=", tmppos + 1); + } + for(int i=0;i0){ + imgManger.resetParameter(); + imgManger.setImagefileid(imagefileid); + imgManger.setDocid(docid); + imgManger.DeleteSingleDocImageInfo(); + } + } + } + + /** + * 修正创建或者编辑文档时,文档内容中的图片和文档对应关系 + * @param docid + * @param docContent + * 备注:该方法建议停用 + */ + public void correctDocImageFileByDocContent(int docid,String docContent){ + ArrayList list=Util.matchAll(docContent,"/weaver/weaver.file.FileDownload\\?fileid=([0-9]+)",1,1); + RecordSet rsTwo= new RecordSet(); + RecordSet rs2= new RecordSet(); + for(int i=0;i0){ + flag = true; + } + } + + return flag; + } + + /** + * 更新文档图片对应关系 + * + * @param docid 文档id + * @param deleteaccessory 被删除的附件id + * @return String 被删除的所有版本的附件id + */ + private String getAllDeleteaccessory(int docid,String deleteaccessory){ + + if(deleteaccessory==null||deleteaccessory.trim().equals("")){ + return ""; + } + + String returndeleteaccessory=deleteaccessory; + int imagefileid=0; + RecordSet rsTwo=new RecordSet(); + rsTwo.executeSql("select imagefileid from docimagefile a where a.docid="+docid+" and exists(select * from docimagefile b where b.docid="+docid+" and b.imagefileid in ("+deleteaccessory+") and b.id=a.id)"); + while(rsTwo.next()){ + imagefileid=Util.getIntValue(rsTwo.getString("imagefileid"),-1); + if(imagefileid<=0){ + continue; + } + if((","+returndeleteaccessory+",").indexOf(","+imagefileid+",")==-1){ + returndeleteaccessory=returndeleteaccessory+","+imagefileid; + } + } + return returndeleteaccessory; + } + public static int getReplyCount125(String docid){ + RecordSet rs125 = new RecordSet(); + rs125.executeSql("select replaydoccount from DocDetail where id="+docid); + if(rs125.next()) return rs125.getInt(1); + return 0; + } + public String getSource() { + return source; + } + + public void setSource(String source) { + this.source = source; + } +} diff --git a/weaver/docs/weaver.zip b/weaver/docs/weaver.zip new file mode 100644 index 0000000..2e9c22b Binary files /dev/null and b/weaver/docs/weaver.zip differ diff --git a/weaver/file/FileUpload.java b/weaver/file/FileUpload.java new file mode 100644 index 0000000..2184c6a --- /dev/null +++ b/weaver/file/FileUpload.java @@ -0,0 +1,1382 @@ +package weaver.file; + + +/** + * Title: hpsales + * Description: for hp sales system + * Copyright: Copyright (c) 2001 + * Company: weaver + * + * @author liuyu, Charoes Huang + * @version 1.0 ,2004-6-25 + */ + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; +import weaver.alioss.AliOSSObjectManager; +import weaver.conn.RecordSet; +import weaver.docs.docs.DocManager; +import weaver.docs.docs.ImageFileIdUpdate; +import weaver.email.MailCommonUtils; +import weaver.email.service.MailAliOSSService; +import weaver.file.multipart.DefaultFileRenamePolicy; +import weaver.file.multipart.MultipartRequest; +import weaver.file.multipart.UploadedFile; +import weaver.file.util.FileSuffixCheckUtil; +import weaver.file.util.PicCompression; +import weaver.filter.XssUtil; +import weaver.general.BaseBean; +import weaver.general.GCONST; +import weaver.general.StaticObj; +import weaver.general.Util; +import weaver.security.util.SecurityMethodUtil; +import weaver.system.SystemComInfo; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.net.URLDecoder; +import java.util.*; +import java.util.List; +import java.util.zip.ZipInputStream; + +public class FileUpload extends BaseBean { + private static ImageFileIdUpdate imageFileIdUpdate = new ImageFileIdUpdate(); + + + private MultipartRequest mpdata = null; + HttpServletRequest request = null; + private String[] filenames = null; + private InputStream source = null; + private ArrayList filesizes = new ArrayList(); + private ArrayList imagewidth = new ArrayList(); + private ArrayList imageheight = new ArrayList(); + private ArrayList delfilerealpaths = new ArrayList(); + private int mailid; + private boolean needimagewidth = false; + private boolean needzip = false; + private boolean needzipencrypt = false; + private String isaesencrypt = "0"; + private String aescode = ""; + private String remoteAddr = ""; + private XssUtil xss = null; + + public FileUpload(HttpServletRequest request) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request); + this.request = request; + this.xss = new XssUtil(); + } + + public FileUpload(HttpServletRequest request, String encode) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request, encode); + this.request = request; + this.xss = new XssUtil(); + } + + public FileUpload(HttpServletRequest request, String encode, boolean iszip, String isEmail) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request) && "1".equals(isEmail)) mpdata = getEmailAttachment(request, encode, iszip); + this.request = request; + this.xss = new XssUtil(); + } + + public FileUpload(HttpServletRequest request, String encode, boolean iszip) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request, encode, iszip); + this.request = request; + this.xss = new XssUtil(); + } + + public FileUpload(HttpServletRequest request, String encode, boolean iszip, boolean isoriginal) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request, encode, iszip, isoriginal); + this.request = request; + this.xss = new XssUtil(); + } + + //modify by mackjoe at 2005-11-28 td3282 获得request对象 + public HttpServletRequest getRequest() { + return request; + } + + //for license upload by chenyingjie 2003-06-26 + public FileUpload(HttpServletRequest request, boolean iszip) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request, iszip); + this.request = request; + } + + public FileUpload(HttpServletRequest request, boolean iszip, boolean isaesencrypt) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request, iszip, isaesencrypt); + this.request = request; + } + + + //for homepage image upload by dongping 2006-8-24 + public FileUpload(HttpServletRequest request, boolean iszip, String strDirAddr) { + this.remoteAddr = request.getRemoteAddr(); + if (isMultipartData(request)) mpdata = getAttachment(request, iszip, strDirAddr); + this.request = request; + } + + //html模板图片保存 + public FileUpload(HttpServletRequest request, boolean iszip, boolean encoding, String strDirAddr) { + this.remoteAddr = Util.getIpAddr(request); + if (isMultipartData(request)) mpdata = getAttachment(request, iszip, encoding, strDirAddr); + this.request = request; + } + + public Hashtable getUploadImgNames() { + String el = "", imgpath = "", imgname = ""; + Hashtable ht = new Hashtable(); + for (Enumeration e = mpdata.getFileUploadNames(); e.hasMoreElements(); ) { + el = (String) e.nextElement(); + if (el.indexOf("docimages_") == -1) continue; + imgpath = Util.null2String(mpdata.getFilePath(el)); + imgname = Util.null2String(mpdata.getFileName(el)); + if (imgpath.equals("") || imgname.equals("")) continue; + String elNumber = el.substring(el.indexOf("_") + 1, el.length()); + ht.put(elNumber, imgpath + imgname); + + } + return ht; + } + + public Hashtable getUploadFileNames() { + String el = "", imgpath = "", imgname = ""; + Hashtable ht = new Hashtable(); + for (Enumeration e = mpdata.getFileUploadNames(); e.hasMoreElements(); ) { + el = (String) e.nextElement(); + UploadedFile uploadedFile = mpdata.getUploadedFile(el); + ht.put(el, uploadedFile); + } + return ht; + } + + //modify by xhheng @20050315 for 流程附件上传 + public String getRemoteAddr() { + return remoteAddr; + } + + public String getParameter(String key) throws RuntimeException { + if (!isMultipartData(request)) return Util.null2String(request.getParameter(key)); + if (mpdata == null) return ""; +// return Util.null2String(mpdata.getParameter(key)) ; + + try { + String value = Util.null2String(mpdata.getParameter(key)); + if (!value.equals("")) {//特殊参数需要从paramsMap中获取 + if (value.startsWith(XssUtil.__RANDOM__)) { + //xssUtil.cacheKey(Util.null2String(Thread.currentThread().hashCode()),value); + return xss.get(value); + } + } + return new String(value.getBytes("ISO8859_1"), "UTF-8"); + } catch (Exception ex) { + return ""; + } + } + + + public String getParameter2(String key) { + if (!isMultipartData(request)) return Util.null2String(request.getParameter(key)); + if (mpdata == null) return ""; + String value = Util.null2String(mpdata.getParameter(key)); + return value; + } + + /** + * 本方法返回值不会对null进行特殊处理,如果是null则直接返回null, + * 如果是空字符串("")则直接返回空字符串("")。 + * + * @param key + * @return + */ + public String getParameter3(String key) { + if (!isMultipartData(request)) { + return request.getParameter(key); + } + if (mpdata == null) { + return null; + } + + String value = mpdata.getParameter(key); + if (value == null) { + return null; + } + + try { + return new String(value.getBytes("ISO8859_1"), "UTF-8"); + } catch (Exception ex) { + return value; + } + } + + public String[] getParameters(String key) { + if (!isMultipartData(request)) return request.getParameterValues(key); + if (mpdata == null) return null; + String[] values = mpdata.getParameterValues(key); + return values; + } + + public Enumeration getParameterNames() { + if (!isMultipartData(request)) return request.getParameterNames(); + if (mpdata == null) return null; + return mpdata.getParameterNames(); + } + + public String[] getParameterValues(String name) { + if (!isMultipartData(request)) return request.getParameterValues(name); + if (mpdata == null) return null; + String[] values = mpdata.getParameterValues(name); + return values; + } + + public String[] getParameterValues2(String name) { + String[] values = null; + if (!isMultipartData(request)) { + values = request.getParameterValues(name); + String[] multivalues = new String[values.length]; + try { + for (int i = 0; i < values.length; i++) { + multivalues[i] = new String(Util.null2String(values[i]).getBytes("ISO8859_1"), "UTF-8"); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return multivalues; + } + if (mpdata == null) return null; + values = mpdata.getParameterValues(name); + String[] multivalues = new String[values.length]; + try { + for (int i = 0; i < values.length; i++) { + multivalues[i] = new String(Util.null2String(values[i]).getBytes("ISO8859_1"), "UTF-8"); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return multivalues; + } + + + public String getFileName() { + return this.filenames[0].replace("'", "’"); + } + + public String[] getFileNames() { + return this.filenames; + } + + public void setFileNames(String[] filenames) { + this.filenames = filenames; + } + + public int getFileSize() { + return Util.getIntValue((String) this.filesizes.get(0)); + } + + public int[] getFileSizes() { + int[] filesizearr = new int[filesizes.size()]; + for (int i = 0; i < filesizes.size(); i++) filesizearr[i] = Util.getIntValue((String) this.filesizes.get(i)); + return filesizearr; + } + + public void setFileSizes(ArrayList filesizes) { + this.filesizes = filesizes; + } + + public int getWidth() { + return Util.getIntValue((String) this.imagewidth.get(0)); + } + + public int getHeight() { + return Util.getIntValue((String) this.imageheight.get(0)); + } + + public int[] getWidths() { + int[] imagewidtharr = new int[imagewidth.size()]; + for (int i = 0; i < imagewidth.size(); i++) + imagewidtharr[i] = Util.getIntValue((String) this.imagewidth.get(i)); + return imagewidtharr; + } + + public int[] getHeights() { + int[] imageheightarr = new int[imageheight.size()]; + for (int i = 0; i < imageheight.size(); i++) + imageheightarr[i] = Util.getIntValue((String) this.imageheight.get(i)); + return imageheightarr; + } + + public void setMailid(int mailid) { + this.mailid = mailid; + } + + public int getMailid() { + return mailid; + } + + public void needImagewidth(boolean needimagewidth) { + this.needimagewidth = needimagewidth; + } + + public ArrayList getDelFilerealpaths() { + return delfilerealpaths; + } + + + public String uploadFiles(String uploadname) { + String[] uploadnames = new String[1]; + uploadnames[0] = uploadname; + String paramFileName = this.getParameter("name"); //获取参数当中的文件名 + //String[] filenames = uploadFiles(uploadnames) ; + String[] filenames = uploadFiles(uploadnames, paramFileName); + if (filenames == null || filenames.length < 1) { + return null; + } + return filenames[0]; + } + + //add by liuy 20190705 start + /* 上传文件文件名IOS系统出现错误问题修复 + * + */ + public String[] uploadFiles(String[] uploadnames, String paramFileName) { + if (mpdata == null) return null; + + int upload_numbers = uploadnames.length; + String[] fileids = new String[upload_numbers]; + this.filenames = new String[upload_numbers]; + for (int i = 0; i < upload_numbers; i++) { + filenames[i] = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadnames[i])); + if (filenames[i] == null || "".equals(filenames[i])) { + return fileids; + } + //满足三个条件,否则走else; + //1 请求参数未包含文件名 + //2 有请求参数并且和上传文件流里的文件名参数一致 + //3 值不一致,但是文件流里的文件名为file,防止 IOS篡改 + if (StringUtils.isBlank(paramFileName) || paramFileName.equals(filenames[i]) || (!paramFileName.equals(filenames[i]) && !"file".equals(filenames[i]))) { + fileids[i] = saveFile(uploadnames[i], mpdata); + } else { + filenames[i] = paramFileName; //修改文件名 + fileids[i] = saveFile(uploadnames[i], paramFileName, mpdata); + } + + } + return fileids; + } + + public String[] uploadFiles(String[] uploadnames) { + if (mpdata == null) return null; + int upload_numbers = uploadnames.length; + String[] fileids = new String[upload_numbers]; + this.filenames = new String[upload_numbers]; + for (int i = 0; i < upload_numbers; i++) { + filenames[i] = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadnames[i])); + if (filenames[i] != null && !filenames[i].equals("")) { + fileids[i] = saveFile(uploadnames[i], mpdata); + } + } + return fileids; + } + + /** + * 处理邮件模块上传的附件存储 + * + * @param uploadname + * @return + */ + public String uploadFilesToEmail(String uploadname) { + String[] uploadnames = new String[1]; + uploadnames[0] = uploadname; + String[] filenames = uploadFilesToEmail(uploadnames); + return filenames[0]; + } + + /** + * 处理邮件模块上传的附件存储 + * + * @param uploadnames + * @return + */ + public String[] uploadFilesToEmail(String[] uploadnames) { + if (mpdata == null) return null; + int upload_numbers = uploadnames.length; + String[] fileids = new String[upload_numbers]; + this.filenames = new String[upload_numbers]; + for (int i = 0; i < upload_numbers; i++) { + filenames[i] = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadnames[i])); + if (filenames[i] != null && !filenames[i].equals("")) { + fileids[i] = saveFileToEmail(uploadnames[i], mpdata); + } + } + return fileids; + } + + /** + * 保存邮件附件记录到mailresourcefile表。 + * + * @param uploadname + * @param mpdata + * @return + */ + private synchronized String saveFileToEmail(String uploadname, MultipartRequest mpdata) { + String imageid = ""; + String filepath = mpdata.getFilePath(uploadname); + String filename = mpdata.getFileName(uploadname); + String originalfilename = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadname)); + writeLog("-saveFileToEmail-filename:" + filename + "-originalfilename:" + originalfilename); + originalfilename = StringEscapeUtils.unescapeHtml(originalfilename); + writeLog("-saveFileToEmail-unescapeHtml-originalfilename:" + originalfilename); + String contenttype = mpdata.getContentType(uploadname); + long filesize = mpdata.getFileSize(uploadname); + String filerealpath = filepath + filename; + // WeavermailComInfo wmc = new WeavermailComInfo() ; + String isfileattrachment = "1";// wmc.getCurrentFileAttachment() ; + String fileContentId = "";// wmc.getCurrentFileContentId(); + String isEncoded = "";// wmc.getCurrentFilenameencode(); + String secretLevel = Util.null2s(getParameter("secretLevel"), "4"); + String secretDeadline = Util.null2s(getParameter("secretLevelValidity"), ""); + + //判断实体文件是否存在,如果不存在,保存失败。 + File file = new File(filerealpath); + if (!file.exists()) { + writeLog("检测到实体文件不存在,附件上传失败.originalfilename=" + originalfilename + ",filerealpath=" + filerealpath); + return imageid; + } + + String iszip = "0"; + String isencrypt = "0"; + if (needzip) iszip = "1"; + if (needzipencrypt) isencrypt = "1"; + + originalfilename = escapeSpecialCharactersForFileName(originalfilename); + + RecordSet rs = new RecordSet(); + char separator = Util.getSeparator(); + String mailFileUUID = MailCommonUtils.getRandomUUID(); + String para = "0" + separator + originalfilename + separator + contenttype + separator + filerealpath + + separator + iszip + separator + isencrypt + separator + isfileattrachment + separator + fileContentId + + separator + isEncoded + separator + String.valueOf(filesize) + separator + mailFileUUID; + rs.executeProc("MailResourceFile_Insert", para); + rs.executeQuery("select id from MailResourceFile where mrf_uuid = ?", mailFileUUID); + if (rs.next()) { + imageid = rs.getString("id"); + } + + // 更新加密信息 + rs.executeUpdate("update MailResourceFile set isaesencrypt=?, aescode=?, secretLevel=?, secretDeadline=? where id=?", isaesencrypt, aescode, secretLevel, secretDeadline, imageid); + + //处理oss存储逻辑 + MailAliOSSService mailAliOSSService = new MailAliOSSService(); + mailAliOSSService.updateFileToOSSByUUID(mailFileUUID); + + return imageid; + } + + /** + * 过滤附件名称里的特殊字符,防止入库 是出现 问号? + * + * @param fileName + * @return + */ + private String escapeSpecialCharactersForFileName(String fileName) { + fileName = Util.null2String(fileName); + + fileName = fileName.replaceAll("(\r\n|\r|\n|\n\r)", "").replaceAll("\t", ""); // 替换换行符,tab符 + + //替换英文半角字符,防止半角字符展示为?问号 https://tbatm.iteye.com/blog/2196068 + byte bytes[] = {(byte) 0xC2, (byte) 0xA0}; + try { + String UTFSpace = new String(bytes, "utf-8"); + fileName = fileName.replaceAll(UTFSpace, " "); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return fileName; + } + + + /** + * 处理邮件模块上传的附件存储 + * + * @param uploadnames + * @param withsave + * @return + */ + public ArrayList uploadFilesToMail(String[] uploadnames, String withsave) { + if (mpdata == null) return null; + int upload_numbers = uploadnames.length; + ArrayList filecontents = new ArrayList(); + this.filenames = new String[upload_numbers]; + for (int i = 0; i < upload_numbers; i++) { + String tempfilename = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadnames[i])); + if (tempfilename != null && !tempfilename.equals("")) { + filenames[i] = tempfilename; + filecontents.add(getFileContent(uploadnames[i], mpdata, withsave)); + } + } + return filecontents; + } + + + private MultipartRequest getAttachment(HttpServletRequest req) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = getCreateDir(syscominfo.getFilesystem()); + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + if ((syscominfo.getNeedzip()).equals("1")) needzip = true; + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, "", isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + private MultipartRequest getAttachment(HttpServletRequest req, String encoding) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = getCreateDir(syscominfo.getFilesystem()); + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + if ((syscominfo.getNeedzip()).equals("1")) needzip = true; + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, encoding, isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + private MultipartRequest getEmailAttachment(HttpServletRequest req, String encoding, boolean iszip) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + + // String createdir = getCreateDir(syscominfo.getFilesystem()) ; + String createdir = GCONST.getRootPath() + "filesystem" + File.separatorChar; + createdir = getCreateDir(createdir + File.separatorChar); + RecordSet rs = new RecordSet(); + rs.execute("select filePath from MailConfigureInfo"); + while (rs.next()) { + String emailpath = rs.getString("filePath"); + if (!"".equals(emailpath)) { + createdir = getCreateDir(emailpath + File.separatorChar); + } + } + + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + needzip = iszip; + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, encoding, isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + protected MultipartRequest getAttachment(HttpServletRequest req, String encoding, boolean iszip) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = getCreateDir(syscominfo.getFilesystem()); + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + needzip = iszip; + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, encoding, isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + private MultipartRequest getAttachment(HttpServletRequest req, String encoding, boolean iszip, boolean original) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = null; + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = getCreateDir(syscominfo.getFilesystem()); + isaesencrypt = "0"; + aescode = Util.getRandomString(13); + needzip = false; + if (!original) { + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + needzip = iszip; + } + + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, encoding, isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + //for license upload by chenyingjie 2003-06-26 + private MultipartRequest getAttachment(HttpServletRequest req, boolean iszip) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = getCreateDir(syscominfo.getFilesystem()); + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + if ((syscominfo.getNeedzip()).equals("1")) needzip = true; + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + if (!iszip) needzip = false; + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, "", isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + private MultipartRequest getAttachment(HttpServletRequest req, boolean iszip, boolean isaesencryptBoolean) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = getCreateDir(syscominfo.getFilesystem()); + if (isaesencryptBoolean) { + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + } + if ((syscominfo.getNeedzip()).equals("1")) needzip = true; + // if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + if (!iszip) needzip = false; + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, "", isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + public List getFiles() { + if (mpdata == null) return null; + return mpdata.getFiles(); + } + + //for homepage edit by dongping 2006-08-24 + private MultipartRequest getAttachment(HttpServletRequest req, boolean iszip, String strDirAddr) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + //String createdir = getCreateDir(syscominfo.getFilesystem()) ; + isaesencrypt = syscominfo.getIsaesencrypt(); + aescode = Util.getRandomString(13); + String createdir = getCreateDir(GCONST.getRootPath() + strDirAddr); + if ((syscominfo.getNeedzip()).equals("1")) needzip = true; + //if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + if (!iszip) needzip = false; + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, "", isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + //html模板图片保存 + private MultipartRequest getAttachment(HttpServletRequest req, boolean iszip, boolean encoding, String strDirAddr) { + if (isMultipartData(req)) + try { + DefaultFileRenamePolicy defpolicy = new DefaultFileRenamePolicy(); + SystemComInfo syscominfo = new SystemComInfo(); + //String createdir = getCreateDir(syscominfo.getFilesystem()) ; + isaesencrypt = syscominfo.getIsaesencrypt(); + if (!encoding) isaesencrypt = "0"; + aescode = Util.getRandomString(13); + String createdir = getCreateDir(GCONST.getRootPath() + strDirAddr); + if ((syscominfo.getNeedzip()).equals("1")) needzip = true; + //if( (syscominfo.getNeedzipencrypt()).equals("1") ) needzipencrypt = true ; + + if (!iszip) needzip = false; + return new MultipartRequest(req, createdir, req.getContentLength(), defpolicy, needzip, needzipencrypt, "", isaesencrypt, aescode); + } catch (Exception ex) { + writeLog(ex); + return null; + } + return null; + } + + private InputStream getFileContent(String uploadname, MultipartRequest mpdata, String withsave) { + if (withsave.equals("1") || withsave.equals("2")) { + + String filepath = mpdata.getFilePath(uploadname); + String filename = mpdata.getFileName(uploadname); + String originalfilename = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadname)); + String contenttype = mpdata.getContentType(uploadname); + long filesize = mpdata.getFileSize(uploadname); + String filerealpath = filepath + filename; + //WeavermailComInfo wmc = new WeavermailComInfo() ; + String isfileattrachment = "1";//wmc.getCurrentFileAttachment() ; + String fileContentId = "";//wmc.getCurrentFileContentId(); + String isEncoded = "";//wmc.getCurrentFilenameencode(); + + String iszip = "0"; + String isencrypt = "0"; + if (needzip) iszip = "1"; + if (needzipencrypt) isencrypt = "1"; + + RecordSet rs = new RecordSet(); + char separator = Util.getSeparator(); + + String para = "" + mailid + separator + originalfilename + separator + + contenttype + separator + filerealpath + separator + + iszip + separator + isencrypt + separator + isfileattrachment + separator + + fileContentId + separator + isEncoded + separator + String.valueOf(filesize); + + rs.executeProc("MailResourceFile_Insert", para); + } else { + String filepath = mpdata.getFilePath(uploadname); + String filename = mpdata.getFileName(uploadname); + String filerealpath = filepath + filename; + delfilerealpaths.add(filerealpath); + } + + try { + File thefile = mpdata.getFile(uploadname); + if (needzip) { + ZipInputStream zin = new ZipInputStream(new FileInputStream(thefile)); + if (zin.getNextEntry() != null) source = new BufferedInputStream(zin); + } else source = new BufferedInputStream(new FileInputStream(thefile)); + } catch (Exception e) { + writeLog(e); + } + + return source; + + /* 原有的存储附件数据在数据库中的方式 + + boolean isoracle = (statement.getDBType()).equals("oracle") ; + + try { + statement = new ConnStatement(); + + File thefile = mpdata.getFile(uploadname) ; + int fileLength = new Long(thefile.length()).intValue(); + source = new BufferedInputStream(new FileInputStream(thefile),500*1024) ; + + String sql = "" ; + + if( isoracle) { + sql = "insert into MailResourceFile(mailid,filename,attachfile,filetype) values(?,?,empty_blob(),?)"; + statement.setStatementSql(sql); + statement.setInt(1,mailid); + statement.setString(2,filename) ; + statement.setString(3,contenttype) ; + statement.executeUpdate(); + + sql = "select rownum, attachfile from ( select attachfile from MailResourceFile order by id desc ) where rownum = 1 " ; + statement.setStatementSql(sql); + statement.executeQuery(); + statement.next() ; + BLOB theblob = statement.getBlob(2) ; + + int bytesize = theblob.getBufferSize() ; + byte[] buffer = new byte[bytesize] ; + OutputStream outstream = theblob.getBinaryOutputStream() ; + int length = -1 ; + + while((length = source.read(buffer)) != -1) + outstream.write(buffer, 0 , length) ; + outstream.close() ; + } + else { + sql = "insert into MailResourceFile(mailid,filename,attachfile,filetype) values(?,?,?,?)"; + statement.setStatementSql(sql); + statement.setInt(1,mailid); + statement.setString(2,filename) ; + statement.setBinaryStream(3,source,fileLength); + statement.setString(4,contenttype) ; + statement.executeUpdate(); + } + + source.close() ; + thefile.delete() ; + + if(withsave.equals("1")) { + sql = "select max(id) from MailResourceFile " ; + statement.setStatementSql(sql); + statement.executeQuery(); + statement.next() ; + int fileid = statement.getInt(1) ; + + sql = "select attachfile from MailResourceFile where id = " + fileid; + statement.setStatementSql(sql); + statement.executeQuery(); + statement.next() ; + byte[] imagebyte = null ; + if( isoracle ) imagebyte = statement.getBlobByte("attachfile") ; + else imagebyte = statement.getBytes("attachfile") ; + source = new BufferedInputStream(new ByteArrayInputStream(imagebyte),500*1024) ; + } + statement.close() ; + + + }catch(Exception ex){} + } + return source ; */ + } + + + private synchronized String saveFile(String uploadname, MultipartRequest mpdata) { + + int imageid = 0; + String filepath = mpdata.getFilePath(uploadname); + String filename = mpdata.getFileName(uploadname); + String originalfilename = SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadname)); + String contenttype = mpdata.getContentType(uploadname); + long filesize = mpdata.getFileSize(uploadname); + + String _imagefilename = Util.null2String(getParameter("imagefilename")); + String __originalfilename = Util.null2String(originalfilename); + String _extname = __originalfilename.contains(".") ? __originalfilename.substring(__originalfilename.indexOf(".")) : ""; + if (!_imagefilename.isEmpty() && ("".equals(_extname) || _imagefilename.endsWith(_extname))) { + originalfilename = _imagefilename; + } + + if (filesize == 0) { + writeLog("^^^^^^^^^(文件大小为0)(" + originalfilename + ")^^^^^^^^^^^filepath=" + filepath + filename); + return null; + } + + String filerealpath = filepath + filename; + int fieldId = Util.getIntValue(getParameter("fieldId")); + int workflowId = Util.getIntValue(getParameter("workflowId")); + /* + * QC675390概述:前后台增加附件上传格式控制 + * 如果上传文件的文件名后缀不符合配置文件中的要求,则不上传 + */ + if (!FileSuffixCheckUtil.isEnableUpload(originalfilename) || (fieldId > 0 && workflowId > 0 && !checkFileSuffix(originalfilename, fieldId, workflowId))) { + writeLog("^^^^^^^^^(文件拦截)(" + originalfilename + ")^^^^^^^^^^^filepath=" + filepath + filename); + File _tempFile = new File(filerealpath); + // 如果文件存在,且是文件,删除 + if (_tempFile.exists() && _tempFile.isFile()) { + FileSecurityUtil.deleteFile(_tempFile); + // _tempFile.delete(); + } + return null; + } + //tagtag需要压缩图片 + //System.out.println("contenttype:"+ contenttype); + //System.out.println("filerealpath:"+ filerealpath); + String needCompressionPic = (String) this.request.getAttribute("needCompressionPic"); + if ("1".equals(needCompressionPic) && !needzip) { + PicCompression picCompression = new PicCompression(); + String s = picCompression.compress(filerealpath, 1280, 1024, 1); + } + + + String imagefileused = "1"; + String iszip = "0"; + String isencrypt = "0"; + if (needzip) iszip = "1"; + if (needzipencrypt) isencrypt = "1"; + + + RecordSet rs = new RecordSet(); + char separator = Util.getSeparator(); + + //rs.executeProc("SequenceIndex_SelectFileid" , "" ); + //if( rs.next() ) imageid = Util.getIntValue(rs.getString(1)); + imageid = imageFileIdUpdate.getImageFileNewId(); + String originalfilenameflag = originalfilename; + try { +// if(UrlEncoderUtils.hasUrlEncoded(originalfilename)){ + //originalfilename = originalfilename.replaceAll("[%]","%25").replaceAll("[+]","%2B"); + originalfilename = URLDecoder.decode(originalfilename, "utf-8"); +// } + } catch (Exception e) { + originalfilename = originalfilenameflag; + //e.printStackTrace(); + } + + String para = "" + imageid + separator + originalfilename + separator + + contenttype + separator + imagefileused + separator + filerealpath + separator + + iszip + separator + isencrypt + separator + filesize; + + rs.executeProc("ImageFile_Insert", para); + AliOSSObjectManager aliOSSObjectManager = new AliOSSObjectManager(); + String tokenKey = aliOSSObjectManager.getTokenKeyByFileRealPath(filerealpath); + String secretLevel = Util.null2s(getParameter("secretLevel"), DocManager.DEFAILT_SECRET_LEVEL + ""); + String secretValidity = Util.null2s(getParameter("secretLevelValidity"), ""); + String name = Util.null2s(getParameter("name"), ""); + String sql = "update imagefile set isaesencrypt=" + isaesencrypt + ", aescode='" + aescode + "',TokenKey='" + tokenKey + "',secretLevel=" + secretLevel + ",secretValidity='" + secretValidity + "' where imagefileid=" + imageid; +// rs.writeLog("fileupload1111-----fileid:"+imageid+"---name:"+name+"--secretLevel:"+secretLevel+"--secretValidity:"+secretValidity+"--sql"+sql); + // 更新加密信息 + rs.executeUpdate(sql); + + + try { // add by liuyu to get image file width and height + if (contenttype.indexOf("image") != -1 && needimagewidth) { + File thefile = mpdata.getFile(uploadname); + long fileLength = thefile.length(); + filesizes.add("" + fileLength); + + if (needzip) { + ZipInputStream zin = new ZipInputStream(new FileInputStream(thefile)); + if (zin.getNextEntry() != null) source = new BufferedInputStream(zin); + } else source = new BufferedInputStream(new FileInputStream(thefile)); + + if (isaesencrypt.equals("1")) { + source = AESCoder.decrypt(source, aescode); + } + //byte[] imagebyte = new byte[64*1024] ; + //StringBuffer buf = new StringBuffer(); + //while (source.read(imagebyte, 0, imagebyte.length) != -1) buf.append(imagebyte); + //ByteArraySeekableStream bs = new ByteArraySeekableStream((buf.toString()).getBytes()) ; + //RenderedOp bimage = JAI.create("stream", bs); + //imagewidth.add(""+bimage.getWidth()) ; + //imageheight.add(""+bimage.getHeight()) ; + + + ImageInfo ii = new ImageInfo(); + ii.setInput(source); + if (!ii.check()) { + imagewidth.add("0"); + imageheight.add("0"); + } else { + imagewidth.add("" + ii.getWidth()); + imageheight.add("" + ii.getHeight()); + } + } else { + imagewidth.add("0"); + imageheight.add("0"); + filesizes.add("0"); + } + } catch (Exception imgex) { + imagewidth.add("0"); + imageheight.add("0"); + filesizes.add("0"); + } + + return imageid + ""; + + /* 原有的存储附件数据在数据库中的方式 + + try { + File thefile = mpdata.getFile(uploadname) ; + int fileLength = new Long(thefile.length()).intValue(); + source = new BufferedInputStream(new FileInputStream(thefile),500*1024) ; + + filesizes.add(""+fileLength) ; + + statement = new ConnStatement(); + boolean isoracle = (statement.getDBType()).equals("oracle") ; + + String sql = "select currentid from SequenceIndex where indexdesc='imagefileid'"; + statement.setStatementSql(sql); + statement.executeQuery(); + + if(statement.next()){ + imageid = statement.getInt("currentid"); + } + + sql = "update SequenceIndex set currentid=? where indexdesc='imagefileid'"; + statement.setStatementSql(sql); + statement.setInt(1,imageid+1); + statement.executeUpdate(); + + if( isoracle) { + sql = "insert into ImageFile values(?,?,?,empty_blob(),?)"; + statement.setStatementSql(sql); + statement.setInt(1,imageid); + statement.setString(2,filename) ; + statement.setString(3,contenttype) ; + statement.setInt(4,1); + statement.executeUpdate(); + + sql = "select imagefile from ImageFile where imagefileid = " + imageid ; + statement.setStatementSql(sql); + statement.executeQuery(); + statement.next() ; + BLOB theblob = statement.getBlob(1) ; + + int bytesize = theblob.getBufferSize() ; + byte[] buffer = new byte[bytesize] ; + OutputStream outstream = theblob.getBinaryOutputStream() ; + int length = -1 ; + + while((length = source.read(buffer)) != -1) + outstream.write(buffer, 0 , length) ; + outstream.close() ; + } + else { + sql = "insert into ImageFile values(?,?,?,?,?)"; + statement.setStatementSql(sql); + statement.setInt(1,imageid); + statement.setString(2,filename) ; + statement.setString(3,contenttype) ; + statement.setBinaryStream(4,source,fileLength); + statement.setInt(5,1); + statement.executeUpdate(); + } + + source.close(); + thefile.delete() ; + + try { // add by liuyu to get image file width and height + if(contenttype.indexOf("image") != -1 && needimagewidth) { + sql = "select imagefile from ImageFile where imagefileid = "+imageid; + statement.setStatementSql(sql); + statement.executeQuery(); + statement.next() ; + byte[] imagebyte = null ; + if( isoracle ) imagebyte = statement.getBlobByte("imagefile") ; + else imagebyte = statement.getBytes("imagefile") ; + ByteArraySeekableStream bs = new ByteArraySeekableStream(imagebyte) ; + RenderedOp bimage = JAI.create("stream", bs); + imagewidth.add(""+bimage.getWidth()) ; + imageheight.add(""+bimage.getHeight()) ; + } + else { + imagewidth.add("0") ; + imageheight.add("0") ; + } + } + catch (Exception imgex) { + imagewidth.add("0") ; + imageheight.add("0") ; + } + + statement.close() ; + } + catch (Exception ex) { writeLog(ex); } + + return imageid+""; */ + } + + private synchronized String saveFile(String uploadname, String paramFileName, MultipartRequest mpdata) { + + int imageid = 0; + String filepath = mpdata.getFilePath(uploadname); + String filename = mpdata.getFileName(uploadname); + String originalfilename = paramFileName; + String contenttype = mpdata.getContentType(uploadname); + long filesize = mpdata.getFileSize(uploadname); + + String _imagefilename = Util.null2String(getParameter("imagefilename")); + String __originalfilename = Util.null2String(originalfilename); + String _extname = __originalfilename.contains(".") ? __originalfilename.substring(__originalfilename.indexOf(".")) : ""; + if (!_imagefilename.isEmpty() && ("".equals(_extname) || _imagefilename.endsWith(_extname))) { + originalfilename = _imagefilename; + } + if (filesize == 0) { + writeLog("^^^^^^^^^(文件大小为0)(" + originalfilename + ")^^^^^^^^^^^filepath=" + filepath + filename); + return null; + } + + String filerealpath = filepath + filename; + + //tagtag需要压缩图片 + //System.out.println("contenttype:"+ contenttype); + //System.out.println("filerealpath:"+ filerealpath); + String needCompressionPic = (String) this.request.getAttribute("needCompressionPic"); + if ("1".equals(needCompressionPic) && !needzip) { + PicCompression picCompression = new PicCompression(); + String s = picCompression.compress(filerealpath, 1280, 1024, 1); + } + + + String imagefileused = "1"; + String iszip = "0"; + String isencrypt = "0"; + if (needzip) iszip = "1"; + if (needzipencrypt) isencrypt = "1"; + + + RecordSet rs = new RecordSet(); + char separator = Util.getSeparator(); + + //rs.executeProc("SequenceIndex_SelectFileid" , "" ); + //if( rs.next() ) imageid = Util.getIntValue(rs.getString(1)); + imageid = imageFileIdUpdate.getImageFileNewId(); + String originalfilenameflag = originalfilename; + try { +// if(UrlEncoderUtils.hasUrlEncoded(originalfilename)){ + //originalfilename = originalfilename.replaceAll("[%]","%25").replaceAll("[+]","%2B"); + originalfilename = URLDecoder.decode(originalfilename, "utf-8"); +// } + } catch (Exception e) { + originalfilename = originalfilenameflag; + //e.printStackTrace(); + } + String para = "" + imageid + separator + originalfilename + separator + + contenttype + separator + imagefileused + separator + filerealpath + separator + + iszip + separator + isencrypt + separator + filesize; + + rs.executeProc("ImageFile_Insert", para); + AliOSSObjectManager aliOSSObjectManager = new AliOSSObjectManager(); + String tokenKey = aliOSSObjectManager.getTokenKeyByFileRealPath(filerealpath); + String secretLevel = Util.null2s(getParameter("secretLevel"), DocManager.DEFAILT_SECRET_LEVEL + ""); + String secretValidity = Util.null2s(getParameter("secretLevelValidity"), ""); + String name = Util.null2s(getParameter("name"), ""); + + String sql = "update imagefile set isaesencrypt=" + isaesencrypt + ", aescode='" + aescode + "',TokenKey='" + tokenKey + "',secretLevel=" + secretLevel + ",secretValidity='" + secretValidity + "' where imagefileid=" + imageid; +// rs.writeLog("fileupload2222-----fileid:"+imageid+"---name:"+name+"--secretLevel:"+secretLevel+"--secretValidity:"+secretValidity+"--sql:"+sql); + // 更新加密信息 + rs.executeUpdate(sql); + + aliOSSObjectManager.uploadFile(filerealpath, originalfilename, iszip, isaesencrypt, aescode); + + try { // add by liuyu to get image file width and height + if (contenttype.indexOf("image") != -1 && needimagewidth) { + File thefile = mpdata.getFile(uploadname); + long fileLength = thefile.length(); + filesizes.add("" + fileLength); + + if (needzip) { + ZipInputStream zin = new ZipInputStream(new FileInputStream(thefile)); + if (zin.getNextEntry() != null) source = new BufferedInputStream(zin); + } else source = new BufferedInputStream(new FileInputStream(thefile)); + + if (isaesencrypt.equals("1")) { + source = AESCoder.decrypt(source, aescode); + } + //byte[] imagebyte = new byte[64*1024] ; + //StringBuffer buf = new StringBuffer(); + //while (source.read(imagebyte, 0, imagebyte.length) != -1) buf.append(imagebyte); + //ByteArraySeekableStream bs = new ByteArraySeekableStream((buf.toString()).getBytes()) ; + //RenderedOp bimage = JAI.create("stream", bs); + //imagewidth.add(""+bimage.getWidth()) ; + //imageheight.add(""+bimage.getHeight()) ; + + + ImageInfo ii = new ImageInfo(); + ii.setInput(source); + if (!ii.check()) { + imagewidth.add("0"); + imageheight.add("0"); + } else { + imagewidth.add("" + ii.getWidth()); + imageheight.add("" + ii.getHeight()); + } + } else { + imagewidth.add("0"); + imageheight.add("0"); + filesizes.add("0"); + } + } catch (Exception imgex) { + imagewidth.add("0"); + imageheight.add("0"); + filesizes.add("0"); + } + + return imageid + ""; + } + + + private boolean isMultipartData(HttpServletRequest req) { + return Util.null2String(req.getContentType()).toLowerCase().startsWith("multipart/form-data"); + } + + + public static String getCreateDir(String createdir) { + + if (createdir == null) { + StaticObj staticObj = StaticObj.getInstance(); + staticObj.removeObject("SystemInfo"); + SystemComInfo syscominfo = new SystemComInfo(); + createdir = syscominfo.getFilesystem(); + } + + + if (createdir == null || createdir.equals("")) createdir = GCONST.getSysFilePath(); + else { + createdir = Util.StringReplace(createdir, "\\", "#$^123"); + createdir = Util.StringReplace(createdir, "/", "#$^123"); + createdir = Util.StringReplace(createdir, "#$^123", File.separator); + //if( createdir.lastIndexOf(File.separator) < 0 ) createdir += File.separator ; + + if (!createdir.endsWith(File.separator)) { + createdir += File.separator; + } + } + + Calendar today = Calendar.getInstance(); + String currentyear = Util.add0(today.get(Calendar.YEAR), 4); + String currentmonth = Util.add0(today.get(Calendar.MONTH) + 1, 2); + + Random random = new Random(); + int randomint = 1 + random.nextInt(26); + String charstr = Util.getCharString(randomint); + + createdir += currentyear + currentmonth + File.separatorChar + charstr + File.separatorChar; + String ostype = System.getProperty("os.arch"); + String osname = System.getProperty("os.name").toLowerCase(); + //if (!ostype.equals("x86")&&!ostype.equals("amd64")) { + if (!osname.startsWith("windows")) { + try { + if (!createdir.substring(0, 1).equals(File.separator)) { + new BaseBean().writeLog("WRAN................File path=[" + createdir + "] os=[" + ostype + "]"); + createdir = File.separator + createdir; + new BaseBean().writeLog("WRAN................Changed path=[" + createdir + "] os=[" + ostype + "]"); + } + } catch (Exception e) { + } + } + return createdir; + } + + //获取文件的原始名称 + public String getFileOriginalFileName(String uploadame) { + return SecurityMethodUtil.textXssClean(mpdata.getOriginalFileName(uploadame)); + } + + //根据文件名获取文件 + public File getFile(String filename) { + return mpdata.getFile(filename); + } + + /** + * 根据参数名判断文件是否可以上传, 查询参数名为file对应的文件的后缀 + * + * @return + */ + public boolean canUploadCheckBySecid() { + return canUploadCheckBySecid("file"); + } + + /** + * 根据 uplaodfilename 查找指定的物理文件的文件名,判断文件是否可以上传 + * + * @param uplaodfilename + * @return + */ + public boolean canUploadCheckBySecid(String uplaodfilename) { + int secid = Util.getIntValue(this.getParameter("secid"), -1); + + String paramFileName = this.getFileOriginalFileName(uplaodfilename); //获取参数当中的文件名 + if (secid <= 0) { + return FileSuffixCheckUtil.isEnableUpload(paramFileName); + } else { + return FileSuffixCheckUtil.isEnableUploadBySecId(secid, paramFileName); + } + } + + + /** + * @param fileName 文件名 + * @param fieldId 附件字段id + * @param workflowId 流程id + * @return 文件上传后端校验是否通过 + */ + public boolean checkFileSuffix(String fileName, int fieldId, int workflowId) { + RecordSet rs1 = new RecordSet(); + //查询单个字段设置 + String sql1 = "select limittype,limitvalue from workflow_fileupload where fieldid = " + fieldId + " and workflowid =" + workflowId; + //查询默认设置 + String sql2 = "select limitvalue from workflow_base where id = " + workflowId; + //查询新表单 + String sql3 = "select FIELDHTMLTYPE,TYPE from workflow_billfield where id = " + fieldId; + //查询老表单主表 + String sql4 = "select fieldhtmltype,type from workflow_formdict where id = " + fieldId; + //查询老表单明细表 + String sql5 = "select fieldhtmltype,type from workflow_formdictdetail where id = " + fieldId; + + String limitType = "";//单个字段设置类型 + String limitValueField = "";//单个字段设置限制格式 + String limitValueDefult = "";//默认限制格式 + String fileNameSuffix = FileSuffixCheckUtil.getFileNameSuffix(fileName);//上传的文件名后缀 + + rs1.executeQuery(sql1); + while (rs1.next()) { + limitType = Util.null2String(rs1.getString("limittype")); + limitValueField = Util.null2String(rs1.getString("limitvalue")); + } + rs1.execute(sql2); + while (rs1.next()) { + limitValueDefult = Util.null2String(rs1.getString("limitvalue")); + } + + //新表单 + String fieldHtmlTypeNew = "";//新表单字段大类型 + String typeNew = "";//新表单字段小类型 + rs1.executeQuery(sql3); + while (rs1.next()) { + fieldHtmlTypeNew = Util.null2String(rs1.getString(1)); + typeNew = Util.null2String(rs1.getString(2)); + } + //校验新表单字段是否为图片,如果是图片,则不校验,直接放行 + if ("6".equals(fieldHtmlTypeNew) && "2".equals(typeNew)) { + return true; + } + + + //老表单主表 + String fieldHtmlTypeOld = "";//老表单字段大类型 + String typeOld = "";//老表单字段小类型 + rs1.execute(sql4); + while (rs1.next()) { + fieldHtmlTypeOld = Util.null2String(rs1.getString(1)); + typeOld = Util.null2String(rs1.getString(2)); + } + //校验老表单字段是否为图片,如果是图片,则不校验,直接放行 + if ("6".equals(fieldHtmlTypeOld) && "2".equals(typeOld)) { + return true; + } + + //老表单明细表 + String fieldHtmlTypeDetailOld = "";//老表单明细字段大类型 + String typeDetailOld = "";//老表单明细字段小类型 + rs1.execute(sql5); + while (rs1.next()) { + fieldHtmlTypeDetailOld = Util.null2String(rs1.getString(1)); + typeDetailOld = Util.null2String(rs1.getString(2)); + } + //校验老表单字段是否为图片,如果是图片,则不校验,直接放行 + if ("6".equals(fieldHtmlTypeDetailOld) && "2".equals(typeDetailOld)) { + return true; + } + + //如果默认和字段都没有设置格式限制,或者字段选择了格式显示,但是格式限制为空,则直接允许提交 + if (("".equals(limitValueField) && "".equals(limitValueDefult)) || ("1".equals(limitType) && "".equals(limitValueField))) { + return true; + } + + //先校验单个字段,如果单个字段没有设置格式校验,则校验默认的格式设置 + if ("1".equals(limitType)) { + String[] formats = limitValueField.split(","); + return Util.contains(formats, fileNameSuffix); + } + if ("0".equals(limitType)) { + String[] restrictedFormat = limitValueDefult.split(","); + return Util.contains(restrictedFormat, fileNameSuffix); + } + + return false; + } + +} + diff --git a/weaver/file/ImageFileManager.java b/weaver/file/ImageFileManager.java new file mode 100644 index 0000000..7897724 --- /dev/null +++ b/weaver/file/ImageFileManager.java @@ -0,0 +1,1149 @@ +package weaver.file; + +import DBstep.iMsgServer2000; +import com.api.odoc.util.OdocFileUtil; +import weaver.alioss.AliOSSObjectManager; +import weaver.conn.ConnStatement; +import weaver.conn.RecordSet; +import weaver.docs.docs.DocManager; +import weaver.docs.docs.ImageFileIdUpdate; +import weaver.file.util.FileDeleteUtil; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.sm.SM4Utils; +import weaver.system.SystemComInfo; + +import java.io.*; +import java.util.Date; +import java.util.UUID; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; + + +/** + * Title: 附件处理基本类 + * Company: weaver + * + * @author fanggsh + * @version 1.0 + */ + +public class ImageFileManager extends BaseBean { + + private static ImageFileIdUpdate imageFileIdUpdate = new ImageFileIdUpdate(); + + private int imageFileId; //附件id + + private String imageFileName;//文件名称 + + private String imageFileType; //文件MIME类型 + + private int imageFileUsed; //文件使用次数 + + private String fileRealPath; //文件存放目录 + + private String isZip; //是否压缩 0:否 1:是 + + private String isencrypt; //是否加密 0:否 1:是 该字段已经基本不使用 + + private String filesize; //文件大小 单位为字节 + + private int downloads; //下载次数 + + private String miniimgpath; //缩略图存放路径 + + private String imgsize; //缩略图大小 + + private String isFTP; //是否存储到FTP 1:是 0或其它:否 + + private int FTPConfigId;//FTP服务器配置ID + + private int isaesencrypt;//是否使用AES附件加密 1:是 0或其它:否 + + private String aescode; //AES加密密码 + + private String tokenKey; //令牌标记 + + private String storageStatus; //传输标志 1:成功 2:文件异常 3:传输中 4:不需要传到云 其他:未传输 + + private String comefrom; // 附件来源 WorkflowToDoc:流程存为文档 + + private int secretlevel; //密级 + private String secretvalidity; // 保密期限 + + private byte[] data; + + /** + * 构造函数 + */ + public ImageFileManager() { + try { + resetParameter(); + } catch (Exception ex) { + writeLog(ex); + } + } + + /** + * 重置各参数的值 + */ + public void resetParameter() { + + imageFileId=0; + imageFileName=""; + imageFileType=""; + imageFileUsed=1; + fileRealPath=""; + isZip=""; + isencrypt=""; + filesize=""; + downloads=0; + miniimgpath=""; + imgsize=""; + isFTP=""; + FTPConfigId=0; + isaesencrypt=0; + aescode=""; + tokenKey=""; + storageStatus=""; + comefrom=""; + secretlevel=DocManager.DEFAILT_SECRET_LEVEL; + secretvalidity=""; + data=null; + } + + /** + * 返回 附件ID + * + * @return 附件ID + * @throws Exception + */ + public int getImageFileId() { + return imageFileId; + } + + /** + * 返回文件名称 + * + * @return 文件名称 + * @throws Exception + */ + public String getImageFileName() { + return imageFileName; + } + + /** + * 返回文件MIME类型 + * + * @return 文件MIME类型 + * @throws Exception + */ + public String getImageFileType() { + return imageFileType; + } + + public void setImageFileType(String para) { + this.imageFileType = para; + } + + /** + * 返回文件使用次数 + * + * @return 文件使用次数 + * @throws Exception + */ + public int getImageFileUsed() { + return imageFileUsed; + } + + /** + * 返回文件存放目录 + * + * @return 文件存放目录 + * @throws Exception + */ + public String getFileRealPath() { + return fileRealPath; + } + + /** + * 返回是否压缩 + * + * @return 是否压缩 + * @throws Exception + */ + public String getIsZip() { + return isZip; + } + + /** + * 返回是否加密 该方法已基本不使用 + * + * @return 是否加密 + * @throws Exception + */ + public String getIsencrypt() { + return isencrypt; + } + + /** + * 返回文件大小 单位为字节 + * + * @return 文件大小 单位为字节 + * @throws Exception + */ + public String getFilesize() { + return filesize; + } + + /** + * 返回下载次数 + * + * @return 下载次数 + * @throws Exception + */ + public int getDownloads() { + return downloads; + } + + /** + * 返回 缩略图存放路径 + * + * @return 缩略图存放路径 + * @throws Exception + */ + public String getMiniimgpath() { + return miniimgpath; + } + + /** + * 返回缩略图大小 + * + * @return 缩略图大小 + * @throws Exception + */ + public String getImgsize() { + return imgsize; + } + + /** + * 返回是否存储到FTP 1:是 0或其它:否 + * + * @return 是否存储到FTP 1:是 0或其它:否 + * @throws Exception + */ + public String getIsFTP() { + return isFTP; + } + + /** + * 返回FTP服务器配置ID + * + * @return FTP服务器配置ID + * @throws Exception + */ + public int getFTPConfigId() { + return FTPConfigId; + } + + /** + * 返回是否使用AES附件加密 + * + * @return 是否使用AES附件加密 + * @throws Exception + */ + public int getIsaesencrypt() { + return isaesencrypt; + } + + /** + * 返回AES加密密码 + * + * @return AES加密密码 + * @throws Exception + */ + public String getAescode() { + return aescode; + } + + /** + * 返回令牌标记 + * + * @return 令牌标记 + * @throws Exception + */ + public String getTokenKey() { + return tokenKey; + } + + /** + * 返回传输标志 + * + * @return 传输标志 + * @throws Exception + */ + public String getStorageStatus() { + return storageStatus; + } + + public void setImageFileId(int imageFileId) { + this.imageFileId = imageFileId; + } + + public int getSecretlevel() { + return secretlevel; + } + + public void setSecretlevel(int secretlevel) { + this.secretlevel = secretlevel; + } + + public String getSecretvalidity() { + return secretvalidity; + } + + public void setSecretvalidity(String secretvalidity) { + this.secretvalidity = secretvalidity; + } + + /** + * 返回附件来源 + * + * @return 附件来源 + * @throws Exception + */ + public String getComefrom() { + return comefrom; + } + + public Date getLastModified() + { + Date lastModified = null; + boolean isonlyAliOSS=false; + if(!tokenKey.equals("")&&storageStatus.equals("1")&&AliOSSObjectManager.isonlyAliOSS()){ + isonlyAliOSS=true; + } + if(isonlyAliOSS){ + lastModified = weaver.alioss.AliOSSObjectUtil.getLastModified(tokenKey); + }else{ + if(fileRealPath!=null&&!fileRealPath.equals("")){ + File file = new File(fileRealPath); + boolean bool = file.exists(); + if(bool) + { + long millisec = file.lastModified(); + lastModified = new Date(millisec); + } + } + } + return lastModified; + } + + public Date getLastModified(String fileRealPath) + { + Date lastModified = null; + if(fileRealPath!=null&&!fileRealPath.equals("")) { + File file = new File(fileRealPath); + boolean bool = file.exists(); + if (bool) { + long millisec = file.lastModified(); + lastModified = new Date(millisec); + } + } + return lastModified; + } + + /** + * 设置文件名称 + * + * @param docid_para + * 文件名称 + */ + public void setImagFileName(String para) { + this.imageFileName = para; + } + + /** + * 设置附件来源 + * + * @param docid_para + * 附件来源 + */ + public void setComefrom(String para) { + this.comefrom = para; + } + + /** + * 设置文档ID + * + * @param docid_para + * 文档ID + */ + public void setData(byte[] para) { + this.data = para; + } + + + + /** + * 返回文件流 已经经过脱密、解压 + * + * @return 文件流 + * @throws Exception + */ + public InputStream getInputStream() { + InputStream imagefile = null; + try{ + boolean isonlyAliOSS=false; + if(!tokenKey.equals("")&&storageStatus.equals("1")&&AliOSSObjectManager.isonlyAliOSS()){ + isonlyAliOSS=true; + } + + if(isonlyAliOSS){ + imagefile=weaver.alioss.AliOSSObjectUtil.downloadFile(tokenKey); + }else{ + if(fileRealPath!=null&&!fileRealPath.equals("")){ + File thefile = new File(fileRealPath) ; + if(isZip.equals("1")) { + ZipInputStream zin = new ZipInputStream(new FileInputStream(thefile)) ; + if(zin.getNextEntry() != null) + imagefile = new BufferedInputStream(zin) ; + } else{ + imagefile = new BufferedInputStream(new FileInputStream(thefile)) ; + } + + }else{ + ConnStatement statement = null; + try { + statement = new ConnStatement(); + boolean isoracle = ("oracle").equals(statement.getDBType()) ; + String sql = "select imagefile from ImageFile where imagefileid = " + imageFileId; + statement.setStatementSql(sql); + statement.executeQuery(); + if(statement.next()){ + if( isoracle ) imagefile = new BufferedInputStream(statement.getBlobBinary("imagefile")) ; + else imagefile = new BufferedInputStream(statement.getBinaryStream("imagefile")) ; + } + } catch(Exception ex) { + }finally { + try{ + if(statement!=null) statement.close() ; + }catch(Exception ex){ + } + } + } + if(isaesencrypt==1){ + imagefile = AESCoder.decrypt(imagefile, aescode); + } + } + }catch(Exception ex){ + + } + return imagefile; + } + + /** + * 返回文件流 已经经过脱密、解压 + * @param imageFileId_para + * @return 文件流 + * @throws Exception + */ + public static InputStream getInputStreamById(int imageFileId_para) { + InputStream imagefile = null; + try{ + RecordSet rs = new RecordSet(); + String sql = "select imagefilename,fileRealPath,isZip,isaesencrypt,aescode,tokenKey,storageStatus from ImageFile where imageFileId = " + imageFileId_para; + rs.executeSql(sql); + if(rs.next()){ + String static_fileRealPath=Util.null2String(rs.getString("fileRealPath")); + String static_isZip=Util.null2String(rs.getString("isZip")); + int static_isaesencrypt=Util.getIntValue(rs.getString("isaesencrypt"),0); + String static_aescode=Util.null2String(rs.getString("aescode")); + String static_tokenKey=Util.null2String(rs.getString("tokenKey")); + String static_storageStatus=Util.null2String(rs.getString("storageStatus")); + String imagefilename=Util.null2String(rs.getString("imagefilename")); + boolean isonlyAliOSS=false; + if(!static_tokenKey.equals("")&&static_storageStatus.equals("1")&&AliOSSObjectManager.isonlyAliOSS()){ + isonlyAliOSS=true; + } + + if(isonlyAliOSS){ + imagefile=weaver.alioss.AliOSSObjectUtil.downloadFile(static_tokenKey); + }else{ + if(static_fileRealPath!=null&&!static_fileRealPath.equals("")){ + File thefile = new File(static_fileRealPath) ; + if(static_isZip.equals("1")) { + ZipInputStream zin = new ZipInputStream(new FileInputStream(thefile)) ; + if(zin.getNextEntry() != null) + imagefile = new BufferedInputStream(zin) ; + } else{ + imagefile = new BufferedInputStream(new FileInputStream(thefile)) ; + } + }else{ + ConnStatement statement = null; + try { + statement = new ConnStatement(); + boolean isoracle = ("oracle").equals(statement.getDBType()) ; + statement.setStatementSql("select imagefile from ImageFile where imagefileid = " + imageFileId_para); + statement.executeQuery(); + if(statement.next()){ + if( isoracle ) imagefile = new BufferedInputStream(statement.getBlobBinary("imagefile")) ; + else imagefile = new BufferedInputStream(statement.getBinaryStream("imagefile")) ; + } + } catch(Exception ex) { + }finally { + try{ + if(statement!=null) statement.close() ; + }catch(Exception ex){ + } + } + } + if(static_isaesencrypt==1){ + imagefile = AESCoder.decrypt(imagefile, static_aescode); + } + + } + if(null!=imagefile){ + String extName = OdocFileUtil.getFileExt(imagefilename); + int byteread; + byte data[] = new byte[1024]; + if(isOfficeToDocument(extName)&&isMsgObjToDocument()){ + //正文的处理 + ByteArrayOutputStream bout = null; + try { + bout = new ByteArrayOutputStream() ; + while((byteread = imagefile.read(data)) != -1) { + bout.write(data, 0, byteread) ; + bout.flush() ; + } + byte[] fileBody = bout.toByteArray(); + iMsgServer2000 MsgObj = new iMsgServer2000(); + MsgObj.MsgFileBody(fileBody); //将文件信息打包 + fileBody = MsgObj.ToDocument(MsgObj.MsgFileBody()); //通过iMsgServer200 将pgf文件流转化为普通Office文件流 + imagefile = new ByteArrayInputStream(fileBody); + bout.close(); + } + catch(Exception e) { + if(bout!=null) bout.close(); + new BaseBean().writeLog("ImageFileManager.getInputStreamById(int imageFileId_para),exception1:",e); + } + + } + } + } + }catch(Exception ex){ + new BaseBean().writeLog("ImageFileManager.getInputStreamById(int imageFileId_para),exception:",ex); + } + return imagefile; + } + + private static boolean isOfficeToDocument(String extName){ + boolean isOfficeForToDocument=false; + if("xls".equalsIgnoreCase(extName) || "doc".equalsIgnoreCase(extName)||"wps".equalsIgnoreCase(extName)||"ppt".equalsIgnoreCase(extName)||"docx".equalsIgnoreCase(extName)||"xlsx".equalsIgnoreCase(extName)||"pptx".equalsIgnoreCase(extName)){ + isOfficeForToDocument=true; + } + return isOfficeForToDocument; + } + + private static boolean isMsgObjToDocument(){ + boolean isMsgObjToDocument=true; + + BaseBean basebean = new BaseBean(); + String mClientName=Util.null2String(basebean.getPropValue("weaver_obj","iWebOfficeClientName")); + boolean isIWebOffice2003 = (mClientName.indexOf("iWebOffice2003")>-1)?true:false; + String isHandWriteForIWebOffice2009=Util.null2String(basebean.getPropValue("weaver_obj","isHandWriteForIWebOffice2009")); + if(isIWebOffice2003||isHandWriteForIWebOffice2009.equals("0")){ + isMsgObjToDocument=false; + } + if(mClientName.indexOf("iWebOffice2009")>-1) + { + isMsgObjToDocument=true; + } + + return isMsgObjToDocument; + } + + /** + * 通过附件ID得到相应的附件信息 + * + * @throws Exception + */ + public void getImageFileInfoById(int imageFileId_para) { + + try{ + RecordSet rs = new RecordSet(); + String sql = "select t1.imageFileId,t1.imageFileName,t1.imageFileType,t1.imageFileUsed,t1.fileRealPath,t1.isZip,t1.isencrypt,t1.filesize,t1.downloads,t1.miniimgpath,t1.imgsize,t1.isFTP,t1.FTPConfigId,t1.isaesencrypt,t1.aescode,t1.tokenKey,t1.storageStatus,t1.comefrom,t2.imagefilename as realname from ImageFile t1 left join DocImageFile t2 on t1.imagefileid = t2.imagefileid where t1.imagefileid = " + imageFileId_para; + rs.executeSql(sql); + if(rs.next()){ + imageFileId=Util.getIntValue(rs.getString("imageFileId"),0); + imageFileName=Util.null2String(rs.getString("realname")); + if(imageFileName.equals("")){ + imageFileName = Util.null2String(rs.getString("imageFileName")); + } + imageFileType=Util.null2String(rs.getString("imageFileType")); + imageFileUsed=Util.getIntValue(rs.getString("imageFileUsed"),0); + fileRealPath=Util.null2String(rs.getString("fileRealPath")); + isZip=Util.null2String(rs.getString("isZip")); + isencrypt=Util.null2String(rs.getString("isencrypt")); + filesize=Util.null2String(rs.getString("filesize")); + downloads=Util.getIntValue(rs.getString("downloads"),0); + miniimgpath=Util.null2String(rs.getString("miniimgpath")); + imgsize=Util.null2String(rs.getString("imgsize")); + isFTP=Util.null2String(rs.getString("isFTP")); + FTPConfigId=Util.getIntValue(rs.getString("FTPConfigId"),0); + isaesencrypt=Util.getIntValue(rs.getString("isaesencrypt"),0); + aescode=Util.null2String(rs.getString("aescode")); + tokenKey=Util.null2String(rs.getString("tokenKey")); + storageStatus=Util.null2String(rs.getString("storageStatus")); + comefrom=Util.null2String(rs.getString("comefrom")); + secretlevel = Util.getIntValue(rs.getString("secretlevel")); + secretvalidity = Util.null2s(rs.getString(secretvalidity),""); + } + }catch(Exception ex){ + + } + } + + /** + * 复制物理文件 + * @param imageFileId_para + * @return 新的附件id + */ + public static int copyImageFile(int imageFileId_para) { + int new_imageFileId=0; + if(imageFileId_para<=0){ + return new_imageFileId; + } + try{ + String static_imageFileName=""; + String static_imageFileType=""; + int static_imageFileUsed=0; + String static_fileRealPath=""; + String static_isZip=""; + String static_isencrypt=""; + String static_filesize=""; + int static_downloads=0; + String static_miniimgpath=""; + String static_imgsize=""; + String static_isFTP=""; + int static_FTPConfigId=0; + int static_isaesencrypt=0; + String static_aescode=""; + String static_tokenKey=""; + String static_storageStatus=""; + String static_comefrom=""; + int static_mainimagefile=0; + int static_secretlevel=DocManager.DEFAILT_SECRET_LEVEL; + String static_secretvalidity=""; + + RecordSet rs = new RecordSet(); + String sql = "select t1.imageFileId,t1.imageFileName,t1.imageFileType,t1.imageFileUsed,t1.fileRealPath,t1.isZip,t1.isencrypt,t1.filesize,t1.downloads,t1.miniimgpath,t1.imgsize,t1.isFTP,t1.FTPConfigId,t1.isaesencrypt,t1.aescode,t1.tokenKey,t1.storageStatus,t1.comefrom,t1.mainimagefile," + + "t1.secretlevel,t1.secretvalidity,t2.imagefilename as realname from ImageFile t1 left join DocImageFile t2 on t1.imagefileid = t2.imagefileid where t1.imagefileid = " + imageFileId_para; + rs.executeSql(sql); + if(rs.next()){ + static_imageFileName=Util.null2String(rs.getString("realname")); + if(static_imageFileName.equals("")){ + static_imageFileName = Util.null2String(rs.getString("imageFileName")); + } + static_imageFileType=Util.null2String(rs.getString("imageFileType")); + static_imageFileUsed=Util.getIntValue(rs.getString("imageFileUsed"),0); + static_fileRealPath=Util.null2String(rs.getString("fileRealPath")); + static_isZip=Util.null2String(rs.getString("isZip")); + static_isencrypt=Util.null2String(rs.getString("isencrypt")); + static_filesize=Util.null2String(rs.getString("filesize")); + static_downloads=Util.getIntValue(rs.getString("downloads"),0); + static_miniimgpath=Util.null2String(rs.getString("miniimgpath")); + static_imgsize=Util.null2String(rs.getString("imgsize")); + static_isFTP=Util.null2String(rs.getString("isFTP")); + static_FTPConfigId=Util.getIntValue(rs.getString("FTPConfigId"),0); + static_isaesencrypt=Util.getIntValue(rs.getString("isaesencrypt"),0); + static_aescode=Util.null2String(rs.getString("aescode")); + static_tokenKey=Util.null2String(rs.getString("tokenKey")); + static_storageStatus=Util.null2String(rs.getString("storageStatus")); + static_comefrom=Util.null2String(rs.getString("comefrom")); + static_mainimagefile=Util.getIntValue(rs.getString("mainimagefile"),0); + static_secretlevel=Util.getIntValue(rs.getString("secretlevel"),0); + static_secretvalidity=Util.null2String(rs.getString("secretvalidity")); + } + if(static_imageFileName==null||static_imageFileName.trim().equals("")){ + return new_imageFileId; + } + + SystemComInfo syscominfo = new SystemComInfo(); + String createdir = FileUpload.getCreateDir(syscominfo.getFilesystem()) ; + String fileName = UUID.randomUUID().toString();// System.currentTimeMillis() + "";解决高并发的情况下,文件重复 李迎新 + if(static_fileRealPath.lastIndexOf(".")>-1){ + fileName+=static_fileRealPath.substring(static_fileRealPath.lastIndexOf(".")); + } + String new_fileRealPath = createdir + fileName ; + String new_tokenKey=AliOSSObjectManager.getTokenKeyByFileRealPath(new_fileRealPath); + String new_storageStatus=""; + new_imageFileId=imageFileIdUpdate.getImageFileNewId(); + + boolean isonlyAliOSS=false; + if(!static_tokenKey.equals("")&&static_storageStatus.equals("1")&&AliOSSObjectManager.isonlyAliOSS()){ + isonlyAliOSS=true; + } + + if(isonlyAliOSS){ + boolean copyStatus=weaver.alioss.AliOSSObjectUtil.copyObject(static_tokenKey, new_tokenKey); + if(copyStatus){ + new_storageStatus="1"; + } + }else if(!static_tokenKey.equals("")&&static_storageStatus.equals("1")&&AliOSSObjectManager.isEnable()){ + boolean copyStatus=weaver.alioss.AliOSSObjectUtil.copyObject(static_tokenKey, new_tokenKey); + if(copyStatus){ + new_storageStatus="1"; + } + FileManage.createDir(createdir); + FileManage.copy(static_fileRealPath, new_fileRealPath); + }else{ + FileManage.createDir(createdir); + FileManage.copy(static_fileRealPath, new_fileRealPath); + } + ConnStatement statement = null; + try{ + statement = new ConnStatement(); + sql = "insert into ImageFile(" + + "imageFileId,imageFileName,imageFileType,imageFileUsed,fileRealPath" + + ",isZip,isencrypt,filesize,downloads,miniimgpath" + + ",imgsize,isFTP,FTPConfigId,isaesencrypt,aescode" + + " ,tokenKey,storageStatus,comefrom,mainimagefile" + + ",secretlevel,secretvalidity"+ + ") values(" + + "?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?,?,?" + + ",?,?"+ + ")"; + statement.setStatementSql(sql); + statement.setInt(1, new_imageFileId); + statement.setString(2, static_imageFileName); + statement.setString(3, static_imageFileType); + statement.setInt(4,static_imageFileUsed); + statement.setString(5, new_fileRealPath); + statement.setString(6, static_isZip); + statement.setString(7, static_isencrypt); + statement.setString(8, static_filesize); + statement.setInt(9, static_downloads); + statement.setString(10, static_miniimgpath); + statement.setString(11, static_imgsize); + statement.setString(12, static_isFTP); + statement.setInt(13,static_FTPConfigId); + statement.setInt(14, static_isaesencrypt); + statement.setString(15, static_aescode); + statement.setString(16, new_tokenKey); + statement.setString(17, new_storageStatus); + statement.setString(18, static_comefrom); + statement.setInt(19, static_mainimagefile); + statement.setInt(20, static_secretlevel); + statement.setString(21, static_secretvalidity); + + statement.executeUpdate(); + + }catch(Exception ex){ + new BaseBean().writeLog("imagefilemanager error",ex); + new BaseBean().writeLog("imagefilemanager error haha:"+ex.getMessage()); + } finally { + try { + statement.close(); + } catch (Exception ex) { + } + } + + + }catch(Exception ee){ + new BaseBean().writeLog("imagefilemanager error",ee); + new BaseBean().writeLog("imagefilemanager error haha:"+ee.getMessage()); + } + return new_imageFileId; + } + + + /** + * 新建物理文件 + * @return 新的附件id + */ + public int saveImageFile(){ + int new_imageFileId=0; + if(this.data==null){ + return new_imageFileId; + } + try{ + String static_imageFileName=this.imageFileName; + String static_imageFileType=""; + if(this.imageFileType==null||this.imageFileType.trim().equals("")){ + static_imageFileType="application/octet-stream"; + } + int static_imageFileUsed=1; + String static_fileRealPath=""; + String static_isZip=""; + String static_isencrypt=""; + String static_filesize=""; + if(this.data!=null){ + static_filesize=""+this.data.length; + } + int static_downloads=0; + String static_miniimgpath=""; + String static_imgsize=""; + String static_isFTP=""; + int static_FTPConfigId=0; + int static_isaesencrypt=0; + String static_aescode=""; + String static_tokenKey=""; + String static_storageStatus=""; + int static_secretlevel=DocManager.DEFAILT_SECRET_LEVEL; + String static_secretvalidity=""; + String static_comefrom=this.comefrom; + + + SystemComInfo syscominfo = new SystemComInfo() ; + String createdir = FileUpload.getCreateDir(syscominfo.getFilesystem()) ; + String random= UUID.randomUUID().toString(); // 解决高并发下,文件重复问题 李迎新 + String fileName = random ; + static_isZip = syscominfo.getNeedzip(); + static_isaesencrypt = Util.getIntValue(syscominfo.getIsaesencrypt(),0); + static_aescode = Util.getRandomString(13); + + if("1".equals(static_isZip)){ + fileName += ".zip"; + } + String fullName = createdir + fileName ; + static_fileRealPath = fullName; + int fsize = 0; + FileManage.createDir(createdir); + //写压缩文件 + OutputStream fileOut = null ; + try{ + File file = new File(static_fileRealPath) ; + if(static_isZip.equals("1")) { + ZipOutputStream filezipOut = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file))) ; + filezipOut.setMethod(ZipOutputStream.DEFLATED) ; //设置压缩方法 + filezipOut.putNextEntry(new ZipEntry(random)) ; + fileOut = filezipOut ; + } else { + fileOut = new BufferedOutputStream(new FileOutputStream(file)) ; + } + + if(static_isaesencrypt==1){ + fileOut = AESCoder.encrypt(fileOut, static_aescode); + String sm4 = Util.null2String(getPropValue("weaver_security_type","reversible_enc_type")); + if("sm4".equalsIgnoreCase(sm4)&&static_aescode.startsWith("sm4start")&&static_aescode.endsWith("sm4end")){ + SM4Utils sM4Utils=new SM4Utils(); + byte[] _key=sM4Utils.getSMCode(static_aescode); + this.data = sM4Utils.encodeBytes(this.data,_key); + } + } + + fileOut.write(this.data, 0, this.data.length) ; + + }catch(Exception ex){ + }finally{ + fileOut.close() ; + } + + new_imageFileId=imageFileIdUpdate.getImageFileNewId(); + static_tokenKey=AliOSSObjectManager.getTokenKeyByFileRealPath(static_fileRealPath); + + ConnStatement statement = null; + try{ + statement = new ConnStatement(); + String sql = "insert into ImageFile(" + + "imageFileId,imageFileName,imageFileType,imageFileUsed,fileRealPath" + + ",isZip,isencrypt,filesize,downloads,miniimgpath" + + ",imgsize,isFTP,FTPConfigId,isaesencrypt,aescode" + + " ,tokenKey,storageStatus,comefrom" + + ",secretlevel,secretvalidity"+ + ") values(" + + "?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?,?" + + ",?,?" + + ")"; + statement.setStatementSql(sql); + statement.setInt(1, new_imageFileId); + statement.setString(2, static_imageFileName); + statement.setString(3, static_imageFileType); + statement.setInt(4,static_imageFileUsed); + statement.setString(5, static_fileRealPath); + statement.setString(6, static_isZip); + statement.setString(7, static_isencrypt); + statement.setString(8, static_filesize); + statement.setInt(9, static_downloads); + statement.setString(10, static_miniimgpath); + statement.setString(11, static_imgsize); + statement.setString(12, static_isFTP); + statement.setInt(13,static_FTPConfigId); + statement.setInt(14, static_isaesencrypt); + statement.setString(15, static_aescode); + statement.setString(16, static_tokenKey); + statement.setString(17, static_storageStatus); + statement.setString(18, static_comefrom); + statement.setInt(19, static_secretlevel); + statement.setString(20, static_secretvalidity); + + statement.executeUpdate(); + + }catch(Exception ex){ + + } finally { + try { + statement.close(); + } catch (Exception ex) { + } + } + + AliOSSObjectManager aliOSSObjectManager=new AliOSSObjectManager(); + aliOSSObjectManager.uploadFile(static_fileRealPath,static_imageFileName,static_isZip,""+static_isaesencrypt,static_aescode); + + }catch(Exception ex){ + + } + return new_imageFileId; + } + + public int saveImageFileByInputStream(InputStream is,String filename){ + int new_imageFileId=0; + if(is==null){ + return new_imageFileId; + } + try{ + String static_imageFileName=filename; + String static_imageFileType=""; + if(this.imageFileType==null||this.imageFileType.trim().equals("")){ + static_imageFileType="application/octet-stream"; + } + int static_imageFileUsed=1; + String static_fileRealPath=""; + String static_isZip=""; + String static_isencrypt=""; + String static_filesize=""; + + int static_downloads=0; + String static_miniimgpath=""; + String static_imgsize=""; + String static_isFTP=""; + int static_FTPConfigId=0; + int static_isaesencrypt=0; + String static_aescode=""; + String static_tokenKey=""; + String static_storageStatus=""; + int static_secretlevel=DocManager.DEFAILT_SECRET_LEVEL; + String static_secretvalidity=""; + String static_comefrom=this.comefrom; + + + SystemComInfo syscominfo = new SystemComInfo() ; + String createdir = FileUpload.getCreateDir(syscominfo.getFilesystem()) ; + String random= UUID.randomUUID().toString(); // 解决高并发下,文件重复问题 李迎新 + String fileName = random ; + static_isZip = syscominfo.getNeedzip(); + static_isaesencrypt = Util.getIntValue(syscominfo.getIsaesencrypt(),0); + static_aescode = Util.getRandomString(13); + + if("1".equals(static_isZip)){ + fileName += ".zip"; + } + String fullName = createdir + fileName ; + static_fileRealPath = fullName; + FileManage.createDir(createdir); + //写压缩文件 + OutputStream fileOut = null ; + try{ + File file = new File(static_fileRealPath) ; + if(static_isZip.equals("1")) { + ZipOutputStream filezipOut = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(file))) ; + filezipOut.setMethod(ZipOutputStream.DEFLATED) ; //设置压缩方法 + filezipOut.putNextEntry(new ZipEntry(random)) ; + fileOut = filezipOut ; + } else { + fileOut = new BufferedOutputStream(new FileOutputStream(file)) ; + } + + boolean writeInput = true; + if(static_isaesencrypt==1){ + fileOut = AESCoder.encrypt(fileOut, static_aescode); + String sm4 = Util.null2String(getPropValue("weaver_security_type","reversible_enc_type")); + if("sm4".equalsIgnoreCase(sm4)&&static_aescode.startsWith("sm4start")&&static_aescode.endsWith("sm4end")){ + + ByteArrayOutputStream bos = null; + try { + bos = new ByteArrayOutputStream(); + byte[] b = new byte[1024]; + int n; + while ((n = is.read(b)) != -1) { + bos.write(b, 0, n); + } + this.data = bos.toByteArray(); + static_filesize = this.data.length + ""; + }catch(Exception e){ + + }finally{ + if(bos != null){ + try{ + bos.close(); + }catch(Exception e){} + } + } + + SM4Utils sM4Utils=new SM4Utils(); + byte[] _key=sM4Utils.getSMCode(static_aescode); + this.data = sM4Utils.encodeBytes(this.data,_key); + writeInput = false; + } + } + + + if(writeInput){ + int n =0; + byte []b = new byte[2048]; + long size = 0; + while((n=is.read(b)) != -1){ + fileOut.write(b, 0, n) ; + size += n; + } + static_filesize = size+""; + }else{ + fileOut.write(this.data,0,this.data.length); + } + + + }catch(Exception ex){ + }finally{ + fileOut.close() ; + } + + new_imageFileId=imageFileIdUpdate.getImageFileNewId(); + static_tokenKey=AliOSSObjectManager.getTokenKeyByFileRealPath(static_fileRealPath); + + ConnStatement statement = null; + try{ + statement = new ConnStatement(); + String sql = "insert into ImageFile(" + + "imageFileId,imageFileName,imageFileType,imageFileUsed,fileRealPath" + + ",isZip,isencrypt,filesize,downloads,miniimgpath" + + ",imgsize,isFTP,FTPConfigId,isaesencrypt,aescode" + + " ,tokenKey,storageStatus,comefrom" + + ",secretlevel,secretvalidity"+ + ") values(" + + "?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?,?,?,?" + + ",?,?,?" + + ",?,?" + + ")"; + statement.setStatementSql(sql); + statement.setInt(1, new_imageFileId); + statement.setString(2, static_imageFileName); + statement.setString(3, static_imageFileType); + statement.setInt(4,static_imageFileUsed); + statement.setString(5, static_fileRealPath); + statement.setString(6, static_isZip); + statement.setString(7, static_isencrypt); + statement.setString(8, static_filesize); + statement.setInt(9, static_downloads); + statement.setString(10, static_miniimgpath); + statement.setString(11, static_imgsize); + statement.setString(12, static_isFTP); + statement.setInt(13,static_FTPConfigId); + statement.setInt(14, static_isaesencrypt); + statement.setString(15, static_aescode); + statement.setString(16, static_tokenKey); + statement.setString(17, static_storageStatus); + statement.setString(18, static_comefrom); + statement.setInt(19, static_secretlevel); + statement.setString(20, static_secretvalidity); + + statement.executeUpdate(); + + }catch(Exception ex){ + + } finally { + try { + statement.close(); + } catch (Exception ex) { + } + } + + AliOSSObjectManager aliOSSObjectManager=new AliOSSObjectManager(); + aliOSSObjectManager.uploadFile(static_fileRealPath,static_imageFileName,static_isZip,""+static_isaesencrypt,static_aescode); + + }catch(Exception ex){ + + }finally{ + if(is != null){ + try{ + is.close(); + }catch(Exception e){} + } + } + return new_imageFileId; + + } + + public void updatesecretlevel(){ + RecordSet rs = new RecordSet(); + String sql = "update imagefile set secretlevel=?,secretvalidity=? where imagefileid = ?"; + rs.executeUpdate(sql,secretlevel,secretvalidity,imageFileId); + } + + /** + * 更改物理文件后相关触发操作 + * @param imageFileId_para + */ + public static void ImageFileTrigger(int imageFileId_para) { + if(imageFileId_para<=0){ + return ; + } + try{ + RecordSet rs = new RecordSet(); + rs.executeSql("insert into ImageFileBackUp(imageFileId) values("+imageFileId_para+")"); + rs.executeSql("update DocPreview set mustReconverted='1' where imageFileId="+imageFileId_para); + rs.executeSql("update DocPreviewHtml set mustReconverted='1' where imageFileId="+imageFileId_para); + deletePdfImageFile(imageFileId_para); + }catch(Exception ex){ + + } + } + + public static void deletePdfImageFile(int imageFileId) { + if(imageFileId<=0){ + return ; + } + try{ + RecordSet rs = new RecordSet(); + String sql = "select p.pdfimagefileid,i.filerealpath from pdf_imagefile p,imagefile i where p.pdfimagefileid = i.imagefileid and p.imagefileid = " + imageFileId; + rs.executeSql(sql); + if(rs.next()) + { + String pdfimagefileid = rs.getString("pdfimagefileid"); + String filerealpath = rs.getString("filerealpath"); + File file = new File(filerealpath); + + new FileDeleteUtil().deleteFile(file); + + rs.executeSql("delete from pdf_imagefile where imagefileid="+imageFileId); + rs.executeSql("delete from imagefile where imagefileid="+pdfimagefileid); + } + + rs.executeUpdate("delete from convert_imagefile where imagefileid=?",imageFileId); + + }catch(Exception ex){ + + } + } + + /** + * 获取新的附件ID + */ + public static int getNewImageFileId(){ + if(null == imageFileIdUpdate) { + return -1; + }else { + return imageFileIdUpdate.getImageFileNewId(); + } + } +} \ No newline at end of file diff --git a/weaver/fna/general/FnaCommon.java b/weaver/fna/general/FnaCommon.java new file mode 100644 index 0000000..7c190cd --- /dev/null +++ b/weaver/fna/general/FnaCommon.java @@ -0,0 +1,5920 @@ +/* + * + * Copyright (c) 2001-2016 泛微软件. + * 泛微协同商务系统,版权所有. + * + */ +package weaver.fna.general; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.UnsupportedEncodingException; +import java.io.Writer; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.UUID; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; + +import oracle.sql.CLOB; + +import org.apache.commons.io.IOUtils; +import org.apache.commons.lang.StringEscapeUtils; + +import weaver.conn.BatchRecordSet; +import weaver.conn.ConnStatement; +import weaver.conn.RecordSet; +import weaver.fna.budget.BudgetApproveWFHandler; +import weaver.fna.budget.BudgetHandler; +import weaver.fna.budget.FnaFeeWfInfoComInfo; +import weaver.fna.budget.FnaWfMultiSet; +import weaver.fna.budget.FnaWfMultiSetFieldInfo; +import weaver.fna.budget.FnaTableNameEnum; +import weaver.fna.budget.FnaWfSet; +import weaver.fna.budget.FnaWfSetCache; +import weaver.fna.encrypt.Des; +import weaver.fna.encrypt.RSAUtils; +import weaver.fna.invoice.common.FnaInvoiceCommon; +import weaver.fna.maintenance.BudgetfeeTypeComInfo; +import weaver.fna.maintenance.FnaAdvanceAmountControl; +import weaver.fna.maintenance.FnaAmountControl; +import weaver.fna.maintenance.FnaBorrowAmountControl; +import weaver.fna.maintenance.FnaChangeAmountControl; +import weaver.fna.maintenance.FnaCostCenter; +import weaver.fna.maintenance.FnaShareAmountControl; +import weaver.fna.maintenance.FnaSplitTableByYearComInfo; +import weaver.fna.maintenance.FnaSystemSetComInfo; +import weaver.general.BaseBean; +import weaver.general.TimeUtil; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.UserManager; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.company.SubCompanyComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.interfaces.workflow.action.FnaAdvanceEffectNew; +import weaver.interfaces.workflow.action.FnaAdvanceReverseNew; +import weaver.interfaces.workflow.action.FnaBorrowEffectNew; +import weaver.interfaces.workflow.action.FnaBorrowReverseNew; +import weaver.interfaces.workflow.action.FnaChangeEffectNew; +import weaver.interfaces.workflow.action.FnaShareEffectNew; +import weaver.interfaces.workflow.action.WorkflowFnaEffectNew; +import weaver.interfaces.workflow.action.WorkflowFnaInWorkflowNew; +import weaver.security.util.SecurityMethodUtil; +import weaver.soa.workflow.request.RequestInfo; +import weaver.soa.workflow.request.RequestService; +import weaver.systeminfo.SysMaintenanceLog; +import weaver.systeminfo.SystemEnv; +import weaver.workflow.html.WFLayoutToHtml; +import weaver.workflow.workflow.WorkflowVersion; + +import com.engine.fnaMulDimensions.biz.FnaExpenseInfoBiz; +import com.engine.fnaMulDimensions.biz.TemplateFillReportBiz; +import com.engine.fnaMulDimensions.biz.TemplateFillReportBizNew; +import com.engine.fnaMulDimensions.biz.action.FnaFreezeBudget; +import com.engine.fnaMulDimensions.biz.action.FnaReleaseBudget; +import com.engine.fnaMulDimensions.util.FnaReimbursementUtils; +import com.engine.fnaMulDimensions.util.FnaWorkflowSetUtils; +import com.engine.fnaMulDimensions.util.FnaWorkflowUtil; + +/** + * 预算通用工具类 + * + * @author 无聊的ck + */ +public class FnaCommon extends BaseBean { + /** + * 获取ip地址 + * + * @param request + * @return + */ + public static String getRemoteAddr(HttpServletRequest request) { + String ip = ""; + try { + ip = request.getHeader("x-forwarded-for"); + } catch (Exception e) { + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + try { + ip = request.getHeader("Proxy-Client-IP"); + } catch (Exception e) { + } + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + try { + ip = request.getHeader("WL-Proxy-Client-IP"); + } catch (Exception e) { + } + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { + try { + ip = request.getRemoteAddr(); + } catch (Exception e) { + } + } + return ip; + } + + /** + * 加载流程html模板页面的流程的费用相关信息 + * + * @param formid + * @param workflowid + * @param requestid + * @param otherPara_hs 传入WFLayoutToHtml的同名变量 + */ + public void loadWFLayoutToHtmlFnaInfo(int formid, int workflowid, int requestid, Hashtable otherPara_hs) { + + + String sql = ""; + RecordSet rs = new RecordSet(); + + //启用多明细表报销 + int fnaWfTypeMultiReim = 0; + sql = "select * from fnaFeeWfInfo where workflowid = " + workflowid; + rs.executeQuery(sql); + if (rs.next()) { + fnaWfTypeMultiReim = rs.getInt("fnaWfTypeMultiReim"); + } + //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; + if (fnaWfTypeMultiReim == 1) { + return; + } + + String _key01 = "_isEnableFnaWfHm_FnaCommon.getIsEnableFnaWfHm_workflowid=" + workflowid + "__requestId=" + requestid; + HashMap _isEnableFnaWfHm = new HashMap(); + if (otherPara_hs.containsKey(_key01)) { + _isEnableFnaWfHm = (HashMap) otherPara_hs.get(_key01); + } else { + _isEnableFnaWfHm = FnaCommon.getIsEnableFnaWfHm(workflowid); + otherPara_hs.put(_key01, _isEnableFnaWfHm); + } + + boolean isEnableFnaWfE8 = "true".equals(_isEnableFnaWfHm.get("isEnableFnaWfE8")); + boolean isEnableFnaChangeWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaChangeWf")); + boolean isEnableFnaShareWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaShareWf")); + boolean isEnableFnaBorrowWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaBorrowWf")); + boolean isEnableFnaRepaymentWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaRepaymentWf")); + boolean enableRepayment = "true".equals(_isEnableFnaWfHm.get("enableRepayment")); + boolean isEnableFnaAdvanceWf = "true".equals(_isEnableFnaWfHm.get("isEnableFnaAdvanceWf")); + boolean enableReverseAdvance = "true".equals(_isEnableFnaWfHm.get("enableReverseAdvance")); + + if (isEnableFnaWfE8 || isEnableFnaChangeWf || isEnableFnaShareWf || isEnableFnaBorrowWf || isEnableFnaRepaymentWf || isEnableFnaAdvanceWf) { + + //读取财务相关流程字段对应关系 + String _key001 = "_isEnableFnaWfHm_fnaBudgetControl.getFnaWfFieldInfo4Expense_workflowid=" + workflowid + "__requestId=" + requestid; + Map fnaWfSetMap = null; + if (otherPara_hs.containsKey(_key001)) { + fnaWfSetMap = (HashMap) otherPara_hs.get(_key001); + } else { + fnaWfSetMap = new HashMap(); + FnaCommon.getFnaWfFieldInfo4Expense(workflowid, fnaWfSetMap); + otherPara_hs.put(_key001, fnaWfSetMap); + } + + //读取费用报销流程、预算变更流程、费用分摊流程,第1个明细表中的数据库中的记录 + if (isEnableFnaWfE8 || isEnableFnaChangeWf || isEnableFnaShareWf) { + String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaExpenseRequestRecord_workflowid=" + workflowid + "__requestId=" + requestid; + if (!otherPara_hs.containsKey(_key002)) { + HashMap> reqDataMap = FnaCommon.qryFnaExpenseRequestRecord(requestid, formid, fnaWfSetMap, + isEnableFnaWfE8, isEnableFnaChangeWf, isEnableFnaShareWf); + otherPara_hs.put(_key002, reqDataMap); + } + } + + //读取费用报销流程,写入费用表的数据库中的记录 + if (isEnableFnaWfE8) { + String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaExpenseInfoAllRowRecordHm_workflowid=" + workflowid + "__requestId=" + requestid; + if (!otherPara_hs.containsKey(_key002)) { + HashMap> reqFnaExpenseDataMap = FnaCommon.qryFnaExpenseInfoAllRowRecordHm(requestid); + otherPara_hs.put(_key002, reqFnaExpenseDataMap); + } + } + + //读取费用报销流程、还款流程,第2个明细表中的数据库中的记录 + if ((isEnableFnaWfE8 && enableRepayment) || isEnableFnaRepaymentWf) { + String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaRepaymentRequestRecord_workflowid=" + workflowid + "__requestId=" + requestid; + if (!otherPara_hs.containsKey(_key002)) { + HashMap> reqRepaymentDataMap = FnaCommon.qryFnaRepaymentRequestRecord(requestid, formid, fnaWfSetMap); + otherPara_hs.put(_key002, reqRepaymentDataMap); + } + } + + //读取费用报销流程,第4个明细表中的数据库中的记录 + if ((isEnableFnaWfE8 && enableReverseAdvance)) { + String _key002 = "_isEnableFnaWfHm_FnaCommon.qryFnaReverseAdvanceRequestRecord_workflowid=" + workflowid + "__requestId=" + requestid; + if (!otherPara_hs.containsKey(_key002)) { + HashMap> reqRepaymentDataMap = FnaCommon.qryFnaReverseAdvanceRequestRecord(requestid, formid, fnaWfSetMap); + otherPara_hs.put(_key002, reqRepaymentDataMap); + } + } + } + } + + /** + * 获取新建流程流程,流程表单对应费用承担主体类型字段的默认值(节点前附加操作/选择框默认值) + * + * @param workflowid + * @param ortType_fieldid 流程表单对应费用承担主体类型字段的字段id + * @return + */ + public static int getOrtTypeFieldidDefaultSelectValue(int workflowid, int ortType_fieldid) { + int organizationtype = -1; + RecordSet rs_fna = new RecordSet(); + + if (organizationtype < 0) { + String sql2 = "select a.customervalue from workflow_addinoperate a " + + " where a.fieldop1id = 0 and a.fieldop2id = 0 and a.operation = 0 " + + " and a.workflowid = " + workflowid + " and a.fieldid = " + ortType_fieldid + " "; + //_bb.writeLog("sql2 01="+sql2); + rs_fna.executeSql(sql2); + if (rs_fna.next()) { + organizationtype = rs_fna.getInt("customervalue"); + } + } + if (organizationtype < 0) { + String sql2 = "select a.* from workflow_SelectItem a " + + " where a.cancel = 0 and a.isdefault = 'y' and a.fieldid = " + ortType_fieldid + " " + + " order by a.selectvalue asc"; + rs_fna.executeSql(sql2); + if (rs_fna.next()) { + organizationtype = rs_fna.getInt("selectvalue"); + } + } + + return organizationtype; + } + + /** + * 获得GUID,数据库方式生成 + * + * @param dBType 数据库类型,目前只支持oracle和sqlServer + * @return 32位长度,无符号-,其中英文字符随机大小写 + */ + public static String getPrimaryKeyGuid1SqlStr(String dBType) { + String guid1SQlStr = "replace(newid(),'-','')"; + if ("oracle".equalsIgnoreCase(dBType)) { + guid1SQlStr = "SYS_GUID()"; + } else if ("mysql".equalsIgnoreCase(dBType)) { + guid1SQlStr = "replace(uuid(),'-','')"; + } else if ("dm".equalsIgnoreCase(dBType)) { + guid1SQlStr = "replace(SYS_GUID(),'0x','')"; + } + return guid1SQlStr; + } + + + /** + * 获取自定义费控流程流程的字段对应关系Map对象 + * + * @param workflowid + * @param dataMap 自定义费控流程流程的字段对应关系Map对象 + * @return + */ + public static String getFnaWfFieldInfo4Expense(int workflowid, Map dataMap) { + String fnaWfType = ""; + String sql = ""; + RecordSet rs = new RecordSet(); + + //启用多明细表报销 + int fnaWfTypeMultiReim = 0; + sql = "select * from fnaFeeWfInfo where workflowid = " + workflowid; + rs.executeSql(sql); + if (rs.next()) { + fnaWfTypeMultiReim = rs.getInt("fnaWfTypeMultiReim"); + fnaWfType = Util.null2String(rs.getString("fnaWfType")); + } + //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; + if (fnaWfTypeMultiReim == 1) { + return fnaWfType; + } + + //从缓存中加载-自定义费控流程流程的字段对应关系Map对象 + + //考虑到集群环境,屏蔽从缓存加载字段对应信息 + if (false) {//FnaWfSetCache.loadFnaWfFieldSetMap(workflowid, dataMap) + fnaWfType = dataMap.get("fnaWfType"); + } else { + sql = "select a.fieldType,a.fieldId,a.dtlNumber,b.fieldname,c.fnaWfType,d.formid, b.fieldhtmltype, b.type, b.detailtable, " + + " a.isWfFieldLinkage, a.automaticTake, a.controlBorrowingWf, a.controlflowSubmission " + + " from fnaFeeWfInfoField a " + + " join workflow_billfield b on a.fieldId=b.id " + + " join fnaFeeWfInfo c on a.mainId = c.id " + + " join workflow_base d on a.workflowid = d.id " + + " where a.workflowid = ?"; + rs.executeQuery(sql, workflowid); + while (rs.next()) { + String fieldType = Util.null2String(rs.getString("fieldType")); + String fieldId = Util.null2String(rs.getString("fieldId")); + String dtlNumber = Util.null2String(rs.getString("dtlNumber")); + String fieldName = Util.null2String(rs.getString("fieldname")); + fnaWfType = Util.null2String(rs.getString("fnaWfType")); + String formid = Util.getIntValue(rs.getString("formid"), 0) + ""; + String fieldhtmltype = Util.null2String(rs.getString("fieldhtmltype")); + String type = Util.null2String(rs.getString("type")); + String _detailtable = Util.null2String(rs.getString("detailtable")); + int is_detailtable = "".equals(_detailtable) ? 0 : 1; + int isWfFieldLinkage = Util.getIntValue(rs.getString("isWfFieldLinkage"), 0); + int automaticTake = Util.getIntValue(rs.getString("automaticTake"), 0); + String controlBorrowingWf = Util.null2String(rs.getString("controlBorrowingWf")).trim(); + int controlflowSubmission = Util.getIntValue(rs.getString("controlflowSubmission"), 1); + + dataMap.put("formid", formid); + dataMap.put("fnaWfType", fnaWfType); + + if ("fnaFeeWf".equals(fnaWfType)) {//报销流程 + String fieldIdSubject_isDtl = "1"; + String fieldIdOrgType_isDtl = "1"; + String fieldIdOrgId_isDtl = "1"; + String fieldIdOccurdate_isDtl = "1"; + + if (Util.getIntValue(dtlNumber) == 0) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("main_fieldIdSqr_fieldId", fieldId); + dataMap.put("main_fieldIdSqr_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdSqr_fieldId"); + dataMap.put("main_fieldIdSqr_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdSqr_type", type); + dataMap.put("main_fieldIdSqr_controlBorrowingWf", controlBorrowingWf);//还款流程中通过申请人字段控制可选择的借款流程 + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("main_fieldIdFysqlc_fieldId", fieldId); + dataMap.put("main_fieldIdFysqlc_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdFysqlc_fieldId"); + dataMap.put("main_fieldIdFysqlc_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdFysqlc_type", type); + if (Util.getIntValue(fieldId) > 0) { + dataMap.put("haveApplicationBudget", "true"); + } else { + dataMap.put("haveApplicationBudget", "false"); + } + dataMap.put("main_fieldIdFysqlc_isWfFieldLinkage", String.valueOf(isWfFieldLinkage)); + dataMap.put("main_fieldIdFysqlc_controlflowSubmission", String.valueOf(controlflowSubmission)); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("main_fieldIdSfbxwc_fieldId", fieldId); + dataMap.put("main_fieldIdSfbxwc_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdSfbxwc_fieldId"); + dataMap.put("main_fieldIdSfbxwc_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdSfbxwc_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("main_fieldIdYfkZfHj_fieldId", fieldId); + dataMap.put("main_fieldIdYfkZfHj_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdYfkZfHj_fieldId"); + dataMap.put("main_fieldIdYfkZfHj_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdYfkZfHj_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("main_fieldIdSfysn_fieldId", fieldId); + dataMap.put("main_fieldIdSfysn_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdSfysn_fieldId"); + dataMap.put("main_fieldIdSfysn_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdSfysn_type", type); + } + } else if (Util.getIntValue(dtlNumber) == 1) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("fieldIdSubject_fieldId", fieldId); + dataMap.put("fieldIdSubject_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubject_fieldId"); + dataMap.put("fieldIdSubject_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubject_type", type); + fieldIdSubject_isDtl = "" + is_detailtable; + dataMap.put("fieldIdSubject_fieldId_isDtl", fieldIdSubject_isDtl); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("fieldIdOrgType_fieldId", fieldId); + dataMap.put("fieldIdOrgType_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgType_fieldId"); + dataMap.put("fieldIdOrgType_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgType_type", type); + fieldIdOrgType_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgType_fieldId_isDtl", fieldIdOrgType_isDtl); + dataMap.put("fieldIdOrgType_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("fieldIdOrgId_fieldId", fieldId); + dataMap.put("fieldIdOrgId_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgId_fieldId"); + dataMap.put("fieldIdOrgId_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgId_type", type); + fieldIdOrgId_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgId_fieldId_isDtl", fieldIdOrgId_isDtl); + dataMap.put("fieldIdOrgId_automaticTake", String.valueOf(automaticTake)); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("fieldIdOccurdate_fieldId", fieldId); + dataMap.put("fieldIdOccurdate_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOccurdate_fieldId"); + dataMap.put("fieldIdOccurdate_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOccurdate_type", type); + fieldIdOccurdate_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOccurdate_fieldId_isDtl", fieldIdOccurdate_isDtl); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("fieldIdAmount_fieldId", fieldId); + dataMap.put("fieldIdAmount_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdAmount_fieldId"); + dataMap.put("fieldIdAmount_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdAmount_type", type); + dataMap.put("fieldIdAmount_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 6) { + dataMap.put("fieldIdHrmInfo_fieldId", fieldId); + dataMap.put("fieldIdHrmInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdHrmInfo_fieldId"); + dataMap.put("fieldIdHrmInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdHrmInfo_type", type); + dataMap.put("fieldIdHrmInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 7) { + dataMap.put("fieldIdDepInfo_fieldId", fieldId); + dataMap.put("fieldIdDepInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdDepInfo_fieldId"); + dataMap.put("fieldIdDepInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdDepInfo_type", type); + dataMap.put("fieldIdDepInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 8) { + dataMap.put("fieldIdSubInfo_fieldId", fieldId); + dataMap.put("fieldIdSubInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubInfo_fieldId"); + dataMap.put("fieldIdSubInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubInfo_type", type); + dataMap.put("fieldIdSubInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 9) { + dataMap.put("fieldIdFccInfo_fieldId", fieldId); + dataMap.put("fieldIdFccInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdFccInfo_fieldId"); + dataMap.put("fieldIdFccInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdFccInfo_type", type); + dataMap.put("fieldIdFccInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 1000) { + dataMap.put("fieldIdReqId_fieldId", fieldId); + dataMap.put("fieldIdReqId_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdReqId_fieldId"); + dataMap.put("fieldIdReqId_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdReqId_type", type); + dataMap.put("fieldIdReqId_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 1010) { + dataMap.put("fieldIdReqDtId_fieldId", fieldId); + dataMap.put("fieldIdReqDtId_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdReqDtId_fieldId"); + dataMap.put("fieldIdReqDtId_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdReqDtId_type", type); + dataMap.put("fieldIdReqDtId_fieldId_isDtl", "" + is_detailtable); + } + } else if (Util.getIntValue(dtlNumber) == 2) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt2_fieldIdJklc_fieldId", fieldId); + dataMap.put("dt2_fieldIdJklc_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdJklc_fieldId"); + dataMap.put("dt2_fieldIdJklc_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdJklc_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt2_fieldIdJkdh_fieldId", fieldId); + dataMap.put("dt2_fieldIdJkdh_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdJkdh_fieldId"); + dataMap.put("dt2_fieldIdJkdh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdJkdh_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt2_fieldIdDnxh_fieldId", fieldId); + dataMap.put("dt2_fieldIdDnxh_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdDnxh_fieldId"); + dataMap.put("dt2_fieldIdDnxh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdDnxh_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("dt2_fieldIdJkje_fieldId", fieldId); + dataMap.put("dt2_fieldIdJkje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdJkje_fieldId"); + dataMap.put("dt2_fieldIdJkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdJkje_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("dt2_fieldIdYhje_fieldId", fieldId); + dataMap.put("dt2_fieldIdYhje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdYhje_fieldId"); + dataMap.put("dt2_fieldIdYhje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdYhje_type", type); + } else if (Util.getIntValue(fieldType) == 6) { + dataMap.put("dt2_fieldIdSpzje_fieldId", fieldId); + dataMap.put("dt2_fieldIdSpzje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdSpzje_fieldId"); + dataMap.put("dt2_fieldIdSpzje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdSpzje_type", type); + } else if (Util.getIntValue(fieldType) == 7) { + dataMap.put("dt2_fieldIdWhje_fieldId", fieldId); + dataMap.put("dt2_fieldIdWhje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdWhje_fieldId"); + dataMap.put("dt2_fieldIdWhje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdWhje_type", type); + } else if (Util.getIntValue(fieldType) == 8) { + dataMap.put("dt2_fieldIdCxje_fieldId", fieldId); + dataMap.put("dt2_fieldIdCxje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdCxje_fieldId"); + dataMap.put("dt2_fieldIdCxje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdCxje_type", type); + } + } else if (Util.getIntValue(dtlNumber) == 3) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt3_fieldIdSkfs_fieldId", fieldId); + dataMap.put("dt3_fieldIdSkfs_fieldName", fieldName); + dataMap.put(fieldId, "dt3_fieldIdSkfs_fieldId"); + dataMap.put("dt3_fieldIdSkfs_fieldhtmltype", fieldhtmltype); + dataMap.put("dt3_fieldIdSkfs_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt3_fieldIdSkje_fieldId", fieldId); + dataMap.put("dt3_fieldIdSkje_fieldName", fieldName); + dataMap.put(fieldId, "dt3_fieldIdSkje_fieldId"); + dataMap.put("dt3_fieldIdSkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt3_fieldIdSkje_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt3_fieldIdKhyh_fieldId", fieldId); + dataMap.put("dt3_fieldIdKhyh_fieldName", fieldName); + dataMap.put(fieldId, "dt3_fieldIdKhyh_fieldId"); + dataMap.put("dt3_fieldIdKhyh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt3_fieldIdKhyh_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("dt3_fieldIdHuming_fieldId", fieldId); + dataMap.put("dt3_fieldIdHuming_fieldName", fieldName); + dataMap.put(fieldId, "dt3_fieldIdHuming_fieldId"); + dataMap.put("dt3_fieldIdHuming_fieldhtmltype", fieldhtmltype); + dataMap.put("dt3_fieldIdHuming_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("dt3_fieldIdSkzh_fieldId", fieldId); + dataMap.put("dt3_fieldIdSkzh_fieldName", fieldName); + dataMap.put(fieldId, "dt3_fieldIdSkzh_fieldId"); + dataMap.put("dt3_fieldIdSkzh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt3_fieldIdSkzh_type", type); + } + } else if (Util.getIntValue(dtlNumber) == 4) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt4_fieldIdYfklc_fieldId", fieldId); + dataMap.put("dt4_fieldIdYfklc_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdYfklc_fieldId"); + dataMap.put("dt4_fieldIdYfklc_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdYfklc_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt4_fieldIdYfkdh_fieldId", fieldId); + dataMap.put("dt4_fieldIdYfkdh_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdYfkdh_fieldId"); + dataMap.put("dt4_fieldIdYfkdh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdYfkdh_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt4_fieldIdDnxh_fieldId", fieldId); + dataMap.put("dt4_fieldIdDnxh_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdDnxh_fieldId"); + dataMap.put("dt4_fieldIdDnxh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdDnxh_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("dt4_fieldIdYfkje_fieldId", fieldId); + dataMap.put("dt4_fieldIdYfkje_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdYfkje_fieldId"); + dataMap.put("dt4_fieldIdYfkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdYfkje_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("dt4_fieldIdYhje_fieldId", fieldId); + dataMap.put("dt4_fieldIdYhje_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdYhje_fieldId"); + dataMap.put("dt4_fieldIdYhje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdYhje_type", type); + } else if (Util.getIntValue(fieldType) == 6) { + dataMap.put("dt4_fieldIdSpzje_fieldId", fieldId); + dataMap.put("dt4_fieldIdSpzje_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdSpzje_fieldId"); + dataMap.put("dt4_fieldIdSpzje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdSpzje_type", type); + } else if (Util.getIntValue(fieldType) == 7) { + dataMap.put("dt4_fieldIdWhje_fieldId", fieldId); + dataMap.put("dt4_fieldIdWhje_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdWhje_fieldId"); + dataMap.put("dt4_fieldIdWhje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdWhje_type", type); + } else if (Util.getIntValue(fieldType) == 8) { + dataMap.put("dt4_fieldIdCxje_fieldId", fieldId); + dataMap.put("dt4_fieldIdCxje_fieldName", fieldName); + dataMap.put(fieldId, "dt4_fieldIdCxje_fieldId"); + dataMap.put("dt4_fieldIdCxje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt4_fieldIdCxje_type", type); + } + } + + boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); + dataMap.put("dt1_haveIsDtlField", dt1_haveIsDtlField ? "true" : "false"); + + } else if ("borrow".equals(fnaWfType)) {//借款流程 + if (Util.getIntValue(dtlNumber) == 0) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("main_fieldIdSqr_fieldId", fieldId);//1:申请人; + dataMap.put("main_fieldIdSqr_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdSqr_fieldId"); + dataMap.put("main_fieldIdSqr_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdSqr_type", type); + } + } else if (Util.getIntValue(dtlNumber) == 1) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt1_fieldIdJklx_fieldId", fieldId);//1:借款类型; + dataMap.put("dt1_fieldIdJklx_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdJklx_fieldId"); + dataMap.put("dt1_fieldIdJklx_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdJklx_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt1_fieldIdJkje_fieldId", fieldId);//2:借款金额; + dataMap.put("dt1_fieldIdJkje_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdJkje_fieldId"); + dataMap.put("dt1_fieldIdJkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdJkje_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt1_fieldIdJkmx_fieldId", fieldId);//3:调整明细; + dataMap.put("dt1_fieldIdJkmx_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdJkmx_fieldId"); + dataMap.put("dt1_fieldIdJkmx_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdJkmx_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("dt1_fieldIdJksm_fieldId", fieldId);//4:借款说明; + dataMap.put("dt1_fieldIdJksm_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdJksm_fieldId"); + dataMap.put("dt1_fieldIdJksm_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdJksm_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("dt1_fieldIdXghklc_fieldId", fieldId);//5:相关还款流程; + dataMap.put("dt1_fieldIdXghklc_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdXghklc_fieldId"); + dataMap.put("dt1_fieldIdXghklc_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdXghklc_type", type); + } + } else if (Util.getIntValue(dtlNumber) == 2) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt2_fieldIdSkfs_fieldId", fieldId);//1:收款方式; + dataMap.put("dt2_fieldIdSkfs_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdSkfs_fieldId"); + dataMap.put("dt2_fieldIdSkfs_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdSkfs_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt2_fieldIdSkje_fieldId", fieldId);//2:收款金额; + dataMap.put("dt2_fieldIdSkje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdSkje_fieldId"); + dataMap.put("dt2_fieldIdSkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdSkje_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt2_fieldIdKhyh_fieldId", fieldId);//3:开户银行; + dataMap.put("dt2_fieldIdKhyh_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdKhyh_fieldId"); + dataMap.put("dt2_fieldIdKhyh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdKhyh_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("dt2_fieldIdHuming_fieldId", fieldId);//4:户名; + dataMap.put("dt2_fieldIdHuming_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdHuming_fieldId"); + dataMap.put("dt2_fieldIdHuming_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdHuming_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("dt2_fieldIdSkzh_fieldId", fieldId);//5:收款账号; + dataMap.put("dt2_fieldIdSkzh_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdSkzh_fieldId"); + dataMap.put("dt2_fieldIdSkzh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdSkzh_type", type); + } + } + + } else if ("repayment".equals(fnaWfType)) {//还款流程 + if (Util.getIntValue(dtlNumber) == 0) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("main_fieldIdSqr_fieldId", fieldId);//1:申请人; + dataMap.put("main_fieldIdSqr_fieldName", fieldName); + dataMap.put(fieldId, "main_fieldIdSqr_fieldId"); + dataMap.put("main_fieldIdSqr_fieldhtmltype", fieldhtmltype); + dataMap.put("main_fieldIdSqr_type", type); + dataMap.put("main_fieldIdSqr_controlBorrowingWf", controlBorrowingWf);//还款流程中通过申请人字段控制可选择的借款流程 + } + } else if (Util.getIntValue(dtlNumber) == 1) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt1_fieldIdHklx_fieldId", fieldId);//1:还款类型; + dataMap.put("dt1_fieldIdHklx_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdHklx_fieldId"); + dataMap.put("dt1_fieldIdHklx_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdHklx_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt1_fieldIdHkje_fieldId", fieldId);//2:还款金额; + dataMap.put("dt1_fieldIdHkje_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdHkje_fieldId"); + dataMap.put("dt1_fieldIdHkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdHkje_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt1_fieldIdTzmx_fieldId", fieldId);//3:调整明细; + dataMap.put("dt1_fieldIdTzmx_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdTzmx_fieldId"); + dataMap.put("dt1_fieldIdTzmx_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdTzmx_type", type); + } + } else if (Util.getIntValue(dtlNumber) == 2) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt2_fieldIdJklc_fieldId", fieldId);//1:借款类型; + dataMap.put("dt2_fieldIdJklc_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdJklc_fieldId"); + dataMap.put("dt2_fieldIdJklc_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdJklc_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt2_fieldIdJkdh_fieldId", fieldId);//2:借款单号; + dataMap.put("dt2_fieldIdJkdh_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdJkdh_fieldId"); + dataMap.put("dt2_fieldIdJkdh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdJkdh_type", type); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("dt2_fieldIdDnxh_fieldId", fieldId);//3:单内序号; + dataMap.put("dt2_fieldIdDnxh_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdDnxh_fieldId"); + dataMap.put("dt2_fieldIdDnxh_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdDnxh_type", type); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("dt2_fieldIdJkje_fieldId", fieldId);//4:借款金额; + dataMap.put("dt2_fieldIdJkje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdJkje_fieldId"); + dataMap.put("dt2_fieldIdJkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdJkje_type", type); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("dt2_fieldIdYhje_fieldId", fieldId);//5:已还借款金额; + dataMap.put("dt2_fieldIdYhje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdYhje_fieldId"); + dataMap.put("dt2_fieldIdYhje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdYhje_type", type); + } else if (Util.getIntValue(fieldType) == 6) { + dataMap.put("dt2_fieldIdSpzje_fieldId", fieldId);//6:审批中还款金额; + dataMap.put("dt2_fieldIdSpzje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdSpzje_fieldId"); + dataMap.put("dt2_fieldIdSpzje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdSpzje_type", type); + } else if (Util.getIntValue(fieldType) == 7) { + dataMap.put("dt2_fieldIdWhje_fieldId", fieldId);//7:未还借款金额; + dataMap.put("dt2_fieldIdWhje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdWhje_fieldId"); + dataMap.put("dt2_fieldIdWhje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdWhje_type", type); + } else if (Util.getIntValue(fieldType) == 8) { + dataMap.put("dt2_fieldIdCxje_fieldId", fieldId);//8:冲销借款金额; + dataMap.put("dt2_fieldIdCxje_fieldName", fieldName); + dataMap.put(fieldId, "dt2_fieldIdCxje_fieldId"); + dataMap.put("dt2_fieldIdCxje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt2_fieldIdCxje_type", type); + } + } + + } else if ("change".equals(fnaWfType)) {//预算变更 + String fieldIdSubject_isDtl = "1"; + String fieldIdOrgType_isDtl = "1"; + String fieldIdOrgId_isDtl = "1"; + String fieldIdOccurdate_isDtl = "1"; + + String fieldIdSubject2_isDtl = "1"; + String fieldIdOrgType2_isDtl = "1"; + String fieldIdOrgId2_isDtl = "1"; + String fieldIdOccurdate2_isDtl = "1"; + + if (Util.getIntValue(dtlNumber) == 1) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("fieldIdSubject_fieldId", fieldId); + dataMap.put("fieldIdSubject_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubject_fieldId"); + dataMap.put("fieldIdSubject_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubject_type", type); + fieldIdSubject_isDtl = "" + is_detailtable; + dataMap.put("fieldIdSubject_fieldId_isDtl", fieldIdSubject_isDtl); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("fieldIdOrgType_fieldId", fieldId); + dataMap.put("fieldIdOrgType_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgType_fieldId"); + dataMap.put("fieldIdOrgType_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgType_type", type); + fieldIdOrgType_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgType_fieldId_isDtl", fieldIdOrgType_isDtl); + dataMap.put("fieldIdOrgType_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("fieldIdOrgId_fieldId", fieldId); + dataMap.put("fieldIdOrgId_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgId_fieldId"); + dataMap.put("fieldIdOrgId_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgId_type", type); + dataMap.put("fieldIdOrgId_automaticTake", String.valueOf(automaticTake)); + fieldIdOrgId_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgId_fieldId_isDtl", fieldIdOrgId_isDtl); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("fieldIdOccurdate_fieldId", fieldId); + dataMap.put("fieldIdOccurdate_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOccurdate_fieldId"); + dataMap.put("fieldIdOccurdate_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOccurdate_type", type); + fieldIdOccurdate_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOccurdate_fieldId_isDtl", fieldIdOccurdate_isDtl); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("fieldIdAmount_fieldId", fieldId); + dataMap.put("fieldIdAmount_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdAmount_fieldId"); + dataMap.put("fieldIdAmount_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdAmount_type", type); + dataMap.put("fieldIdAmount_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 6) { + dataMap.put("fieldIdHrmInfo_fieldId", fieldId); + dataMap.put("fieldIdHrmInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdHrmInfo_fieldId"); + dataMap.put("fieldIdHrmInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdHrmInfo_type", type); + dataMap.put("fieldIdHrmInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 7) { + dataMap.put("fieldIdDepInfo_fieldId", fieldId); + dataMap.put("fieldIdDepInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdDepInfo_fieldId"); + dataMap.put("fieldIdDepInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdDepInfo_type", type); + dataMap.put("fieldIdDepInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 8) { + dataMap.put("fieldIdSubInfo_fieldId", fieldId); + dataMap.put("fieldIdSubInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubInfo_fieldId"); + dataMap.put("fieldIdSubInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubInfo_type", type); + dataMap.put("fieldIdSubInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 9) { + dataMap.put("fieldIdFccInfo_fieldId", fieldId); + dataMap.put("fieldIdFccInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdFccInfo_fieldId"); + dataMap.put("fieldIdFccInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdFccInfo_type", type); + dataMap.put("fieldIdFccInfo_fieldId_isDtl", "" + is_detailtable); + } + + if (Util.getIntValue(fieldType) == 10) { + dataMap.put("fieldIdSubject2_fieldId", fieldId); + dataMap.put("fieldIdSubject2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubject2_fieldId"); + dataMap.put("fieldIdSubject2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubject2_type", type); + fieldIdSubject2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdSubject2_fieldId_isDtl", fieldIdSubject2_isDtl); + } else if (Util.getIntValue(fieldType) == 11) { + dataMap.put("fieldIdOrgType2_fieldId", fieldId); + dataMap.put("fieldIdOrgType2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgType2_fieldId"); + dataMap.put("fieldIdOrgType2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgType2_type", type); + fieldIdOrgType2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgType2_fieldId_isDtl", fieldIdOrgType2_isDtl); + dataMap.put("fieldIdOrgType2_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); + } else if (Util.getIntValue(fieldType) == 12) { + dataMap.put("fieldIdOrgId2_fieldId", fieldId); + dataMap.put("fieldIdOrgId2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgId2_fieldId"); + dataMap.put("fieldIdOrgId2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgId2_type", type); + dataMap.put("fieldIdOrgId2_automaticTake", String.valueOf(automaticTake)); + fieldIdOrgId2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgId2_fieldId_isDtl", fieldIdOrgId2_isDtl); + } else if (Util.getIntValue(fieldType) == 13) { + dataMap.put("fieldIdOccurdate2_fieldId", fieldId); + dataMap.put("fieldIdOccurdate2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOccurdate2_fieldId"); + dataMap.put("fieldIdOccurdate2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOccurdate2_type", type); + fieldIdOccurdate2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOccurdate2_fieldId_isDtl", fieldIdOccurdate2_isDtl); + } else if (Util.getIntValue(fieldType) == 14) { + dataMap.put("fieldIdHrmInfo2_fieldId", fieldId); + dataMap.put("fieldIdHrmInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdHrmInfo2_fieldId"); + dataMap.put("fieldIdHrmInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdHrmInfo2_type", type); + dataMap.put("fieldIdHrmInfo2_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 15) { + dataMap.put("fieldIdDepInfo2_fieldId", fieldId); + dataMap.put("fieldIdDepInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdDepInfo2_fieldId"); + dataMap.put("fieldIdDepInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdDepInfo2_type", type); + dataMap.put("fieldIdDepInfo2_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 16) { + dataMap.put("fieldIdSubInfo2_fieldId", fieldId); + dataMap.put("fieldIdSubInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubInfo2_fieldId"); + dataMap.put("fieldIdSubInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubInfo2_type", type); + dataMap.put("fieldIdSubInfo2_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 17) { + dataMap.put("fieldIdFccInfo2_fieldId", fieldId); + dataMap.put("fieldIdFccInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdFccInfo2_fieldId"); + dataMap.put("fieldIdFccInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdFccInfo2_type", type); + dataMap.put("fieldIdFccInfo2_fieldId_isDtl", "" + is_detailtable); + } + } + + boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); + dataMap.put("dt1_haveIsDtlField", dt1_haveIsDtlField ? "true" : "false"); + + boolean dt1_haveIsDtlField2 = ("1".equals(fieldIdSubject2_isDtl) || "1".equals(fieldIdOrgType2_isDtl) || "1".equals(fieldIdOrgId2_isDtl) || "1".equals(fieldIdOccurdate2_isDtl)); + dataMap.put("dt1_haveIsDtlField2", dt1_haveIsDtlField2 ? "true" : "false"); + + } else if ("share".equals(fnaWfType)) {//费用分摊 + String fieldIdSubject_isDtl = "1"; + String fieldIdOrgType_isDtl = "1"; + String fieldIdOrgId_isDtl = "1"; + String fieldIdOccurdate_isDtl = "1"; + + String fieldIdSubject2_isDtl = "1"; + String fieldIdOrgType2_isDtl = "1"; + String fieldIdOrgId2_isDtl = "1"; + String fieldIdOccurdate2_isDtl = "1"; + + if (Util.getIntValue(dtlNumber) == 1) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("fieldIdSubject_fieldId", fieldId); + dataMap.put("fieldIdSubject_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubject_fieldId"); + dataMap.put("fieldIdSubject_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubject_type", type); + fieldIdSubject_isDtl = "" + is_detailtable; + dataMap.put("fieldIdSubject_fieldId_isDtl", fieldIdSubject_isDtl); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("fieldIdOrgType_fieldId", fieldId); + dataMap.put("fieldIdOrgType_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgType_fieldId"); + dataMap.put("fieldIdOrgType_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgType_type", type); + fieldIdOrgType_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgType_fieldId_isDtl", fieldIdOrgType_isDtl); + dataMap.put("fieldIdOrgType_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); + } else if (Util.getIntValue(fieldType) == 3) { + dataMap.put("fieldIdOrgId_fieldId", fieldId); + dataMap.put("fieldIdOrgId_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgId_fieldId"); + dataMap.put("fieldIdOrgId_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgId_type", type); + dataMap.put("fieldIdOrgId_automaticTake", String.valueOf(automaticTake)); + fieldIdOrgId_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgId_fieldId_isDtl", fieldIdOrgId_isDtl); + } else if (Util.getIntValue(fieldType) == 4) { + dataMap.put("fieldIdOccurdate_fieldId", fieldId); + dataMap.put("fieldIdOccurdate_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOccurdate_fieldId"); + dataMap.put("fieldIdOccurdate_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOccurdate_type", type); + fieldIdOccurdate_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOccurdate_fieldId_isDtl", fieldIdOccurdate_isDtl); + } else if (Util.getIntValue(fieldType) == 5) { + dataMap.put("fieldIdAmount_fieldId", fieldId); + dataMap.put("fieldIdAmount_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdAmount_fieldId"); + dataMap.put("fieldIdAmount_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdAmount_type", type); + dataMap.put("fieldIdAmount_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 6) { + dataMap.put("fieldIdHrmInfo_fieldId", fieldId); + dataMap.put("fieldIdHrmInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdHrmInfo_fieldId"); + dataMap.put("fieldIdHrmInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdHrmInfo_type", type); + dataMap.put("fieldIdHrmInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 7) { + dataMap.put("fieldIdDepInfo_fieldId", fieldId); + dataMap.put("fieldIdDepInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdDepInfo_fieldId"); + dataMap.put("fieldIdDepInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdDepInfo_type", type); + dataMap.put("fieldIdDepInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 8) { + dataMap.put("fieldIdSubInfo_fieldId", fieldId); + dataMap.put("fieldIdSubInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubInfo_fieldId"); + dataMap.put("fieldIdSubInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubInfo_type", type); + dataMap.put("fieldIdSubInfo_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 9) { + dataMap.put("fieldIdFccInfo_fieldId", fieldId); + dataMap.put("fieldIdFccInfo_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdFccInfo_fieldId"); + dataMap.put("fieldIdFccInfo_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdFccInfo_type", type); + dataMap.put("fieldIdFccInfo_fieldId_isDtl", "" + is_detailtable); + } + + if (Util.getIntValue(fieldType) == 10) { + dataMap.put("fieldIdSubject2_fieldId", fieldId); + dataMap.put("fieldIdSubject2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubject2_fieldId"); + dataMap.put("fieldIdSubject2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubject2_type", type); + fieldIdSubject2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdSubject2_fieldId_isDtl", fieldIdSubject2_isDtl); + } else if (Util.getIntValue(fieldType) == 11) { + dataMap.put("fieldIdOrgType2_fieldId", fieldId); + dataMap.put("fieldIdOrgType2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgType2_fieldId"); + dataMap.put("fieldIdOrgType2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgType2_type", type); + fieldIdOrgType2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgType2_fieldId_isDtl", fieldIdOrgType2_isDtl); + dataMap.put("fieldIdOrgType2_defaultSelectValue", FnaCommon.getOrtTypeFieldidDefaultSelectValue(workflowid, Util.getIntValue(fieldId)) + ""); + } else if (Util.getIntValue(fieldType) == 12) { + dataMap.put("fieldIdOrgId2_fieldId", fieldId); + dataMap.put("fieldIdOrgId2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOrgId2_fieldId"); + dataMap.put("fieldIdOrgId2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOrgId2_type", type); + dataMap.put("fieldIdOrgId2_automaticTake", String.valueOf(automaticTake)); + fieldIdOrgId2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOrgId2_fieldId_isDtl", fieldIdOrgId2_isDtl); + } else if (Util.getIntValue(fieldType) == 13) { + dataMap.put("fieldIdOccurdate2_fieldId", fieldId); + dataMap.put("fieldIdOccurdate2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdOccurdate2_fieldId"); + dataMap.put("fieldIdOccurdate2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdOccurdate2_type", type); + fieldIdOccurdate2_isDtl = "" + is_detailtable; + dataMap.put("fieldIdOccurdate2_fieldId_isDtl", fieldIdOccurdate2_isDtl); + } else if (Util.getIntValue(fieldType) == 14) { + dataMap.put("fieldIdHrmInfo2_fieldId", fieldId); + dataMap.put("fieldIdHrmInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdHrmInfo2_fieldId"); + dataMap.put("fieldIdHrmInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdHrmInfo2_type", type); + dataMap.put("fieldIdHrmInfo2_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 15) { + dataMap.put("fieldIdDepInfo2_fieldId", fieldId); + dataMap.put("fieldIdDepInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdDepInfo2_fieldId"); + dataMap.put("fieldIdDepInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdDepInfo2_type", type); + dataMap.put("fieldIdDepInfo2_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 16) { + dataMap.put("fieldIdSubInfo2_fieldId", fieldId); + dataMap.put("fieldIdSubInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdSubInfo2_fieldId"); + dataMap.put("fieldIdSubInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdSubInfo2_type", type); + dataMap.put("fieldIdSubInfo2_fieldId_isDtl", "" + is_detailtable); + } else if (Util.getIntValue(fieldType) == 17) { + dataMap.put("fieldIdFccInfo2_fieldId", fieldId); + dataMap.put("fieldIdFccInfo2_fieldName", fieldName); + dataMap.put(fieldId, "fieldIdFccInfo2_fieldId"); + dataMap.put("fieldIdFccInfo2_fieldhtmltype", fieldhtmltype); + dataMap.put("fieldIdFccInfo2_type", type); + dataMap.put("fieldIdFccInfo2_fieldId_isDtl", "" + is_detailtable); + } + } + + boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); + dataMap.put("dt1_haveIsDtlField", dt1_haveIsDtlField ? "true" : "false"); + + boolean dt1_haveIsDtlField2 = ("1".equals(fieldIdSubject2_isDtl) || "1".equals(fieldIdOrgType2_isDtl) || "1".equals(fieldIdOrgId2_isDtl) || "1".equals(fieldIdOccurdate2_isDtl)); + dataMap.put("dt1_haveIsDtlField2", dt1_haveIsDtlField2 ? "true" : "false"); + + } else if ("advance".equals(fnaWfType)) {//预付款流程 + if (Util.getIntValue(dtlNumber) == 1) { + if (Util.getIntValue(fieldType) == 1) { + dataMap.put("dt1_fieldIdYfkje_fieldId", fieldId);//1:借款金额; + dataMap.put("dt1_fieldIdYfkje_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdYfkje_fieldId"); + dataMap.put("dt1_fieldIdYfkje_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdYfkje_type", type); + } else if (Util.getIntValue(fieldType) == 2) { + dataMap.put("dt1_fieldIdYfkmx_fieldId", fieldId);//2:调整明细; + dataMap.put("dt1_fieldIdYfkmx_fieldName", fieldName); + dataMap.put(fieldId, "dt1_fieldIdYfkmx_fieldId"); + dataMap.put("dt1_fieldIdYfkmx_fieldhtmltype", fieldhtmltype); + dataMap.put("dt1_fieldIdYfkmx_type", type); + } + } + + } + } + + try { + //更新缓存 + FnaWfSetCache.putFnaWfFieldSetMap(workflowid, fnaWfType, dataMap); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + + return fnaWfType; + } + + /** + * 返回指定人员 、日期范围内,未还借款金额 + * + * @param userId + * @param startDate + * @param endDate + * @return + */ + public static double getPersonalLoanAmount(int userId, String startDate, String endDate) { + double personalLoanAmount = 0.00; + RecordSet rs = new RecordSet(); + String sql = "select SUM(fbi.amountBorrow * fbi.borrowDirection) sum_amountBorrow \n" + + " from FnaBorrowInfo fbi \n" + + " where 1=1 \n"; + if (!"".equals(startDate)) { + sql += " and fbi.createDate >= '" + StringEscapeUtils.escapeSql(startDate) + "' \n"; + } + if (!"".equals(endDate)) { + sql += " and fbi.createDate <= '" + StringEscapeUtils.escapeSql(endDate) + "' \n"; + } + sql += " and fbi.applicantid = " + userId; + rs.executeSql(sql); + if (rs.next()) { + personalLoanAmount = Util.getDoubleValue(rs.getString("sum_amountBorrow"), 0.00); + } + return personalLoanAmount; + } + + /** + * 流程表单上填写的费用日期 + */ + public final static String BudgetAutoMoveAfterOccurDate1 = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003241, weaver.general.ThreadVarLanguage.getLang()) + ""; + /** + * 流程费用表中保存的费用日期 + */ + public final static String BudgetAutoMoveAfterOccurDate3 = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003242, weaver.general.ThreadVarLanguage.getLang()) + ""; + /** + * 流程费用表中保存的结转前的费用日期 + */ + public final static String BudgetAutoMoveAfterOccurDate4 = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003243, weaver.general.ThreadVarLanguage.getLang()) + ""; + /** + * 流程费用表记录是否发生过结转;1:结转过;其他:没有结转过; + */ + public final static String IsBudgetAutoMove = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003244, weaver.general.ThreadVarLanguage.getLang()) + "1:" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003245, weaver.general.ThreadVarLanguage.getLang()) + ""; + + /** + * 获取报销流程相应费用明细费用日期相关信息
+ * BudgetAutoMoveAfterOccurDate1 = "流程表单上填写的费用日期";
+ * BudgetAutoMoveAfterOccurDate3 = "流程费用表中保存的费用日期";
+ * BudgetAutoMoveAfterOccurDate4 = "流程费用表中保存的结转前的费用日期";
+ * IsBudgetAutoMove = "流程费用表记录是否发生过结转;1:结转过;其他:没有结转过;"; + * + * @param occurdate 流程表单填写的费用日期 + * @param dtl_id 流程费用明细数据库PkId + * @param requestid 流程requestid + * @param fnaExpenseInfoRecordHm + * @return + */ + public static HashMap getBudgetAutoMoveAfterOccurDate(String occurdate, int dtl_id, int requestid, + HashMap fnaExpenseInfoRecordHm) { + return getBudgetAutoMoveAfterOccurDate(occurdate, "", dtl_id, requestid, fnaExpenseInfoRecordHm); + } + + /** + * 获取报销流程相应费用明细费用日期相关信息
+ * BudgetAutoMoveAfterOccurDate1 = "流程表单上填写的费用日期";
+ * BudgetAutoMoveAfterOccurDate3 = "流程费用表中保存的费用日期";
+ * BudgetAutoMoveAfterOccurDate4 = "流程费用表中保存的结转前的费用日期";
+ * IsBudgetAutoMove = "流程费用表记录是否发生过结转;1:结转过;其他:没有结转过;"; + * + * @param occurdate 流程表单填写的费用日期 + * @param detailtable 流程费用明细表名。与参数dtl_id一并传入。 + * @param dtl_id 流程费用明细数据库PkId + * @param requestid 流程requestid + * @param fnaExpenseInfoRecordHm + * @return + */ + public static HashMap getBudgetAutoMoveAfterOccurDate(String occurdate, String detailtable, int dtl_id, int requestid, + HashMap fnaExpenseInfoRecordHm) { + HashMap retHm = new HashMap(); + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate1, occurdate); + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate3, ""); + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate4, ""); + retHm.put(FnaCommon.IsBudgetAutoMove, "0"); + + if (dtl_id != 0 && requestid > 0) { + if (fnaExpenseInfoRecordHm != null && fnaExpenseInfoRecordHm.containsKey("occurdate")) { + String _occurdate = Util.null2String(fnaExpenseInfoRecordHm.get("occurdate")).trim(); + String _occurdateOld = Util.null2String(fnaExpenseInfoRecordHm.get("occurdateOld")).trim(); + String _isBudgetAutoMove = Util.getIntValue(fnaExpenseInfoRecordHm.get("isBudgetAutoMove"), 0) + ""; + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate3, _occurdate); + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate4, _occurdateOld); + retHm.put(FnaCommon.IsBudgetAutoMove, _isBudgetAutoMove); + + } else { + RecordSet rs = new RecordSet(); + + boolean isFound = false; + //定位 数据库表名, 日期范围可能跨年 + List list_out_FnaExpenseInfo = new ArrayList(); + FnaSplitTableByYearComInfo.getFnaTableNameList(FnaTableNameEnum.FnaExpenseInfo, "1000-01-01", "9999-12-31", list_out_FnaExpenseInfo); + //定位 数据库表名, 日期范围可能跨年 + for (int aaaaaaaa = 0; aaaaaaaa < list_out_FnaExpenseInfo.size(); aaaaaaaa++) { + String tableName_FnaExpenseInfo = list_out_FnaExpenseInfo.get(aaaaaaaa); + + String sql = ""; + if (dtl_id > 0) {//不含有明细 == -987654321 + if (detailtable == null || "".equals(detailtable)) { + sql = "select a.occurdate, a.occurdateOld, a.isBudgetAutoMove \n" + + " from " + tableName_FnaExpenseInfo + " a \n" + + " where a.sourceRequestidDtlId = " + dtl_id + + " and a.sourceRequestid = a.requestid and a.requestid = " + requestid; + } else { + //E9 先回归的拆表,再回归的多明细报销 + try { + boolean query_changeAmt_flag = rs.executeQuery(" select detailtable from " + tableName_FnaExpenseInfo + " where 1=2 "); + if (!query_changeAmt_flag) { + if ("oracle".equalsIgnoreCase(rs.getDBType())) { + rs.execute(" alter table " + tableName_FnaExpenseInfo + " add detailtable VARCHAR2(200) "); + } else if ("mysql".equalsIgnoreCase(rs.getDBType())) { + rs.execute(" alter table " + tableName_FnaExpenseInfo + " add detailtable VARCHAR(200) "); + } else { + rs.execute(" alter table " + tableName_FnaExpenseInfo + " add detailtable VARCHAR(200) "); + } + } + } catch (Exception ex1) { + } + + sql = "select a.occurdate, a.occurdateOld, a.isBudgetAutoMove \n" + + " from " + tableName_FnaExpenseInfo + " a \n" + + " where a.detailtable = '" + StringEscapeUtils.escapeSql(detailtable) + "' and a.sourceRequestidDtlId = " + dtl_id + + " and a.sourceRequestid = a.requestid and a.requestid = " + requestid; + } + } else { + sql = "select a.occurdate, a.occurdateOld, a.isBudgetAutoMove \n" + + " from " + tableName_FnaExpenseInfo + " a \n" + + " where a.sourceRequestid = a.requestid and a.requestid = " + requestid; + } + rs.executeSql(sql); + if (rs.next()) { + isFound = true; //找到日期了,就跳出循环,不需要再查询后面的表了 + String _occurdate = Util.null2String(rs.getString("occurdate")).trim(); + String _occurdateOld = Util.null2String(rs.getString("occurdateOld")).trim(); + String _isBudgetAutoMove = Util.getIntValue(rs.getString("isBudgetAutoMove"), 0) + ""; + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate3, _occurdate); + retHm.put(FnaCommon.BudgetAutoMoveAfterOccurDate4, _occurdateOld); + retHm.put(FnaCommon.IsBudgetAutoMove, _isBudgetAutoMove); + } + + if (isFound) { + break; + } + }//for end + } + } + return retHm; + } + + /** + * 检查指定用户对指定预算单位是否有编辑权限 + * + * @param organizationtype + * @param organizationid + * @param userId + * @return + * @throws Exception + */ + public static boolean checkPermissionsFnaBudgetForEdit(String organizationtype, String organizationid, int userId) throws Exception { + boolean fnaBudgetViewFlag = false; + if ("0".equals(organizationtype)) { + if (FnaBudgetLeftRuleSet.isAllowCmpEdit(userId)) { + fnaBudgetViewFlag = true; + } + } else if ("1".equals(organizationtype)) { + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpIdEdit(userId, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } else if ("2".equals(organizationtype)) { + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowDepIdEdit(userId, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } else if ("3".equals(organizationtype)) { + List grList = new ArrayList(); + grList.add(organizationid); + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowHrmIdEdit(userId, null, null, grList, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } else if ((FnaCostCenter.ORGANIZATION_TYPE + "").equals(organizationtype)) { + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowFccIdEdit(userId, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } + return fnaBudgetViewFlag; + } + + /** + * 检查指定用户对指定预算单位是否有编辑权限 + * + * @param organizationtype + * @param organizationid + * @param userId + * @return + * @throws Exception + */ + public static boolean checkPermissionsFnaBudgetForView(String organizationtype, String organizationid, int userId) throws Exception { + boolean fnaBudgetViewFlag = false; + if ("0".equals(organizationtype)) { + if (FnaBudgetLeftRuleSet.isAllowCmp(userId)) { + fnaBudgetViewFlag = true; + } + } else if ("1".equals(organizationtype)) { + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowSubCmpId(userId, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } else if ("2".equals(organizationtype)) { + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowDepId(userId, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } else if ("3".equals(organizationtype)) { + List grList = new ArrayList(); + grList.add(organizationid); + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowHrmId(userId, null, null, grList, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } else if ((FnaCostCenter.ORGANIZATION_TYPE + "").equals(organizationtype)) { + List allowOrgIdEdit_list = new ArrayList(); + boolean allowOrgIdEdit = FnaBudgetLeftRuleSet.getAllowFccId(userId, allowOrgIdEdit_list); + if (allowOrgIdEdit || allowOrgIdEdit_list.contains(organizationid)) { + fnaBudgetViewFlag = true; + } + } + return fnaBudgetViewFlag; + } + + /** + * 检查字符串长度是否没有超过指定长度(字符串转换编码默认按UTF-8进行转换,一个双字节字符对应长度3) + * + * @param str 被检查的字符串 + * @param maxLength 指定最大长度 + * @return + * @throws UnsupportedEncodingException + */ + public static boolean checkStringLength(String str, int maxLength) throws UnsupportedEncodingException { + return checkStringLength(str, maxLength, "UTF-8"); + } + + /** + * 检查字符串长度是否没有超过指定长度 + * + * @param str 被检查的字符串 + * @param maxLength 指定最大长度 + * @param charsetName 字符串转换编码 + * @return + * @throws UnsupportedEncodingException + */ + public static boolean checkStringLength(String str, int maxLength, String charsetName) throws UnsupportedEncodingException { + if (str == null || "".equals(str)) { + return true; + } else { + return str.getBytes(charsetName).length < maxLength; + } + } + + /** + * 更新oracle数据库clob类型字段值、更新sqlserver数据库text类型字段值的方法 + * + * @param tableName 表名 + * @param clobFieldName clob、text类型字段数据库字段名 + * @param colbFieldValue clob、text字段值 + * @param keyFieldName 记录主键字段数据库字段名 + * @param keyFieldValue 记录主键字段值 + * @param keyFieldDbType 记录主键字段数据库字段类型:int、string + * @return + * @throws Exception + */ + public static boolean updateDbClobOrTextFieldValue(String tableName, + String clobFieldName, String colbFieldValue, + String keyFieldName, String keyFieldValue, String keyFieldDbType) throws Exception { + //new BaseBean().writeLog("updateDbClobOrTextFieldValue colbFieldValue>>>"+colbFieldValue+";;;keyFieldValue>>>"+keyFieldValue); + + if ("int".equals(keyFieldDbType) || "string".equals(keyFieldDbType)) { + } else { + new Exception("FnaCommon.updateDbClobTextFieldValue:keyFieldDbType 记录主键字段数据库字段类型:int、string,该参数值不正确!"); + } + + RecordSet rs = new RecordSet(); + if ("oracle".equals(rs.getDBType()) && Util.null2String(rs.getOrgindbtype()).equals("oracle")) { + boolean flag = false; + boolean flag_exec_updateSql = false; + ConnStatement statement = null; + try { + statement = new ConnStatement(); + + String sql = "update " + tableName + " " + + " set " + clobFieldName + " = empty_clob() " + + " where " + keyFieldName + " = ?"; + //new BaseBean().writeLog(sql); + statement.setStatementSql(sql); + if ("int".equals(keyFieldDbType)) { + statement.setInt(1, Util.getIntValue(keyFieldValue, -1)); + } else { + statement.setString(1, keyFieldValue); + } + statement.executeUpdate(); + + sql = "select " + clobFieldName + " from " + tableName + " where " + keyFieldName + " = "; + if ("int".equals(keyFieldDbType)) { + sql += Util.getIntValue(keyFieldValue, -1); + } else { + sql += "'" + StringEscapeUtils.escapeSql(keyFieldValue) + "'"; + } + //new BaseBean().writeLog(sql); + statement.setStatementSql(sql, false); + statement.executeQuery(); + if (statement.next()) { + // String(this.doccontent.getBytes("ISO8859_1"), + // "UTF-8")) ; + char[] _writeCharArray = Util.null2String(colbFieldValue).toCharArray(); + CLOB theclob = statement.getClob(1); + if (theclob != null) { + Writer _write = theclob.getCharacterOutputStream(); + if (_write != null) { + try { + _write.write(_writeCharArray); + } finally { + try { + if (_write != null) { + _write.flush(); + } + } catch (Exception ex01) { + } + try { + if (_write != null) { + _write.close(); + } + } catch (Exception ex01) { + } + } + + flag = true; + } else { + flag_exec_updateSql = true; + } + } else { + flag_exec_updateSql = true; + } + } + + } finally { + try { + if (statement != null) { + statement.close(); + } + } catch (Exception ex) { + new BaseBean().writeLog("fna_FnaCommon_Exception:" + ex); + } + } + + if (flag_exec_updateSql) { + String sql = "update " + tableName + " " + + " set " + clobFieldName + " = ? " + + " where " + keyFieldName + " = ?"; + return rs.executeUpdate(sql, Util.null2String(colbFieldValue), keyFieldValue + ""); + } + + return flag; + + } else { + /*String sql = "update "+tableName+" " + + " set "+clobFieldName+" = ? " + + " where "+keyFieldName+" = ?"; + return rs.executeUpdate(sql, Util.null2String(colbFieldValue), keyFieldValue+"");*/ + + ConnStatement connStatement = new ConnStatement(); + try { + String sql = "update " + tableName + " " + + " set " + clobFieldName + " = ? " + + " where " + keyFieldName + " = ?"; + connStatement.setStatementSql(sql); + connStatement.setString(1, Util.null2String(colbFieldValue)); + connStatement.setString(2, keyFieldValue); + connStatement.executeUpdate(); + return true; + } catch (Exception e) { + new BaseBean().writeLog("fna_FnaCommon_Exception:" + e.getMessage()); + return false; + } finally { + connStatement.close(); + } + + } + } + + /** + * 深复制List + * + * @param list1 + * @return + */ + public static List copyList_stringArray(List list1) { + List list2 = new ArrayList(); + if (list1 != null) { + int list1Len = list1.size(); + for (int i = 0; i < list1Len; i++) { + String[] arr1 = list1.get(i); + if (arr1 != null) { + int arr1Len = arr1.length; + String[] arr2 = new String[arr1Len]; + for (int j = 0; j < arr1Len; j++) { + arr2[j] = arr1[j]; + } + list2.add(arr2); + } else { + list2.add(null); + } + } + } else { + return null; + } + return list2; + } + + /** + * 深复制List + * + * @param list1 + * @return + */ + public static List copyList_string(List list1) { + List list2 = new ArrayList(); + if (list1 != null) { + int list1Len = list1.size(); + for (int i = 0; i < list1Len; i++) { + list2.add(list1.get(i)); + } + } else { + return null; + } + return list2; + } + + /** + * 复制List + * + * @param list1 源list,待复制的 + * @param list2 被复制的,复制前会调用clear函数,清除原有数据。 + */ + public void copyList_string(List list1, List list2) { + //List list2 = new ArrayList(); + if (list1 != null && list2 != null) { + list2.clear(); + int list1Len = list1.size(); + for (int i = 0; i < list1Len; i++) { + list2.add(list1.get(i)); + } + } + } + + /** + * 获得GUID + * + * @return 32位长度,无符号-,其中英文字符随机大小写 + */ + public static String getPrimaryKeyGuid1() { + int max = 10; + int min = 1; + Random random = new Random(); + + String uuid1 = UUID.randomUUID().toString().replaceAll("-", ""); + + StringBuffer guid1 = new StringBuffer(); + String[] uuid1Array = uuid1.split(""); + for (int i = 0; i < uuid1Array.length; i++) { + int s = random.nextInt(max) % (max - min + 1) + min; + if (s < 6) { + guid1.append(uuid1Array[i]); + } else { + guid1.append(uuid1Array[i].toUpperCase()); + } + } + + return Util.null2String(guid1.toString()).trim(); + } + + /** + * 报销费用类型(科目)、成本中心浏览框支持流程浏览数据定义 + * + * @param params 参数键值对 + * @param operation add/del + * @return + */ + public boolean saveOrUpdateWfBrowdef(Map params, String operation) { + try { + String workflowid = Util.null2String(params.get("workflowId")); + String fieldId = Util.null2String(params.get("fieldId")); + String viewType = Util.null2String(params.get("viewType")); + String fieldType = Util.null2String(params.get("fieldType")); + String title = Util.null2String(params.get("title")); + String feetypeRange = Util.null2String(params.get("feetypeRange")); + String fccId = Util.null2String(params.get("fccId")); + + String param = !feetypeRange.equals("") ? feetypeRange : fccId; + + /*new BaseBean().writeLog("workflowid:"+workflowid); + new BaseBean().writeLog("fieldId:"+fieldId); + new BaseBean().writeLog("viewType:"+viewType); + new BaseBean().writeLog("fieldType:"+fieldType); + new BaseBean().writeLog("title:"+ new String(title.getBytes("ISO-8859-1"),"utf-8")); + new BaseBean().writeLog("feetypeRange:"+feetypeRange); + new BaseBean().writeLog("fccId:"+fccId);*/ + + if (operation.equals("del")) { + removeWfBrowdef(workflowid, fieldId, fieldType); + } else if (operation.equals("add")) { + removeWfBrowdef(workflowid, fieldId, fieldType); + initNewWfBrowdef(workflowid, fieldId, viewType, fieldType, title, param); + } + BudgetfeeTypeComInfo budgetfeeTypeComInfo = new BudgetfeeTypeComInfo(); + budgetfeeTypeComInfo.removeBudgetfeeTypeCache(); + return true; + } catch (Exception e) { + new BaseBean().writeLog(e); + return false; + } + } + + /** + * 删除 流程浏览数据定义 + * + * @param workflowid 流程id + * @param fieldId 字段id + * @param fieldType 浏览按钮类型 + */ + private void removeWfBrowdef(String workflowid, String fieldId, String fieldType) throws Exception { + String sql = ""; + RecordSet rs = new RecordSet(); + RecordSet rs2 = new RecordSet(); + + //删除历史数据 + sql = "select id from FnaFeetypeWfbrowdef " + + " where workflowid=" + workflowid + + " and fieldId=" + fieldId + + " and fieldType=" + fieldType; + rs.executeSql(sql); + if (rs.next()) { + String tempid = Util.null2String(rs.getString("id")); + + sql = "delete from FnaFeetypeWfbrowdef where id=" + tempid; + rs2.executeSql(sql); + sql = "delete from FnaFeetypeWfbrowdef_dt1 where mainid=" + tempid; + rs2.executeSql(sql); + } + } + + /** + * 流程浏览数据定义 + * + * @param workflowid 流程id + * @param fieldId 字段id + * @param viewType + * @param fieldType 浏览按钮类型 + * @param title 标题 + * @param param 参数键值对 + */ + private void initNewWfBrowdef(String workflowid, String fieldId, String viewType, String fieldType, String title, String param) throws Exception { + String sql = ""; + RecordSet rs = new RecordSet(); + + sql = "insert into FnaFeetypeWfbrowdef (workflowid,fieldId,viewType,fieldType,title) " + + " values " + + " (" + workflowid + "," + fieldId + "," + viewType + "," + fieldType + ",'" + title + "')"; + rs.executeSql(sql); + + + //插入新数据 + String id = ""; + sql = "select max(id) maxid from FnaFeetypeWfbrowdef"; + rs.executeSql(sql); + if (rs.next()) { + id = Util.null2String(rs.getString("maxid")); + } + + if (!param.equals("") && !id.equals("")) { + for (String refid : param.split(",")) { + sql = "insert into FnaFeetypeWfbrowdef_dt1 (mainid,refid)" + + " values " + + " (" + id + "," + refid + ")"; + rs.executeSql(sql); + } + } + } + + /** + * 返回:路径设置》浏览按钮定义:中定义的可见科目 + * + * @param workflowid + * @param fieldId + * @param fieldType 浏览按钮类型 + * @return + */ + public List getWfBrowdefList(String workflowid, String fieldId, String fieldType) { + try { + String sql = ""; + RecordSet rs = new RecordSet(); + List returnList = new ArrayList(); + + sql = "select * from FnaFeetypeWfbrowdef_dt1 where mainid = " + + "(" + + " select id from FnaFeetypeWfbrowdef " + + " where workflowid=" + Util.getIntValue(workflowid) + + " and fieldId=" + Util.getIntValue(fieldId) + + " and fieldType=" + Util.getIntValue(fieldType) + + ") " + + "order by id "; + rs.executeSql(sql); + while (rs.next()) { + returnList.add(Util.null2String(rs.getString("refId"))); + } + return returnList; + } catch (Exception e) { + new BaseBean().writeLog(e); + return null; + } + } + + /** + * Rsa加密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaDecrypt配套使用 + * + * @param str 需要进行加密的明文 + * @return 加密后的字符串密文 + */ + public String doFnaEncrypt(String str) { + return this.doFnaEncrypt(str, Des.KEY1, Des.KEY2, Des.KEY3); + } + + /** + * Rsa加密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaDecrypt配套使用 + * + * @param str 需要进行加密的明文 + * @param key1 Des.KEY1 + * @param key2 Des.KEY2 + * @param key3 Des.KEY3 + * @return 加密后的字符串密文 + */ + public String doFnaEncrypt(String str, String key1, String key2, String key3) { + Des desObj = new Des(); + String pwd_des = desObj.strEnc(str, key1, key2, key3); + + int len = pwd_des.length(); + StringBuffer tmp_pwd_des = new StringBuffer(); + while (len > 100) { + String _s = pwd_des.substring(0, 100); + tmp_pwd_des.append(RSAUtils.encryptString(_s)).append(" "); + pwd_des = pwd_des.substring(100); + len = pwd_des.length(); + } + if (len > 0) { + tmp_pwd_des.append(RSAUtils.encryptString(pwd_des)).append(" "); + } + + return tmp_pwd_des.toString(); + } + + + /** + * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaEncrypt配套使用 + * + * @param str + * @return 解密后的字符串明文 + */ + public String doFnaDecrypt(String str) { + return this.doFnaDecrypt(str, Des.KEY1, Des.KEY2, Des.KEY3); + } + + /** + * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢);与doFnaEncrypt配套使用 + * + * @param str 加密后的字符串密文 + * @param key1 Des.KEY1 + * @param key2 Des.KEY2 + * @param key3 Des.KEY3 + * @return 解密后的字符串明文 + */ + public String doFnaDecrypt(String str, String key1, String key2, String key3) { + StringBuffer descrypedStr = new StringBuffer(""); + String[] encrypedStrArray = str.trim().split(" "); + int encrypedStrArrayLen = encrypedStrArray.length; + + for (int i = 0; i < encrypedStrArrayLen; i++) { + String _str = Util.null2String(encrypedStrArray[i]).trim(); + String _descrypedStr = ""; + if (!"".equals(_str)) { + _descrypedStr = RSAUtils.decryptString(_str); + } + descrypedStr.append(_descrypedStr); + } + + Des desObj = new Des(); + return desObj.strDec(descrypedStr.toString(), key1, key2, key3); + } + + /** + * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢); + * + * @param str + * @return 解密后的字符串明文 + */ + public String doFnaDecrypt1(String str) { + return this.doFnaDecrypt1(str, Des.KEY1, Des.KEY2, Des.KEY3); + } + + /** + * Rsa解密支持中文和长字符(不推荐长字符加密/解密会很慢);配合js加密使用:/fna/js/e8Common_wev8.js中的函数doFnaEncryptRsa1() + * + * @param str /fna/js/e8Common_wev8.js中的函数doFnaEncryptRsa1() 加密后的字符串密文 + * @param key1 Des.KEY1 + * @param key2 Des.KEY2 + * @param key3 Des.KEY3 + * @return 解密后的字符串明文 + */ + public String doFnaDecrypt1(String str, String key1, String key2, String key3) { + StringBuffer descrypedStr = new StringBuffer(""); + String[] encrypedStrArray = str.trim().split(" "); + int encrypedStrArrayLen = encrypedStrArray.length; + + for (int i = 0; i < encrypedStrArrayLen; i++) { + String _str = Util.null2String(encrypedStrArray[i]).trim(); + String _descrypedStr = ""; + if (!"".equals(_str)) { + _descrypedStr = RSAUtils.decryptStringByJs(_str); + } + descrypedStr.append(_descrypedStr); + } + + Des desObj = new Des(); + return desObj.strDec(descrypedStr.toString(), key1, key2, key3); + } + + + /** + * 将Object对象序列化成字符串 + * + * @param obj + * @return + * @throws Exception + */ + public String serialDoc2Str(Object obj) throws Exception { + ByteArrayOutputStream byteArrayOutputStream = null; + ObjectOutputStream objectOutputStream = null; + try { + byteArrayOutputStream = new ByteArrayOutputStream(); + objectOutputStream = new ObjectOutputStream(byteArrayOutputStream); + objectOutputStream.writeObject(obj); + String serStr = byteArrayOutputStream.toString("ISO-8859-1"); + serStr = java.net.URLEncoder.encode(serStr, "UTF-8"); + return serStr; + } finally { + try { + if (objectOutputStream != null) { + IOUtils.closeQuietly(objectOutputStream); + } + } catch (Exception ex) { + } + try { + if (byteArrayOutputStream != null) { + IOUtils.closeQuietly(byteArrayOutputStream); + } + } catch (Exception ex) { + } + } + } + + /** + * 将字符串序列化成Object对象 + * + * @param serStr + * @return + * @throws Exception + */ + public Object serialStr2Doc(String serStr) throws Exception { + ByteArrayInputStream byteArrayInputStream = null; + ObjectInputStream objectInputStream = null; + try { + String redStr = java.net.URLDecoder.decode(serStr, "UTF-8"); + byteArrayInputStream = new ByteArrayInputStream(redStr.getBytes("ISO-8859-1")); + //objectInputStream = new ObjectInputStream(byteArrayInputStream); + objectInputStream = SecurityMethodUtil.getSafeObjectInputStream(byteArrayInputStream); + return (Object) objectInputStream.readObject(); + } finally { + try { + if (objectInputStream != null) { + IOUtils.closeQuietly(objectInputStream); + } + } catch (Exception ex) { + } + try { + if (byteArrayInputStream != null) { + IOUtils.closeQuietly(byteArrayInputStream); + } + } catch (Exception ex) { + } + } + } + + /** + * 释放 系统表单:预算审批流转单 对应的预算审批中版本(从审批中修改为草稿版本,修改成草稿版本前会删除当前的草稿版本) + * + * @param requestid + */ + public void releaseBillFnaBudget(int requestid) { + RecordSet rs_1 = new RecordSet(); + RecordSet rs_2 = new RecordSet(); + RecordSet rs_3 = new RecordSet(); + List budgetid_list = new ArrayList(); + + String sql = "select fnayear,budgetdetail " + + " from bill_FnaBudget " + + " where budgetdetail is not null " + + " and requestid = " + requestid + " " + + " order by id desc"; + rs_1.executeSql(sql); + while (rs_1.next()) { + int fnayear = Util.getIntValue(rs_1.getString("fnayear"));//年份 + int budgetid = Util.getIntValue(rs_1.getString("budgetdetail")); + + //TODO 定位 数据库表名 + String tableName_FnaBudgetInfo = FnaSplitTableByYearComInfo.getFnaTableNameByYear(FnaTableNameEnum.FnaBudgetInfo, fnayear); + + if (budgetid > 0 && !budgetid_list.contains(String.valueOf(tableName_FnaBudgetInfo + "_" + budgetid))) { + budgetid_list.add(String.valueOf(tableName_FnaBudgetInfo + "_" + budgetid));//每张表的ID都是自增长的,所以需要拼接表名区分ID来源 + + String sql0 = "select organizationtype, budgetorganizationid, budgetperiods, status " + + " from " + tableName_FnaBudgetInfo + " " + + " where id=" + budgetid; + rs_2.executeSql(sql0); + if (rs_2.next()) { + int _organizationtype = rs_2.getInt("organizationtype"); + int _budgetorganizationid = rs_2.getInt("budgetorganizationid"); + int _budgetperiods = rs_2.getInt("budgetperiods"); + int _status = rs_2.getInt("status"); + + if (_status == 3) {//只有当当前预算信息版本还是审批中的时候才需要进行后续操作 + if (_organizationtype > 0 && _budgetorganizationid > 0 && _budgetperiods > 0) { + BudgetHandler.deleteFnaBudgetInfoAndFnaBudgetInfoDetail(_organizationtype, _budgetorganizationid, _budgetperiods, 0); + + String sql1 = "update " + tableName_FnaBudgetInfo + " set status = 0, revision = 0 where id=" + budgetid; + rs_3.executeSql(sql1); + } + } + } + } + } + } + + /** + * 生效 系统表单:预算审批流转单 对应的预算审批中版本(从审批中修改为生效版本) + * + * @param requestid + * @throws Exception + */ + public void effectBillFnaBudget(int requestid) throws Exception { + RecordSet rs_1 = new RecordSet(); + //update to new revision + String sql = "select a.id, a.fnayear, a.budgetdetail, b.creater\n" + + " from bill_FnaBudget a\n" + + " join workflow_requestbase b on a.requestid = b.requestid\n" + + " where a.budgetdetail is not null\n" + + " and a.requestid = ? \n" + + " order by a.id desc"; + rs_1.executeQuery(sql, requestid); + if (rs_1.next()) { + int fnayear = Util.getIntValue(rs_1.getString("fnayear"));//年份 + int budgetid = Util.getIntValue(rs_1.getString("budgetdetail")); + int creater = Util.getIntValue(rs_1.getString("creater")); + + if (budgetid > 0) { + RecordSet rs = new RecordSet(); + + //TODO 定位 数据库表名 + String tableName_FnaBudgetInfo = FnaSplitTableByYearComInfo.getFnaTableNameByYear(FnaTableNameEnum.FnaBudgetInfo, fnayear); + + User user = new UserManager().getUserByUserIdAndLoginType(creater, "1"); + + String currentdate = TimeUtil.getCurrentDateString(); + String inusefnabudgetinfoid = ""; + String orgId = "0"; + String orgType = "0"; + int budgetperiods = 0; + + sql = "select budgetorganizationid, organizationtype, budgetperiods, revision, status \n" + + " from " + tableName_FnaBudgetInfo + " a\n" + + " where id = ? \n"; + rs.executeQuery(sql, budgetid); + if (rs.next()) { + orgId = Util.null2String(rs.getString("budgetorganizationid")).trim(); + orgType = Util.null2String(rs.getString("organizationtype")).trim(); + budgetperiods = Util.getIntValue(rs.getString("budgetperiods"), 0); + int revision = Util.getIntValue(rs.getString("revision"), 0); + int _status = rs.getInt("status"); + + if (_status == 3) {//只有当当前预算信息版本还是审批中的时候才需要进行后续操作 + if (revision > 0) { + sql = "select max(revision) max_revision \n" + + " from " + tableName_FnaBudgetInfo + " a\n" + + " where a.status in (1,2) \n" + + " and a.revision < ?\n" + + " and a.organizationtype = ?\n" + + " and a.budgetperiods = ?" + + " and a.budgetorganizationid = ?\n"; + rs.executeQuery(sql, revision, orgType, budgetperiods, orgId); + if (rs.next()) { + revision = Util.getIntValue(rs.getString("max_revision"), 0); + + if (revision > 0) { + sql = "select a.id \n" + + " from " + tableName_FnaBudgetInfo + " a\n" + + " where a.status in (1,2) \n" + + " and a.revision = ?\n" + + " and a.organizationtype = ?\n" + + " and a.budgetperiods = ?\n" + + " and a.budgetorganizationid = ?"; + rs.executeQuery(sql, revision, orgType, budgetperiods, orgId); + if (rs.next()) { + inusefnabudgetinfoid = Util.null2String(rs.getString("id")).trim(); + } + } + } + } + + BudgetApproveWFHandler handler = new BudgetApproveWFHandler(); + handler.changeBudgetRevison(budgetid, 1, budgetperiods); + + BudgetHandler.fnaBudgetInfoReverseInput(1, budgetid + "", inusefnabudgetinfoid, orgId, orgType, budgetperiods, currentdate, user); + } + } + } + } + } + + /** + * 特殊处理(费用流程,在强制归档时,同时,已经配置生效、释放冻结预算)
+ * 145257 解决借款流程强制归档触发action逻辑错误的问题
+ * 1、强制删除、强制收回(收回至)创建节点、强制归档(选择成归档时释放预算)
+ * 系统表单、e7方式配置的费用流程、e8方式配置的费用流程(借款、还款、报销):释放借款、释放预算
+ * 2、强制归档(选择成归档时生效预算)
+ * 1)系统表单、e7方式配置的费用流程:生效审批中的费用,如果流程没有审批中费用,则不产生已发送费用
+ * 2)e8方式配置的费用流程(借款、还款、报销):
+ * 借款:流程节点中有配置过action.FnaBorrowEffectNew,则会产生借款(重新生成数据)
+ * 还款:流程节点中有配置过action.fnaBorrowReverseNew,则会产生还款(重新生成数据)
+ * 报销:
+ * 流程节点中有配置过action.fnaBorrowReverseNew,则会产生还款(重新生成数据)
+ * 流程节点中有配置过action.WorkflowFnaInWorkflowNew,则会产生审批中预算(重新生成数据)
+ * 流程节点中有配置过action.WorkflowFnaEffectNew,则会产生已发送预算(生效审批中数据)
+ * 流程节点中有配置过action.FnaChangeEffectNew,则会生效变更
+ * 流程节点中有配置过action.FnaShareEffectNew,则会生效分摊
+ * 系统表单:预算审批流转单 生效释放操作 + * + * @param requestid 流程requestid + * @param wfForceOverLogic 该参数的业务逻辑只有当流程处于归档节点才生效; 0:走删除逻辑;1:走生效逻辑; + * @param forceDelete true:无视流程所处节点,无视流程是否已经被删除,强制走删除逻辑(无视参数:wfForceOverLogic); + */ + public void doWfForceOver(int requestid, int wfForceOverLogic, boolean forceDelete) { +// new BaseBean().writeLog("doWfForceOver requestid="+requestid+";wfForceOverLogic="+wfForceOverLogic+";forceDelete="+forceDelete+";"); + RecordSet rs_1 = new RecordSet(); + + int currentnodetype = -1; + if (forceDelete) { + } else { + String fnasql = "select currentnodetype from workflow_requestbase where requestid = " + requestid; + rs_1.executeSql(fnasql); + if (rs_1.next()) { + currentnodetype = rs_1.getInt("currentnodetype"); + } + } + + //流程退回创建节点或者删除流程 + if (currentnodetype == 0 || (forceDelete && wfForceOverLogic == 0)) { + try { + //初始化发票状态 + FnaInvoiceCommon fnaInvoiceCommon = new FnaInvoiceCommon(); + fnaInvoiceCommon.doWfForceOver(requestid); + } catch (Exception ex1) { + } + } + + if (currentnodetype == 3 || (forceDelete && wfForceOverLogic == 0)) { + if (wfForceOverLogic == 0) { + try { + //多维度上报,将当前审批流程中关联的C节点的状态修改成【草稿】,更新填报主表中的审批流程requestid为0 + TemplateFillReportBizNew ReportBiz = new TemplateFillReportBizNew(); + ReportBiz.updateStatusAndRequestid(requestid); + } catch (Exception ex1) { + } + try { + FnaAdvanceAmountControl fnaAdvanceAmountControl = new FnaAdvanceAmountControl(); + fnaAdvanceAmountControl.delFnaAdvanceInfoHaveLog(requestid); + } catch (Exception ex1) { + } + try { + FnaBorrowAmountControl fnaBorrowAmountControl = new FnaBorrowAmountControl(); + fnaBorrowAmountControl.delFnaBorrowInfoHaveLog(requestid); + } catch (Exception ex1) { + } + try { + FnaAmountControl fnaAmountControl = new FnaAmountControl(); + fnaAmountControl.delFnaExpenseInfo(requestid); + } catch (Exception ex1) { + } + try { + FnaChangeAmountControl control = new FnaChangeAmountControl(); + control.delFnaExpenseInfo(requestid); + } catch (Exception ex1) { + } + try { + FnaShareAmountControl control = new FnaShareAmountControl(); + control.delFnaExpenseInfo(requestid); + } catch (Exception ex1) { + } + try { + this.releaseBillFnaBudget(requestid); + } catch (Exception ex1) { + } + + try { + //释放(全面预算) + FnaReleaseBudget fnaReleaseBudget = new FnaReleaseBudget(); + fnaReleaseBudget.releaseBudget(requestid); + } catch (Exception ex1) { + } + try { + //还原预算填报的变更流程数据 + new BaseBean().writeLog("doWfForceOver1111111111111111111111111111111111111111111111"); + FnaReimbursementUtils fnaReimbursementUtils = new FnaReimbursementUtils(); + fnaReimbursementUtils.delOldRequestEffectChangData(requestid); + } catch (Exception ex1) { + } + } else if (wfForceOverLogic == 1) { + String fnaWfType = ""; + boolean fnaWfTypeEnable = false; + rs_1.executeSql("select b.fnaWfType, b.enable " + + " from workflow_requestbase a " + + " join fnaFeeWfInfo b on a.workflowid = b.workflowid " + + " where a.requestid = " + requestid); + if (rs_1.next()) { + fnaWfType = Util.null2String(rs_1.getString("fnaWfType")).trim(); + fnaWfTypeEnable = (rs_1.getInt("enable") == 1); + } + + int formid = 0; + int _workflowid = 0; + rs_1.executeSql("select a.workflowid, b.formid " + + " from workflow_requestbase a " + + " join workflow_base b on a.workflowid = b.id " + + " where a.requestid = " + requestid); + if (rs_1.next()) { + _workflowid = rs_1.getInt("workflowid"); + formid = rs_1.getInt("formid"); + } + + if (!"".equals(fnaWfType)) {//是e8后台配置的某一类费用流程 + if (fnaWfTypeEnable) {//启用了的费用流程 + if ("advance".equals(fnaWfType)) {//是e8后台配置的预付款流程 + RequestService requestService = new RequestService(); + + //扣除-节点前附加操作 + String deductAdvanceNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductAdvanceNode1Ids"); + //扣除-节点后附加操作 + String deductAdvanceNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductAdvanceNode2Ids"); + //扣除-出口附加操作 + String deductAdvanceNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductAdvanceNode3Ids"); + //配置了生成借款的action(FnaAdvanceEffectNew) + if (!"".equals(deductAdvanceNode1Ids) || !"".equals(deductAdvanceNode2Ids) || !"".equals(deductAdvanceNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaAdvanceEffectNew fnaAdvanceEffectNew = new FnaAdvanceEffectNew(); + fnaAdvanceEffectNew.execute(requestInfo); + } + + } else if ("borrow".equals(fnaWfType)) {//是e8后台配置的借款流程 + RequestService requestService = new RequestService(); + + //扣除-节点前附加操作 + String deductBorrowNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductBorrowNode1Ids"); + //扣除-节点后附加操作 + String deductBorrowNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductBorrowNode2Ids"); + //扣除-出口附加操作 + String deductBorrowNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductBorrowNode3Ids"); + //配置了生成借款的action(FnaBorrowEffectNew) + if (!"".equals(deductBorrowNode1Ids) || !"".equals(deductBorrowNode2Ids) || !"".equals(deductBorrowNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaBorrowEffectNew fnaBorrowEffectNew = new FnaBorrowEffectNew(); + fnaBorrowEffectNew.execute(requestInfo); + } + + } else if ("repayment".equals(fnaWfType)) {//是e8后台配置的还款流程 + RequestService requestService = new RequestService(); + + //冲销借款-节点前附加操作 + String repaymentBorrowNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode1Ids"); + //冲销借款-节点后附加操作 + String repaymentBorrowNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode2Ids"); + //冲销借款-出口附加操作 + String repaymentBorrowNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode3Ids"); + //配置了冲销借款的action(FnaBorrowReverseNew) + if (!"".equals(repaymentBorrowNode1Ids) || !"".equals(repaymentBorrowNode2Ids) || !"".equals(repaymentBorrowNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaBorrowReverseNew fnaBorrowReverseNew = new FnaBorrowReverseNew(); + fnaBorrowReverseNew.execute(requestInfo); + } + + } else if ("fnaFeeWf".equals(fnaWfType)) {//是e8后台配置的报销流程 + RequestService requestService = new RequestService(); + + //冲销借款-节点前附加操作 + String repaymentBorrowNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode1Ids"); + //冲销借款-节点后附加操作 + String repaymentBorrowNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode2Ids"); + //冲销借款-出口附加操作 + String repaymentBorrowNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentBorrowNode3Ids"); + //配置了冲销借款的action(fnaBorrowReverseNew) + if (!"".equals(repaymentBorrowNode1Ids) || !"".equals(repaymentBorrowNode2Ids) || !"".equals(repaymentBorrowNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaBorrowReverseNew fnaBorrowReverseNew = new FnaBorrowReverseNew(); + fnaBorrowReverseNew.execute(requestInfo); + } + + //冻结-节点前附加操作 + String frozeNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "frozeNode1Ids"); + //冻结-节点后附加操作 + String frozeNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "frozeNode2Ids"); + //冻结-出口附加操作 + String frozeNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "frozeNode3Ids"); + + //配置了冻结预算的action(workflowFnaInWorkflowNew) + if ((!"".equals(frozeNode1Ids) || !"".equals(frozeNode2Ids) || !"".equals(frozeNode3Ids))) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + WorkflowFnaInWorkflowNew workflowFnaInWorkflowNew = new WorkflowFnaInWorkflowNew(); + workflowFnaInWorkflowNew.execute(requestInfo); + } + + //扣除-节点前附加操作 + String deductNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductNode1Ids"); + //扣除-节点后附加操作 + String deductNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductNode2Ids"); + //扣除-出口附加操作 + String deductNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "deductNode3Ids"); + + //配置了扣除预算的action(WorkflowFnaEffectNew) + if (!"".equals(deductNode1Ids) || !"".equals(deductNode2Ids) || !"".equals(deductNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + WorkflowFnaEffectNew workflowFnaEffectNew = new WorkflowFnaEffectNew(); + workflowFnaEffectNew.execute(requestInfo); + } + + + //扣除-节点前附加操作 + String repaymentAdvanceNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentAdvanceNode1Ids"); + //扣除-节点后附加操作 + String repaymentAdvanceNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentAdvanceNode2Ids"); + //扣除-出口附加操作 + String repaymentAdvanceNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "repaymentAdvanceNode3Ids"); + + //配置了冲销预付款的action(FnaAdvanceReverseNew) + if (!"".equals(repaymentAdvanceNode1Ids) || !"".equals(repaymentAdvanceNode2Ids) || !"".equals(repaymentAdvanceNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaAdvanceReverseNew fnaAdvanceReverseNew = new FnaAdvanceReverseNew(); + fnaAdvanceReverseNew.execute(requestInfo); + } + + } else if ("change".equals(fnaWfType)) {//是e8后台配置的预算变更流程 + RequestService requestService = new RequestService(); + + String effectChangeNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectChangeNode1Ids"); + String effectChangeNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectChangeNode2Ids"); + String effectChangeNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectChangeNode3Ids"); + if (!"".equals(effectChangeNode1Ids) || !"".equals(effectChangeNode2Ids) || !"".equals(effectChangeNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaChangeEffectNew fnaChangeEffectNew = new FnaChangeEffectNew(); + fnaChangeEffectNew.execute(requestInfo); + } + + } else if ("share".equals(fnaWfType)) {//是e8后台配置的费用分摊流程 + RequestService requestService = new RequestService(); + + String effectShareNode1Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectShareNode1Ids"); + String effectShareNode2Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectShareNode2Ids"); + String effectShareNode3Ids = FnaWfSet.getActionSet4Wf(_workflowid, "effectShareNode3Ids"); + if (!"".equals(effectShareNode1Ids) || !"".equals(effectShareNode2Ids) || !"".equals(effectShareNode3Ids)) { + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setSrc("submit"); + requestInfo.getRequestManager().setFormid(formid); + FnaShareEffectNew fnaShareEffectNew = new FnaShareEffectNew(); + fnaShareEffectNew.execute(requestInfo); + } + + } + } + } else {//其他不是e8后台配置的费用流程统一处理,只将当前流程插入费用表的费用数据置为已发送状态,如果当前流程没有往费用表写如果费用数据,则什么都不做 + + //定位 数据库表名, 日期范围可能跨年 + List list_out_FnaExpenseInfo = new ArrayList(); + FnaSplitTableByYearComInfo.getFnaTableNameList(FnaTableNameEnum.FnaExpenseInfo, "1000-01-01", "9999-12-31", list_out_FnaExpenseInfo); + //定位 数据库表名, 日期范围可能跨年 + for (int aaaaaaaa = 0; aaaaaaaa < list_out_FnaExpenseInfo.size(); aaaaaaaa++) { + String tableName_FnaExpenseInfo = list_out_FnaExpenseInfo.get(aaaaaaaa); + + rs_1.executeSql("update " + tableName_FnaExpenseInfo + " set status=1 where requestid=" + requestid); + }//for end + } + + try { + this.effectBillFnaBudget(requestid); + } catch (Exception ex1) { + } + + //生效(全面预算) + try { + String frozeNode1Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulFrozeNode1Ids"); + String frozeNode2Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulFrozeNode2Ids"); + String frozeNode3Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulFrozeNode3Ids"); + + String deductNode1Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulDeductNode1Ids"); + String deductNode2Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulDeductNode2Ids"); + String deductNode3Ids = FnaWorkflowUtil.getActionSet4MulWf(_workflowid, "mulDeductNode3Ids"); + + + boolean hasFroze = (!"".equals(frozeNode1Ids) || !"".equals(frozeNode2Ids) || !"".equals(frozeNode3Ids)); + boolean hasDeduct = (!"".equals(deductNode1Ids) || !"".equals(deductNode2Ids) || !"".equals(deductNode3Ids)); + + if (hasFroze || hasDeduct) { + FnaFreezeBudget fnaFreezeBudget = new FnaFreezeBudget(); + if (hasDeduct) { + fnaFreezeBudget.setDeductAction(Boolean.TRUE); + } + + RequestService requestService = new RequestService(); + RequestInfo requestInfo = requestService.getRequest(requestid); + requestInfo.getRequestManager().setWorkflowid(_workflowid); + requestInfo.getRequestManager().setFormid(formid); + requestInfo.getRequestManager().setSrc("submit"); + User user = new User(1); + user.setLanguage(7); + requestInfo.getRequestManager().setUser(user); + fnaFreezeBudget.execute(requestInfo); + } + } catch (Exception ex1) { + } + } + } + } + + /** + * 获得有权限查看的流程的过滤条件的sql + * + * @param user + * @param tableAliasNameForRequestId + * @param tableAliasNameForWorkflowId + * @return + */ + public static String getCanQueryRequestSqlCondition(User user, + String tableAliasNameForRequestId, String tableAliasNameForWorkflowId) { + int userID = user.getUID(); + String usertype = "0"; + + if (user.getLogintype().equals("2")) { + usertype = "1"; + } + + return getCanQueryRequestSqlCondition(userID, usertype, tableAliasNameForRequestId, tableAliasNameForWorkflowId); + } + + /** + * 获得有权限查看的流程的过滤条件的sql + * + * @param userID + * @param usertype + * @param tableAliasNameForRequestId + * @param tableAliasNameForWorkflowId + * @return + */ + public static String getCanQueryRequestSqlCondition(int userID, String usertype, + String tableAliasNameForRequestId, String tableAliasNameForWorkflowId) { + StringBuffer sqlwhere = new StringBuffer(); + sqlwhere.append(" and exists (select 1 from workflow_currentoperator b,workflow_base c where b.requestid = " + tableAliasNameForRequestId + ".requestid "); + sqlwhere.append(" and b.userid in (" + userID); + sqlwhere.append(" )and b.usertype=" + usertype + + " and " + tableAliasNameForWorkflowId + ".workflowid = c.id" + + " and c.isvalid in (1,3) and (c.istemplate is null or c.istemplate<>'1'))"); + sqlwhere.append(" "); + return sqlwhere.toString(); + } + + /** + * 获取生成选择借款流程借款明细的按钮 + * + * @param jklc 无用 + * @param spanValue 默认显示内容 + * @param fieldid 字段id + * @param derecorderindex 明细行行号 + * @param finCss 显示内容css样式 + * @param ismand 是否可编辑:1是;其他否; + * @return + */ + public static String getBtnRequestDtlBrowser(int jklc, String spanValue, int fieldid, + String derecorderindex, String finCss, int ismand) { + if (ismand == 1 && Util.getIntValue(spanValue) <= 0) { + spanValue = ""; + } + String spanStr = "" + spanValue + ""; + String inputStr = spanStr + "
" + + "" + + "" + + "" + + "" + + "" + + "
"; + return inputStr; + } + + /** + * 获取生成选择预付款流程预付款明细的按钮 + * + * @param jklc 无用 + * @param spanValue 默认显示内容 + * @param fieldid 字段id + * @param derecorderindex 明细行行号 + * @param finCss 显示内容css样式 + * @param ismand 是否可编辑:1是;其他否; + * @return + */ + public static String getBtnAdvanceRequestDtlBrowser(int jklc, String spanValue, int fieldid, + String derecorderindex, String finCss, int ismand) { + if (ismand == 1 && Util.getIntValue(spanValue) <= 0) { + spanValue = ""; + } + String spanStr = "" + spanValue + ""; + String inputStr = spanStr + "
" + + "" + + "" + + "" + + "" + + "" + + "
"; + return inputStr; + } + + /** + * 获取生成查看借还款金额修改历史的按钮 + * + * @param fieldid 字段id + * @param derecorderindex 明细行行号 + * @param languageId 当前登录用户所用语言标识 + * @param detailRecordId 字段所在明细表序号 + * @return + */ + public static String getBtnTzmx(int fieldid, String derecorderindex, int languageId, int detailRecordId) { + String inputStr = ""; + return inputStr; + } + + /** + * 获取生成查看预付款金额修改历史的按钮 + * + * @param fieldid 字段id + * @param derecorderindex 明细行行号 + * @param languageId 当前登录用户所用语言标识 + * @param detailRecordId 字段所在明细表序号 + * @return + */ + public static String getBtnTzmxAdvance(int fieldid, String derecorderindex, int languageId, int detailRecordId) { + String inputStr = ""; + return inputStr; + } + + /** + * 获取生成查询相关还款流程的按钮 + * + * @param fieldid 字段id + * @param derecorderindex 明细行行号 + * @param languageId 当前登录用户所用语言标识 + * @param detailRecordId 字段所在明细表序号 + * @return + */ + public static String getBtnXghklc(int fieldid, String derecorderindex, int languageId, int detailRecordId) { + String inputStr = ""; + return inputStr; + } + + /** + * 检查指定流程指定字段是否是指定类型的预算类流程字段 + * + * @param workflowid 流程wfid + * @param fieldId 字段id + * @param fieldType 字段类型 + * @param dtlNumber 明细表序号 + * @param fnaWfType 预算类流程类型 + * @return + */ + public static boolean checkFnaWfFieldFnaType(int workflowid, int fieldId, int fieldType, int dtlNumber, String fnaWfType) { + RecordSet rs_fna = new RecordSet(); + + String sql = "select count(*) cnt from fnaFeeWfInfoField a join fnaFeeWfInfo b on b.id = a.MAINID \n" + + " where a.DTLNUMBER = " + dtlNumber + " and a.fieldType = " + fieldType + " and a.fieldId = " + fieldId + " " + + " and b.FNAWFTYPE = '" + StringEscapeUtils.escapeSql(fnaWfType) + "' and a.workflowid = " + workflowid; + rs_fna.executeSql(sql); + if (rs_fna.next() && rs_fna.getInt("cnt") > 0) { + return true; + } + + return false; + } + + /** + * 获取相关还款流程配置信息 + * + * @param _workflowid + * @return 是否是借款费控流程:key:isEnableFnaRepaymentWf;value:true、false;
+ * 流程表单id:key:formId;value:表单id;
+ * 流程是否新表单:key:isbill;value:0、1; + */ + public static HashMap getIsEnableFnaRepaymentWfHm(int _workflowid) { + BaseBean _bb = new BaseBean(); + RecordSet rs_fna = new RecordSet(); + + HashMap retHm = new HashMap(); + + //是否是系统表单的费控流程 + int _formId = 0; + int _isbill = -1; + String sqlFna1 = "select a.formid, a.isbill from workflow_base a where a.id = " + _workflowid; + rs_fna.executeSql(sqlFna1); + if (rs_fna.next()) { + _formId = Util.getIntValue(rs_fna.getString("formid"), 0); + _isbill = Util.getIntValue(rs_fna.getString("isbill"), 0); + } + retHm.put("formId", _formId + ""); + retHm.put("isbill", _isbill + ""); + + //是否是启用的Ecology8还款费控流程 + retHm.put("isEnableFnaRepaymentWf", "false"); + String sqlFnaWfSet = "select a.enable from fnaFeeWfInfo a where a.fnaWfType = 'repayment' and a.workflowid = " + _workflowid; + rs_fna.executeSql(sqlFnaWfSet); + if (rs_fna.next()) { + if (rs_fna.getInt("enable") == 1) { + retHm.put("isEnableFnaRepaymentWf", "true"); + } + } + + return retHm; + } + + /** + * 获取相关借款流程配置信息 + * + * @param _workflowid + * @return 是否是借款费控流程:key:isEnableFnaBorrowWf;value:true、false;
+ * 流程表单id:key:formId;value:表单id;
+ * 流程是否新表单:key:isbill;value:0、1; + */ + public static HashMap getIsEnableFnaBorrowWfHm(int _workflowid) { + BaseBean _bb = new BaseBean(); + RecordSet rs_fna = new RecordSet(); + + HashMap retHm = new HashMap(); + + //是否是系统表单的费控流程 + int _formId = 0; + int _isbill = -1; + String sqlFna1 = "select a.formid, a.isbill from workflow_base a where a.id = " + _workflowid; + rs_fna.executeSql(sqlFna1); + if (rs_fna.next()) { + _formId = Util.getIntValue(rs_fna.getString("formid"), 0); + _isbill = Util.getIntValue(rs_fna.getString("isbill"), 0); + } + retHm.put("formId", _formId + ""); + retHm.put("isbill", _isbill + ""); + + //是否是启用的Ecology8借款费控流程 + retHm.put("isEnableFnaBorrowWf", "false"); + String sqlFnaWfSet = "select a.enable from fnaFeeWfInfo a where a.fnaWfType = 'borrow' and a.workflowid = " + _workflowid; + rs_fna.executeSql(sqlFnaWfSet); + if (rs_fna.next()) { + if (rs_fna.getInt("enable") == 1) { + retHm.put("isEnableFnaBorrowWf", "true"); + } + } + + return retHm; + } + + /** + * 拆封in中的值的长度,防止超过999调后sql执行报错 + * + * @param condStr 完整的值 + * @param splitNumber 拆分长度 + * @param chr1 ,号 + * @param df 如果值是字符串则传入null + * @return + */ + public static List splitToListForSqlCond(String condStr, int splitNumber, String chr1, DecimalFormat df) { + List condList = new ArrayList(); + + String[] _reqIdArray = condStr.split(","); + int _reqIdArrayLen = _reqIdArray.length; + int _reqIdArrayIndex = 0; + while (_reqIdArrayIndex < _reqIdArrayLen) { + StringBuffer _reqIdArrayCond = new StringBuffer(""); + for (int i = 0; i < splitNumber; i++) { + if (_reqIdArrayIndex == _reqIdArrayLen) { + break; + } + if (_reqIdArrayCond.length() > 0) { + _reqIdArrayCond.append(chr1); + } + String _key = _reqIdArray[_reqIdArrayIndex]; + if (df == null) { + _reqIdArrayCond.append("'" + StringEscapeUtils.escapeSql(_key) + "'"); + } else { + _reqIdArrayCond.append(df.format(Util.getDoubleValue(_key, 0))); + } + _reqIdArrayIndex++; + } + + condList.add(_reqIdArrayCond.toString()); + } + + return condList; + } + + /** + * 获取报销单位浏览按钮类型,依据报销类型 + * + * @param fieldid 字段id + * @param oldBtnType 转义前对应的承担主体流程表单字段的字段的浏览按钮类型 + * @param detailRecordId 明细表数据库记录id值 + * @param requestId 流程reqid + * @param fnaWfSetMap 预算流程字段对应关系hm对象 + * @param reqDataMap 流程数据hm对象 + * @param languageId 当前登录人员语言标识 + * @param otherPara_hs 调用该函数的流程方法内有一个同名变量 + * @param otherReturnVal 返回值hm对象 + * @return 转义后对应的承担主体流程表单字段的字段的浏览按钮类型 + */ + public static int getOrgBtnTypeByFnaFieldType(int fieldid, int oldBtnType, int detailRecordId, int requestId, + Map fnaWfSetMap, HashMap> reqDataMap, + int languageId, + Hashtable otherPara_hs, HashMap otherReturnVal) { + return FnaCommon.getOrgBtnTypeByFnaFieldType(fieldid, oldBtnType, detailRecordId + "", requestId, + fnaWfSetMap, reqDataMap, + languageId, + otherPara_hs, otherReturnVal); + } + + /** + * 依据承担主体类型获取承担主体名称 + * + * @param oldOrgName 转义前的承担主体名称 + * @param _detailFieldId 字段id + * @param requestid 流程reqid + * @param rowIdx 明细行行号 + * @param fnaWfType 财务类流程类型标识 + * @param fnaWfSetMap 预算流程字段对应关系hm对象 + * @param reqDataMap 流程数据hm对象 + * @param otherPara_hs 调用该函数的流程方法内有一个同名变量 + * @param language 当前登录人员语言标识 + * @param rci 人员缓存类对象 + * @param dci 部门缓存类对象 + * @param scci 分部缓存类对象 + * @param fccListHm 成本中心缓存对象 + * @return 转义后的承担主体名称 + */ + public static String getOrgNameByOrgType(String oldOrgName, int _detailFieldId, int requestid, int rowIdx, + String fnaWfType, HashMap fnaWfSetMap, HashMap> reqDataMap, Hashtable otherPara_hs, + int language, ResourceComInfo rci, DepartmentComInfo dci, SubCompanyComInfo scci, HashMap> fccListHm) { + if ("fnaFeeWf".equals(fnaWfType) || "change".equals(fnaWfType) || "share".equals(fnaWfType)) {//报销流程;预算变更;费用分摊; + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(_detailFieldId + "")) || "fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(_detailFieldId + ""))) { + FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo(); + int wfDtlImpRole4Fcc = Util.getIntValue(fnaSystemSetComInfo.get_wfDtlImpRole4Fcc(), 0);//成本中心字段流程明细导入规则 + + int oldBtnType = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgId_type")); + String detailRecordKey = "key_idx>>" + rowIdx; + HashMap otherReturnVal = new HashMap(); + int newBtnType = FnaCommon.getOrgBtnTypeByFnaFieldType(_detailFieldId, oldBtnType, detailRecordKey, requestid, + fnaWfSetMap, reqDataMap, + language, + otherPara_hs, otherReturnVal); + HashMap reqOneRowDataMap = reqDataMap.get(detailRecordKey); + int _organizationid_value = 0; + if (reqOneRowDataMap != null) { + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(_detailFieldId + ""))) { + _organizationid_value = Util.getIntValue(reqOneRowDataMap.get("organizationid"), -1); + } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(_detailFieldId + ""))) { + _organizationid_value = Util.getIntValue(reqOneRowDataMap.get("organizationid2"), -1); + } + } + if (newBtnType != oldBtnType && _organizationid_value > 0) { + String newOrgName = oldOrgName; + if (newBtnType == 1) {//个人 + newOrgName = Util.null2String(rci.getLastname(_organizationid_value + "")); + } else if (newBtnType == 4) {//部门 + newOrgName = Util.null2String(dci.getDepartmentname(_organizationid_value + "")); + } else if (newBtnType == 164) {//分部 + newOrgName = Util.null2String(scci.getSubCompanyname(_organizationid_value + "")); + } else if (newBtnType == 251) {//成本中心 + HashMap fccHm = fccListHm.get(_organizationid_value + ""); + if (fccHm != null) { + if (wfDtlImpRole4Fcc == 1) { + newOrgName = Util.null2String(fccHm.get("code")).trim(); + } else if (wfDtlImpRole4Fcc == 2) { //成本中心全路径名称 + newOrgName = RequestDetailImportUtil.getCostCenterFullName(_organizationid_value + ""); + } else { + newOrgName = Util.null2String(fccHm.get("name")).trim(); + } + } else { + newOrgName = ""; + } + } + oldOrgName = newOrgName; + } + } + } + return oldOrgName; + } + + /** + * 依据流程选择框的名称,获取选择框的值,并依据选择框的值,返回对应的承担主体浏览按钮的类型 + * + * @param oldBtnType 转义前对应的承担主体流程表单字段的字段的浏览按钮类型 + * @param orgIdFieldId 承担主体浏览按钮的fieldid + * @param orgTypeFieldId 承担主体类型按钮的fieldid + * @param orgTypeSelectName 承担主体类型选择框选择的名称 + * @param requestid 流程reqid + * @param language 当前登录人员语言标识 + * @param fnaWfSetMap 预算流程字段对应关系hm对象 + * @param reqDataMap 流程数据hm对象 + * @param otherPara_hs 调用该函数的流程方法内有一个同名变量 + * @return 转义后对应的承担主体流程表单字段的字段的浏览按钮类型 + */ + public static int getOrgSelectValueByOrgTypeSelectName(int oldBtnType, int orgIdFieldId, int orgTypeFieldId, String orgTypeSelectName, + int requestid, int language, + HashMap fnaWfSetMap, HashMap> reqDataMap, Hashtable otherPara_hs) { + RecordSet rs_fna = new RecordSet(); + + String languageIdStr = ""; + if (language > 9) { + languageIdStr = language + ""; + } else { + languageIdStr = language + " "; + } + + int newBtnType = oldBtnType; + int selectvalue = -1; + String _sql = "select a.selectvalue \n" + + " from workflow_SelectItem a \n" + + " where 1=1 and (a.cancel is null or a.cancel = 0) " + + " and (a.selectname like '%`~`" + languageIdStr + StringEscapeUtils.escapeSql(orgTypeSelectName) + "`~`%' or a.selectname = '" + StringEscapeUtils.escapeSql(orgTypeSelectName) + "') \n" + + " and a.fieldid = " + orgTypeFieldId + + " order by a.listorder asc"; + rs_fna.executeSql(_sql); + if (rs_fna.next()) { + selectvalue = rs_fna.getInt("selectvalue"); + } + if (selectvalue == 0) { + newBtnType = 1; + } else if (selectvalue == 1) { + newBtnType = 4; + } else if (selectvalue == 2) { + newBtnType = 164; + } else if (selectvalue == 3) { + newBtnType = 251; + } else { + int detailRecordId = 0; + HashMap otherReturnVal = new HashMap(); + newBtnType = FnaCommon.getOrgBtnTypeByFnaFieldType(orgIdFieldId, oldBtnType, detailRecordId, requestid, + fnaWfSetMap, reqDataMap, + language, + otherPara_hs, otherReturnVal); + } + return newBtnType; + } + + /** + * 获取报销单位浏览按钮类型,依据报销类型 + * + * @param fieldid + * @param oldBtnType + * @param detailRecordKey + * @param requestId + * @param fnaWfSetMap + * @param reqDataMap + * @param languageId + * @param otherPara_hs + * @param otherReturnVal + * @return + */ + public static int getOrgBtnTypeByFnaFieldType(int fieldid, int oldBtnType, String detailRecordKey, int requestId, + Map fnaWfSetMap, HashMap> reqDataMap, + int languageId, + Hashtable otherPara_hs, HashMap otherReturnVal) { + BaseBean _bb = new BaseBean(); + RecordSet rs_fna = new RecordSet(); + detailRecordKey = Util.null2String(detailRecordKey).trim(); + +// _bb.writeLog("getOrgBtnTypeByFnaFieldType"); + + WFLayoutToHtml wfLayoutToHtml = new WFLayoutToHtml(); + + int fieldid_tmp = Util.getIntValue((String) otherPara_hs.get("fieldid_tmp")); + int fieldhtmltype_tmp = Util.getIntValue((String) otherPara_hs.get("fieldhtmltype_tmp")); + int type_tmp = Util.getIntValue((String) otherPara_hs.get("type_tmp")); + + Hashtable inoperatefield_hs = (Hashtable) otherPara_hs.get("inoperatefield_hs"); + if (inoperatefield_hs == null) { + inoperatefield_hs = new Hashtable(); + } + Hashtable fieldvalue_hs = (Hashtable) otherPara_hs.get("fieldvalue_hs"); + if (fieldvalue_hs == null) { + fieldvalue_hs = new Hashtable(); + } + Map fieldMap = (Map) otherPara_hs.get("fieldMap"); + if (fieldMap == null) { + fieldMap = new HashMap(); + } + + ResourceComInfo resourceComInfo = (ResourceComInfo) otherPara_hs.get("resourceComInfo"); + if (resourceComInfo == null) { + try { + resourceComInfo = new ResourceComInfo(); + } catch (Exception e) { + _bb.writeLog(e); + } + } + + String prjid = Util.null2String((String) otherPara_hs.get("prjid")).trim(); + String docid = Util.null2String((String) otherPara_hs.get("docid")).trim(); + String dt_beagenter = Util.null2String((String) otherPara_hs.get("dt_beagenter")).trim(); + String hrmid = Util.null2String((String) otherPara_hs.get("hrmid")).trim(); + int body_isagent = Util.getIntValue((String) otherPara_hs.get("body_isagent")); + int agenttype = Util.getIntValue((String) otherPara_hs.get("agenttype")); + + String crmid = Util.null2String((String) otherPara_hs.get("crmid")).trim(); + String reqid = Util.null2String((String) otherPara_hs.get("reqid")).trim(); + + int organizationtype = -1; + + boolean _isDbDataFlag = false; + + HashMap reqOneRowDataMap = null; +// new BaseBean().writeLog("reqDataMap="+reqDataMap+";requestId="+requestId+";"); + if (reqDataMap != null && requestId > 0) { + String fieldIdSubject_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdSubject_fieldId_isDtl")); + String fieldIdOrgType_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgType_fieldId_isDtl")); + String fieldIdOrgId_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgId_fieldId_isDtl")); + String fieldIdOccurdate_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOccurdate_fieldId_isDtl")); + + //报销明细中是否包含了明细表字段 + boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); +// new BaseBean().writeLog("fieldIdSubject_isDtl="+fieldIdSubject_isDtl+";"); +// new BaseBean().writeLog("fieldIdOrgType_isDtl="+fieldIdOrgType_isDtl+";"); +// new BaseBean().writeLog("***************fieldIdOrgId_isDtl="+fieldIdOrgId_isDtl+";"); +// new BaseBean().writeLog("fieldIdOccurdate_isDtl="+fieldIdOccurdate_isDtl+";"); +// new BaseBean().writeLog("***************dt1_haveIsDtlField="+dt1_haveIsDtlField+";"); + + if (!"1".equals(fieldIdOrgId_isDtl) && dt1_haveIsDtlField) {//承担主体是主表,但是,有其他字段是明细表时,随便取reqDataMap中的一个值中即可 +// new BaseBean().writeLog("reqDataMap="+reqDataMap+";"); + Iterator iter = reqDataMap.entrySet().iterator(); +// new BaseBean().writeLog("iter="+iter+";"); + if (iter.hasNext()) { + Map.Entry entry = (Map.Entry) iter.next(); +// new BaseBean().writeLog("entry="+entry+";"); + reqOneRowDataMap = (HashMap) entry.getValue(); +// new BaseBean().writeLog("1 reqOneRowDataMap="+reqOneRowDataMap+";"); + } + } else if ((!"".equals(detailRecordKey) && detailRecordKey.startsWith("key_idx>>")) || Util.getIntValue(detailRecordKey) > 0) {//先检查是否是来自明细,如果是来自明细则使用明细id获取数据 + reqOneRowDataMap = reqDataMap.get(detailRecordKey + ""); + } else if (requestId > 0) {//如果不是来自明细则使用主表requestid来获取数据 + reqOneRowDataMap = reqDataMap.get(requestId + ""); + } + } +// new BaseBean().writeLog("f reqOneRowDataMap="+reqOneRowDataMap+";"); + + if (reqOneRowDataMap == null) {//数据库里面没有记录 +// fnaWfSetMap +// requestId +// detailRecordKey + + String formid = Util.null2String(fnaWfSetMap.get("formid")); + int formidABS = Math.abs(Util.getIntValue(formid, 0)); + if (formidABS > 0) { + String fieldIdOrgType_fieldName = ""; + String fieldIdOrgType_fieldId_isDtl = ""; + + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + fieldIdOrgType_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdOrgType_fieldName")).trim(); + fieldIdOrgType_fieldId_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgType_fieldId_isDtl")).trim(); + } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + fieldIdOrgType_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdOrgType2_fieldName")).trim(); + fieldIdOrgType_fieldId_isDtl = Util.null2String(fnaWfSetMap.get("fieldIdOrgType2_fieldId_isDtl")).trim(); + } + + if (!"".equals(fieldIdOrgType_fieldName)) { + StringBuffer sqlQry = new StringBuffer(); + sqlQry.append("select t.").append(fieldIdOrgType_fieldName).append(" orgType "); + + sqlQry.append(" from "); + if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { + sqlQry.append(" formtable_main_").append(formidABS).append(" t "); + } else { + sqlQry.append(" formtable_main_").append(formidABS).append(" main "); + sqlQry.append(" join ").append("formtable_main_").append(formidABS).append("_dt1 t on main.id = t.mainid "); + } + + sqlQry.append(" where 1=1 "); + + if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { + } else { + sqlQry.append(" and t.id=? "); + } + + sqlQry.append(" and "); + if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { + sqlQry.append("t."); + } else { + sqlQry.append("main."); + } + sqlQry.append("requestid=? "); + + RecordSet rs_sqlQry = new RecordSet(); + if (!"1".equals(fieldIdOrgType_fieldId_isDtl)) { + rs_sqlQry.executeQuery(sqlQry.toString(), requestId); + } else { + rs_sqlQry.executeQuery(sqlQry.toString(), detailRecordKey, requestId); + } + if (rs_sqlQry.next()) { + String _orgTypeValue = Util.null2String(rs_sqlQry.getString("orgType")).trim(); + + reqOneRowDataMap = new HashMap(); + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + reqOneRowDataMap.put("organizationtype", _orgTypeValue); + } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + reqOneRowDataMap.put("organizationtype2", _orgTypeValue); + } + } + + } + } + } +// new BaseBean().writeLog("f1 reqOneRowDataMap="+reqOneRowDataMap+";"); + + if (reqOneRowDataMap != null) {//数据库里面有记录,表示是历史行 + organizationtype = -1; + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype"), -1); + } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype2"), -1); + } + _isDbDataFlag = true; +// _bb.writeLog("1 organizationtype="+organizationtype); + + } else {//数据库中无纪律,表示是新增行 + int ortType_fieldid_tmp = 0; + int ortType_fieldhtmltype_tmp = 0; + int ortType_type_tmp = 0; + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + ortType_fieldid_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_fieldId")); + ortType_fieldhtmltype_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_fieldhtmltype")); + ortType_type_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_type")); + } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + ortType_fieldid_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_fieldId")); + ortType_fieldhtmltype_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_fieldhtmltype")); + ortType_type_tmp = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_type")); + } + +// _bb.writeLog("ortType_fieldid_tmp="+ortType_fieldid_tmp+";ortType_fieldhtmltype_tmp="+ortType_fieldhtmltype_tmp+";ortType_type_tmp="+ortType_type_tmp); + + String fieldvalue_tmp = wfLayoutToHtml.getFieldValueTmp(ortType_fieldid_tmp, ortType_fieldhtmltype_tmp, ortType_type_tmp, + inoperatefield_hs, fieldvalue_hs, fieldMap, + resourceComInfo, + prjid, docid, dt_beagenter, hrmid, body_isagent, agenttype, + crmid, reqid); + organizationtype = Util.getIntValue(fieldvalue_tmp); + if (organizationtype < 0) { + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + organizationtype = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType_defaultSelectValue")); + ; + } else if ("fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + organizationtype = Util.getIntValue(fnaWfSetMap.get("fieldIdOrgType2_defaultSelectValue")); + } + } +// _bb.writeLog("2 organizationtype="+organizationtype+";fieldvalue_tmp="+fieldvalue_tmp); + } + + if ("fieldIdOrgId_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdOrgId2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + int btnType = oldBtnType; + if (organizationtype == 0) {//个人 + btnType = 1; + } else if (organizationtype == 1) {//部门 + btnType = 4; + } else if (organizationtype == 2) {//分部 + btnType = 164; + } else if (organizationtype == 3) {//成本中心 + btnType = 251; + } +// _bb.writeLog("btnType="+btnType+";_oldBtnType="+oldBtnType); + + String fieldvalue_tmp = ""; + if (!_isDbDataFlag && btnType != oldBtnType) { + fieldvalue_tmp = wfLayoutToHtml.getFieldValueTmp(fieldid, 3, btnType, + inoperatefield_hs, fieldvalue_hs, fieldMap, + resourceComInfo, + prjid, docid, dt_beagenter, hrmid, body_isagent, agenttype, + crmid, reqid); + if (Util.getIntValue(fieldvalue_tmp) == 0) { + fieldvalue_tmp = ""; + } + otherReturnVal.put("newOrgIdDefValue", fieldvalue_tmp); +// _bb.writeLog("newOrgIdDefValue="+fieldvalue_tmp); + } + + if (!_isDbDataFlag && btnType == 251 && "".equals(fieldvalue_tmp)) {//成本中心 + String fieldIdOrgId_automaticTake = Util.null2String(fnaWfSetMap.get("fieldIdOrgId_automaticTake")); + if ("1".equals(fieldIdOrgId_automaticTake)) { + String _fnaFccId_fieldvalue_tmp_key = "fieldIdOrgId_automaticTake_hrmid=" + hrmid + "_isDbDataFlagEqualsFalse_btnType251_fnaFccId_fieldvalue_tmp_key"; + if (otherPara_hs.containsKey(_fnaFccId_fieldvalue_tmp_key)) { + fieldvalue_tmp = Util.null2String((String) otherPara_hs.get(_fnaFccId_fieldvalue_tmp_key)).trim(); + } else { + HashMap dataMapHrm = new HashMap(); + FnaCommon.getHrmResourceInfo(dataMapHrm, Util.getIntValue(hrmid)); + String _fnaFccId = Util.null2String(dataMapHrm.get("fccId")); + fieldvalue_tmp = _fnaFccId; + if (Util.getIntValue(fieldvalue_tmp) == 0) { + fieldvalue_tmp = ""; + } + otherPara_hs.put(_fnaFccId_fieldvalue_tmp_key, fieldvalue_tmp); + } + otherReturnVal.put("newOrgIdDefValue", fieldvalue_tmp); + } + } + +// _bb.writeLog("btnType="+btnType); + return btnType; + } + +// _bb.writeLog("_oldBtnType="+oldBtnType); + return oldBtnType; + } + + /** + * 获取预算信息字段显示内容 + * + * @param fieldid + * @param detailRecordId + * @param fieldvalue_old + * @param _requestId + * @param _detailNumber + * @param fnaWfSetMap + * @param reqDataMap + * @param fnaExpenseInfoAllRowRecordHm + * @param languageId + * @param otherPara_hs + * @return + */ + public String getRemainByFnaFieldType(int fieldid, int detailRecordId, String fieldvalue_old, + int _requestId, int _detailNumber, + Map fnaWfSetMap, HashMap> reqDataMap, HashMap> fnaExpenseInfoAllRowRecordHm, int languageId, + Hashtable otherPara_hs) { + if (_requestId > 0) { + RecordSet rs2 = new RecordSet(); + //启用多明细表报销 + int fnaWfTypeMultiReim = 0; + rs2.executeQuery("select a.* from fnaFeeWfInfo a join workflow_requestbase b on a.workflowid = b.workflowid where b.requestid = " + _requestId); + if (rs2.next()) { + fnaWfTypeMultiReim = rs2.getInt("fnaWfTypeMultiReim"); + } + //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; + if (fnaWfTypeMultiReim == 1) { + return ""; + } + } + BaseBean _bb = new BaseBean(); + //_bb.writeLog("getRemainByFnaFieldType"); + + String _hrmremain_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdHrmInfo_fieldName")).trim(); + String _deptremain_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdDepInfo_fieldName")).trim(); + String _subcomremain_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdSubInfo_fieldName")).trim(); + String _Fcc_fieldName = Util.null2String(fnaWfSetMap.get("fieldIdFccInfo_fieldName")).trim(); + + String _hrmremain_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdHrmInfo2_fieldName")).trim(); + String _deptremain_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdDepInfo2_fieldName")).trim(); + String _subcomremain_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdSubInfo2_fieldName")).trim(); + String _Fcc_fieldName2 = Util.null2String(fnaWfSetMap.get("fieldIdFccInfo2_fieldName")).trim(); + + int subject = -1; + int organizationtype = -1; + int organizationid = -1; + String budgetperiod = ""; + String _fnaWfFieldFnaType_typeFlag = ""; + String[] _dt1_remain_array = new String[]{"", "", "", ""}; + + HashMap reqOneRowDataMap = null; + if (reqDataMap != null) { + if (detailRecordId > 0) {//先检查是否是来自明细,如果是来自明细则使用明细id获取数据 + reqOneRowDataMap = reqDataMap.get(detailRecordId + ""); + } else if (_requestId > 0) {//如果不是来自明细则使用主表requestid来获取数据 + reqOneRowDataMap = reqDataMap.get(_requestId + ""); + } + } + if ("fieldIdHrmInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdDepInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdSubInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdFccInfo_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + if (reqOneRowDataMap != null) { + subject = Util.getIntValue(reqOneRowDataMap.get("subject"), -1); + organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype"), -1); + organizationid = Util.getIntValue(reqOneRowDataMap.get("organizationid"), -1); + budgetperiod = Util.null2String(reqOneRowDataMap.get("budgetperiod")).trim(); + } + _fnaWfFieldFnaType_typeFlag = "6_7_8_9"; + _dt1_remain_array = new String[]{_hrmremain_fieldName, _deptremain_fieldName, _subcomremain_fieldName, _Fcc_fieldName}; + + } else if ("fieldIdHrmInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdDepInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdSubInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdFccInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + if (reqOneRowDataMap != null) { + subject = Util.getIntValue(reqOneRowDataMap.get("subject2"), -1); + organizationtype = Util.getIntValue(reqOneRowDataMap.get("organizationtype2"), -1); + organizationid = Util.getIntValue(reqOneRowDataMap.get("organizationid2"), -1); + budgetperiod = Util.null2String(reqOneRowDataMap.get("budgetperiod2")).trim(); + } + _fnaWfFieldFnaType_typeFlag = "14_15_16_17"; + _dt1_remain_array = new String[]{_hrmremain_fieldName2, _deptremain_fieldName2, _subcomremain_fieldName2, _Fcc_fieldName2}; + + } + + BudgetHandler budgetHandler = new BudgetHandler(); + + int orgtype = -1; + if (organizationtype == 0) {//个人 + orgtype = 3; + } else if (organizationtype == 1) {//部门 + orgtype = 2; + } else if (organizationtype == 2) {//分部 + orgtype = 1; + } else if (organizationtype == 3) {//成本中心 + orgtype = FnaCostCenter.ORGANIZATION_TYPE; + } + + if (organizationtype >= 0 && organizationtype <= 3) { + if ("fieldIdHrmInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdDepInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdSubInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdFccInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdHrmInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdDepInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdSubInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + "")) + || "fieldIdFccInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) { + String infos = " , , | , , , | , , , | , , , | , , , | , , , | , , , | , , , | , , , "; + if (!"".equals(budgetperiod) && orgtype != -1 && organizationid > 0 && subject > 0) { + String key01 = "FnaCommon_getRemainByFnaFieldType_" + _fnaWfFieldFnaType_typeFlag + "_requestId=" + _requestId + "detailRecordId=" + detailRecordId + "_detailNumber=" + _detailNumber; + if (otherPara_hs.containsKey(key01)) { + infos = (String) otherPara_hs.get(key01); + } else { + HashMap fnaExpenseInfoRecordHm = fnaExpenseInfoAllRowRecordHm.get(detailRecordId + ""); + infos = Util.null2String(budgetHandler.getBudgetKPI4DWR(budgetperiod, orgtype, organizationid, subject, true, true, detailRecordId, _requestId, fnaExpenseInfoRecordHm)).trim(); + otherPara_hs.put(key01, infos); + } + } + String[] fnainfos = infos.split("\\|"); + + String budgetAutoMoveInfo = ""; + if (fnainfos.length >= 5) { + budgetAutoMoveInfo = fnainfos[4]; + if (!"".equals(budgetAutoMoveInfo)) { + String regex = "^[, ]+$"; + Pattern pattern = Pattern.compile(regex); + Matcher match = pattern.matcher(budgetAutoMoveInfo); + if (match.matches()) {//判断是否只包含了逗号和空格,如果是则不处理 + budgetAutoMoveInfo = ""; + } else { + budgetAutoMoveInfo = SystemEnv.getHtmlLabelName(126630, languageId) + ":" + budgetAutoMoveInfo; + } + } + } + + + String _dt1_remain_only = ""; + if (getFnaNotEmptyCount(_dt1_remain_array) == 1) { + _dt1_remain_only = getFnaOnlyNotEmptyValue(_dt1_remain_array); + } + + String[] values = new String[]{"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""}; + + int fnainfosLen = fnainfos.length; + if (("fieldIdHrmInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdHrmInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 1) { + String _dt1_remain = _dt1_remain_array[0]; + if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { + values = fnainfos[organizationtype].split(","); + } else { + values = fnainfos[0].split(","); + } + + } else if (("fieldIdDepInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdDepInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 2) { + String _dt1_remain = _dt1_remain_array[1]; + if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { + values = fnainfos[organizationtype].split(","); + } else { + values = fnainfos[1].split(","); + } + + } else if (("fieldIdSubInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdSubInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 3) { + String _dt1_remain = _dt1_remain_array[2]; + if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { + values = fnainfos[organizationtype].split(","); + } else { + values = fnainfos[2].split(","); + } + + } else if (("fieldIdFccInfo_fieldId".equals(fnaWfSetMap.get(fieldid + "")) || "fieldIdFccInfo2_fieldId".equals(fnaWfSetMap.get(fieldid + ""))) && fnainfosLen >= 4) { + String _dt1_remain = _dt1_remain_array[3]; + if ((!_dt1_remain_only.equals("") && _dt1_remain_only.equals(_dt1_remain)) || (getFnaSameValueCount(_dt1_remain_array, _dt1_remain) > 1)) { + values = fnainfos[organizationtype].split(","); + } else { + values = fnainfos[3].split(","); + } + + } + + + String values0 = ""; + String values1 = ""; + String values2 = ""; + int valuesLen = values.length; + if (valuesLen >= 1) { + values0 = values[0]; + } + if (valuesLen >= 2) { + values1 = values[1]; + } + if (valuesLen >= 3) { + values2 = values[2]; + } + + String tempmsg = SystemEnv.getHtmlLabelName(18768, languageId) + ":" + values0 + "
" + + "" + SystemEnv.getHtmlLabelName(18503, languageId) + ":" + values1 + "
" + + "" + SystemEnv.getHtmlLabelName(18769, languageId) + ":" + values2 + ""; + if (!"".equals(budgetAutoMoveInfo)) { + tempmsg += "
" + budgetAutoMoveInfo; + } + + //_bb.writeLog("tempmsg="+tempmsg); + return tempmsg; + } + } + return fieldvalue_old; + } + + /** + * 获取素组中有相同值的个数 + * + * @param checkValArray + * @param compareValue + * @return + */ + public int getFnaSameValueCount(String[] checkValArray, String compareValue) { + int _count = 0; + if (checkValArray != null) { + for (int i = 0; i < checkValArray.length; i++) { + String _val = checkValArray[i]; + if (_val.equals(compareValue)) { + _count++; + } + } + } + return _count; + } + + /** + * 获取素组中非相同空项的值(取第一个) + * + * @param checkValArray + * @return + */ + public String getFnaOnlyNotEmptyValue(String[] checkValArray) { + String _value = ""; + if (this.getFnaNotEmptyCount(checkValArray) == 1) { + if (checkValArray != null) { + for (int i = 0; i < checkValArray.length; i++) { + String _val = checkValArray[i]; + if (_val != null && _val.equals("")) { + _value = _val; + break; + } + } + } + } + return _value; + } + + /** + * 获取素组中非相同空值数量 + * + * @param checkValArray + * @return + */ + public int getFnaNotEmptyCount(String[] checkValArray) { + int _count = 0; + if (checkValArray != null) { + for (int i = 0; i < checkValArray.length; i++) { + String _val = checkValArray[i]; + if (_val != null && _val.equals("")) { + _count++; + } + } + } + return _count; + } + + /** + * 依据流程类型获取查询费控相关字段的sql + * + * @param _requestId 流程requestid + * @param _formId 流程表单id + * @param dataMap 预算类流程字段对应关系hm + * @param _isEnableFnaWfE8 是否是启用的Ecology8费控流程 + * @param _isEnableFnaChangeWf 是否是启用的Ecology8预算变更流程 + * @param _isEnableFnaShareWf 是否是启用的Ecology8预算分摊流程 + * @return SQL + */ + public static String getSqlByFnaFieldType(int _requestId, int _formId, Map dataMap, + boolean _isEnableFnaWfE8, boolean _isEnableFnaChangeWf, boolean _isEnableFnaShareWf) { +// _bb.writeLog("_formId="+_formId+";_isbill="+_isbill+";_isEnableFnaWfE7="+_isEnableFnaWfE7+";_isEnableFnaWfE8="+_isEnableFnaWfE8); + + StringBuffer sql = new StringBuffer(""); + if (_isEnableFnaWfE8 || _isEnableFnaChangeWf || _isEnableFnaShareWf) {//自定义新表单 + int _formIdABS = Math.abs(_formId); + + String fieldIdSubject_isDtl = "1"; + String fieldIdOrgType_isDtl = "1"; + String fieldIdOrgId_isDtl = "1"; + String fieldIdOccurdate_isDtl = "1"; + + String fieldIdSubject2_isDtl = "1"; + String fieldIdOrgType2_isDtl = "1"; + String fieldIdOrgId2_isDtl = "1"; + String fieldIdOccurdate2_isDtl = "1"; + + String _subject_fieldName = ""; + String _organizationtype_fieldName = ""; + String _organizationid_fieldName = ""; + String _budgetperiod_fieldName = ""; + + String _subject_fieldName2 = ""; + String _organizationtype_fieldName2 = ""; + String _organizationid_fieldName2 = ""; + String _budgetperiod_fieldName2 = ""; + + String fieldIdAmount_isDtl = "1"; + String _amount_fieldName = ""; + + if (_isEnableFnaWfE8) { + _subject_fieldName = Util.null2String(dataMap.get("fieldIdSubject_fieldName")); + _organizationtype_fieldName = Util.null2String(dataMap.get("fieldIdOrgType_fieldName")); + _organizationid_fieldName = Util.null2String(dataMap.get("fieldIdOrgId_fieldName")); + _budgetperiod_fieldName = Util.null2String(dataMap.get("fieldIdOccurdate_fieldName")); + + fieldIdSubject_isDtl = Util.null2String(dataMap.get("fieldIdSubject_fieldId_isDtl")); + fieldIdOrgType_isDtl = Util.null2String(dataMap.get("fieldIdOrgType_fieldId_isDtl")); + fieldIdOrgId_isDtl = Util.null2String(dataMap.get("fieldIdOrgId_fieldId_isDtl")); + fieldIdOccurdate_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate_fieldId_isDtl")); + + _amount_fieldName = Util.null2String(dataMap.get("fieldIdAmount_fieldName")); + fieldIdAmount_isDtl = Util.null2String(dataMap.get("fieldIdAmount_fieldId_isDtl")); + + } else if (_isEnableFnaChangeWf) { + _subject_fieldName = Util.null2String(dataMap.get("fieldIdSubject_fieldName")); + _organizationtype_fieldName = Util.null2String(dataMap.get("fieldIdOrgType_fieldName")); + _organizationid_fieldName = Util.null2String(dataMap.get("fieldIdOrgId_fieldName")); + _budgetperiod_fieldName = Util.null2String(dataMap.get("fieldIdOccurdate_fieldName")); + + _subject_fieldName2 = Util.null2String(dataMap.get("fieldIdSubject2_fieldName")); + _organizationtype_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgType2_fieldName")); + _organizationid_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgId2_fieldName")); + _budgetperiod_fieldName2 = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldName")); + + fieldIdSubject_isDtl = Util.null2String(dataMap.get("fieldIdSubject_fieldId_isDtl")); + fieldIdOrgType_isDtl = Util.null2String(dataMap.get("fieldIdOrgType_fieldId_isDtl")); + fieldIdOrgId_isDtl = Util.null2String(dataMap.get("fieldIdOrgId_fieldId_isDtl")); + fieldIdOccurdate_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate_fieldId_isDtl")); + + fieldIdSubject2_isDtl = Util.null2String(dataMap.get("fieldIdSubject2_fieldId_isDtl")); + fieldIdOrgType2_isDtl = Util.null2String(dataMap.get("fieldIdOrgType2_fieldId_isDtl")); + fieldIdOrgId2_isDtl = Util.null2String(dataMap.get("fieldIdOrgId2_fieldId_isDtl")); + fieldIdOccurdate2_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldId_isDtl")); + + _amount_fieldName = Util.null2String(dataMap.get("fieldIdAmount_fieldName")); + fieldIdAmount_isDtl = Util.null2String(dataMap.get("fieldIdAmount_fieldId_isDtl")); + + } else if (_isEnableFnaShareWf) { + _subject_fieldName = Util.null2String(dataMap.get("fieldIdSubject_fieldName")); + _organizationtype_fieldName = Util.null2String(dataMap.get("fieldIdOrgType_fieldName")); + _organizationid_fieldName = Util.null2String(dataMap.get("fieldIdOrgId_fieldName")); + _budgetperiod_fieldName = Util.null2String(dataMap.get("fieldIdOccurdate_fieldName")); + + _subject_fieldName2 = Util.null2String(dataMap.get("fieldIdSubject2_fieldName")); + _organizationtype_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgType2_fieldName")); + _organizationid_fieldName2 = Util.null2String(dataMap.get("fieldIdOrgId2_fieldName")); + _budgetperiod_fieldName2 = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldName")); + + fieldIdSubject_isDtl = Util.null2String(dataMap.get("fieldIdSubject_fieldId_isDtl")); + fieldIdOrgType_isDtl = Util.null2String(dataMap.get("fieldIdOrgType_fieldId_isDtl")); + fieldIdOrgId_isDtl = Util.null2String(dataMap.get("fieldIdOrgId_fieldId_isDtl")); + fieldIdOccurdate_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate_fieldId_isDtl")); + + fieldIdSubject2_isDtl = Util.null2String(dataMap.get("fieldIdSubject2_fieldId_isDtl")); + fieldIdOrgType2_isDtl = Util.null2String(dataMap.get("fieldIdOrgType2_fieldId_isDtl")); + fieldIdOrgId2_isDtl = Util.null2String(dataMap.get("fieldIdOrgId2_fieldId_isDtl")); + fieldIdOccurdate2_isDtl = Util.null2String(dataMap.get("fieldIdOccurdate2_fieldId_isDtl")); + + _amount_fieldName = Util.null2String(dataMap.get("fieldIdAmount_fieldName")); + fieldIdAmount_isDtl = Util.null2String(dataMap.get("fieldIdAmount_fieldId_isDtl")); + + } + + if ("".equals(_subject_fieldName2)) { + _subject_fieldName2 = _subject_fieldName; + fieldIdSubject2_isDtl = fieldIdSubject_isDtl; + } + if ("".equals(_organizationtype_fieldName2)) { + _organizationtype_fieldName2 = _organizationtype_fieldName; + fieldIdOrgType2_isDtl = fieldIdOrgType_isDtl; + } + if ("".equals(_organizationid_fieldName2)) { + _organizationid_fieldName2 = _organizationid_fieldName; + fieldIdOrgId2_isDtl = fieldIdOrgId_isDtl; + } + if ("".equals(_budgetperiod_fieldName2)) { + _budgetperiod_fieldName2 = _budgetperiod_fieldName; + fieldIdOccurdate2_isDtl = fieldIdOccurdate_isDtl; + } + + + //报销明细中是否包含了明细表字段 + boolean dt1_haveIsDtlField = ("1".equals(fieldIdSubject_isDtl) || "1".equals(fieldIdOrgType_isDtl) || "1".equals(fieldIdOrgId_isDtl) || "1".equals(fieldIdOccurdate_isDtl)); + boolean dt1_haveIsDtlField2 = ("1".equals(fieldIdSubject2_isDtl) || "1".equals(fieldIdOrgType2_isDtl) || "1".equals(fieldIdOrgId2_isDtl) || "1".equals(fieldIdOccurdate2_isDtl)); + + + sql.append("select "); + + if ("1".equals(fieldIdAmount_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_amount_fieldName + " applyamount, \n"); + + if ("1".equals(fieldIdOrgType_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_organizationtype_fieldName + " organizationtype, \n"); + + if ("1".equals(fieldIdOrgId_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_organizationid_fieldName + " organizationid, \n"); + + if ("1".equals(fieldIdSubject_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_subject_fieldName + " subject, \n"); + + if ("1".equals(fieldIdOccurdate_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_budgetperiod_fieldName + " budgetperiod, \n"); + + + if ("1".equals(fieldIdOrgType2_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_organizationtype_fieldName2 + " organizationtype2, \n"); + + if ("1".equals(fieldIdOrgId2_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_organizationid_fieldName2 + " organizationid2, \n"); + + if ("1".equals(fieldIdSubject2_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_subject_fieldName2 + " subject2, \n"); + + if ("1".equals(fieldIdOccurdate2_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_budgetperiod_fieldName2 + " budgetperiod2, \n"); + + if (dt1_haveIsDtlField || dt1_haveIsDtlField2) { + sql.append(" b.id, b.id dtlId, a.requestid "); + } else { + sql.append(" a.requestid "); + } + + + sql.append(" from formtable_main_" + _formIdABS + " a \n"); + if (dt1_haveIsDtlField || dt1_haveIsDtlField2) { + sql.append(" join formtable_main_" + _formIdABS + "_dt1 b on a.id = b.mainid \n"); + } + sql.append(" where a.requestid = " + _requestId); + + sql.append(" order by "); + if (_isEnableFnaChangeWf) { + if ("1".equals(fieldIdAmount_isDtl)) { + sql.append(" b."); + } else { + sql.append(" a."); + } + sql.append(_amount_fieldName + " asc,"); + } + sql.append(" a.id asc"); + if (dt1_haveIsDtlField || dt1_haveIsDtlField2) { + sql.append(", b.id asc"); + } + } + + return sql.toString(); + } + + /** + * 依据getSqlByFnaFieldType方法返回sql,获取当前requestid对应的所有预算相关业务逻辑数据 + * + * @param _requestId 流程requestid + * @param _formId 流程表单id + * @param dataMap 预算类流程字段对应关系hm + * @param _isEnableFnaWfE8 是否是启用的Ecology8费控流程 + * @param _isEnableFnaChangeWf 是否是启用的Ecology8预算变更流程 + * @param _isEnableFnaShareWf 是否是启用的Ecology8预算分摊流程 + * @return + */ + public static HashMap> qryFnaExpenseRequestRecord(int _requestId, int _formId, Map dataMap, + boolean _isEnableFnaWfE8, boolean _isEnableFnaChangeWf, boolean _isEnableFnaShareWf) { + RecordSet rs_fna = new RecordSet(); + + HashMap> retHm = new HashMap>(); + + int _idx = 0; + String sql = FnaCommon.getSqlByFnaFieldType(_requestId, _formId, dataMap, + _isEnableFnaWfE8, _isEnableFnaChangeWf, _isEnableFnaShareWf); + if (!"".equals(sql)) { + rs_fna.executeSql(sql); + while (rs_fna.next()) { + HashMap hm = new HashMap(); + String keyId = Util.null2String(rs_fna.getString("id")).trim(); + if ("".equals(keyId)) { + keyId = Util.null2String(rs_fna.getString("requestid")).trim(); + } + + hm.put("organizationtype", Util.null2String(rs_fna.getString("organizationtype")).trim()); + hm.put("organizationid", Util.null2String(rs_fna.getString("organizationid")).trim()); + hm.put("subject", Util.null2String(rs_fna.getString("subject")).trim()); + hm.put("budgetperiod", Util.null2String(rs_fna.getString("budgetperiod")).trim()); + + hm.put("organizationtype2", Util.null2String(rs_fna.getString("organizationtype2")).trim()); + hm.put("organizationid2", Util.null2String(rs_fna.getString("organizationid2")).trim()); + hm.put("subject2", Util.null2String(rs_fna.getString("subject2")).trim()); + hm.put("budgetperiod2", Util.null2String(rs_fna.getString("budgetperiod2")).trim()); + + retHm.put(keyId, hm); + retHm.put("key_idx>>" + _idx, hm); + + _idx++; + } + } + + return retHm; + } + + /** + * 获取指定流程写入费用表的所有数据 + * + * @param _requestId 流程requestid + * @return HashMap> + */ + public static HashMap> qryFnaExpenseInfoAllRowRecordHm(int _requestId) { + RecordSet rs_fna = new RecordSet(); + + HashMap> retHm = new HashMap>(); + + //定位 数据库表名, 日期范围可能跨年 + List list_out_FnaExpenseInfo = new ArrayList(); + FnaSplitTableByYearComInfo.getFnaTableNameList(FnaTableNameEnum.FnaExpenseInfo, "1000-01-01", "9999-12-31", list_out_FnaExpenseInfo); + for (int aaaaaaaa = 0; aaaaaaaa < list_out_FnaExpenseInfo.size(); aaaaaaaa++) { + String tableName_FnaExpenseInfo = list_out_FnaExpenseInfo.get(aaaaaaaa); + + String sql = "select a.id, a.organizationid, a.organizationtype, a.occurdate, a.subject, a.amount, a.occurdateOld, \n" + + " a.status, a.guid, \n" + + " a.requestid, a.requestidDtlId, a.sourceRequestid, a.sourceRequestidDtlId, a.sourceDtlNumber, \n" + + " a.budgetperiods, a.budgetperiodslist, a.isBudgetAutoMoveByMinusAmt, a.isBudgetAutoMove \n" + + " from " + tableName_FnaExpenseInfo + " a where a.requestid = " + _requestId; + rs_fna.executeSql(sql); + while (rs_fna.next()) { + HashMap hm = new HashMap(); + String keyId = Util.null2String(rs_fna.getString("sourceRequestidDtlId")).trim();//这个作为key是唯一的,不需要考虑多张数据表的情况 + if (!"".equals(keyId)) { + hm.put("id", Util.null2String(rs_fna.getString("id")).trim()); + hm.put("organizationid", Util.null2String(rs_fna.getString("organizationid")).trim()); + hm.put("organizationtype", Util.null2String(rs_fna.getString("organizationtype")).trim()); + hm.put("occurdate", Util.null2String(rs_fna.getString("occurdate")).trim()); + hm.put("subject", Util.null2String(rs_fna.getString("subject")).trim()); + hm.put("amount", Util.null2String(rs_fna.getString("amount")).trim()); + hm.put("occurdateOld", Util.null2String(rs_fna.getString("occurdateOld")).trim()); + + hm.put("status", Util.null2String(rs_fna.getString("status")).trim()); + hm.put("guid", Util.null2String(rs_fna.getString("guid")).trim()); + + hm.put("requestid", Util.null2String(rs_fna.getString("requestid")).trim()); + hm.put("requestidDtlId", Util.null2String(rs_fna.getString("requestidDtlId")).trim()); + hm.put("sourceRequestid", Util.null2String(rs_fna.getString("sourceRequestid")).trim()); + hm.put("sourceRequestidDtlId", Util.null2String(rs_fna.getString("sourceRequestidDtlId")).trim()); + hm.put("sourceDtlNumber", Util.null2String(rs_fna.getString("sourceDtlNumber")).trim()); + + hm.put("budgetperiods", Util.null2String(rs_fna.getString("budgetperiods")).trim()); + hm.put("budgetperiodslist", Util.null2String(rs_fna.getString("budgetperiodslist")).trim()); + hm.put("isBudgetAutoMoveByMinusAmt", Util.null2String(rs_fna.getString("isBudgetAutoMoveByMinusAmt")).trim()); + hm.put("isBudgetAutoMove", Util.null2String(rs_fna.getString("isBudgetAutoMove")).trim()); + + retHm.put(keyId, hm); + } + } + }//for end + + return retHm; + } + + /** + * 获取指定流程的冲销/还款数据 + * + * @param requestid 流程requestid + * @param _formId 流程表单id + * @param dataMap 预算类流程字段对应关系hm + * @return + */ + public static HashMap> qryFnaRepaymentRequestRecord(int requestid, int _formId, Map dataMap) { + RecordSet rs_fna = new RecordSet(); + + HashMap> retHm = new HashMap>(); + + String dt2_fieldIdJklc_fieldName = Util.null2String(dataMap.get("dt2_fieldIdJklc_fieldName")); + String dt2_fieldIdDnxh_fieldName = Util.null2String(dataMap.get("dt2_fieldIdDnxh_fieldName")); + String dt2_fieldIdJkje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdJkje_fieldName")); + String dt2_fieldIdYhje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdYhje_fieldName")); + String dt2_fieldIdSpzje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdSpzje_fieldName")); + String dt2_fieldIdWhje_fieldName = Util.null2String(dataMap.get("dt2_fieldIdWhje_fieldName")); + + StringBuffer borrowRequestIds = new StringBuffer(); + + int formidAbs = Math.abs(_formId); + HashMap> jklcsHm = new HashMap>(); + + StringBuffer sql = new StringBuffer(); + sql.append("select dt.id dtlId "); + if (!"".equals(dt2_fieldIdJklc_fieldName)) { + sql.append(", dt." + dt2_fieldIdJklc_fieldName + " jklc "); + } + if (!"".equals(dt2_fieldIdDnxh_fieldName)) { + sql.append(", dt." + dt2_fieldIdDnxh_fieldName + " dnxh "); + } + if (!"".equals(dt2_fieldIdJkje_fieldName)) { + sql.append(", dt." + dt2_fieldIdJkje_fieldName + " jkje "); + } + if (!"".equals(dt2_fieldIdYhje_fieldName)) { + sql.append(", dt." + dt2_fieldIdYhje_fieldName + " yhje "); + } + if (!"".equals(dt2_fieldIdSpzje_fieldName)) { + sql.append(", dt." + dt2_fieldIdSpzje_fieldName + " spzje "); + } + if (!"".equals(dt2_fieldIdWhje_fieldName)) { + sql.append(", dt." + dt2_fieldIdWhje_fieldName + " whje "); + } + sql.append(" from formtable_main_" + formidAbs + "_dt2 dt "); + sql.append(" join formtable_main_" + formidAbs + " main on main.id=dt.mainid "); + sql.append(" where main.requestId=" + requestid); + rs_fna.executeSql(sql.toString()); + while (rs_fna.next()) { + HashMap hm = new HashMap(); + String keyId = Util.null2String(rs_fna.getString("dtlId")).trim(); + + String jklc = Util.null2String(rs_fna.getString("jklc")).trim(); + String dnxh = Util.null2String(rs_fna.getString("dnxh")).trim(); + String jkje = Util.null2String(rs_fna.getString("jkje")).trim(); + String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); + String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); + String whje = Util.null2String(rs_fna.getString("whje")).trim(); + + String dnxhShowName = ""; + + int i_jklc = Util.getIntValue(jklc); + int i_dnxh = Util.getIntValue(dnxh); + + if (i_jklc > 0 && i_dnxh > 0) { + if (!jklcsHm.containsKey(jklc)) { + FnaCommon.getRequestBorrowDnxhShowName(i_jklc, i_dnxh, jklcsHm); + } + HashMap _jklcDtlIdxHm = jklcsHm.get(jklc); + if (_jklcDtlIdxHm != null) { + dnxhShowName = Util.null2String(_jklcDtlIdxHm.get(dnxh)).trim(); + } + } + + if ("".equals(dnxhShowName)) { + dnxhShowName = dnxh; + } + + hm.put("jklc", jklc); + hm.put("dnxh", dnxh); + hm.put("dnxhShowName", dnxhShowName); + hm.put("jkje", jkje); + hm.put("yhje", yhje); + hm.put("spzje", spzje); + hm.put("whje", whje); + + retHm.put(keyId, hm); + + if (i_jklc > 0) { + if (borrowRequestIds.length() > 0) { + borrowRequestIds.append(","); + } + borrowRequestIds.append(i_jklc); + } + } + + if (borrowRequestIds.length() > 0) { + String sql1 = "select SUM(CASE WHEN (a.recordType='borrow') THEN a.amountBorrow ELSE 0.0 END) jkje, \n" + + " SUM(CASE WHEN (a.recordType='reverse') THEN a.amountBorrow ELSE 0.0 END) yhje, \n" + + " SUM(CASE WHEN (a.recordType='freezeBorrow') THEN a.amountBorrow ELSE 0.0 END) spzje, \n" + + " SUM(CASE WHEN (a.recordType='borrow') THEN a.amountBorrow ELSE (a.amountBorrow * -1) END) whje, \n" + + " a.borrowRequestId, a.borrowRequestIdDtlId \n" + + " from FnaBorrowInfo a \n" + + " where a.borrowRequestId in (" + borrowRequestIds.toString() + ") \n" + + " group by a.borrowRequestId, a.borrowRequestIdDtlId"; + rs_fna.executeSql(sql1); + while (rs_fna.next()) { + HashMap hm = new HashMap(); + String keyId = Util.null2String("borrowRequestIdInfo_" + rs_fna.getString("borrowRequestId")).trim() + "_" + Util.null2String(rs_fna.getString("borrowRequestIdDtlId")).trim(); + + String jkje = Util.null2String(rs_fna.getString("jkje")).trim(); + String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); + String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); + String whje = Util.null2String(rs_fna.getString("whje")).trim(); + + hm.put("jkje", jkje); + hm.put("yhje", yhje); + hm.put("spzje", spzje); + hm.put("whje", whje); + + retHm.put(keyId, hm); + } + } + + return retHm; + } + + /** + * 获取指定流程的预付款相关数据 + * + * @param requestid 流程requestid + * @param _formId 流程表单id + * @param dataMap 预算类流程字段对应关系hm + * @return + */ + public static HashMap> qryFnaReverseAdvanceRequestRecord(int requestid, int _formId, Map dataMap) { + RecordSet rs_fna = new RecordSet(); + + HashMap> retHm = new HashMap>(); + + String dt4_fieldIdYfklc_fieldName = Util.null2String(dataMap.get("dt4_fieldIdYfklc_fieldName")); + String dt4_fieldIdDnxh_fieldName = Util.null2String(dataMap.get("dt4_fieldIdDnxh_fieldName")); + String dt4_fieldIdYfkje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdYfkje_fieldName")); + String dt4_fieldIdYhje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdYhje_fieldName")); + String dt4_fieldIdSpzje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdSpzje_fieldName")); + String dt4_fieldIdWhje_fieldName = Util.null2String(dataMap.get("dt4_fieldIdWhje_fieldName")); + + StringBuffer advanceRequestIds = new StringBuffer(); + + int formidAbs = Math.abs(_formId); + HashMap> YfklcsHm = new HashMap>(); + + StringBuffer sql = new StringBuffer(); + sql.append("select dt.id dtlId "); + if (!"".equals(dt4_fieldIdYfklc_fieldName)) { + sql.append(", dt." + dt4_fieldIdYfklc_fieldName + " Yfklc "); + } + if (!"".equals(dt4_fieldIdDnxh_fieldName)) { + sql.append(", dt." + dt4_fieldIdDnxh_fieldName + " dnxh "); + } + if (!"".equals(dt4_fieldIdYfkje_fieldName)) { + sql.append(", dt." + dt4_fieldIdYfkje_fieldName + " Yfkje "); + } + if (!"".equals(dt4_fieldIdYhje_fieldName)) { + sql.append(", dt." + dt4_fieldIdYhje_fieldName + " yhje "); + } + if (!"".equals(dt4_fieldIdSpzje_fieldName)) { + sql.append(", dt." + dt4_fieldIdSpzje_fieldName + " spzje "); + } + if (!"".equals(dt4_fieldIdWhje_fieldName)) { + sql.append(", dt." + dt4_fieldIdWhje_fieldName + " whje "); + } + sql.append(" from formtable_main_" + formidAbs + "_dt4 dt "); + sql.append(" join formtable_main_" + formidAbs + " main on main.id=dt.mainid "); + sql.append(" where main.requestId=" + requestid); + rs_fna.executeSql(sql.toString()); + while (rs_fna.next()) { + HashMap hm = new HashMap(); + String keyId = Util.null2String(rs_fna.getString("dtlId")).trim(); + + String Yfklc = Util.null2String(rs_fna.getString("Yfklc")).trim(); + String dnxh = Util.null2String(rs_fna.getString("dnxh")).trim(); + String Yfkje = Util.null2String(rs_fna.getString("Yfkje")).trim(); + String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); + String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); + String whje = Util.null2String(rs_fna.getString("whje")).trim(); + + String dnxhShowName = ""; + + int i_Yfklc = Util.getIntValue(Yfklc); + int i_dnxh = Util.getIntValue(dnxh); + + if (i_Yfklc > 0 && i_dnxh > 0) { + if (!YfklcsHm.containsKey(Yfklc)) { + FnaCommon.getRequestAdvanceDnxhShowName(i_Yfklc, i_dnxh, YfklcsHm); + } + HashMap _YfklcDtlIdxHm = YfklcsHm.get(Yfklc); + if (_YfklcDtlIdxHm != null) { + dnxhShowName = Util.null2String(_YfklcDtlIdxHm.get(dnxh)).trim(); + } + } + + if ("".equals(dnxhShowName)) { + dnxhShowName = dnxh; + } + + hm.put("Yfklc", Yfklc); + hm.put("dnxh", dnxh); + hm.put("dnxhShowName", dnxhShowName); + hm.put("Yfkje", Yfkje); + hm.put("yhje", yhje); + hm.put("spzje", spzje); + hm.put("whje", whje); + + retHm.put(keyId, hm); + + if (i_Yfklc > 0) { + if (advanceRequestIds.length() > 0) { + advanceRequestIds.append(","); + } + advanceRequestIds.append(i_Yfklc); + } + } + + if (advanceRequestIds.length() > 0) { + String sql1 = "select SUM(CASE WHEN (a.recordType='advance') THEN a.amountAdvance ELSE 0.0 END) Yfkje, \n" + + " SUM(CASE WHEN (a.recordType='reverse') THEN a.amountAdvance ELSE 0.0 END) yhje, \n" + + " SUM(CASE WHEN (a.recordType='freezeAdvance') THEN a.amountAdvance ELSE 0.0 END) spzje, \n" + + " SUM(CASE WHEN (a.recordType='advance') THEN a.amountAdvance ELSE (a.amountAdvance * -1." + + ") END) whje, \n" + + " a.advanceRequestId, a.advanceRequestIdDtlId \n" + + " from FnaAdvanceInfo a \n" + + " where a.advanceRequestId in (" + advanceRequestIds.toString() + ") \n" + + " group by a.advanceRequestId, a.advanceRequestIdDtlId"; + rs_fna.executeSql(sql1); + while (rs_fna.next()) { + HashMap hm = new HashMap(); + String keyId = Util.null2String("advanceRequestIdInfo_" + rs_fna.getString("advanceRequestId")).trim() + "_" + Util.null2String(rs_fna.getString("advanceRequestIdDtlId")).trim(); + + String Yfkje = Util.null2String(rs_fna.getString("Yfkje")).trim(); + String yhje = Util.null2String(rs_fna.getString("yhje")).trim(); + String spzje = Util.null2String(rs_fna.getString("spzje")).trim(); + String whje = Util.null2String(rs_fna.getString("whje")).trim(); + + hm.put("Yfkje", Yfkje); + hm.put("yhje", yhje); + hm.put("spzje", spzje); + hm.put("whje", whje); + + retHm.put(keyId, hm); + } + } + + return retHm; + } + + /** + * 获取单内序号对应显示名称 + * + * @param jklc 流程reqid + * @param dhxh 单内序号 + * @return 单内序号对应显示名称 + */ + public static String getRequestAdvanceDnxhShowName(int jklc, int dhxh) { + return FnaCommon.getRequestAdvanceDnxhShowName(jklc, dhxh, null); + } + + /** + * 获取单内序号对应显示名称 + * + * @param jklc 流程reqid + * @param dhxh 单内序号 + * @param jklcsHm 输出参数 + * @return 单内序号对应显示名称 + */ + public static String getRequestAdvanceDnxhShowName(int jklc, int dhxh, + HashMap> jklcsHm) { + return FnaCommon.getRequestBorrowDnxhShowName(jklc, dhxh, jklcsHm); + } + + /** + * 获取单内序号对应显示名称 + * + * @param jklc 流程reqid + * @param dhxh 单内序号 + * @return 单内序号对应显示名称 + */ + public static String getRequestBorrowDnxhShowName(int jklc, int dhxh) { + return FnaCommon.getRequestBorrowDnxhShowName(jklc, dhxh, null); + } + + /** + * 获取单内序号对应显示名称 + * + * @param jklc 流程reqid + * @param dhxh 单内序号 + * @param jklcsHm 输出参数 + * @return 单内序号对应显示名称 + */ + public static String getRequestBorrowDnxhShowName(int jklc, int dhxh, + HashMap> jklcsHm) { + RecordSet rs_fna = new RecordSet(); + String spanValue = ""; + if (jklc > 0 && dhxh > 0) { + boolean _flag1 = false; + HashMap _jklcDtlIdxHm = null; + if (jklcsHm != null) { + if (jklcsHm.containsKey(jklc + "")) { + _jklcDtlIdxHm = jklcsHm.get(jklc + ""); + _flag1 = true; + } else { + _jklcDtlIdxHm = new HashMap(); + jklcsHm.put(jklc + "", _jklcDtlIdxHm); + } + } + + if (_flag1) { + _flag1 = _jklcDtlIdxHm != null; + } + + if (_flag1) { + spanValue = Util.null2String(_jklcDtlIdxHm.get(dhxh + "")).trim(); + } else { + String sql = "select b.formid \n" + + " from workflow_requestbase a \n" + + " join workflow_base b on a.workflowid = b.id \n" + + " where a.requestid = " + jklc; + rs_fna.executeSql(sql); + if (rs_fna.next()) { + int jklcFormid = Util.getIntValue(rs_fna.getString("formid")); + int jklcFormidAbs = Math.abs(jklcFormid); + + int dtlIdx = 0; + sql = "select dt.id dtlId " + + " from formtable_main_" + jklcFormidAbs + "_dt1 dt " + + " join formtable_main_" + jklcFormidAbs + " main on main.id=dt.mainid " + + " where main.requestId=" + jklc + " " + + " order by dt.id asc"; + rs_fna.executeSql(sql); + while (rs_fna.next()) { + dtlIdx++; + int dtlId = rs_fna.getInt("dtlId"); + if (_jklcDtlIdxHm != null) { + _jklcDtlIdxHm.put(dtlId + "", dtlIdx + ""); + jklcsHm.put(jklc + "", _jklcDtlIdxHm); + } + if (dtlId == dhxh) { + spanValue = dtlIdx + ""; + } + } + } + } + } + return spanValue; + } + + /** + * 生成定义成了报销流程的流程表单的数据的查询sql, 适用于明细表1报销的情况 + * + * @param requestid 流程reqid + * @param formidAbs 流程表单id绝对值 + * @param dt1_haveIsDtlField 字段中是否包含了至少一个明细表字段 + * @param fieldIdOrgType_isDtl 承担主体类型是否是明细表字段 + * @param fieldNameOrgType 承担主体类型字段名 + * @param fieldIdOrgId_isDtl 承担主体是否是明细表字段 + * @param fieldNameOrgId 承担主体字段名 + * @param fieldIdSubject_isDtl 科目是否是明细表字段 + * @param fieldNameSubject 科目字段名 + * @param fieldIdOccurdate_isDtl 费用日期是否是明细表字段 + * @param fieldNameOccurdate 费用日期字段名 + * @param fieldIdAmount_isDtl 报销金额是否是明细表字段 + * @param fieldNameAmount 报销金额字段名 + * @param fieldNameRequestidApplication 相关费用预申请流程是否是明细表字段 + * @param fieldNameCloseRequestidApplication 相关费用预申请流程字段名 + * @param isDebug 是否打印调试日期 + * @param isNewWf + * @param fieldIdReqId_isDtl + * @param fieldNameReqId + * @param fieldIdReqDtId_isDtl + * @param fieldNameReqDtId + * @return SQL + */ + public static String getFnaWf8Sql(int requestid, int formidAbs, boolean dt1_haveIsDtlField, + String fieldIdOrgType_isDtl, String fieldNameOrgType, + String fieldIdOrgId_isDtl, String fieldNameOrgId, + String fieldIdSubject_isDtl, String fieldNameSubject, + String fieldIdOccurdate_isDtl, String fieldNameOccurdate, + String fieldIdAmount_isDtl, String fieldNameAmount, + String fieldNameRequestidApplication, String fieldNameCloseRequestidApplication, + boolean isDebug, boolean isNewWf, + String fieldIdReqId_isDtl, String fieldNameReqId, + String fieldIdReqDtId_isDtl, String fieldNameReqDtId) { + + StringBuffer querySql = new StringBuffer("select "); + + if ("1".equals(fieldIdOrgType_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameOrgType + " organizationtype, "); + + if ("1".equals(fieldIdOrgId_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameOrgId + " organizationid, "); + + if ("1".equals(fieldIdSubject_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameSubject + " subject, "); + + if ("1".equals(fieldIdOccurdate_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameOccurdate + " budgetperiod, "); + + if ("1".equals(fieldIdAmount_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameAmount + " applyamount, "); + + if (isNewWf) { + if ("1".equals(fieldIdReqId_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameReqId + " ReqId, "); + + if ("1".equals(fieldIdReqDtId_isDtl)) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fieldNameReqDtId + " ReqDtId, "); + } + + if (!"".equals(fieldNameRequestidApplication)) { + querySql.append(" main." + fieldNameRequestidApplication + " fysqlc, "); + } + + if (!"".equals(fieldNameCloseRequestidApplication)) { + querySql.append(" main." + fieldNameCloseRequestidApplication + " sfbxwc, "); + } + + if (dt1_haveIsDtlField) { + querySql.append(" dt.id dtlId "); + } else { + querySql.append(" -987654321 dtlId "); + } + + querySql.append(" from formtable_main_" + formidAbs + " main "); + if (dt1_haveIsDtlField) { + querySql.append(" join formtable_main_" + formidAbs + "_dt1 dt on main.id=dt.mainid "); + } + querySql.append(" where main.requestId=" + requestid); + if (dt1_haveIsDtlField) { + querySql.append(" order by dt.id asc "); + } + if (isDebug) { + new BaseBean().writeLog("FnaCommon -> getFnaWf8Sql -> querySql=" + querySql.toString()); + } + + return querySql.toString(); + } + + + /** + * 生成定义成了报销流程的流程表单的数据的查询sql, 适用于明细表1报销的情况 + * + * @param requestid 流程reqid + * @param formidAbs 流程表单id绝对值 + * @param dt1_haveIsDtlField 字段中是否包含了至少一个明细表字段 + * @param fieldIdOrgType_isDtl 承担主体类型是否是明细表字段 + * @param fieldNameOrgType 承担主体类型字段名 + * @param fieldIdOrgId_isDtl 承担主体是否是明细表字段 + * @param fieldNameOrgId 承担主体字段名 + * @param fieldIdSubject_isDtl 科目是否是明细表字段 + * @param fieldNameSubject 科目字段名 + * @param fieldIdOccurdate_isDtl 费用日期是否是明细表字段 + * @param fieldNameOccurdate 费用日期字段名 + * @param fieldIdAmount_isDtl 报销金额是否是明细表字段 + * @param fieldNameAmount 报销金额字段名 + * @param fieldNameRequestidApplication 相关费用预申请流程是否是明细表字段 + * @param fieldNameCloseRequestidApplication 相关费用预申请流程字段名 + * @param isDebug 是否打印调试日期 + * @return SQL + */ + public static String getFnaWf8Sql(int requestid, int formidAbs, boolean dt1_haveIsDtlField, + String fieldIdOrgType_isDtl, String fieldNameOrgType, + String fieldIdOrgId_isDtl, String fieldNameOrgId, + String fieldIdSubject_isDtl, String fieldNameSubject, + String fieldIdOccurdate_isDtl, String fieldNameOccurdate, + String fieldIdAmount_isDtl, String fieldNameAmount, + String fieldNameRequestidApplication, String fieldNameCloseRequestidApplication, + boolean isDebug) { + + + return FnaCommon.getFnaWf8Sql(requestid, formidAbs, dt1_haveIsDtlField, + fieldIdOrgType_isDtl, fieldNameOrgType, + fieldIdOrgId_isDtl, fieldNameOrgId, + fieldIdSubject_isDtl, fieldNameSubject, + fieldIdOccurdate_isDtl, fieldNameOccurdate, + fieldIdAmount_isDtl, fieldNameAmount, + fieldNameRequestidApplication, fieldNameCloseRequestidApplication, + isDebug, false, + null, null, + null, null); + } + + + /** + * 生成定义成了报销流程的流程表单的数据的查询sql, 适用于多明细表报销的情况 + * + * @param requestid 流程reqid + * @param formidAbs 流程表单id绝对值 + * @param isDebug 是否打印调试日期 + * @return SQL + */ + public static String getFnaWf8MultiSql(int requestid, int formidAbs, boolean isDebug) { + StringBuffer querySql = new StringBuffer(); + boolean dt1_haveIsDtlField = true; + + RecordSet rs = new RecordSet(); + rs.executeQuery("select a.workflowid from workflow_requestbase a where a.requestid = ?", requestid); + if (rs.next()) { + int workflowid = rs.getInt("workflowid"); + + FnaWfMultiSet fnaWfMultiSet = new FnaWfMultiSet(workflowid, 0, 0); + HashMap fieldInfoHm = fnaWfMultiSet.getFieldInfoHm(); + List detailTableList = fnaWfMultiSet.getDetailTableList(); + int detailTableList_len = detailTableList.size(); + + new BaseBean().writeLog("detailTableList_len:" + detailTableList_len); + + for (int i = 0; i < detailTableList_len; i++) { + String detailTable = detailTableList.get(i); + FnaWfMultiSetFieldInfo fnaWfMultiSetFieldInfo = fieldInfoHm.get(detailTable); + + if (i > 0) { + querySql.append("\r\n UNION ALL \r\n"); + } + + querySql.append(" select "); + + String zd_orgtype = ""; + if (fnaWfMultiSetFieldInfo.getFkCdztlx_dtlNum() > 0) { + //querySql.append(" dt."); + zd_orgtype = "dt." + fnaWfMultiSetFieldInfo.getFkCdztlx_fieldName(); + } else { + //querySql.append(" main."); + zd_orgtype = "main." + fnaWfMultiSetFieldInfo.getFkCdztlx_fieldName(); + } + //querySql.append(fnaWfMultiSetFieldInfo.getFkCdztlx_fieldName()+" organizationtype, "); + querySql.append(zd_orgtype + " organizationtype, "); + + //拼接 承担主体ID 的 case when 语句 start + String orgid_Case_When = " (CASE "; + //承担主体 - 人员 - 字段英文名称 + String zd_orgid = fnaWfMultiSetFieldInfo.getFkBxgr_fieldName(); + if (fnaWfMultiSetFieldInfo.getFkBxgr_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 0 THEN dt." + zd_orgid); + } else if (zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 0 THEN main." + zd_orgid); + } + //承担主体 - 部门 - 字段英文名称 + zd_orgid = fnaWfMultiSetFieldInfo.getFkBxbm_fieldName(); + if (fnaWfMultiSetFieldInfo.getFkBxbm_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 1 THEN dt." + zd_orgid); + } else if (zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 1 THEN main." + zd_orgid); + } + //承担主体 - 分部 - 字段英文名称 + zd_orgid = fnaWfMultiSetFieldInfo.getFkBxfb_fieldName(); + if (fnaWfMultiSetFieldInfo.getFkBxfb_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 2 THEN dt." + zd_orgid); + } else if (zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 2 THEN main." + zd_orgid); + } + //承担主体 - 成本中心 - 字段英文名称 + zd_orgid = fnaWfMultiSetFieldInfo.getFkBxcbzx_fieldName(); + if (fnaWfMultiSetFieldInfo.getFkBxcbzx_dtlNum() > 0 && zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 3 THEN dt." + zd_orgid); + } else if (zd_orgid != null && !"".equals(zd_orgid)) { + orgid_Case_When += (" WHEN " + zd_orgtype + " = 3 THEN main." + zd_orgid); + } + orgid_Case_When += " ELSE -1 END) "; + querySql.append(orgid_Case_When + " organizationid, "); + //拼接 承担主体ID 的 case when 语句 end + + if (fnaWfMultiSetFieldInfo.getFkBxkm_dtlNum() > 0) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fnaWfMultiSetFieldInfo.getFkBxkm_fieldName() + " subject, "); + + if (fnaWfMultiSetFieldInfo.getFkFyrq_dtlNum() > 0) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fnaWfMultiSetFieldInfo.getFkFyrq_fieldName() + " budgetperiod, "); + + if (fnaWfMultiSetFieldInfo.getFkBxje_dtlNum() > 0) { + querySql.append(" dt."); + } else { + querySql.append(" main."); + } + querySql.append(fnaWfMultiSetFieldInfo.getFkBxje_fieldName() + " applyamount, "); + +// if(!"".equals(fieldNameRequestidApplication)){ +// querySql.append(" main."+fieldNameRequestidApplication+" fysqlc, "); +// } +// +// if(!"".equals(fieldNameCloseRequestidApplication)){ +// querySql.append(" main."+fieldNameCloseRequestidApplication+" sfbxwc, "); +// } + + if (dt1_haveIsDtlField) { + querySql.append(" dt.id dtlId, '" + StringEscapeUtils.escapeSql(detailTable) + "' detailtable "); + } else { + querySql.append(" -987654321 dtlId, '' detailtable "); + } + + querySql.append(" from formtable_main_" + formidAbs + " main "); + if (dt1_haveIsDtlField) { + querySql.append(" join " + detailTable + " dt on main.id=dt.mainid "); + } + querySql.append(" where main.requestId=" + requestid + " "); + } + } + if (true) { + new BaseBean().writeLog(querySql.toString()); + } + + return querySql.toString(); + } + + /** + * 获取流程相关费控信息 + * + * @param _workflowid + * @return 是否是系统表单的费控流程:key:isEnableFnaWfSysWf;value:true、false;
+ * 是否是启用的Ecology7费控流程:key:isEnableFnaWfE7;value:true、false;
+ * 是否是启用的Ecology8费控流程:key:isEnableFnaWfE8;value:true、false;
+ * 流程表单id:key:formId;value:表单id;
+ * 流程是否新表单:key:isbill;value:0、1; + */ + public static HashMap getIsEnableFnaWfHm(int _workflowid) { + BaseBean _bb = new BaseBean(); + RecordSet rs_fna = new RecordSet(); + + HashMap retHm = new HashMap(); + + //是否是系统表单的费控流程 + retHm.put("isEnableFnaWfSysWf", "false"); + int _formId = 0; + int _isbill = -1; + String sqlFna1 = "select a.formid, a.isbill from workflow_base a where a.id = " + _workflowid; + rs_fna.executeSql(sqlFna1); + if (rs_fna.next()) { + _formId = Util.getIntValue(rs_fna.getString("formid"), 0); + _isbill = Util.getIntValue(rs_fna.getString("isbill"), 0); + } + retHm.put("formId", _formId + ""); + retHm.put("isbill", _isbill + ""); + //系统表单:报销申请单、付款申请单,也是显示显示预算信息的,需要特殊处理 + if ((_formId == 158 || _formId == 156) && _isbill == 1) { + retHm.put("isEnableFnaWfSysWf", "true"); + } + + //是否是启用的Ecology7费控流程 + retHm.put("isEnableFnaWfE7", "false"); + //ecology7中配置的自定义表单费控流程的workflowId,多个id之间使用英文半角,号分隔 + String ecology7_FnaWfIds = ""; + try { + ecology7_FnaWfIds = Util.null2String(new String(Util.null2String(_bb.getPropValue("Ecology7_FnaWf", "ecology7_FnaWfIds")).getBytes("ISO-8859-1"), "gbk")).trim(); + } catch (Exception e) { + } + if (!"".equals(ecology7_FnaWfIds) && _workflowid > 0 && ("," + ecology7_FnaWfIds + ",").indexOf("," + _workflowid + ",") >= 0) { + retHm.put("isEnableFnaWfE7", "true"); + } + + //是否是启用的Ecology8费控流程 + retHm.put("isEnableFnaWfE8", "false"); + //是否是启用的Ecology8借款费控流程 + retHm.put("isEnableFnaBorrowWf", "false"); + //是否是启用的Ecology8还款费控流程 + retHm.put("isEnableFnaRepaymentWf", "false"); + //是否是启用的Ecology8预算变更流程 + retHm.put("isEnableFnaChangeWf", "false"); + //是否是启用的Ecology8预算分摊流程 + retHm.put("isEnableFnaShareWf", "false"); + //费用报销流程是否启用了还款明细 + retHm.put("enableRepayment", "false"); + //费用报销流程是否启用了预付款冲销明细 + retHm.put("enableReverseAdvance", "false"); + //是否是启用的Ecology8预付款费控流程 + retHm.put("isEnableFnaAdvanceWf", "false"); + + String sqlFnaWfSet = "select a.* from fnaFeeWfInfo a where a.workflowid = " + _workflowid; + rs_fna.executeSql(sqlFnaWfSet); + if (rs_fna.next()) { + if (rs_fna.getInt("enable") == 1) { + String fnaWfType = Util.null2String(rs_fna.getString("fnaWfType")); + if ("fnaFeeWf".equals(fnaWfType)) { + retHm.put("isEnableFnaWfE8", "true"); + int fnaWfTypeColl = rs_fna.getInt("fnaWfTypeColl"); + int fnaWfTypeReverse = rs_fna.getInt("fnaWfTypeReverse"); + boolean enableRepayment = (fnaWfTypeReverse > 0 && fnaWfTypeColl > 0); + if (enableRepayment) { + retHm.put("enableRepayment", "true"); + } + boolean enableReverseAdvance = rs_fna.getInt("fnaWfTypeReverseAdvance") == 1; + if (enableReverseAdvance) { + retHm.put("enableReverseAdvance", "true"); + } + } else if ("borrow".equals(fnaWfType)) { + retHm.put("isEnableFnaBorrowWf", "true"); + } else if ("repayment".equals(fnaWfType)) { + retHm.put("isEnableFnaRepaymentWf", "true"); + } else if ("change".equals(fnaWfType)) { + retHm.put("isEnableFnaChangeWf", "true"); + } else if ("share".equals(fnaWfType)) { + retHm.put("isEnableFnaShareWf", "true"); + } else if ("advance".equals(fnaWfType)) { + retHm.put("isEnableFnaAdvanceWf", "true"); + } + } + } + + return retHm; + } + + /** + * 从session中获取预算编制编辑页面,编辑单尚未保存到数据库中的新预算额度 + * + * @param session + * @param guid1 编辑页面guid1 + * @param tabFeeperiod 预算周期:月度:M;季度:Q;半年度:H;年度:Y; + * @param subject 三级科目id + * @param budgetperiodslist 预算周期期间数:月度:(1~12);季度:(1~4);半年度:(1~2);年度:(1); + * @param currentAmt 从数据库中获取的当前预算金额,如果session中不存在则返回该金额 + * @return + */ + public static double getBudgetEditNewAmtByGuid(HttpSession session, String guid1, String tabFeeperiod, int subject, int budgetperiodslist, double currentAmt) { + List mbudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_mbudgetvalues_" + guid1); + List msubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_msubject3names_" + guid1); + List qbudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_qbudgetvalues_" + guid1); + List qsubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_qsubject3names_" + guid1); + List hbudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_hbudgetvalues_" + guid1); + List hsubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_hsubject3names_" + guid1); + List ybudgetvalues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_ybudgetvalues_" + guid1); + List ysubject3names = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_ysubject3names_" + guid1); + List budgetValues = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_budgetValues_" + guid1); + List subjectNames = (List) session.getAttribute("FnaBudgetEditSaveFnaAjax.jsp_subjectNames_" + guid1); + + if (mbudgetvalues == null) { + mbudgetvalues = new ArrayList(); + msubject3names = new ArrayList(); + } + if (qbudgetvalues == null) { + qbudgetvalues = new ArrayList(); + qsubject3names = new ArrayList(); + } + if (hbudgetvalues == null) { + hbudgetvalues = new ArrayList(); + hsubject3names = new ArrayList(); + } + if (ybudgetvalues == null) { + ybudgetvalues = new ArrayList(); + ysubject3names = new ArrayList(); + } + if (budgetValues == null) { + budgetValues = new ArrayList(); + subjectNames = new ArrayList(); + } + + return FnaCommon.getBudgetEditNewAmt(tabFeeperiod, subject, budgetperiodslist, currentAmt, + mbudgetvalues, msubject3names, qbudgetvalues, qsubject3names, hbudgetvalues, hsubject3names, ybudgetvalues, ysubject3names, + budgetValues, subjectNames); + } + + /** + * 从session中获取和List中获取,预算编制编辑页面,编辑单尚未保存到数据库中的新预算额度 + * + * @param tabFeeperiod 预算周期:月度:M;季度:Q;半年度:H;年度:Y; + * @param subject 科目id + * @param budgetperiodslist 预算周期期间数:月度:(1~12);季度:(1~4);半年度:(1~2);年度:(1); + * @param currentAmt 从数据库中获取的当前预算金额,如果session中不存在则返回该金额 + * @param mbudgetvalues + * @param msubject3names + * @param qbudgetvalues + * @param qsubject3names + * @param hbudgetvalues + * @param hsubject3names + * @param ybudgetvalues + * @param ysubject3names + * @param budgetValues + * @param subjectNames + * @return + */ + public static double getBudgetEditNewAmt(String tabFeeperiod, int subject, int budgetperiodslist, double currentAmt, + List mbudgetvalues, List msubject3names, + List qbudgetvalues, List qsubject3names, + List hbudgetvalues, List hsubject3names, + List ybudgetvalues, List ysubject3names, + List budgetValues, List subjectNames) { + DecimalFormat df = new DecimalFormat("####################################################0.00"); + + double _ysze = currentAmt; + String _yszeStr = df.format(_ysze); + + if ("M".equals(tabFeeperiod)) { + int _idx = msubject3names.indexOf(subject + ""); + if (_idx >= 0) { + try { + String[] _valArray = (String[]) mbudgetvalues.get(_idx); + _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); + _ysze = Util.getDoubleValue(_yszeStr, 0.00); + } catch (Exception ex1) { + new BaseBean().writeLog(ex1); + } + } + + } else if ("Q".equals(tabFeeperiod)) { + int _idx = qsubject3names.indexOf(subject + ""); + if (_idx >= 0) { + try { + String[] _valArray = (String[]) qbudgetvalues.get(_idx); + _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); + _ysze = Util.getDoubleValue(_yszeStr, 0.00); + } catch (Exception ex1) { + new BaseBean().writeLog(ex1); + } + } + + } else if ("H".equals(tabFeeperiod)) { + int _idx = hsubject3names.indexOf(subject + ""); + if (_idx >= 0) { + try { + String[] _valArray = (String[]) hbudgetvalues.get(_idx); + _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); + _ysze = Util.getDoubleValue(_yszeStr, 0.00); + } catch (Exception ex1) { + new BaseBean().writeLog(ex1); + } + } + + } else if ("Y".equals(tabFeeperiod)) { + int _idx = ysubject3names.indexOf(subject + ""); + if (_idx >= 0) { + try { + String[] _valArray = (String[]) ybudgetvalues.get(_idx); + _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); + _ysze = Util.getDoubleValue(_yszeStr, 0.00); + } catch (Exception ex1) { + new BaseBean().writeLog(ex1); + } + } + + } + + int _idx = subjectNames.indexOf(subject + ""); + if (_idx >= 0) { + try { + String[] _valArray = (String[]) budgetValues.get(_idx); + _yszeStr = Util.null2String(_valArray[budgetperiodslist - 1]).trim(); + _ysze = Util.getDoubleValue(_yszeStr, 0.00); + } catch (Exception ex1) { + new BaseBean().writeLog(ex1); + } + } + + return Util.getDoubleValue(df.format(_ysze)); + } + + /** + * 获得并保存预算编制界面分页每页行数 + * + * @param pageSize + * @param defPageSize + * @param userId + * @return + */ + public static int getAndSaveFnaBudgetInfoPageSize(int pageSize, int defPageSize, int userId) { + RecordSet rs = new RecordSet(); + if (pageSize <= 0) { + pageSize = defPageSize; + rs.executeQuery("select pageSize from FnaBudgetInfoPageSize where userId=?", userId); + if (rs.next()) { + pageSize = Util.getIntValue(rs.getString("pageSize"), 50); + } + } + if (pageSize <= 0) { + pageSize = defPageSize; + } + rs.executeQuery("select * from FnaBudgetInfoPageSize where userId=?", userId); + if (rs.next()) { + String _id = rs.getString("id"); + int _pageSize = rs.getInt("pageSize"); + if (pageSize != _pageSize) { + rs.executeUpdate("update FnaBudgetInfoPageSize set pageSize = ? where id = ?", pageSize, _id); + } + } else { + rs.executeUpdate("delete from FnaBudgetInfoPageSize where userId=?", userId); + rs.executeUpdate("insert into FnaBudgetInfoPageSize (userId, pageSize) values (?, ?)", userId, pageSize); + } + + return pageSize; + } + + /** + * 转义 & " ' < > 空格 这些html特殊字符
+ * str始终先进行trim后再进行转义处理 + * + * @param str + * @return + */ + public static String escapeHtmlTrim(String str) { + return FnaCommon.escapeHtml(Util.null2String(str).trim()); + } + + /** + * 转义 & " ' < > 空格 这些html特殊字符
+ * str=null,直接返回空字符串 + * + * @param str + * @return + */ + public static String escapeHtmlNull(String str) { + if (str == null) { + return ""; + } else { + return FnaCommon.escapeHtml(str); + } + } + + /** + * 转义 & " ' < > 空格 这些html特殊字符 + * + * @param str + * @return + */ + public static String escapeHtml(String str) { + if (str == null || "".equals(str)) { + return str; + } + return str + .replaceAll("\\&", "&") + .replaceAll("\"", """) + .replaceAll("\'", "'") + .replaceAll("\\<", "<") + .replaceAll("\\>", ">") + ; + } + + /** + * 转义 & " ' < > 这些xml特殊字符 + * + * @param str + * @return + */ + public static String escapeXml(String str) { + if (str == null || "".equals(str)) { + return str; + } + return str + .replaceAll("\\&", "&") + .replaceAll("\"", """) + .replaceAll("\'", "'") + .replaceAll("\\<", "<") + .replaceAll("\\>", ">") + ; + } + + + /** + * 将url参数值中的被转义的编码解码成实际的值 + * + * @param str + * @return + */ + public static String decodeURL(String str) { + if (str == null || "".equals(str)) { + return str; + } + return str + .replaceAll("%20", " ") + .replaceAll("%22", "\"") + .replaceAll("%23", "#") + .replaceAll("%28", "(") + .replaceAll("%29", ")") + .replaceAll("%2B", "+") + .replaceAll("%2C", ",") + .replaceAll("%2F", "/") + .replaceAll("%3A", ":") + .replaceAll("%3B", ";") + .replaceAll("%3C", "<") + .replaceAll("%3D", "=") + .replaceAll("%3E", ">") + .replaceAll("%3F", "?") + .replaceAll("%4o", "@") + .replaceAll("%5C", "\\\\") + .replaceAll("%7C", "|") + .replaceAll("%26", "&") + .replaceAll("%25", "%") + ; + } + + /** + * 给url参数值转义成url中可以传送的编码 + * + * @param str + * @return + */ + public static String encodeURL(String str) { + if (str == null || "".equals(str)) { + return str; + } + return str + .replaceAll("\\%", "%25") + .replaceAll("\\&", "%26") + .replaceAll(" ", "%20") + .replaceAll("\"", "%22") + .replaceAll("\\#", "%23") + .replaceAll("\\(", "%28") + .replaceAll("\\)", "%29") + .replaceAll("\\+", "%2B") + .replaceAll("\\,", "%2C") + .replaceAll("\\/", "%2F") + .replaceAll("\\:", "%3A") + .replaceAll("\\;", "%3B") + .replaceAll("\\<", "%3C") + .replaceAll("\\=", "%3D") + .replaceAll("\\>", "%3E") + .replaceAll("\\?", "%3F") + .replaceAll("\\@", "%4o") + .replaceAll("\\\\", "%5C") + .replaceAll("\\|", "%7C") + ; + } + + /** + * 系统表单 + * 获得相应具体某个流程流转中某个字段是否可编辑状态(只要有任意一个节点是可编辑状态即返回true) + * + * @param fieldName + * @param requestId + * @param currentNodeId + * @param detailtable + * @return + */ + public static boolean isEditFieldByReqId(String fieldName, int requestId, int currentNodeId, String detailtable) { + + boolean isEdit = FnaCommon.isEditField(fieldName, currentNodeId, detailtable); + if (isEdit) { + return true; + } + + if (requestId > 0) { + RecordSet rs = new RecordSet(); + //签字类型:0:批准;1:保存;2:提交;3:退回;4:重新打开;5:删除;6:激活;7:转发;9:批注;e:强制归档;t:抄送;s:督办;i:??; + rs.executeSql("select DISTINCT nodeid from workflow_requestLog where logtype in ('0','2') and requestid = " + requestId); + while (rs.next()) { + int nodeid = rs.getInt("nodeid"); + isEdit = FnaCommon.isEditField(fieldName, nodeid, detailtable); + if (isEdit) { + return true; + } + } + } + return false; + } + + /** + * 系统表单 + * 获得相应节点中某个字段是否是可编辑状态 + * + * @param fieldName 字段名称 + * @param nodeid 节点id + * @param detailtable + * @return + */ + public static boolean isEditField(String fieldName, int nodeid, String detailtable) { + List> fieldList = FnaCommon.getWfFieldFormInfoByNodeId(nodeid); + return FnaCommon.isEditField(fieldName, fieldList, detailtable); + } + + /** + * 系统表单 + * 获得相应节点字段list中某个字段是否是可编辑状态 + * + * @param fieldName 字段名称 + * @param fieldList 节点字段list + * @param detailtable 明细表表名 + * @return + */ + public static boolean isEditField(String fieldName, List> fieldList, String detailtable) { + int fieldListLen = fieldList.size(); + for (int i = 0; i < fieldListLen; i++) { + HashMap fieldHm = (HashMap) fieldList.get(i); + + String _isedit = Util.null2String(fieldHm.get("isedit")); + String _fieldname = Util.null2String(fieldHm.get("fieldname")); + String _detailtable = Util.null2String(fieldHm.get("detailtable")); + + if (_fieldname.equalsIgnoreCase(fieldName) && _detailtable.equalsIgnoreCase(detailtable)) { + if ("1".equalsIgnoreCase(_isedit)) { + return true; + } + return false; + } + } + return false; + } + + /** + * 系统表单 + * 获得对应流程节点,所有表单字段查看编辑状态: + * fieldid;isview;isedit;ismandatory;orderid;dsporder;fieldname;detailtable; + * + * @param nodeid 节点id + * @return List> 节点字段list + */ + public static List> getWfFieldFormInfoByNodeId(int nodeid) { + RecordSet rs = new RecordSet(); + RecordSet rs1 = new RecordSet(); + + List> fieldList = new ArrayList>(); + + rs.executeProc("workflow_FieldForm_Select", nodeid + ""); + while (rs.next()) { + String fieldid = Util.null2String(rs.getString("fieldid")).trim(); + String isview = Util.null2String(rs.getString("isview")).trim(); + String isedit = Util.null2String(rs.getString("isedit")).trim(); + String ismandatory = Util.null2String(rs.getString("ismandatory")).trim(); + String orderid = Util.null2String(rs.getString("orderid")).trim(); + String dsporder = Util.null2String(rs.getString("dsporder")).trim(); + + String fieldname = ""; + String detailtable = ""; + String sql1 = "SELECT fieldname, detailtable FROM workflow_billfield where id = " + fieldid; + rs1.executeSql(sql1); + if (rs1.next()) { + fieldname = Util.null2String(rs1.getString("fieldname")).trim(); + detailtable = Util.null2String(rs1.getString("detailtable")).trim(); + } + + HashMap fieldHm = new HashMap(); + + fieldHm.put("fieldid", fieldid); + fieldHm.put("isview", isview); + fieldHm.put("isedit", isedit); + fieldHm.put("ismandatory", ismandatory); + fieldHm.put("orderid", orderid); + fieldHm.put("dsporder", dsporder); + fieldHm.put("fieldname", fieldname); + fieldHm.put("detailtable", detailtable); + + fieldList.add(fieldHm); + } + + return fieldList; + } + + /** + * 保存系统日志 + * 关于系统日志属性改造的说明 + * + * @param relatedId 处理记录id + * @param relatedName 处理记录名称 + * @param operateType SptmForCowork.getTypeName + * @param operateDesc 操作的类型 + * @param operateItem + * @param operateUserid 操作用户id + * @param clientAddress 客户端ip地址 + * @param operatesmalltype 系统维护类型(默认值):SysMaintenanceLog.OPERATE_0;系统操作类型: SysMaintenanceLog.OPERATE_1; + */ + public void saveSysLogInfo(int relatedId, String relatedName, + String operateType, String operateDesc, String operateItem, + int operateUserid, String clientAddress, int operatesmalltype) { + try { + SysMaintenanceLog log = new SysMaintenanceLog(); + log.resetParameter(); + log.setRelatedId(relatedId); + log.setRelatedName(relatedName); + log.setOperateType(operateType); + log.setOperateDesc(operateDesc); + log.setOperateItem(operateItem); + log.setOperateUserid(operateUserid); + log.setClientAddress(clientAddress); + log.setOperatesmalltype(operatesmalltype); + log.setSysLogInfo(); + } catch (Exception e) { + new BaseBean().writeLog(e); + } + } + + /** + * 流程存为新版时:处理财务模块相关多版本支持代码 + * + * @param oldWfId 原流程(版本) + * @param newWfId 新流程(版本) + */ + public static void fnaSaveAsVersion(int oldWfId, int newWfId) throws Exception { + fnaSaveAsVersion(oldWfId, newWfId, "", null); + } + + /** + * 流程存为新版时:处理财务模块相关多版本支持代码 + * + * @param oldWfId 原流程(版本) + * @param newWfId 新流程(版本) + */ + public static void fnaSaveAsVersion(int oldWfId, int newWfId, String ip, User user) throws Exception { + if (oldWfId <= 0 || newWfId <= 0) { + return; + } + + RecordSet rs1 = new RecordSet(); + RecordSet rs2 = new RecordSet(); + + WorkflowVersion wfVer = new WorkflowVersion(); + + String sql1 = ""; + + if (true) { + sql1 = "select * from wf_fna_initWfInfo where workflowId = " + oldWfId; + rs1.executeSql(sql1); + if (rs1.next()) { + int _formid = rs1.getInt("formId"); + int _fnaWfType1 = rs1.getInt("fnaWfType1"); + int _fnaWfType2 = rs1.getInt("fnaWfType2"); + FnaWfInitE8.save_wf_fna_initWfInfo(newWfId, _formid, _fnaWfType1, _fnaWfType2); + } + } + + if (true) {//处理:路径设置》高级设置》浏览数据定义: + sql1 = "select count(*) cnt from FnaFeetypeWfbrowdef where workflowid = " + newWfId; + rs1.executeSql(sql1); + if (!rs1.next() || rs1.getInt("cnt") <= 0) { + sql1 = "select * from FnaFeetypeWfbrowdef where workflowid = " + oldWfId; + rs1.executeSql(sql1); + while (rs1.next()) { + int oldMainid = (rs1.getInt("id")); + int fieldid = (rs1.getInt("fieldid")); + int viewtype = (rs1.getInt("viewtype")); + int fieldtype = (rs1.getInt("fieldtype")); + String title = (rs1.getString("title")); + + String sql2 = ""; + sql2 = "insert into FnaFeetypeWfbrowdef(workflowid,fieldId,viewType,fieldType,title)\n" + + " values " + + " (" + newWfId + "," + fieldid + "," + viewtype + "," + fieldtype + ",'" + StringEscapeUtils.escapeSql(title) + "')"; + rs2.executeSql(sql2); + + sql2 = "select max(id) maxid from FnaFeetypeWfbrowdef where fieldId = " + fieldid + " and workflowid = " + newWfId; + rs2.executeSql(sql2); + if (rs2.next()) { + int newMainid = rs2.getInt("maxid"); + + sql2 = "insert into Fnafeetypewfbrowdef_Dt1 (mainid,refid)" + + " select " + newMainid + ",refid from Fnafeetypewfbrowdef_Dt1 b where b.mainid =" + oldMainid; + rs2.executeSql(sql2); + } + } + } + } + + sql1 = "select count(*) cnt from fnafeewfinfo where workflowid = " + oldWfId; + rs1.executeSql(sql1); + if (rs1.next() && rs1.getInt("cnt") > 0) { + } else { + sql1 = "select a.activeVersionID from workflow_base a where id = " + oldWfId; + rs1.executeSql(sql1); + if (rs1.next()) { + int activeVersionID = rs1.getInt("activeVersionID"); + if (activeVersionID > 0) { + sql1 = "select a.id, a.workflowname, a.version, a.activeVersionID from workflow_base a \n" + + " where a.activeVersionID = " + activeVersionID + " \n" + + " order by case when (a.version is null or a.version = '') then 1 else a.version end DESC"; + rs1.executeSql(sql1); + while (rs1.next()) { + int wf_id = rs1.getInt("id"); + String sql2 = "select count(*) cnt from fnafeewfinfo where workflowid = " + wf_id; + rs2.executeSql(sql2); + if (rs2.next() && rs2.getInt("cnt") > 0) { + oldWfId = wf_id; + break; + } + } + } + } + } + + if (true) {//费用流程凭证集成配置 + RecordSet rs3 = new RecordSet(); + String dbtype = rs2.getDBType(); + if (dbtype.equals("oracle") && rs2.getOrgindbtype().equals("dm")) dbtype = "dm"; + String guid1SQlStr = FnaCommon.getPrimaryKeyGuid1SqlStr(dbtype); + + sql1 = "select count(*) cnt from fnaVoucherXml where workflowid = " + newWfId; + rs1.executeSql(sql1); + if (!rs1.next() || rs1.getInt("cnt") <= 0) { + sql1 = "select id, xmlname, xmlmemo, xmlversion, xmlencoding, " +//1 + " workflowid, typename, datasourceid, interfacesaddress, profession " +//2 + " from fnavoucherxml " + + " where workflowid = " + oldWfId; + rs1.executeSql(sql1); + while (rs1.next()) { + //1 + int oldFnaVoucherXmlId = rs1.getInt("id"); + String xmlname = Util.null2String(rs1.getString("xmlname")).trim(); + String xmlmemo = Util.null2String(rs1.getString("xmlmemo")).trim(); + String xmlversion = Util.null2String(rs1.getString("xmlversion")).trim(); + String xmlencoding = Util.null2String(rs1.getString("xmlencoding")).trim(); + //2 +// int workflowid = rs1.getInt("workflowid"); + String typename = Util.null2String(rs1.getString("typename")).trim(); + String datasourceid = Util.null2String(rs1.getString("datasourceid")).trim(); + String interfacesaddress = Util.null2String(rs1.getString("interfacesaddress")).trim(); + int profession = rs1.getInt("profession"); + + String sql2 = ""; + sql2 = "insert into fnavoucherxml\n" + + " (xmlname, xmlmemo, xmlversion, xmlencoding, " +//1 + " workflowid, typename, datasourceid, interfacesaddress, profession)\n" +//2 + " values\n" + + " ('" + StringEscapeUtils.escapeSql(xmlname) + "', '" + StringEscapeUtils.escapeSql(xmlmemo) + "', '" + StringEscapeUtils.escapeSql(xmlversion) + "', '" + StringEscapeUtils.escapeSql(xmlencoding) + "', " +//1 + " " + newWfId + ", '" + StringEscapeUtils.escapeSql(typename) + "', '" + StringEscapeUtils.escapeSql(datasourceid) + "', '" + StringEscapeUtils.escapeSql(interfacesaddress) + "', " + profession + ")";//2 + rs2.executeSql(sql2); + + sql2 = "select max(id) maxid from fnavoucherxml where workflowid = " + newWfId; + rs2.executeSql(sql2); + if (rs2.next()) { + int newFnaVoucherXmlId = rs2.getInt("maxid"); + + if ("mysql".equalsIgnoreCase(dbtype)) { + //TODO 经过排查客户问题,发现针对mysql数据库,函数 replace(uuid(),'-','') 会出现UUID重复的情况,导致SQL执行失败,报主键重复 + //修改为 批量插入 + List paraList = new ArrayList(); + sql2 = " select fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 + " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 + " fieldvalue "+//3 + " from fnafinancesetting " + + " where fnaVoucherXmlId = "+oldFnaVoucherXmlId; + while(rs3.next()){ + String fieldname = Util.null2String(rs3.getString("fieldname")); + String fieldvaluetype1 = Util.null2String(rs3.getString("fieldvaluetype1")); + String fieldvaluetype2 = Util.null2String(rs3.getString("fieldvaluetype2")); + String fielddbtbname = Util.null2String(rs3.getString("fielddbtbname")); + String detailtable = Util.null2String(rs3.getString("detailtable")); + String fielddbname = Util.null2String(rs3.getString("fielddbname")); + String fielddbtype = Util.null2String(rs3.getString("fielddbtype")); + String datasourceids = Util.null2String(rs3.getString("datasourceid")); + String fieldvalue = Util.null2String(rs3.getString("fieldvalue")); + + String guid1 = FnaCommon.getPrimaryKeyGuid1(); + paraList.add("" + +guid1 + Util.getSeparator() + newFnaVoucherXmlId + Util.getSeparator() + fieldname + Util.getSeparator() + fieldvaluetype1 + Util.getSeparator() + fieldvaluetype2 //1 ++ Util.getSeparator() + fielddbtbname + Util.getSeparator() + detailtable + Util.getSeparator() + fielddbname + Util.getSeparator() + fielddbtype + Util.getSeparator() + datasourceids //2 ++ Util.getSeparator() + fieldvalue //3 + ); + } //while end + BatchRecordSet brs = new BatchRecordSet(); + brs.executeSqlBatch( "insert into fnafinancesetting \n" + + " (guid1, fnavoucherxmlid, fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 + " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 + " fieldvalue)\n" + //3 + " values(?,?,?,?,?,?,?,?,?,?,?)", paraList); + + }else{ + sql2 = "insert into fnafinancesetting\n" + + " (guid1, fnavoucherxmlid, fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 + " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 + " fieldvalue)\n" + //3 + " select " + guid1SQlStr + ", " + newFnaVoucherXmlId + ", fieldname, fieldvaluetype1, fieldvaluetype2, " +//1 + " fielddbtbname, detailtable, fielddbname, fielddbtype, datasourceid, " +//2 + " fieldvalue " +//3 + " from fnafinancesetting " + + " where fnaVoucherXmlId = " + oldFnaVoucherXmlId; + rs2.executeSql(sql2); + } + + + sql2 = "insert into fnavoucherxmlcontent\n" + + " (fnavoucherxmlid, contenttype, contentparentid, contentname, contentvaluetype, " +//1 + " contentmemo, orderid, isnullnotprint, contentvalue, parameter, " +//2 + " isnullnotprintnode, oldId)\n" + //3 + " select " + newFnaVoucherXmlId + ", contenttype, contentparentid, contentname, contentvaluetype, " +//1 + " contentmemo, orderid, isnullnotprint, contentvalue, parameter, " +//2 + " isnullnotprintnode, id " +//3 + " from fnavoucherxmlcontent " + + " where fnavoucherxmlid = " + oldFnaVoucherXmlId; + rs2.executeSql(sql2); + + List newFnavoucherxmlcontentid_list = new ArrayList(); + List oldContentparentid_list = new ArrayList(); + HashMap fnavoucherxmlcontentid_hm = new HashMap(); + sql2 = "select * from fnavoucherxmlcontent where fnavoucherxmlid = " + newFnaVoucherXmlId; + rs2.executeSql(sql2); + while (rs2.next()) { + int newFnavoucherxmlcontentid = Util.getIntValue(rs2.getString("id"), 0); + int oldFnavoucherxmlcontentid = Util.getIntValue(rs2.getString("oldId"), 0); + int oldContentparentid = Util.getIntValue(rs2.getString("contentparentid"), 0); + + newFnavoucherxmlcontentid_list.add(newFnavoucherxmlcontentid + ""); + oldContentparentid_list.add(oldContentparentid + ""); + fnavoucherxmlcontentid_hm.put(oldFnavoucherxmlcontentid + "", newFnavoucherxmlcontentid + ""); + } + int newFnavoucherxmlcontentid_listLen = newFnavoucherxmlcontentid_list.size(); + for (int i = 0; i < newFnavoucherxmlcontentid_listLen; i++) { + int newFnavoucherxmlcontentid = Util.getIntValue(newFnavoucherxmlcontentid_list.get(i), 0); + int oldContentparentid = Util.getIntValue(oldContentparentid_list.get(i), 0); + + int newContentparentid = Util.getIntValue(fnavoucherxmlcontentid_hm.get(oldContentparentid + ""), 0); + + String sql3 = "update fnavoucherxmlcontent " + + " set contentparentid = " + newContentparentid + " " + + " where id = " + newFnavoucherxmlcontentid; + rs3.executeSql(sql3); + } + + sql2 = "insert into fnavoucherxmlcontentdset\n" + + " (fnavoucherxmlid, fnavoucherxmlcontentid, dsetalias, inittiming, fnadatasetid, " +//1 + " dsetmemo, orderid, parameter)\n" + //2 + " select " + newFnaVoucherXmlId + ", fnavoucherxmlcontentid, dsetalias, inittiming, fnadatasetid, " +//1 + " dsetmemo, orderid, parameter " +//2 + " from fnavoucherxmlcontentdset " + + " where fnavoucherxmlid = " + oldFnaVoucherXmlId; + rs2.executeSql(sql2); + + sql2 = "select * from fnavoucherxmlcontentdset where fnavoucherxmlid = " + newFnaVoucherXmlId; + rs2.executeSql(sql2); + while (rs2.next()) { + int newFnavoucherxmlcontentdsetid = Util.getIntValue(rs2.getString("id"), 0); + int oldFnavoucherxmlcontentid = Util.getIntValue(rs2.getString("fnavoucherxmlcontentid"), 0); + + int newFnavoucherxmlcontentid = Util.getIntValue(fnavoucherxmlcontentid_hm.get(oldFnavoucherxmlcontentid + ""), 0); + + String sql3 = "update fnavoucherxmlcontentdset " + + " set contentparentid = " + newFnavoucherxmlcontentid + " " + + " where id = " + newFnavoucherxmlcontentdsetid; + rs3.executeSql(sql3); + } + + + } + } + } + } + + if (true) {//处理:费控流程定义 +// 10 fnaFeeWfInfo 费控流程定义表 +// 11 fnaFeeWfInfoField 费控流程字段对应关系定义表 +// 12 fnaFeeWfInfoLogic 费控流程提交校验定义表 +// Fnafeewfinfologicreverse +// fnaFeeWfInfoLogicAdvanceR +// fnafeewfinfonodectrl +// fnaControlScheme_FeeWfInfo + + RecordSet rs3 = new RecordSet(); + RecordSet rs4 = new RecordSet(); + + sql1 = "select count(*) cnt from fnafeewfinfo where workflowid = " + newWfId; + rs1.executeSql(sql1); + if (!rs1.next() || rs1.getInt("cnt") <= 0) { + boolean need_removeCache_fnaFeeWfInfoComInfo = false; + sql1 = "select * " +//3 + " from fnafeewfinfo " + + " where workflowid = " + oldWfId; + rs1.executeSql(sql1); + while (rs1.next()) { + need_removeCache_fnaFeeWfInfoComInfo = true; + //1 + int oldMainid = rs1.getInt("id"); + // int workflowid = rs1.getInt("workflowid"); + int enable = rs1.getInt("enable"); + String lastmodifieddate = Util.null2String(rs1.getString("lastmodifieddate")).trim(); + String templatefile = Util.null2String(rs1.getString("templatefile")).trim(); + //2 + String templatefilemobile = Util.null2String(rs1.getString("templatefilemobile")).trim(); + String fnawftype = Util.null2String(rs1.getString("fnawftype")).trim(); + int fnawftypeborrow = rs1.getInt("fnawftypeborrow"); + int fnawftypecoll = rs1.getInt("fnawftypecoll"); + int fnawftypereverse = rs1.getInt("fnawftypereverse"); + //3 + int fnawftypereim = rs1.getInt("fnawftypereim"); + String overstandardtips = Util.null2String(rs1.getString("overstandardtips")).trim(); + int isallnodescontrol = rs1.getInt("isallnodescontrol"); + int fnaWfTypeReverseAdvance = Util.getIntValue(rs1.getString("fnaWfTypeReverseAdvance"), 0); + int budgetCanBeNegative = Util.getIntValue(rs1.getString("budgetCanBeNegative"), 0); + + //多明细 start + int fnaWfTypeMultiReim = Util.getIntValue(rs1.getString("fnaWfTypeMultiReim"), 0);//启用多明细表报销 + //启用多明细表报销,开关开启:当前流程的任意明细表都 【 可以用于也仅可以用于 】 费用报销;不再支持"还款,预付款冲销"功能; + if (fnaWfTypeMultiReim == 1) { + fnawftypecoll = 0;//启用还款业务逻辑 + fnawftypereverse = 0;//启用冲销业务逻辑 + fnaWfTypeReverseAdvance = 0;//启用预申请业务逻辑 + sql1 = " insert into fnaFeeWfInfoMultiField(workflowId,dtlIdx,fieldName,fieldFnaType, fieldMemo) " + + " select " + newWfId + ",dtlIdx,fieldName,fieldFnaType, fieldMemo from fnaFeeWfInfoMultiField where workflowId = " + oldWfId; + rs2.executeSql(sql1); + } + //多明细 end + + //承担主体无预算自动向上查询 总开关; 0=默认=关闭; 1=开启 + int noBudgetQueryUp = Util.getIntValue(rs1.getString("noBudgetQueryUp"), 0); + //承担主体无预算时自动向上查询 分部; 0=默认=关闭; 1=开启=逐级查询上级分部 + int noBudgetQueryUp1 = Util.getIntValue(rs1.getString("noBudgetQueryUp1"), 0); + //承担主体无预算时自动向上查询 部门; 0=默认=关闭; 1=开启=逐级查询上级部门; 2=开启=逐级查询上级部门及分部 + int noBudgetQueryUp2 = Util.getIntValue(rs1.getString("noBudgetQueryUp2"), 0); + //承担主体无预算时自动向上查询 人员; 0=默认=关闭; 1=开启=逐级查询上级部门; 2=开启=逐级查询上级部门及分部 + int noBudgetQueryUp3 = Util.getIntValue(rs1.getString("noBudgetQueryUp3"), 0); + + String sql2 = ""; + sql2 = "insert into fnafeewfinfo\n" + + " (workflowid, enable, lastmodifieddate, templatefile, " +//1 + " templatefilemobile, fnawftype, fnawftypeborrow, fnawftypecoll, fnawftypereverse, " +//2 + " fnawftypereim, overstandardtips, isallnodescontrol, fnaWfTypeReverseAdvance, " + + " budgetCanBeNegative, " + + " noBudgetQueryUp, " + + " noBudgetQueryUp1, " + + " noBudgetQueryUp2, " + + " noBudgetQueryUp3, " + + " fnaWfTypeMultiReim)\n" + //3 + " values\n" + + " (" + newWfId + ", " + enable + ", '" + StringEscapeUtils.escapeSql(lastmodifieddate) + "', '" + StringEscapeUtils.escapeSql(templatefile) + "', " +//1 + " '" + StringEscapeUtils.escapeSql(templatefilemobile) + "', '" + StringEscapeUtils.escapeSql(fnawftype) + "', " + fnawftypeborrow + ", " + fnawftypecoll + ", " + fnawftypereverse + ", " +//2 + " " + fnawftypereim + ", '" + StringEscapeUtils.escapeSql(overstandardtips) + "', " + isallnodescontrol + ", " + fnaWfTypeReverseAdvance + ", " + + budgetCanBeNegative + ", " + + noBudgetQueryUp + ", " + + noBudgetQueryUp1 + ", " + + noBudgetQueryUp2 + ", " + + noBudgetQueryUp3 + ", " + + fnaWfTypeMultiReim + ")";//3 + rs2.executeSql(sql2); + + sql2 = "select max(id) maxid from fnafeewfinfo where workflowid = " + newWfId; + rs2.executeSql(sql2); + if (rs2.next()) { + int newMainid = rs2.getInt("maxid"); + + String sql3 = "select fnaControlSchemeId from fnaControlScheme_FeeWfInfo where fnaFeeWfInfoId = " + oldMainid; + rs3.executeSql(sql3); + while (rs3.next()) { + int fnaControlSchemeId = rs3.getInt("fnaControlSchemeId"); + + String sql4 = "insert into fnaControlScheme_FeeWfInfo (fnaControlSchemeId, fnaFeeWfInfoId) values (" + fnaControlSchemeId + ", " + newMainid + ")"; + rs4.executeSql(sql4); + } + + sql2 = "insert into fnafeewfinfofield\n" + + " (mainid, workflowid, formid, fieldtype, fieldid, " +//1 + " isdtl, showalltype, dtlnumber, fieldvalue, fieldvaltype, " +//2 + " fcsguid1, fieldvaluewfsys, tabindex, " +//3 + " isWfFieldLinkage, controlflowSubmission, automaticTake, controlBorrowingWf) \n" + //4 + " select " + newMainid + ", " + newWfId + ", formid, fieldtype, fieldid, " +//1 + " isdtl, showalltype, dtlnumber, fieldvalue, fieldvaltype, " +//2 + " fcsguid1, fieldvaluewfsys, tabindex, " +//3 + " isWfFieldLinkage, controlflowSubmission, automaticTake, controlBorrowingWf " +//4 + " from fnafeewfinfofield " + + " where workflowid = " + oldWfId + " " + + " and mainid = " + oldMainid; + rs2.executeSql(sql2); + + sql2 = "insert into fnafeewfinfologic\n" + + " (mainid, kmidscondition, kmids, orgtype, orgidscondition, " +//1 + " orgids, intensity, promptsc, prompttc, prompten, " +//2 + " totalamtverification, isapplicationbudgetwf)\n" + //3 + " select " + newMainid + ", kmidscondition, kmids, orgtype, orgidscondition, " +//1 + " orgids, intensity, promptsc, prompttc, prompten, " +//2 + " totalamtverification, isapplicationbudgetwf " +//3 + " from fnafeewfinfologic " + + " where mainid = " + oldMainid; + rs2.executeSql(sql2); + + sql2 = "insert into fnafeewfinfologicreverse\n" + + " (mainid, rule1, rule1intensity, rule2, rule2intensity, " +//1 + " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 + " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 + " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 + " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 + " prompten5)\n" + //6 + " select " + newMainid + ", rule1, rule1intensity, rule2, rule2intensity, " +//1 + " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 + " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 + " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 + " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 + " prompten5 " +//6 + " from fnafeewfinfologicreverse " + + " where mainid = " + oldMainid; + rs2.executeSql(sql2); + + sql2 = "insert into fnaFeeWfInfoLogicAdvanceR\n" + + " (mainid, rule1, rule1intensity, rule2, rule2intensity, " +//1 + " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 + " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 + " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 + " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 + " prompten5)\n" + //6 + " select " + newMainid + ", rule1, rule1intensity, rule2, rule2intensity, " +//1 + " rule3, rule3intensity, rule4, rule4intensity, rule5, " +//2 + " rule5intensity, promptsc, prompttc, prompten, promptsc2, " +//3 + " prompttc2, prompten2, promptsc3, prompttc3, prompten3, " +//4 + " promptsc4, prompttc4, prompten4, promptsc5, prompttc5, " +//5 + " prompten5 " +//6 + " from fnaFeeWfInfoLogicAdvanceR " + + " where mainid = " + oldMainid; + rs2.executeSql(sql2); + + + rs2.executeUpdate("delete from fnaFeeWfInfoMultiField where workflowId=?", newWfId); + sql2 = "insert into fnaFeeWfInfoMultiField\n" + + " (workflowId, dtlIdx, fieldName, fieldFnaType, fieldMemo)\n" + //1 + " select " + newWfId + ", dtlIdx, fieldName, fieldFnaType, fieldMemo " +//1 + " from fnaFeeWfInfoMultiField " + + " where workflowId = " + oldWfId; + rs2.executeUpdate(sql2); + + sql2 = "select nodeid, checkway " + + " from fnafeewfinfonodectrl " + + " where mainid = " + oldMainid; + rs2.executeSql(sql2); + while (rs2.next()) { + int nodeid_old = Util.getIntValue(rs2.getString("nodeid"), 0); + String checkway = Util.null2String(rs2.getString("checkway")).trim(); + + int nodeid_new = wfVer.getNodeidByWfidAndOldnodeid(newWfId, nodeid_old); + if (nodeid_new > 0) { + sql3 = "insert into fnafeewfinfonodectrl\n" + + " (mainid, nodeid, checkway)\n" + + " values " + + " (" + newMainid + ", " + nodeid_new + ", '" + StringEscapeUtils.escapeSql(checkway) + "') "; + rs3.executeSql(sql3); + } + } + + + //移除指定workflowId缓存中的-自定义费控流程流程的字段对应关系Map对象 + FnaWfSetCache.removeFnaWfFieldSetMap(newWfId); + //通过读取配置信息更新缓存 + FnaCommon.getFnaWfFieldInfo4Expense(newWfId, new HashMap()); + } + } + if (need_removeCache_fnaFeeWfInfoComInfo) { + new FnaFeeWfInfoComInfo().removeCache(); + } + } + } + + //发票去重设置生成新版本 + if (true) { + //1.fnaInvoiceWfInfo + //2.fnaInvoiceFeeWfInfoLogic + //3.fnaInvoiceWfInfoField + + sql1 = "select count(*) cnt from fnaInvoiceWfInfo where workflowid = " + newWfId; + rs1.executeSql(sql1); + if (!rs1.next() || rs1.getInt("cnt") <= 0) { + sql1 = "select * " +//3 + " from fnaInvoiceWfInfo " + + " where workflowid = " + oldWfId; + rs1.executeSql(sql1); + while (rs1.next()) { + int oldMainid = rs1.getInt("id"); + int enable = rs1.getInt("enable"); + String lastmodifieddate = Util.null2String(rs1.getString("lastmodifieddate")).trim(); + //fnaInvoiceWfInfo + String sql2 = "insert into fnaInvoiceWfInfo (workflowid,enable,lastmodifieddate) values (" + newWfId + "," + enable + ",'" + StringEscapeUtils.escapeSql(lastmodifieddate) + "')"; + rs2.executeSql(sql2); + + sql2 = "select max(id) maxid from fnaInvoiceWfInfo where workflowid = " + newWfId; + rs2.executeSql(sql2); + if (rs2.next()) { + int newMainid = rs2.getInt("maxid"); + //fnaInvoiceWfInfoField + sql2 = "insert into fnaInvoiceWfInfoField\n" + + " (mainid, workflowid, formid, fieldid, " +//1 + " fieldname, tabindex, " +//2 + " dtlnumber, isdtl) \n" + //3 + " select " + newMainid + ", " + newWfId + ", formid, fieldid, " +//1 + " fieldname, tabindex, " +//2 + " dtlnumber, isdtl " +//3 + " from fnaInvoiceWfInfoField " + + " where workflowid = " + oldWfId + " " + + " and mainid = " + oldMainid; + rs2.executeSql(sql2); + } + } + } + } + + //微报账记一笔 可发起的报销流程 + if (true) { + + if (true) {//1可发起的报销流程赋值 + String workflowIds = ""; + rs1.executeQuery("select workflowIds from fnaInvoiceEnterWay"); + if (rs1.next()) { + workflowIds = Util.null2String(rs1.getString("workflowIds")); + } + String[] workflowIdsSplit = workflowIds.split(","); + StringBuffer workflowIdBuffer = new StringBuffer(); + for (int i = 0; i < workflowIdsSplit.length; i++) { + String workFlowId = workflowIdsSplit[i]; + if (oldWfId == Util.getIntValue(workFlowId, 0)) { + workFlowId = workFlowId + "," + newWfId; + } + if (workflowIdBuffer.length() != 0) { + workflowIdBuffer.append(","); + } + workflowIdBuffer.append(workFlowId); + } + if (!workflowIds.equals(workflowIdBuffer.toString())) { + rs1.executeUpdate("update fnaInvoiceEnterWay set workflowIds=?", workflowIdBuffer.toString()); + } + } + if (true) {//2每个记一笔费用类型中 + rs1.executeQuery("select id,workflowIds from fnaTakeOneNote"); + while (rs1.next()) { + String id = Util.null2String(rs1.getString("id")); + String workflowIds = Util.null2String(rs1.getString("workflowIds")); + String[] workflowIdsSplit = workflowIds.split(","); + StringBuilder workflowIdBuffer = new StringBuilder(); + for (String s : workflowIdsSplit) { + String workFlowId = s; + if (oldWfId == Util.getIntValue(workFlowId, 0)) { + workFlowId = workFlowId + "," + newWfId; + } + if (workflowIdBuffer.length() != 0) { + workflowIdBuffer.append(","); + } + workflowIdBuffer.append(workFlowId); + } + if (!workflowIds.equals(workflowIdBuffer.toString())) { + rs2.executeUpdate("update fnaTakeOneNote set workflowIds=? where id=?", workflowIdBuffer.toString(), id); + } + } + } + if (true) {//3每个记一笔费用类型中的字段对应 + String sql = "insert into fnaTakeNoteWfField(mainId,workflowId,formId,fieldId,fieldDbName,dtlNumber,isDtl)" + + " select mainId," + newWfId + ",formId,fieldId,fieldDbName,dtlNumber,isDtl from fnaTakeNoteWfField where workflowId=?"; + rs1.executeUpdate(sql, oldWfId); + } + } + + + { + RecordSet mainIdRs = new RecordSet(); + RecordSet mainTableRs = new RecordSet(); + RecordSet dtlTableRs = new RecordSet(); + RecordSet accountIdRs = new RecordSet(); + String newSubjectMainId = ""; + String newPeriodMainId = ""; + String newBearerMainId = ""; + + String oldSubjectMainId = ""; + String oldBearerMainId = ""; + String oldPeriodMainId = ""; + List subjectAccountList = new ArrayList<>(); + List periodAccountList = new ArrayList<>(); + List bearerAccountList = new ArrayList<>(); + // 开始复制主表 + String subjectConfigInsertSql = + " insert into FnaMultiAccountSubject (workflowId,fieldId,accountId,onlyEnd,isFilter,choice) " + + " select " + newWfId + " ,fieldId,accountId,onlyEnd,isFilter,choice from FnaMultiAccountSubject where workflowId = ? "; + + String periodConfigInsertSql = + " insert into FnaMultiPeriodFilter (workflowId,fieldId,accountId,onlyEnd,isFilter,choice) " + + " select " + newWfId + " ,fieldId,accountId,onlyEnd,isFilter,choice from FnaMultiPeriodFilter where workflowId = ? "; + String bearerConfigInsertSql = + " insert into FnaMultiBearerFilter (workflowId,fieldId,accountId,onlyEnd,isFilter,choice) " + + " select " + newWfId + " ,fieldId,accountId,onlyEnd,isFilter,choice from FnaMultiBearerFilter where workflowId = ? "; + mainTableRs.executeUpdate(subjectConfigInsertSql, oldWfId); + mainTableRs.executeUpdate(periodConfigInsertSql, oldWfId); + mainTableRs.executeUpdate(bearerConfigInsertSql, oldWfId); + + // 根据旧的 wfID 找到对应的 accountId [账套可能是多个] + String subjectAccountSql = " select accountId , fieldId from FnaMultiAccountSubject where workflowId = ? "; + String periodAccountSql = " select accountId , fieldId from FnaMultiPeriodFilter where workflowId = ? "; + String bearerAccountSql = " select accountId , fieldId from FnaMultiBearerFilter where workflowId = ? "; + accountIdRs.executeQuery(subjectAccountSql, oldWfId); + while (accountIdRs.next()) { + subjectAccountList.add(Util.null2String(accountIdRs.getString("accountId")) + "_" +Util.null2String(accountIdRs.getString("fieldId"))); + } + accountIdRs.executeQuery(periodAccountSql, oldWfId); + while (accountIdRs.next()) { + periodAccountList.add(Util.null2String(accountIdRs.getString("accountId")) + "_" +Util.null2String(accountIdRs.getString("fieldId"))); + + } + accountIdRs.executeQuery(bearerAccountSql, oldWfId); + while (accountIdRs.next()) { + bearerAccountList.add(Util.null2String(accountIdRs.getString("accountId")) + "_" +Util.null2String(accountIdRs.getString("fieldId"))); + } + + // 根据旧的的 wfID 和 accountId / fieldId 找到旧的 MainId + // 根据旧的 mainId 找到所对应的数据 + // 把数据复制到新的 mainId + // 更新 FnaMultiAccountSubjectDetail 明细表 + String subjectConfigSelectSql = " select id from FnaMultiAccountSubject where workflowId = ? and accountId = ? and fieldId = ?"; + for (String subjectAccountArray : subjectAccountList) { + String[] split = subjectAccountArray.split("_"); + mainIdRs.executeQuery(subjectConfigSelectSql, newWfId, split[0],split[1]); + if (mainIdRs.next()) { + newSubjectMainId = Util.null2String(mainIdRs.getString("id")); + } + mainIdRs.executeQuery(subjectConfigSelectSql, oldWfId, split[0],split[1]); + if (mainIdRs.next()) { + oldSubjectMainId = Util.null2String(mainIdRs.getString("id")); + } + String subjectConfigDtlInsertSql = + " insert into FnaMultiAccountSubjectDetail ( mainId , subjectId , subjectCode ) " + + " select " + newSubjectMainId + " , subjectId , subjectCode from FnaMultiAccountSubjectDetail where mainId = ? "; + dtlTableRs.executeUpdate(subjectConfigDtlInsertSql, oldSubjectMainId ); + } + + // 更新 FnaMultiPeriodFilterDtl 明细表 + String periodConfigSelectSql = " select id from FnaMultiPeriodFilter where workflowId = ? and accountId = ? and fieldId = ?"; + for (String periodAccountArray : periodAccountList) { + String[] split = periodAccountArray.split("_"); + mainIdRs.executeQuery(periodConfigSelectSql, newWfId, split[0],split[1]); + if (mainIdRs.next()) { + newPeriodMainId = Util.null2String(mainIdRs.getString("id")); + } + + mainIdRs.executeQuery(periodConfigSelectSql, oldWfId, split[0],split[1]); + if (mainIdRs.next()) { + oldPeriodMainId = Util.null2String(mainIdRs.getString("id")); + } + String periodConfigDtlInsertSql = + " insert into FnaMultiPeriodFilterDtl ( mainId , periodId , periodCode ) " + + " select " + newPeriodMainId + " , periodId , periodCode from FnaMultiPeriodFilterDtl where mainId = ? "; + dtlTableRs.executeUpdate(periodConfigDtlInsertSql, oldPeriodMainId); + } + + // 更新 FnaMultiBearerFilterDetail 明细表 + String bearerConfigSelectSql = " select id from FnaMultiBearerFilter where workflowId = ? and accountId = ? and fieldId = ? "; + for (String bearerAccountArray : bearerAccountList) { + String[] split = bearerAccountArray.split("_"); + mainIdRs.executeQuery(bearerConfigSelectSql, newWfId, split[0],split[1]); + if (mainIdRs.next()) { + newBearerMainId = Util.null2String(mainIdRs.getString("id")); + } + + mainIdRs.executeQuery(bearerConfigSelectSql, oldWfId, split[0],split[1]); + if (mainIdRs.next()) { + oldBearerMainId = Util.null2String(mainIdRs.getString("id")); + } + + String bearerConfigDtlInsertSql = + " insert into FnaMultiBearerFilterDetail ( mainId , bearerIds , bearerCode ) " + + " select " + newBearerMainId + " , bearerIds , bearerCode from FnaMultiBearerFilterDetail where mainId = ? "; + dtlTableRs.executeUpdate(bearerConfigDtlInsertSql, oldBearerMainId); + } + } + FnaWorkflowSetUtils.createNewWorkflowVersion(oldWfId, newWfId, ip, user); + } + + + /** + * 左侧填充字符串 + */ + public final static int LEFT = 0; + + /** + * 右侧填充字符串 + */ + public final static int RIGHT = 1; + + /** + * 填充字符串 + * + * @param srcStr + * @param fillChar + * @param length + * @param leftOrRight 填充左侧:DooGlobalBase.LEFT;填充右侧:DooGlobalBase.RIGHT + * @return + */ + public static String fillStr(final String srcStr, final char fillChar, final int length, final int leftOrRight) { + final StringBuilder formatStr = new StringBuilder(""); + for (int i = srcStr.getBytes().length; i < length; i++) { + formatStr.append(fillChar); + } + if (leftOrRight == FnaCommon.LEFT) { + return formatStr.toString() + srcStr; + } else if (leftOrRight == FnaCommon.RIGHT) { + return srcStr + formatStr.toString(); + } + return ""; + } + + /** + * 将dataArray中的数据,按900个一组(每一项之间使用英文半角逗号分隔)set到return的List中去 + * + * @param dataArray + * @return + */ + public static List initData1(String[] dataArray) { + List dataList = Arrays.asList(dataArray); + return FnaCommon.initData1(dataList); + } + + /** + * 将dataList中的数据,按900个一组(每一项之间使用英文半角逗号分隔)set到return的List中去 + * + * @param dataList + * @return + */ + public static List initData1(List dataList) { + List distinct_list = new ArrayList(); + ArrayList list = new ArrayList(); + int dataListLen = dataList.size(); + int sqlCond_Index = 0; + while (sqlCond_Index < dataListLen) { + StringBuffer sqlCond_ids = new StringBuffer(""); + for (int i = 0; i < 900; i++) { + if (sqlCond_Index == dataListLen) { + break; + } + String key1 = dataList.get(sqlCond_Index); + if (!"".equals(key1) && !distinct_list.contains(key1)) { + distinct_list.add(key1); + if (sqlCond_ids.length() > 0) { + sqlCond_ids.append(","); + } + sqlCond_ids.append(key1); + } + sqlCond_Index++; + } + if (sqlCond_ids.length() > 0) { + list.add(sqlCond_ids.toString()); + } + } + return list; + } + + /** + * 获取传入人员id(userid)的相关信息(传入人员、所属部门、所属分部,关联的第一个成本中心的id和名称) + * + * @param dataMapHrm lastname;deptId;deptName;subcomId;subcomName;fccId;fccName; + * @param userid 人员id + */ + public static void getHrmResourceInfo(HashMap dataMapHrm, int userid) { + + FnaSystemSetComInfo fnaSystemSetComInfo = new FnaSystemSetComInfo(); + String fccFilterRule = Util.null2String(fnaSystemSetComInfo.get_fccFilterRule(), "");//成本中心按关联对象过滤 + boolean isFilter = false;//是否需要考虑规则 + //判断 成本中心按关联对象过滤 的已配置的规则 + int count = FnaCostCenter.fccFilterRuleChoice.length; + boolean[] aaaa = new boolean[count]; + for (int i = 1; i <= count; i++) { + if (("," + fccFilterRule + ",").indexOf(("," + i + ",")) > -1) { + aaaa[i - 1] = true; + isFilter = true; + } else { + aaaa[i - 1] = false; + } + } + boolean openSub = (count >= 1 ? aaaa[0] : false); + boolean openDept = (count >= 2 ? aaaa[1] : false); + boolean openHrm = (count >= 3 ? aaaa[2] : false); + + ResourceComInfo rci = null; + try { + rci = new ResourceComInfo(); + } catch (Exception ex) { + } + DepartmentComInfo dci = new DepartmentComInfo(); + SubCompanyComInfo scci = new SubCompanyComInfo(); + + String _userid = String.valueOf(userid); + + String lastname = ""; + String deptId = ""; + String deptName = ""; + String subcomId = ""; + String subcomName = ""; + String fccId = ""; + String fccName = ""; + + if ("1".equals(fnaSystemSetComInfo.get_fnaBudgetOAOrg())) { + lastname = rci.getLastname(_userid); + deptId = rci.getDepartmentID(_userid); + deptName = dci.getDepartmentname(deptId); + subcomId = rci.getSubCompanyID(_userid); + subcomName = scci.getSubCompanyname(subcomId); + } + + if ("1".equals(fnaSystemSetComInfo.get_fnaBudgetCostCenter())) { + RecordSet rs = new RecordSet(); + String sql02 = "select a.id fccId, a.name fccName, b.type " + + " from FnaCostCenter a " + + " join FnaCostCenterDtl b on a.id = b.fccId " + + " where (a.Archive is null or a.Archive = 0) and ((b.objId=? and b.type=1) or (b.objId=? and b.type=2) or (b.objId=? and b.type=3)) " + + " order by b.type desc, a.code, a.name, a.id"; + rs.executeQuery(sql02, Util.getIntValue(subcomId), Util.getIntValue(deptId), userid); + while (rs.next()) { + int type = Util.getIntValue(rs.getString("type")); + if (type == 3 && (!isFilter || (isFilter && openHrm))) {//通过人员关联关系带出成本中心 + fccId = Util.null2String(rs.getString("fccId")); + fccName = Util.null2String(rs.getString("fccName")); + break; + } else if (type == 2 && (!isFilter || (isFilter && openDept))) {//通过人员所属部门关联关系带出成本中心 + fccId = Util.null2String(rs.getString("fccId")); + fccName = Util.null2String(rs.getString("fccName")); + break; + } else if (type == 1 && (!isFilter || (isFilter && openSub))) {//通过人员所属分部关联关系带出成本中心 + fccId = Util.null2String(rs.getString("fccId")); + fccName = Util.null2String(rs.getString("fccName")); + break; + } + } + } + + dataMapHrm.put("lastname", lastname); + dataMapHrm.put("deptId", deptId); + dataMapHrm.put("deptName", deptName); + dataMapHrm.put("subcomId", subcomId); + dataMapHrm.put("subcomName", subcomName); + dataMapHrm.put("fccId", fccId); + dataMapHrm.put("fccName", fccName); + } + + /** + * 判断当前 流程 是否需要进行费控校验 + * + * @param workflowid 流程ID + * @param requestid 请求ID + * @param dataMap 流程字段对应信息,可以传 null + * @param isprint 是否打印日志 + * @param isDB
  • true=校验数据库的值, 此时 _value_main_fieldIdSfysn 可以是任意值; + *
  • false=校验页面上的值,此时 _value_main_fieldIdSfysn 应该取值于页面; + * @param _value_main_fieldIdSfysn 真值 + * @return boolean true=需要费控校验; false=不需要费控校验 + */ + @Deprecated + public static boolean isNeedControl( + int workflowid, + int requestid, + Map dataMap, + boolean isprint, + boolean isDB, + int _value_main_fieldIdSfysn) { + + boolean isControl = true;//默认需要费控 + + int condition = FnaCommon.isNeedControl_New(workflowid, requestid, dataMap, isprint, isDB, _value_main_fieldIdSfysn); + + if (condition == 0 || condition == 2) {//0=预算外;2=预算内,且不做任何校验; + isControl = false; + } else if (condition == 1) {//1=预算内,且按照标准的费控逻辑进行判断; + isControl = true; + } + return isControl; + } + + /** + * 判断当前 流程 所属的费控情况是什么 + * + * @param workflowid 流程ID + * @param requestid 请求ID + * @param dataMap 流程字段对应信息,可以传 null + * @param isprint 是否打印日志 + * @param isDB
  • true=校验数据库的值, 此时 _value_main_fieldIdSfysn 可以是任意值; + *
  • false=校验页面上的值,此时 _value_main_fieldIdSfysn 应该取值于页面; + * @param _value_main_fieldIdSfysn 真值 + * @return int 情况含义: + *
  • 0=预算外; + *
  • 1=预算内,且按照标准的费控逻辑进行判断; + *
  • 2=预算内,且不做任何校验; + */ + public static int isNeedControl_New( + int workflowid, + int requestid, + Map dataMap, + boolean isprint, + boolean isDB, + int _value_main_fieldIdSfysn) { + + int isControl = 1;//默认需要费控 + RecordSet rs = new RecordSet(); + boolean result = false;//sql 语句执行是否成功 + String sql = ""; + int formid = -100; + BaseBean bb = new BaseBean(); + + if (!isDB && _value_main_fieldIdSfysn < 0) {//校验页面上的值 且 页面没有选择值 + isControl = 1; + return isControl; + } + + + if (dataMap == null) { + dataMap = new HashMap(); + FnaCommon.getFnaWfFieldInfo4Expense(workflowid, dataMap); + } + + if (requestid <= 0) {//是新建的流程 + isDB = false; + } + + try { + //(1)下拉框字段filedName + String filedname = Util.null2s(dataMap.get("main_fieldIdSfysn_fieldName"), ""); + if ("".equals(filedname)) { + isControl = 1;//流程没有费控配置信息,则默认需要费控 + return isControl; + } else { + //(2)需要费控 的真值 + List selectvalueList = new ArrayList(); + selectvalueList.add("");//不填默认也是需要费控 + selectvalueList.add("-100");//不填默认也是需要费控 + selectvalueList.add("1");// 1=是=预算内 + + //(3)判断当前流程是否需要费控 + if (isDB) {//是数据库的值,则校验数据库的 + String formValue = "";//字段在表单中的值 + //(3-1)获取流程表单中的下拉框字段的值 + sql = "select * from workflow_base where id = " + workflowid; + result = rs.executeQuery(sql); + if (!result) { + isControl = 1; + return isControl; + } else { + if (rs.next()) { + formid = Math.abs(Util.getIntValue(rs.getString("formid"))); + } + } + + String maintable = "formtable_main_" + formid;//当前流程主表英文名称 + + sql = " select a." + filedname + " as filedValue from " + maintable + " a where a.requestid=" + requestid; + if (isprint) { + bb.writeLog("FnaCommon.java 4700 sql=" + sql); + } + result = rs.executeQuery(sql); + if (!result) { + isControl = 1; + return isControl; + } else { + if (rs.next()) { + formValue = Util.null2String(rs.getString("filedValue"), "").trim(); + } + } + //(3-1)判断表单中的值 是否 是需要费控的值, 是则需要费控;否则不需要费控 + if (selectvalueList.contains(formValue)) { + isControl = 1; + } else { + int ssss = Util.getIntValue(formValue, 1); + if (0 <= ssss && ssss <= 2) { + isControl = ssss; + } else { + isControl = 1; + } + } + } else {//是页面上的值,则校验页面的 + //(3-2)判断表单中的值 是否 是需要费控的值, 是则需要费控;否则不需要费控 + if (selectvalueList.contains(String.valueOf(_value_main_fieldIdSfysn))) { + isControl = 1; + } else { + int ssss = _value_main_fieldIdSfysn; + if (0 <= ssss && ssss <= 2) { + isControl = ssss; + } else { + isControl = 1; + } + } + } + } + } catch (Exception e) { + return isControl; + } + return isControl; + } + + /** + * 校验承担主体ID是否存在 + * + * @param rs2 + * @param organizationtype + * @param organizationid + */ + public static String checkCdzt(RecordSet rs2, int organizationtype, int organizationid) { + String result = ""; + //802939 承担主体会消失,需要校验是否存在 + String sql = ""; + String orgTypeName = ""; + if (organizationtype == 1) { + sql = " select a.id, a.subcompanyname name from HrmSubCompany a where a.id = ? "; + orgTypeName = SystemEnv.getHtmlLabelName(141, 7); + } else if (organizationtype == 2) { + sql = " select a.id, a.departmentname name from HrmDepartment a where a.id = ? "; + orgTypeName = SystemEnv.getHtmlLabelName(124, 7); + } else if (organizationtype == 3) { + sql = " select a.id, a.lastname name from HrmResource a where a.id = ? "; + orgTypeName = SystemEnv.getHtmlLabelName(6087, 7); + } else if (organizationtype == FnaCostCenter.ORGANIZATION_TYPE) { + sql = " select a.id, a.name name from FnaCostCenter a where a.id = ? "; + orgTypeName = SystemEnv.getHtmlLabelName(515, 7); + } + rs2.executeQuery(sql, organizationid); + if (rs2.next()) { + } else { + result = "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003246, weaver.general.ThreadVarLanguage.getLang()) + "" + orgTypeName + "ID : " + organizationid + " " + weaver.systeminfo.SystemEnv.getHtmlLabelName(24233, weaver.general.ThreadVarLanguage.getLang()) + "OA" + weaver.systeminfo.SystemEnv.getHtmlLabelName(10003247, weaver.general.ThreadVarLanguage.getLang()) + ""; + } + + return result; + } +} diff --git a/weaver/fna/invoice/common/FnaInvoiceCommon.java b/weaver/fna/invoice/common/FnaInvoiceCommon.java new file mode 100644 index 0000000..65d2300 --- /dev/null +++ b/weaver/fna/invoice/common/FnaInvoiceCommon.java @@ -0,0 +1,2523 @@ +/* + * + Copyright (c) 2001-2016 泛微软件. + * 泛微协同商务系统,版权所有. + * + */ +package weaver.fna.invoice.common; + +import java.io.*; +import java.security.MessageDigest; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.jsp.JspWriter; + + +import com.api.doc.detail.service.DocSaveService; +import com.engine.fna.util.FnaTakeOneNoteCostTypeUtil; +import com.engine.personalIncomeTax.biz.RecordsBiz; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.http.HttpResponse; +import org.apache.http.client.HttpClient; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; + +import com.cloudstore.dev.api.util.APPManager; + +//import b.a.a.ac.r; + +import org.apache.commons.codec.binary.Base64; + +import net.coobird.thumbnailator.Thumbnails; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import weaver.conn.BatchRecordSet; +import weaver.conn.RecordSet; +import weaver.file.ImageFileManager; +import weaver.fna.e9.po.base.FnaInvoiceLedger; +import weaver.fna.general.FnaCommon; +import weaver.fna.general.FnaLogSqlUtil; +import weaver.fna.invoice.entity.FnaInvoiceInterface; +import weaver.fna.invoice.entity.FnaInvoiceLedgerDetail; +import weaver.fna.invoice.interfaces.baiwang.FnaBaiwangOpenApi; +import weaver.fna.invoice.sdk.SdkInvoiceUtil; +import weaver.fna.invoice.utils.*; +import weaver.general.BaseBean; +import weaver.general.ThreadVarLanguage; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.hrm.company.DepartmentComInfo; +import weaver.hrm.company.SubCompanyComInfo; +import weaver.hrm.resource.ResourceBelongtoComInfo; +import weaver.hrm.resource.ResourceComInfo; +import weaver.sm.SM4Utils; +import weaver.systeminfo.SystemEnv; + + +/** + * 发票公共处理类 + * + */ +@SuppressWarnings({ "rawtypes", "deprecation" }) +public final class FnaInvoiceCommon extends BaseBean{ + + //ea92aec4-45f2-4ef9-9fd6-b25000481ba4,password + public static final String MDE_CODE = "WEAVER_39CE313C5FAAC649EF10269F69C06B3D"; + + //56f3236a-a9c6-40b5-84e6-56749fba3012,client_secret + public static final String MDE_CODE_CLIENT_SECRET = "WEAVER_FFC947EA939B3C5F74A53C8F0D9F99F5"; + + //978c7c07-24f0-4a65-97aa-50f9d4f88ace,sqm + public static final String MDE_CODE_SQM = "WEAVER_D8165D1FBC808F0DFE4016073A3A2A80"; + + //de9a995f-79c5-43dc-b353-4a3f3f82ff6b,SM4加密密钥 + public static String SM4 = ""; + static { + getSM(); + } + public static void getSM(){ + //初始化前fnaEncryptInfo表中无数据,考虑老数据问题,如果fnainvoiceinterface表中有数据,使用老的加密方式,否则随机生成一个 + RecordSet rs = new RecordSet(); + SM4=""; + int sign=0; + rs.executeQuery("select smkey,sign from fnaEncryptInfo"); + if(rs.next()){ + SM4 = Util.null2String(rs.getString("smkey")); + sign = Util.getIntValue(rs.getString("sign"),0); + } + if(sign!=1){ + int cnt=0; + rs.executeQuery("select count(id) cnt from fnainvoiceinterface"); + if(rs.next()){ + cnt = Util.getIntValue(rs.getString("cnt"),0); + } + if(cnt<=0) { + SM4 = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("update fnaEncryptInfo set smkey=?,sign=?",SM4,"1"); + } + + } + } + + + /** 金额格式化对象;保留两位小数*/ + DecimalFormat df = new DecimalFormat("####################################################0.00"); + + /**来自微信*/ + public static final int INVOICESOURCE_WECHAT = 1; + + /**来自国信*/ + public static final int INVOICESOURCE_GUOXIN = 2; + + /**来自台帐*/ + public static final int INVOICESOURCE_TAIZHANG = 3; + + /**来自百望*/ + public static final int INVOICESOURCE_BAIWANG = 4; + + /**来自发票识别*/ + public static final int INVOICESOURCE_OCR = 5; + + /**来自发票识别*/ + public static final int INVOICESOURCE_EMAIL = 6; + + /**初始状态*/ + public static final int INIT_STATUS = 0; + + /**冻结状态*/ + public static final int LOCK_STATUS = 1; + + /**核销状态*/ + public static final int CLOSURE_STATUS = 2; + + /** 批量更新发票状态*/ + private String UPDATEINVOICESTATUS_URL = "https://qyapi.weixin.qq.com/cgi-bin/card/invoice/reimburse/updatestatusbatch?access_token="; + + /** 批量查询电子发票*/ + private String GETINVOICEINFOBATCH_URL = "https://qyapi.weixin.qq.com/cgi-bin/card/invoice/reimburse/getinvoiceinfobatch?access_token="; + + /** corpId 企业号ID*/ + private String corpId = ""; + + /** 最大上传大小 2.5 * 1024 * 1024 */ + public static final double MAX_BYTES = 2.5 * 1000 * 1000; + /** 最大上传大小 2.5 * 1024 * 1024 */ + public static final double MAX_BYTES_RQ = 8.0 * 1000 * 1000; + /**压缩图片质量递减间隔*/ + private static final double DIMINISHING_INTERVAL = 0.5d; + + + + + /** + * 错误信息 + */ + private final static ConcurrentHashMap CONCURRENT_HASH_MAP = new ConcurrentHashMap(); + + static{ + CONCURRENT_HASH_MAP.put("72015", ""+ SystemEnv.getHtmlLabelName(10003250,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72017", ""+ SystemEnv.getHtmlLabelName(10003251,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72023", ""+ SystemEnv.getHtmlLabelName(10003252,weaver.general.ThreadVarLanguage.getLang())+"/"+ SystemEnv.getHtmlLabelName(10003253,weaver.general.ThreadVarLanguage.getLang())+"/App"+ SystemEnv.getHtmlLabelName(10003254,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72024", ""+ SystemEnv.getHtmlLabelName(10003255,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72025", "wx_invoice_token "+ SystemEnv.getHtmlLabelName(2245,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72028", ""+ SystemEnv.getHtmlLabelName(10003256,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72029", ""+ SystemEnv.getHtmlLabelName(10003257,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72030", "mchid "+ SystemEnv.getHtmlLabelName(2245,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72031", ""+ SystemEnv.getHtmlLabelName(10003258,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72035", ""+ SystemEnv.getHtmlLabelName(10003259,weaver.general.ThreadVarLanguage.getLang())+"order_id"+ SystemEnv.getHtmlLabelName(10003260,weaver.general.ThreadVarLanguage.getLang())+"order_id"+ SystemEnv.getHtmlLabelName(10003261,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72036", ""+ SystemEnv.getHtmlLabelName(10003262,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72038", ""+ SystemEnv.getHtmlLabelName(10003263,weaver.general.ThreadVarLanguage.getLang())+" appid 、"+ SystemEnv.getHtmlLabelName(10003264,weaver.general.ThreadVarLanguage.getLang())+" appid 、"+ SystemEnv.getHtmlLabelName(26738,weaver.general.ThreadVarLanguage.getLang())+" order_id "+ SystemEnv.getHtmlLabelName(386675,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72039", ""+ SystemEnv.getHtmlLabelName(10003265,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72040", "Pdf "+ SystemEnv.getHtmlLabelName(10003266,weaver.general.ThreadVarLanguage.getLang())+" pdf"); + CONCURRENT_HASH_MAP.put("72042", ""+ SystemEnv.getHtmlLabelName(10003267,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72043", ""+ SystemEnv.getHtmlLabelName(10003268,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("72044", ""+ SystemEnv.getHtmlLabelName(10003269,weaver.general.ThreadVarLanguage.getLang())+""); + CONCURRENT_HASH_MAP.put("40078", "card_id"+ SystemEnv.getHtmlLabelName(10003270,weaver.general.ThreadVarLanguage.getLang())+" "+ SystemEnv.getHtmlLabelName(10003271,weaver.general.ThreadVarLanguage.getLang())+" "+ SystemEnv.getHtmlLabelName(10003272,weaver.general.ThreadVarLanguage.getLang())+"card_id"+ SystemEnv.getHtmlLabelName(10003273,weaver.general.ThreadVarLanguage.getLang())+""); + } + + /** + * 构造方法 + */ + public FnaInvoiceCommon(){ + corpId = getPropValue("wechatElecInvoice_e9", "corpId").trim(); + } + + /** + * 发票代码校验 + * @param invoiceCode + * @throws Exception + */ + public void checkInvoicecodeIflegal(String invoiceCode,int invoiceTypeSrc) throws Exception{ + int invoiceType = 0; + if(invoiceCode.length() == 10){ + String eight = String.valueOf(invoiceCode.charAt(7)); + if("1".equals(eight) || "2".equals(eight) || "5".equals(eight) || "7".equals(eight)){ + invoiceType = 1; + }else if("3".equals(eight) || "6".equals(eight)){ + invoiceType = 2; + } + }else if(invoiceCode.length() == 12){ + String first = String.valueOf(invoiceCode.charAt(0)); + String elevenTwelve = String.valueOf(invoiceCode.charAt(10)) + String.valueOf(invoiceCode.charAt(11)); + if("0".equals(first) && ("04".equals(elevenTwelve) || "05".equals(elevenTwelve) || "06".equals(elevenTwelve) || "07".equals(elevenTwelve) + || "11".equals(elevenTwelve) || "12".equals(elevenTwelve))){ + invoiceType = 2; + } + } + //没有发票类型 + if(invoiceType == 0){ + throw new Exception("请输入正确的发票代码!"); + } + //发票代码与发票类型不匹配 + if((invoiceTypeSrc == 1 && invoiceType == 1) || (invoiceTypeSrc == 2 && invoiceType == 2)){ + throw new Exception("请输入正确的发票代码!!"); + } + } + + /** + * 新建或更新发票 + * @param request + * @param response + * @param out + * @param user + */ + public void saveInvoice(HttpServletRequest request, HttpServletResponse response, JspWriter out, User user) throws Exception{ + String entryTime = Util.date(2);//录入时间 + int userid = user.getUID(); + int language = user.getLanguage(); + StringBuffer errorMsg = new StringBuffer(); + RecordSet rs = new RecordSet(); + BatchRecordSet brs = new BatchRecordSet(); + int currentid = Util.getIntValue(request.getParameter("id"),0); + String billingDate = Util.null2String(request.getParameter("billingDate")); + String invoiceCode = Util.null2String(request.getParameter("invoiceCode")); + String invoiceNumber = Util.null2String(request.getParameter("invoiceNumber")); + int invoiceType = Util.getIntValue(request.getParameter("invoiceType")); + String checkCode = Util.null2String(request.getParameter("checkCode")); + String seller = Util.null2String(request.getParameter("seller")); + String purchaser = Util.null2String(request.getParameter("purchaser")); + String purchaserTaxNo=Util.null2String(request.getParameter("purchaserTaxNo")); + String salesTaxNo=Util.null2String(request.getParameter("salesTaxNo")); + int indexnum = Util.getIntValue(request.getParameter("linkage_indexnum")); + double priceWithoutTax = Util.getDoubleValue(request.getParameter("priceWithoutTax"),0.00); + double tax = Util.getDoubleValue(request.getParameter("tax"),0.00); + double taxIncludedPrice = Util.getDoubleValue(request.getParameter("taxIncludedPrice"),0.00); + try { + //校验invoiceCode发票代码 + Pattern pattern = Pattern.compile("[0-9]*"); + Matcher isNum = pattern.matcher(invoiceCode); + if(!isNum.matches()){ + throw new Exception(SystemEnv.getHtmlLabelName(10000026, Util.getIntValue(language)));//XXX数据不正确 + } + //存在10位和12位两种情况 + if(invoiceCode.length() != 10 && invoiceCode.length() != 12){ + throw new Exception(SystemEnv.getHtmlLabelName(10000026, Util.getIntValue(language))+"!");//XXX数据不正确 + } + /** + if(invoiceType == 1){//增值税普通发票 + //当位数为12位时,不需要判断,当位数为10位时需判断 + if(invoiceCode.length() == 10 && !invoiceCode.substring(invoiceCode.length()-2, invoiceCode.length()-1).equals("2")){ + throw new Exception(SystemEnv.getHtmlLabelName(10000026,weaver.general.Util.getIntValue(language))+"!!!");//XXX数据不正确 + } + }else if(invoiceType == 2){//增值税专用发票 + if(invoiceCode.length() == 10 && !invoiceCode.substring(invoiceCode.length()-2, invoiceCode.length()-1).equals("3")){ + throw new Exception(SystemEnv.getHtmlLabelName(10000026,weaver.general.Util.getIntValue(language))+"!!!");//XXX数据不正确 + } + if(invoiceCode.length() == 12){ + throw new Exception(SystemEnv.getHtmlLabelName(10000026,weaver.general.Util.getIntValue(language))+"!!!");//XXX数据不正确 + } + } + */ + checkInvoicecodeIflegal(invoiceCode,invoiceType); + //校验invoiceNumber发票号码 + isNum = pattern.matcher(invoiceNumber); + if(!isNum.matches()){ + throw new Exception(SystemEnv.getHtmlLabelName(10000027, Util.getIntValue(language)));//XXX数据不正确 + } + if(invoiceNumber.length() != 8){ + throw new Exception(SystemEnv.getHtmlLabelName(10000027, Util.getIntValue(language))+"!!");//XXX数据不正确 + } + String sql = "select * from FnaInvoiceLedger where invoiceNumber = '"+invoiceNumber+"'"; + boolean flag = rs.execute(sql); + if(!flag)throw new Exception(SystemEnv.getHtmlLabelName(10000018, Util.getIntValue(language)));//数据库错误!请联系管理员! + int id = 0; + String invoiceNo = ""; + if(rs.next()){ + id = Util.getIntValue(rs.getString("id")); + invoiceNo = Util.null2String(rs.getString("invoiceNumber")); + } + if(id != 0 && currentid != id && invoiceNumber.equals(invoiceNo)){ + throw new Exception(SystemEnv.getHtmlLabelName(10000028, Util.getIntValue(language)).replace("#replaceString#", "【"+invoiceCode+"】【"+invoiceNumber+"】"));//XXX已存在! + } + //校验invoiceType发票类型 + if(invoiceType != 1 && invoiceType != 2 && invoiceType != 15 && invoiceType != 16 && invoiceType != 20){ + throw new Exception(SystemEnv.getHtmlLabelName(10000031, Util.getIntValue(language))); + } + //校验checkCode校验码 + if(invoiceType == 1){//普通发票校验,专用发票没有校验码 + if(checkCode == null){ + throw new Exception(SystemEnv.getHtmlLabelName(10000142,language));//XXX不能为空! + } + pattern = Pattern.compile("^[0-9]{20}$"); + Matcher matcher = pattern.matcher(checkCode.trim()); + if(!matcher.matches()){ + throw new Exception(SystemEnv.getHtmlLabelName(10000143,language));//XXX必须为长度是20的数字! + } + } + //校验明细信息 + for(int i = 0;i 0){//更新发票 + String update = "update FnaInvoiceLedger set billingDate='"+StringEscapeUtils.escapeSql(billingDate)+"',"+ + " invoiceCode='"+StringEscapeUtils.escapeSql(invoiceCode)+"',"+ + " invoiceNumber='"+StringEscapeUtils.escapeSql(invoiceNumber)+"',"+ + " invoiceType='"+invoiceType+"',"+ + " checkCode='"+StringEscapeUtils.escapeSql(checkCode)+"',"+ + " seller='"+StringEscapeUtils.escapeSql(seller)+"',"+ + " purchaser='"+StringEscapeUtils.escapeSql(purchaser)+"',"+ + " purchaserTaxNo='"+StringEscapeUtils.escapeSql(purchaserTaxNo)+"',"+ + " salesTaxNo='"+StringEscapeUtils.escapeSql(salesTaxNo)+"',"+ + " priceWithoutTax = "+df.format(priceWithoutTax)+","+ + " tax = "+df.format(tax)+","+ + " taxIncludedPrice = "+df.format(taxIncludedPrice)+" "+ + " where id = "+currentid; + rs.execute(update); + }else{ + String insert = "insert into FnaInvoiceLedger(billingDate,invoiceCode,invoiceNumber,invoiceType,checkCode,seller,purchaser,purchaserTaxNo,salesTaxNo,priceWithoutTax,tax,taxIncludedPrice,authenticity"+ + ",userid_new,invoiceSource_new,status,entryTime) values ("+ + "'"+StringEscapeUtils.escapeSql(billingDate)+"',"+ + "'"+StringEscapeUtils.escapeSql(invoiceCode)+"',"+ + "'"+StringEscapeUtils.escapeSql(invoiceNumber)+"',"+ + ""+invoiceType+","+ + "'"+StringEscapeUtils.escapeSql(checkCode)+"',"+ + "'"+StringEscapeUtils.escapeSql(seller)+"',"+ + "'"+StringEscapeUtils.escapeSql(purchaser)+"',"+ + "'"+StringEscapeUtils.escapeSql(purchaserTaxNo)+"',"+ + "'"+StringEscapeUtils.escapeSql(salesTaxNo)+"',"+ + ""+df.format(priceWithoutTax)+","+ + ""+df.format(tax)+","+ + ""+df.format(taxIncludedPrice)+","+ + ""+0+","+ + ""+userid+","+ + ""+INVOICESOURCE_TAIZHANG+","+ + ""+INIT_STATUS+","+ + "'"+entryTime+"'"+ + ")"; + rs.execute(insert); + sql = "select max(id) maxid from FnaInvoiceLedger"; + rs.execute(sql); + int maxid = 0; + if(rs.next()){ + maxid = Util.getIntValue(rs.getString("maxid")); + } + currentid = maxid; + } + + String delete = "delete from FnaInvoiceLedgerDetail where mainid = "+currentid; + rs.execute(delete); + List insertList = new ArrayList(); + for(int i = 0;i 0){//更新发票 + insertList.add(currentid+"" + Util.getSeparator() + StringEscapeUtils.escapeSql(_invoiceServiceYype)+"" + Util.getSeparator() + +df.format(_priceWithoutTax)+ Util.getSeparator()+df.format(_taxRate)+ Util.getSeparator()+df.format(_tax)); + } + } + brs.executeSqlBatch("insert into FnaInvoiceLedgerDetail(mainid,invoiceServiceYype,priceWithoutTax,taxRate,tax) VALUES (?,?,?,?,?)", insertList); + } catch (Exception e) { + errorMsg.append(e.getMessage()); + } + JSONObject jsonObject = new JSONObject(); + if(errorMsg.length() > 0){ + jsonObject.put("code", false); + jsonObject.put("msg", errorMsg.toString()); + }else{ + jsonObject.put("flag", true); + } + out.print(jsonObject.toString()); + response.flushBuffer(); + } + + /** + * 判断当前发票是否可以被批量验票 + * @param id + * @return + */ + public String getInvoice_checkboxpopedom(String id){ + RecordSet rs = new RecordSet(); + String sql = "select requestid,checkStatus,invoiceType from FnaInvoiceLedger where id = "+id; + rs.execute(sql); + String requestid = ""; + int checkStatus = 0; + int invoiceType = 0; + while(rs.next()){ + requestid = Util.null2String(rs.getString("requestid")); + checkStatus = Util.getIntValue(rs.getString("checkStatus")); + invoiceType = Util.getIntValue(rs.getString("invoiceType")); + } + if(!"".equals(requestid) || checkStatus == 1 || (invoiceType != 1 && invoiceType != 2 && invoiceType != 15 && invoiceType != 20 && invoiceType != 16))return "false"; + return "true"; + } + + /** + * 判断当前的企业名称和企业纳税人识别号是否为接口所有,如果是则不可以被删除,如果是发票所有,则可以删除 + * @param type + * @return + */ + public String getCompanyAndTaxpayerNumber_checkboxpopedom(String type){ + if("1".equals(type)){ + return "false"; + }else{ + return "true"; + } + } + + /** + * 判断当前发票是否可以被删除或者验票 + * @param id 删除、编辑、查看、打印 + * @return + */ + public List getInvoice_popedom(String id,String otherParams){ + String[] otherParamArray = otherParams.split("\\+"); + String ifExistsInterface = otherParamArray[0]; + int userid = Util.getIntValue(otherParamArray[1], 0); + String canEditAll = otherParamArray[2]; + + //获取requestId + int requestid = getRequestIdByInvoice(id); + + RecordSet rs = new RecordSet(); + List resultList = new ArrayList(); + rs.executeQuery("select checkStatus,invoiceType from FnaInvoiceLedger where id=?",id); + int checkStatus = 0; + int invoiceType = 0; + while(rs.next()){ + checkStatus = Util.getIntValue(rs.getString("checkStatus"),0); + invoiceType = Util.getIntValue(rs.getString("invoiceType"),0); + } + if(requestid>0){ + resultList.add("false"); + resultList.add("false"); + resultList.add("true"); + }else if(checkStatus == 1){ + resultList.add("true"); + resultList.add("false"); + resultList.add("true"); + }else{ + resultList.add("true"); + resultList.add("true"); + resultList.add("false"); + } + if((invoiceType==1 || invoiceType==2 || invoiceType==15 || invoiceType==20) && checkStatus == 1){ + resultList.add("true"); + }else{ + resultList.add("false"); + } + resultList.add("true"); + resultList.add("true"); + + + //判断某个人是否仅仅只是个共享人 + if (userid != 1 && !Boolean.parseBoolean(canEditAll)) { //能查看所有他就不仅仅是个共享人 + boolean isOnlySharer = InvoiceSharerUtil.checkInvoiceShare(id, userid); + if (isOnlySharer) { + //依据上面的权限为主,如果上面权限可查看,则再加上当前限制(只有,查看,打印,导出,对应下标:2,3,4) + for (int i = 0; i < resultList.size(); i++) { + String isShow = resultList.get(i); + if ("true".equals(isShow)) { + if (i != 2 && i != 3 && i != 4) { + resultList.set(i, "false"); + } + } + } + } + } + + return resultList; + } + + /** + * 获取发票requestid + * @param invoiceId + * @return + */ + public static int getRequestIdByInvoice(String invoiceId){ + RecordSet rs = new RecordSet(); + int requestid=0; + rs.executeQuery("select requestid from FnaInvoiceLedger where id=?",invoiceId); + if(rs.next()){ + requestid =Util.getIntValue(rs.getString("requestid"),0); + } + if(requestid<=0){ + rs.executeQuery("select requestid from fnaInvoiceReimbursement where mainid=?",invoiceId); + if(rs.next()){ + requestid =Util.getIntValue(rs.getString("requestid"),0); + } + } + return requestid; + } + + + /** + * 发票是否可以删除 + * @param invoiceIds + * @return + */ + public static String canDeleteInvoice(boolean canEditAll,User user,String invoiceIds){ + String msg = ""; + try{ + RecordSet rsQuery = FnaInvoiceCommon.executeInSql("select count(id) cnt from fnaInvoiceLedger where requestId>0 and id in(占位符标识)", invoiceIds, "executeQuery"); + if (rsQuery.next()){ + int cnt = Util.getIntValue(rsQuery.getString("cnt")); + if(cnt>0) { + throw new Exception(SystemEnv.getHtmlLabelName(529701,user.getLanguage())); + } + } + + RecordSet rs2Query = FnaInvoiceCommon.executeInSql("select count(id) cnt from fnaInvoiceReimbursement where requestId>0 and mainid in(占位符标识)", invoiceIds, "executeQuery"); + if (rs2Query.next()){ + int cnt = Util.getIntValue(rs2Query.getString("cnt")); + if(cnt>0) { + throw new Exception(SystemEnv.getHtmlLabelName(529701,user.getLanguage())); + } + } + + if(!canEditAll){ + RecordSet rs3Query = FnaInvoiceCommon.executeInSql("select userId_new from fnaInvoiceLedger where id in(占位符标识)", invoiceIds, "executeQuery"); + while (rs3Query.next()){ + int userId_new = Util.getIntValue(rs3Query.getString("userId_new")); + if(userId_new!=user.getUID()) { + throw new Exception(SystemEnv.getHtmlLabelName(2012,user.getLanguage())); + } + } + } + }catch (Exception e){ + msg = e.getMessage(); + } + return msg; + } + + /** + * 如果当前企业名称和纳税人识别号属于查验接口,则不可以编辑和删除 + * @param id + * @param type + * @return + */ + public List getCompanyAndTaxpayerNumber_popedom(String id,String type){ + List resultList = new ArrayList(); + if("1".equals(type)){ + resultList.add("false"); + resultList.add("false"); + resultList.add("true"); + }else{ + resultList.add("true"); + resultList.add("true"); + resultList.add("true"); + } + return resultList; + } + /** + * 判断当前记录是否生效或关闭 + * @param id + * @param para + * @return + */ + public List getInterface_popedom(String id,String para){ + RecordSet rs = new RecordSet(); + List resultList = new ArrayList(); + String sql = "select status,interfaceType from fnainvoiceinterface where id = "+id; + rs.execute(sql); + int status = 0; + int interfaceType=-1; + if(rs.next()){ + status = Util.getIntValue(rs.getString("status"),0); + interfaceType = Util.getIntValue(rs.getString("interfaceType"),0); + } + resultList.add("true"); + if(interfaceType==2){ + resultList.add("false"); + }else{ + resultList.add("true"); + } + + resultList.add("false"); + resultList.add("false"); + + if(interfaceType==1){ + resultList.add("true"); + }else{ + resultList.add("false"); + } + return resultList; + } + + /** + * 判断当前记录是否生效或关闭 + * @param id + * @param para + * @return + */ + public String getInterface_checkboxpopedom(String id){ + RecordSet rs = new RecordSet(); + List resultList = new ArrayList(); + rs.executeQuery("select interfaceType from fnainvoiceinterface where id =?",id); + int interfaceType=-1; + if(rs.next()){ + interfaceType = Util.getIntValue(rs.getString("interfaceType"),0); + } + if(interfaceType==2){ + return "false"; + }else{ + return "true"; + } + + } + + /** + * 判断已处理,未处理 + * @param id + * @param para + * @return + */ + public List getHandleStatus_popedom(String id,String para){ + RecordSet rs = new RecordSet(); + List resultList = new ArrayList(); + String sql = "select handleStatus from FnaInvoiceCheckFailLog where id = "+id; + rs.execute(sql); + int handleStatus = 0; + if(rs.next()){ + handleStatus = Util.getIntValue(rs.getString("handleStatus"),0); + } + if(handleStatus == 0){ + resultList.add("true"); + resultList.add("false"); + }else{ + resultList.add("false"); + resultList.add("true"); + } + return resultList; + } + + /** + * 赋值发票信息(包括主表,明细表) + * @param checkIds + * @return + */ + public void getFnaInvoiceLedgerList(String checkIds,FnaAbstractInterface fnaAbstractInterface){ + RecordSet rs = new RecordSet(); + RecordSet rs2 = new RecordSet(); + ArrayList arrayList = new ArrayList(); + Map> detailMap = new HashMap>(); + rs.execute("select * from FnaInvoiceLedger where id in ( "+checkIds+" 0 )"); + while(rs.next()){ + //查询发票主表信息 + String invoiceNumber= Util.null2String(rs.getString("InvoiceNumber")); + int id = Util.getIntValue(rs.getString("id")); + FnaInvoiceLedger fnaInvoiceLedger = new FnaInvoiceLedger(); + fnaInvoiceLedger.setId(id); + fnaInvoiceLedger.setBillingDate(Util.null2String(rs.getString("BillingDate"))); + fnaInvoiceLedger.setInvoiceCode(Util.null2String(rs.getString("InvoiceCode"))); + fnaInvoiceLedger.setInvoiceNumber(invoiceNumber); + fnaInvoiceLedger.setInvoiceType(Util.getIntValue(rs.getString("InvoiceType"))); + fnaInvoiceLedger.setSeller(Util.null2String(rs.getString("Seller"))); + fnaInvoiceLedger.setPurchaser(Util.null2String(rs.getString("Purchaser"))); + fnaInvoiceLedger.setInvoiceServiceYype(Util.null2String(rs.getString("InvoiceServiceYype"))); + fnaInvoiceLedger.setPriceWithoutTax(Util.getDoubleValue(rs.getString("PriceWithoutTax"))); + fnaInvoiceLedger.setTaxRate(Util.getDoubleValue(rs.getString("TaxRate"))); + fnaInvoiceLedger.setTax(Util.getDoubleValue(rs.getString("Tax"))); + fnaInvoiceLedger.setTaxIncludedPrice(Util.getDoubleValue(rs.getString("TaxIncludedPrice"))); + fnaInvoiceLedger.setAuthenticity(Util.getIntValue(rs.getString("Authenticity"))); + fnaInvoiceLedger.setCheckStatus(Util.getIntValue(rs.getString("checkStatus"))); + fnaInvoiceLedger.setCheckCode(Util.null2String(rs.getString("CheckCode"))); + arrayList.add(fnaInvoiceLedger); + //查询明细表信息 + rs2.execute("select * from FnaInvoiceLedgerDetail where mainid = "+id); + List detailList = new ArrayList(); + while(rs2.next()){ + FnaInvoiceLedgerDetail fnaInvoiceLedgerDetail = new FnaInvoiceLedgerDetail(); + fnaInvoiceLedgerDetail.setInvoiceServiceYype(Util.null2String(rs2.getString("invoiceServiceYype"))); + fnaInvoiceLedgerDetail.setPriceWithoutTax(Util.getDoubleValue(rs2.getString("priceWithoutTax"))); + fnaInvoiceLedgerDetail.setTaxRate(Util.getDoubleValue(rs2.getString("taxRate"))); + fnaInvoiceLedgerDetail.setTax(Util.getDoubleValue(rs2.getString("tax"))); + detailList.add(fnaInvoiceLedgerDetail); + } + detailMap.put(invoiceNumber, detailList); + } + fnaAbstractInterface.setArrayList(arrayList); + fnaAbstractInterface.setDetailMap(detailMap); + } + + + + + /** + * 流程强制收回,退回,删除等操作时,修改发票状态为未冻结状态 + * @param requestid + */ + public void doWfForceOver(int requestid) { + doWfForceOver(requestid,"",new User(1)); + } + /** + * 流程强制收回,退回,删除等操作时,修改发票状态为未冻结状态 + * @param requestid + */ + public void doWfForceOver(int requestid,String ipAdress,User user){ + //初始化发票状态 + RecordSet rs = new RecordSet(); + Map> mapCloud = new HashMap>();//其中key为userid_new, value为的List + Map mapCloudOA = new HashMap();//其中key为invoiceId, value为的cloudId + //添加日志 + FnaLogSqlUtil fnaLogSqlUtil = new FnaLogSqlUtil(); + Map> labelIdMaps = new HashMap>(); + Map> beforeMaps = new HashMap>(); + + + StringBuffer sqlBuffer = new StringBuffer(); + rs.executeQuery("select * from fnainvoiceledger where requestid =?",requestid); + while(rs.next()){ + String invoiceId = Util.null2String(rs.getString("id")); + String cloudId = Util.null2String(rs.getString("cloudId")); + String userid_new = Util.null2String(rs.getString("userId_new")); + + if(mapCloud.containsKey(userid_new)){ + List cloudIdList = mapCloud.get(userid_new); + if(!cloudIdList.contains(cloudId)){ + cloudIdList.add(cloudId); + mapCloud.put(userid_new,cloudIdList); + } + }else{ + List cloudIdList = new ArrayList<>(); + cloudIdList.add(cloudId); + mapCloud.put(userid_new,cloudIdList); + } + mapCloudOA.put(invoiceId,cloudId); + //添加至日志map + fnaLogSqlUtil.getActionInvoiceLogInfo(invoiceId,labelIdMaps,beforeMaps); + if(sqlBuffer.length() > 0){ + sqlBuffer.append(","); + } + sqlBuffer.append(invoiceId); + } + int workflowlogic = ReimbursementUtil.getWorkflowlogic(); + StringBuffer invoiceIdBuffer = new StringBuffer(); + if(workflowlogic==3) { + rs.executeQuery("select b.id,b.cloudId,b.userId_new from FnaInvoiceReimbursement a join fnainvoiceledger b on a.mainid=b.id where a.requestid = ?",requestid); + while (rs.next()){ + String invoiceId = Util.null2String(rs.getString("id")); + String cloudId = Util.null2String(rs.getString("cloudId")); + String userid_new = Util.null2String(rs.getString("userId_new")); + + if(mapCloud.containsKey(userid_new)){ + List cloudIdList = mapCloud.get(userid_new); + if(!cloudIdList.contains(cloudId)){ + cloudIdList.add(cloudId); + mapCloud.put(userid_new,cloudIdList); + } + }else{ + List cloudIdList = new ArrayList<>(); + cloudIdList.add(cloudId); + mapCloud.put(userid_new,cloudIdList); + } + mapCloudOA.put(invoiceId,cloudId); + fnaLogSqlUtil.getActionInvoiceLogInfo(invoiceId,labelIdMaps,beforeMaps); + if(invoiceIdBuffer.length()==0){ + invoiceIdBuffer.append(invoiceId); + }else{ + invoiceIdBuffer.append(",").append(invoiceId); + } + } + } + + //发票云报销修改发票云数据 + RecordSet rs5= new RecordSet(); + for(Map.Entry> entry : mapCloud.entrySet()){ + String userid_new = entry.getKey(); + List cloudIdList = entry.getValue();//发票id + int userid_newInt = Util.getIntValue(Util.null2String(userid_new),0); + JSONObject interfaceInfo = InvoiceCloudUtil.getInterfaceInfo(new User(userid_newInt), false, false, true); + JSONObject cloudInfo = interfaceInfo.getJSONObject("cloud"); + boolean existEffectCloud = cloudInfo.getBoolean("existEffectCloud"); + if(existEffectCloud){ + String cid = Util.null2String(cloudInfo.getString("cid")); + String userName = Util.null2String(cloudInfo.getString("userName")); + String password = Util.null2String(cloudInfo.getString("password")); + String aesKey = Util.null2String(cloudInfo.getString("aesKey")); + String reimburseUrl = Util.null2String(cloudInfo.getString("reimburseUrl")); + + + JSONObject bodyJson = new JSONObject(); + bodyJson.put("cid",cid); + bodyJson.put("userId",user.getUID()); + bodyJson.put("flag","2"); + JSONArray fnaInvoiceReimburseInfoJa = new JSONArray(); + if(workflowlogic==3){ + rs5.executeQuery("select * from FnaInvoiceReimbursement where requestid=?",requestid); + while (rs5.next()){ + String cloudId = mapCloudOA.get(Util.null2String(rs5.getString("mainid"))); + if(cloudIdList.contains(cloudId)) { + JSONObject fnaInvoiceReimburseInfoJo = new JSONObject(); + fnaInvoiceReimburseInfoJo.put("dataid", requestid); + fnaInvoiceReimburseInfoJo.put("amount", ""); + fnaInvoiceReimburseInfoJo.put("uid", ""); + fnaInvoiceReimburseInfoJo.put("date", ""); + fnaInvoiceReimburseInfoJo.put("name", ""); + fnaInvoiceReimburseInfoJo.put("fid", cloudId); + fnaInvoiceReimburseInfoJo.put("cid", cid); + fnaInvoiceReimburseInfoJa.add(fnaInvoiceReimburseInfoJo); + } + } + }else{ + rs5.executeQuery("select * from fnaInvoiceLedger where requestid=?",requestid); + while (rs5.next()){ + String cloudId = Util.null2String(rs5.getString("cloudId")); + if(cloudIdList.contains(cloudId)) { + JSONObject fnaInvoiceReimburseInfoJo = new JSONObject(); + fnaInvoiceReimburseInfoJo.put("dataid", requestid); + fnaInvoiceReimburseInfoJo.put("amount", ""); + fnaInvoiceReimburseInfoJo.put("uid", ""); + fnaInvoiceReimburseInfoJo.put("date", ""); + fnaInvoiceReimburseInfoJo.put("name", ""); + fnaInvoiceReimburseInfoJo.put("fid", cloudId); + fnaInvoiceReimburseInfoJo.put("cid", cid); + fnaInvoiceReimburseInfoJa.add(fnaInvoiceReimburseInfoJo); + } + } + } + bodyJson.put("infos",fnaInvoiceReimburseInfoJa); + bodyJson.put("sreim","0"); + try { + JSONObject reimburseJson = InvoiceCloudUtil.reimburseInvoice(reimburseUrl, aesKey, bodyJson, userName, password, "解锁报销修改数据"); + if(!reimburseJson.getBoolean("flag")){ + throw new Exception(reimburseJson.getString("msg")); + } + }catch (Exception e){ + new BaseBean().writeLog("解锁报销修改数据错误:"+e.getMessage()); + } + } + } + + + if(sqlBuffer.length()>0){ + String updateInvoceStatus = "update fnainvoiceledger set status = "+FnaInvoiceCommon.INIT_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL "+ + " where id in ("+sqlBuffer.toString()+")"; + rs.executeUpdate(updateInvoceStatus); + } + //去重校验控制逻辑 + if(workflowlogic==3) { + if(invoiceIdBuffer.length()>0){ + FnaInvoiceCommon.executeInSql("update fnainvoiceledger set status = "+FnaInvoiceCommon.INIT_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL " + + " where id in(占位符标识)",invoiceIdBuffer.toString(),"executeUpdate"); + } + rs.executeUpdate("delete from FnaInvoiceReimbursement where requestid = ?", requestid); + } + + + //更新日志信息 + for (Map.Entry> entry : labelIdMaps.entrySet()) { + String invoiceId = entry.getKey(); + Map labelIdMap = entry.getValue(); + Map beforeMap = beforeMaps.get(invoiceId); + //插入日志2 + Map afterMap =fnaLogSqlUtil.getInvoiceMap(invoiceId,labelIdMap); + fnaLogSqlUtil.invoiceLedgerAddlog(user,ipAdress,"2",invoiceId,"4", + beforeMap,afterMap,labelIdMap); + } + + + + + } + + /** + * 获取发票信息入口 + * @param jsonObject + * @param userid + * @return + */ + public String getInfoEntrance(JSONObject jsonObject,int userid){ + String entryTime = Util.date(2);//录入时间 + DecimalFormat df = new DecimalFormat("#######################0.00"); + RecordSet rs = new RecordSet(); + try{ + JSONArray jsonArray = jsonObject.getJSONArray("info"); + writeLog("jsonArray:", jsonArray); + Iterator iterator = jsonArray.iterator(); + StringBuffer param = new StringBuffer(); + param.append("{\"item_list\": ["); + int count = 0; + HashMap cardMap = new HashMap(); + while(iterator.hasNext()){ + JSONObject json = (JSONObject)iterator.next(); + String card_id = json.getString("card_id"); + String encrypt_code = json.getString("encrypt_code"); + //判断此card_id是否已经在表中存在,已经同步过的不需要同步 + if(judgeCardId(card_id,encrypt_code,rs)){ + continue; + } + if(count > 0){ + param.append(","); + } + cardMap.put(card_id+"_index"+count, encrypt_code); + param.append("{\"card_id\":\""+card_id+"\",").append("\"encrypt_code\":\""+encrypt_code+"\"}"); + count ++; + } + param.append("]}"); + String token = getAccessToken(); + if("".equals(token)){ + return ""+ SystemEnv.getHtmlLabelName(10003158,weaver.general.ThreadVarLanguage.getLang())+"token"+ SystemEnv.getHtmlLabelName(498,weaver.general.ThreadVarLanguage.getLang())+"!"; + } + writeLog("token:", token); + writeLog("param:", param); + JSONObject invoiceInfoJson = getElecInvoiceInfoBatch(param.toString(), token); + writeLog("invoiceInfoJson:", invoiceInfoJson); + String errorMsg = Util.null2String(invoiceInfoJson.get("errorMsg")); + //判断调用方法时是否存在错误 + if(!"".equals(errorMsg)){ + return invoiceInfoJson.getString("errorMsg"); + } + //判断返回结果是否错误 + String errcode = invoiceInfoJson.getString("errcode"); + if(!"0".equals(errcode)){ + String errmsg = invoiceInfoJson.getString("errmsg"); + return CONCURRENT_HASH_MAP.containsKey(errcode) ? CONCURRENT_HASH_MAP.get(errcode):errmsg; + } + JSONArray jsonArrayItem_list = invoiceInfoJson.getJSONArray("item_list"); + Iterator iteratorItem_list = jsonArrayItem_list.iterator(); + count = 0; + while(iteratorItem_list.hasNext()){ + JSONObject json = (JSONObject)iteratorItem_list.next(); + String card_id = json.getString("card_id"); + String openid = json.getString("openid"); + String encrypt_code = cardMap.get(card_id+"_index"+count); + String seller = json.getString("payee");//销售方 + JSONObject user_info = json.getJSONObject("user_info"); + String billingDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date(user_info.getLong("billing_time")*1000));//开票日期 + String invoiceNumber = user_info.getString("billing_code");//发票号码 + String invoiceCode = user_info.getString("billing_no");//发票代码 + String purchaser = user_info.getString("title");//购买方 + String checkcode = user_info.getString("check_code");//校验码 + + //这两个字段不一定在json中存在 + String priceWithoutTax = "0.00";//金额(不含税价) + if(user_info.containsKey("fee_without_tax")){ + priceWithoutTax = df.format(Double.parseDouble(user_info.getString("fee_without_tax"))/100); + } + String tax = "0.00";//税额(税价) + if(user_info.containsKey("tax")){ + tax = df.format(Double.parseDouble(user_info.getString("tax"))/100); + } + + String taxIncludedPrice = df.format(Double.parseDouble(user_info.getString("fee"))/100);//价税合计 + + String taxRate = "0.00";//税率 + if(!"0.00".equals(priceWithoutTax)){ + taxRate = getRoundNumber((Double.parseDouble(tax) / Double.parseDouble(priceWithoutTax)) * 100); + } + + @SuppressWarnings("unused") + String pdf_url = user_info.getString("pdf_url");//这张发票对应的PDF_URL + +// new BaseBean().writeLog("pdf_url:", pdf_url); + + /** + * INVOICE_REIMBURSE_INIT 发票初始状态,未锁定,可提交报销 + * INVOICE_REIMBURSE_LOCK 发票已锁定,无法重复提交报销 + * INVOICE_REIMBURSE_CLOSURE 发票已核销,从用户卡包中移除 + */ + String reimburse_status = user_info.getString("reimburse_status");//发票报销状态 + + //只有未冻结的发票才能被选到,默认为0 + int status = INIT_STATUS; + + String invoiceServiceYype = "";//货物或应税服务类型 + JSONArray infoArray = user_info.getJSONArray("info"); + for(int arr=0;arr labelIdMap = new HashMap(); + Map beforeMap = new HashMap(); + int invoiceId = InvoiceUtil.getInvoiceId(invoiceNumber,invoiceCode); + Map afterMap =fnaLogSqlUtil.getInvoiceMap(String.valueOf(invoiceId),labelIdMap); + fnaLogSqlUtil.invoiceLedgerAddlog(new User(userid),"","0",String.valueOf(invoiceId),"0", + beforeMap,afterMap,labelIdMap); + } + count++; + } + + }catch(Exception e){ + return e.getMessage(); + } + return ""; + } + + /** + * 更新发票状态 + * @param invoiceAmtMap + * @param requestid + * @param userid 流程创建人 + * @param doubleCheckInvoiceList + * @param type + * @param user 当前人员 + * @param ipAdress + * @throws Exception + */ + public void changeStatusEntrance(Map invoiceAmtMap,String requestid,int userid,ArrayList doubleCheckInvoiceList,String type,User user,String ipAdress) throws Exception{ + RecordSet rs = new RecordSet(); + try { + + + for(Map.Entry entry : invoiceAmtMap.entrySet()) { + String invoiceId = entry.getKey(); + + double canReimbursementAmt = ReimbursementUtil.getCanReimbursementAmt(invoiceId); + //选择了一张发票的情况下 + if(doubleCheckInvoiceList.contains(invoiceId)){ + double reimbursementAmt = entry.getValue(); + String updateInvoceStatus = ""; + if(reimbursementAmt < canReimbursementAmt) { + updateInvoceStatus = "update fnainvoiceledger set status = "+FnaInvoiceCommon.INIT_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL "+ + " where id = ? "; + }else if(reimbursementAmt == canReimbursementAmt){ + if("lock".equals(type)){ + updateInvoceStatus = "update fnainvoiceledger set status = "+FnaInvoiceCommon.LOCK_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL "+ + " where id = ? "; + }else{ + updateInvoceStatus = "update fnainvoiceledger set status = "+FnaInvoiceCommon.CLOSURE_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL "+ + " where id = ? "; + } + } + rs.executeUpdate(updateInvoceStatus,invoiceId); + rs.executeUpdate("insert into FnaInvoiceReimbursement(mainid,requestid,reimbursementAmt,reimbursementDate,userid) values (?,?,?,?,?)", + invoiceId,requestid,reimbursementAmt,new SimpleDateFormat("yyyy-MM-dd").format(new Date()),userid); + }else{//选择多张发票的情况下,全额报销 + String updateInvoceStatus = ""; + if("lock".equals(type)){ + updateInvoceStatus = "update fnainvoiceledger set status = "+FnaInvoiceCommon.LOCK_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL "+ + " where id = ? "; + }else{ + updateInvoceStatus = "update fnainvoiceledger set status = "+FnaInvoiceCommon.CLOSURE_STATUS+",reimbursementDate=NULL,requestid=NULL,reimbursePerson=NULL "+ + " where id = ? "; + } + rs.executeUpdate(updateInvoceStatus,invoiceId); + rs.executeUpdate("insert into FnaInvoiceReimbursement(mainid,requestid,reimbursementAmt,reimbursementDate,userid) values (?,?,?,?,?)", + invoiceId,requestid,canReimbursementAmt,new SimpleDateFormat("yyyy-MM-dd").format(new Date()),userid); + } + } + + + } catch (Exception e) { + throw new Exception(e.getMessage()); + } + } + + /** + * 获取验票接口 + * @param user + * @throws Exception + */ + /*public FnaAbstractInterface getInterface(User user) throws Exception{ + int baiwangtype = Util.getIntValue(getPropValue("baiwang", "type"),0); + FnaInvoiceCommon.getinterface(); + String Type = FnaInvoiceInterface.getInstance().getType(); + FnaAbstractInterface fnaAbstractInterface = null; + if("1".equals(Type)){//国信接口 + fnaAbstractInterface = new FnaBaiwangOpenApi(user); + }else if("2".equals(Type)){//百望接口 + if(baiwangtype == 0){ + fnaAbstractInterface = new FnaBaiwangOpenApi(user); + }else { + fnaAbstractInterface = new FnaBaiwangOpenApi(user); + } + }else{ + throw new Exception(SystemEnv.getHtmlLabelName(520790,user.getLanguage()));//后台【预算】-【发票管理】-【发票接口配置】未配置生效的增值税发票查验接口! + } + fnaAbstractInterface.setUser(user); + return fnaAbstractInterface; + }*/ + + /** + * 获取验票接口 + * @param user + * @throws Exception + */ + public FnaAbstractInterface getInterface(User user) throws Exception{ + FnaAbstractInterface fnaAbstractInterface = new FnaBaiwangOpenApi(user); + fnaAbstractInterface.setUser(user); + return fnaAbstractInterface; + } + + + /** + * 获取发票参数 + * @param invoiceId + * @param rs + * @return + */ + public String[] getInvoiceInfoParam(String invoiceId,RecordSet rs){ + String[] params = new String[4]; + String sql = "select invoiceSource_new,card_id_new,encrypt_code_new,openid_new from FnaInvoiceLedger where id="+invoiceId; + rs.execute(sql); + String invoiceSource = ""; + String card_id = ""; + String encrypt_code = ""; + String openid_new = ""; + while(rs.next()){ + invoiceSource = Util.null2String(rs.getString("invoiceSource_new")); + card_id = Util.null2String(rs.getString("card_id_new")); + encrypt_code = Util.null2String(rs.getString("encrypt_code_new")); + openid_new = Util.null2String(rs.getString("openid_new")); + } + params[0] = invoiceSource; + params[1] = card_id; + params[2] = encrypt_code; + params[3] = openid_new; + return params; + } + + /** + * 查询电子发票信息 + * @param param + * @return + */ + public JSONObject getElecInvoiceInfoBatch(String param,String token){ + String httpUrl = GETINVOICEINFOBATCH_URL + token; + return httpRequest(httpUrl,param); + } + + /** + * 更新发票状态 + * @param param + * @param token + * @return + */ + public JSONObject updateElecInvoiceStatus(String param,String token){ + String httpUrl = UPDATEINVOICESTATUS_URL + token; + return httpRequest(httpUrl,param); + } + + /** + * 调用微信接口通用方法 + * @param requestUrl + * @param param + * @return + */ + @SuppressWarnings(value={"resource"}) + public JSONObject httpRequest(String requestUrl,String param){ + JSONObject jsonObject = new JSONObject(); + HttpClient httpClient = new DefaultHttpClient(); + HttpPost post = new HttpPost(requestUrl); + try { + if(param != null){ + StringEntity postingString = new StringEntity(param); + post.setEntity(postingString); + post.setHeader("Content-type", "application/json"); + } + HttpResponse response = httpClient.execute(post); + String content = EntityUtils.toString(response.getEntity()); + jsonObject = JSONObject.fromObject(content); + } catch (Exception e) { + jsonObject.put("errorMsg", e.getMessage()); + } + return jsonObject; + } + + /** + * 四舍五入 + * @param number + * @return + */ + public String getRoundNumber(double number){ + DecimalFormat df = new DecimalFormat("################################0.00"); + if(number == 0){ + return "0.00"; + } + return df.format(((double)Math.round(number))); + } + + /** + * 获取token + * @return + */ + public String getAccessToken() throws Exception{ + Map params = new HashMap(); + params.put("corpId", corpId); + String appStr = APPManager.getThirdAccessToken(params); + new BaseBean().writeLog("appStr:", appStr); + JSONObject jsonObject = JSONObject.fromObject(appStr); + String errcode = Util.null2String(jsonObject.get("errcode")); + String access_token = ""; + if("0".equals(errcode)){ + access_token = jsonObject.getString("accessToken"); + }else{ + throw new Exception(jsonObject.getString("errmsg")); + } + new BaseBean().writeLog("access_token:", access_token); + return access_token; + } + + /** + * 删除电子发票 + * @param card_id + * @param rs + */ + public void deleteCardId(String card_id,RecordSet rs){ + String sql = "delete from FnaInvoiceLedger where card_id='"+StringEscapeUtils.escapeSql(card_id)+"'"; + rs.execute(sql); + } + + /** + * 判断card_id是否存在 + * @param card_id + * @param encrypt_code + * @param rs + * @return + */ + public boolean judgeCardId(String card_id,String encrypt_code,RecordSet rs){ + String sql = "select 1 from fnaInvoiceLedger where card_id_new = '"+StringEscapeUtils.escapeSql(card_id)+"' and encrypt_code_new = '"+StringEscapeUtils.escapeSql(encrypt_code)+"' "; + rs.execute(sql); + if(rs.next()){ + return true; + } + return false; + } + + + /** + * 判断扫描的发票是否在表中已经存在(发票号码),之前很多方法不用了,为保证不报错,选择重载 + * @param invoiceNumber + * @param rs + * @return + */ + public boolean ifExist(String invoiceNumber,RecordSet rs){ + String sql = "select 1 from fnaInvoiceLedger where invoiceNumber = '"+StringEscapeUtils.escapeSql(invoiceNumber)+"'"; + rs.execute(sql); + if(rs.next()){ + return true; + } + return false; + } + + + /** + * 判断扫描的发票是否在表中已经存在(发票代码和发票号码) + * @param invoiceNumber + * @param rs + * @return + */ + public boolean ifExist(String invoiceNumber,String invoiceCode, RecordSet rs){ + String sql = "select 1 from fnaInvoiceLedger where invoiceNumber = ? and invoiceCode = ? "; + rs.executeQuery(sql, invoiceNumber,invoiceCode); + if(rs.next()){ + return true; + } + return false; + } + + /** + * 判断扫描的发票是否在表中已经存在(发票代码和发票号码),并且发票为有效已查验、有效未查验 + * @param invoiceNumber + * @param rs + * @return + */ + public boolean ifExistAuthenticity(String invoiceNumber,String invoiceCode, RecordSet rs){ + String sql = "select 1 from fnaInvoiceLedger where invoiceNumber = ? and invoiceCode = ? and (checkStatus =1 or checkStatus=2) "; + rs.executeQuery(sql, invoiceNumber,invoiceCode); + if(rs.next()){ + return true; + } + return false; + } + + /** + * 判断扫描的发票是否在表中已经存在(发票代码和发票号码),并且发票为有效已查验 + * @param invoiceNumber + * @param rs + * @return + */ + public boolean ifExistAuthenticity2(String invoiceNumber,String invoiceCode, RecordSet rs){ + String sql = "select 1 from fnaInvoiceLedger where invoiceNumber = ? and invoiceCode = ? and checkStatus =1"; + rs.executeQuery(sql, invoiceNumber,invoiceCode); + if(rs.next()){ + return true; + } + return false; + } + + + /** + * 获取配置的自动验票地址 + * @return + */ + public static void getinterface(){ + RecordSet rs = new RecordSet(); + rs.execute("select * from fnainvoiceinterface where (type = 1 or (type = 2 and interfaceType = 1)) and status = 1"); + if(rs.next()){ + String type = Util.null2String(rs.getString("type")); + String interfaceurl = Util.null2String(rs.getString("interfaceurl")); + String userName = Util.null2String(rs.getString("userName")); + String password = Util.null2String(rs.getString("password")); + FnaInvoiceInterface.getInstance().setType(type); + FnaInvoiceInterface.getInstance().setInterfaceurl(interfaceurl); + FnaInvoiceInterface.getInstance().setUserName(userName); + FnaInvoiceInterface.getInstance().setPassword(password); + }else{ + FnaInvoiceInterface.getInstance().setType(""); + FnaInvoiceInterface.getInstance().setInterfaceurl(""); + FnaInvoiceInterface.getInstance().setUserName(""); + FnaInvoiceInterface.getInstance().setPassword(""); + } + } + + /** + * 压缩上传的图片,图片的大小大于2.5M时,进行图片压缩 + * @param imageBytes + * @return + */ + public byte[] compressImage(byte[] imageBytes){ + ByteArrayInputStream byteArrayInputStream = null; + ByteArrayOutputStream byteArrayOutputStream = null; + try { + double quality = 1d; + while(quality >= 0){ + byteArrayInputStream = new ByteArrayInputStream(imageBytes); + byteArrayOutputStream = new ByteArrayOutputStream(); + //压缩图片 + Thumbnails.of(byteArrayInputStream).scale(1).outputQuality(quality).toOutputStream(byteArrayOutputStream); + if(byteArrayOutputStream.toByteArray().length <= MAX_BYTES){ + break; + } + //压缩之后图片还是大于2.5M,继续压缩 + quality = quality - DIMINISHING_INTERVAL; + } + writeLog("压缩质量:",quality); + } catch (Exception e) { + writeLog("压缩出现错误:", e.getMessage()); + } finally { + try { + if(byteArrayInputStream!=null) byteArrayInputStream.close(); + if(byteArrayOutputStream!=null) byteArrayOutputStream.close(); + } catch (Exception e) { + writeLog("出现错误:", e.getMessage()); + } + } + return byteArrayOutputStream.toByteArray(); + } + + /** + * 获取发票图片 + * @param imageID + * @param canEditAll + * @param userid + * @return + */ + public String getImageBase64(int imageID,boolean canEditAll,int userid){ + if(imageID>0){ + RecordSet rs = new RecordSet(); + rs.executeQuery("select id from FnaInvoiceLedger where imageID = ?", imageID); + int invoiceId = 0; + if(rs.next()){ + invoiceId = Util.getIntValue(rs.getString("id")); + } + if(getInvoicePermission(invoiceId, canEditAll, userid)){ + return changeFileTobase64(ImageFileManager.getInputStreamById(imageID)); + } + } + return "-1"; + } + + /** + * 查看发票权限 + * @param invoiceId + * @param canEditAll + * @param userid + * @return + */ + public boolean getInvoicePermission(int invoiceId,boolean canEditAll,int userid){ + boolean canView = false; + if(invoiceId>0){ + canView = canEditAll; + if(!canView){ + RecordSet rs = new RecordSet(); + rs.executeQuery("select 1 from fnaInvoiceLedger where (userid_new = ? or id in ( select invoiceId from fnaInvoiceSharer where sharer = ? )) and id = ?", userid, userid, invoiceId); + if(rs.next()){ + canView = true; + }else{ + String sql=" select count(*) cnt " + + " from workflow_currentoperator a " + + " join FnaInvoiceLedger b on a.requestid = b.requestid " + + " where b.id =? and a.userid in("; + + //通过userid查询该userid关联的所有主从账号id + List sqlList = new ArrayList(); + sqlList.add(String.valueOf(invoiceId)); + List useridList = getAllUserid(String.valueOf(userid)); + for(int i=0;i 0){ + canView = true; + } + if(!canView){ + //去重校验控制逻辑 + int workflowlogic = ReimbursementUtil.getWorkflowlogic(); + if(workflowlogic==3) { + sql=" select count(*) cnt "+ + " from workflow_currentoperator a "+ + " join FnaInvoiceReimbursement b on a.requestid = b.requestid "+ + " where b.mainid = ? and a.userid in("; + //通过userid查询该userid关联的所有主从账号id + sqlList.clear(); + sqlList.add(String.valueOf(invoiceId)); + for(int i=0;i 0){ + canView = true; + } + } + } + } + } + } + return canView; + } + + + /** + * 通过一个账号获取管理的所有的主从账号 + * @param userid + * @return + */ + public List getAllUserid(String userid){ + List list = new ArrayList(); + try{ + ResourceComInfo resourceComInfo = new ResourceComInfo(); + ResourceBelongtoComInfo resourceBelongtoComInfo = new ResourceBelongtoComInfo(); + String accountType = resourceComInfo.getAccountType(userid); + if("0".equals(accountType) || "".equals(accountType)){//主账号 + List userList = resourceBelongtoComInfo.getBelongtousers(userid);//获取所有次账号 + for(int i=0;i>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + return new String(str); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 补全校验码 + * @param checkCode + * @return + */ + @Deprecated + public String addCheckCode(String checkCode){ + int length = checkCode.length(); + int add = 20 - length; + StringBuffer addbuffer = new StringBuffer(); + for(int i = 0;i invoiceTypeList = Arrays.asList(invoiceTypes.split(",")); + + boolean vatExistInWhiltList = false;//增值税连号发票控制当前用户是否已维护于白名单 + boolean otherExistInWhiltList = false;//其他连号发票控制当前用户是否已维护于白名单 + if (vatCtrl==1) { + vatExistInWhiltList = this.existInWhiltList(user, 1); + } + if (otherCtrl==1) { + otherExistInWhiltList = this.existInWhiltList(user, 2); + } + + //查询出所有例外的发票 + List exceptInvoiceList = new ArrayList(); + rs.executeQuery("select invoiceId from fnaExceptInvoice"); + while (rs.next()){ + exceptInvoiceList.add(Util.null2String(rs.getString("invoiceId"))); + } + //查询出需要校验是否连号的发票信息发票号码+发票代码,用 + + List invoiceLedgerList = new ArrayList(); + if(vatCtrl==1 || otherCtrl==1) { + rs.executeQuery("select id,invoiceNumber,invoiceCode,invoiceType from fnaInvoiceLedger where id in(" + StringEscapeUtils.escapeSql(invoiceIds) + ")"); + while (rs.next()) { + String id = Util.null2String(rs.getString("id")); + String invoiceNumber = Util.null2String(rs.getString("invoiceNumber")); + String invoiceCode = Util.null2String(rs.getString("invoiceCode")); + int invoiceType = Util.getIntValue(rs.getString("invoiceType")); + //如果开启了增值税发票连号控制,并且当前发票是增值税发票 + if(vatCtrl==1 && (invoiceType==1 || invoiceType==2 || invoiceType==15 || invoiceType==16 || invoiceType==20 || invoiceType==21)){ + //如果当前人员不在把增值税发票连号控制白名单内,并且当前发票不在例外列表中 + if(!vatExistInWhiltList && !exceptInvoiceList.contains(id)){ + FnaInvoiceLedger fnaInvoiceLedger = new FnaInvoiceLedger(); + fnaInvoiceLedger.setInvoiceNumber(invoiceNumber); + fnaInvoiceLedger.setInvoiceCode(invoiceCode); + fnaInvoiceLedger.setInvoiceType(invoiceType); + invoiceLedgerList.add(fnaInvoiceLedger); + } + } + //如果开启了其他类型发票连号控制,并且当前发票是非增值税发票 + if(otherCtrl==1 && invoiceType!=1 && invoiceType!=2 && invoiceType!=15 && invoiceType!=16 && invoiceType!=20 && invoiceType!=11){ + + if(invoiceTypeList.contains(String.valueOf(invoiceType))){ + //如果当前人员不在把增值税发票连号控制白名单内,并且当前发票不在例外列表中 + if(!otherExistInWhiltList && !exceptInvoiceList.contains(id)){ + FnaInvoiceLedger fnaInvoiceLedger = new FnaInvoiceLedger(); + fnaInvoiceLedger.setInvoiceNumber(invoiceNumber); + fnaInvoiceLedger.setInvoiceCode(invoiceCode); + fnaInvoiceLedger.setInvoiceType(invoiceType); + invoiceLedgerList.add(fnaInvoiceLedger); + } + } + } + + } + } + StringBuffer serialInvoice = new StringBuffer(); + for(FnaInvoiceLedger fnaInvoiceLedger :invoiceLedgerList){ + String invoiceNumber = fnaInvoiceLedger.getInvoiceNumber(); + String invoiceCode = fnaInvoiceLedger.getInvoiceCode(); + int invoiceType = fnaInvoiceLedger.getInvoiceType(); + //可以用来判断发票是否连号的发票号码一定是数字 + int number = 0; + try{ + number = Integer.valueOf(invoiceNumber); + }catch (Exception e){ + continue; + } + int beforeNumber = number - 1; + int afterNumber = number + 1; + rs.executeQuery("select id from fnaInvoiceLedger where invoiceType=? and invoiceCode=? and (invoiceNumber=? or invoiceNumber=?)", + invoiceType, invoiceCode, beforeNumber, afterNumber); + if (rs.next()) { + if (serialInvoice.length() == 0) { + serialInvoice.append(invoiceNumber); + } else { + serialInvoice.append(" ").append(invoiceNumber); + } + } + + + } + if(serialInvoice.length()>0){ + serialInvoiceJson.put("status",false); + serialInvoiceJson.put("msg",SystemEnv.getHtmlLabelName(516385,user.getLanguage()).replace("aaaaaaaa",serialInvoice.toString())); + }else{ + serialInvoiceJson.put("status",true); + } + }catch( Exception e){ + serialInvoiceJson.put("status",false); + serialInvoiceJson.put("msg",e.getMessage()); + } + return serialInvoiceJson; + } + + + /** + * 判断用户是否已经在白名单中维护了 + * @param user + * @param serialInvoiceType 连号发票类型 1增值税 2其他 + * @return + */ + public boolean existInWhiltList(User user,int serialInvoiceType) throws Exception { + RecordSet rs = new RecordSet(); + RecordSet rs2 = new RecordSet(); + ResourceComInfo resourceComInfo = new ResourceComInfo(); + DepartmentComInfo departmentComInfo = new DepartmentComInfo(); + SubCompanyComInfo subCompanyComInfo = new SubCompanyComInfo(); + boolean exist = false; + int seclevel=Util.getIntValue(user.getSeclevel()); + String userId = String.valueOf(user.getUID()); + String userDepartment = String.valueOf(user.getUserDepartment()); + String userSubCompany1 = String.valueOf(user.getUserSubCompany1()); + rs.executeQuery("select * from fnaInvoiceWhiteList where serialInvoiceType=?",serialInvoiceType); + while (rs.next()){ + int orgType = Util.getIntValue(rs.getString("orgType"),0);//组织结构类型 1人力资源,2部门,3分部,4角色,5岗位,6所有人 + String orgIds = Util.null2String(rs.getString("orgIds"));//组织结构ID + List orgIdsList = Arrays.asList(orgIds.split(",")); + int startSecurityLevel = Util.getIntValue(rs.getString("startSecurityLevel"),0);//开始安全级别 针对于部门、分部、角色、所有人 + int endSecurityLevel = Util.getIntValue(rs.getString("endSecurityLevel"),0);//结束安全级别 针对于部门、分部、角色、所有人 默认值100 + //String includeSubordinates = Util.null2String(rs.getString("includeSubordinates"));//是否包含下级,针对于部门和分部 1包含,0不含包 + //String roleLevel = Util.null2String(rs.getString("roleLevel"));//角色级别 1部门,2分部,3总部 + //String jobLevel = Util.null2String(rs.getString("jobLevel"));//岗位级别 1总部,2指定分部,3指定部门 + //String jobDesignOrgIds = Util.null2String(rs.getString("jobDesignOrgIds"));//岗位指定的分部或者部门 + if(orgType==1){//人力资源 + if(orgIdsList.contains(userId)){ + exist = true; + break; + } + }else if(orgType==2){//部门 + if(orgIdsList.contains(userDepartment) && seclevel>=startSecurityLevel && seclevel<=endSecurityLevel){ + exist = true; + break; + } + }else if(orgType==3){//分部 + if(orgIdsList.contains(userSubCompany1) && seclevel>=startSecurityLevel && seclevel<=endSecurityLevel){ + exist = true; + break; + } + }else if(orgType==6){//所有人 + if(seclevel>=startSecurityLevel && seclevel<=endSecurityLevel){ + exist = true; + break; + } + } + } + return exist; + } + + /** + * 流程上传识别发票图片 + * @param fileids 文件fileid集合 + * @throws Exception + */ + public static byte[] invoiceIdentifyFormWorkflow(String imagefileid) throws Exception{ + RecordSet rs = new RecordSet(); + //发票ids + InputStream inputStream = ImageFileManager.getInputStreamById(Util.getIntValue(imagefileid)); + FnaInvoiceCommon fnaInvoiceCommon = new FnaInvoiceCommon(); + String fileData = fnaInvoiceCommon.changeFileTobase64(inputStream); + if(fileData.contains("data:image/jpeg;base64,")){//为图片 + fileData = fileData.replaceFirst("data:image/jpeg;base64,", ""); + }else if(fileData.contains("data:image/png;base64,")){//为png + fileData = fileData.replaceFirst("data:image/png;base64,", ""); + }else if(fileData.contains("data:image/gif;base64,")){//为gif + fileData = fileData.replaceFirst("data:image/gif;base64,", ""); + }else if(fileData.contains("data:application/pdf;base64,")){//为pdf + fileData = fileData.replaceFirst("data:application/pdf;base64,", ""); + } + byte[] imageBytes = ImageUtil.transformImage(fileData); + return imageBytes; + } + + + /** + * + * @Title: getInvoiceIdByCheck + * @Description: 验票 + * @param: @param invoiceInfo + * @param: @param user + * @param: @return + * @param: @throws Exception + * @return: String + * @throws + */ + public static JSONObject getInvoiceIdByCheck(JSONObject invoiceInfo,User user,String ipAdress) throws Exception{ + String invoiceId = ""; + String invoiceNumber = ""; + JSONObject returnObj = new JSONObject(); + try{ + RecordSet rs = new RecordSet(); + if(invoiceInfo.containsKey("invoiceId")){ + invoiceId = invoiceInfo.getString("invoiceId"); + } + boolean isauthenticity = false; + + String invoiceCode = ""; + String priceWithoutTax = ""; + String checkcode = ""; + String billingDate = ""; + int userid_new = 0; + String invoicestatus = ""; + String invoiceType = invoiceInfo.getString("invoiceType"); + if(!"".equals(invoiceId)){ + String authenticity = ""; + + String sql = "select id,billingDate,taxIncludedPrice,invoiceType,checkCode,invoiceCode,userid_new,authenticity,invoiceNumber,status from fnaInvoiceLedger where id = ? "; + rs.executeQuery(sql, invoiceId); + if(rs.next()){ + billingDate = Util.null2String(rs.getString("billingDate")); + priceWithoutTax = Util.null2String(rs.getString("taxIncludedPrice")); + checkcode = Util.null2String(rs.getString("checkCode")); + userid_new = Util.getIntValue(rs.getString("userid_new")); + authenticity = Util.null2String(rs.getString("authenticity")); + invoiceNumber = Util.null2String(rs.getString("invoiceNumber")); + invoiceCode = Util.null2String(rs.getString("invoiceCode")); + invoicestatus = Util.null2String(rs.getString("status")); + } + if("1".equals(authenticity)){ + isauthenticity = true; + } + }else{ + + JSONObject inv = invoiceInfo.getJSONObject("invoiceInfo"); + + + if(inv.containsKey("pretax_amount")){ + priceWithoutTax =inv.getString("pretax_amount"); + } + if(inv.containsKey("code")){ + invoiceCode =inv.getString("code"); + } + if(inv.containsKey("number")){ + invoiceNumber =inv.getString("number"); + } + + checkcode =""; + if((!"10100".equals(invoiceType))&&inv.containsKey("check_code")){ + checkcode = inv.getString("check_code"); + } + String[] invoiceData = getInvoiceData(invoiceNumber,invoiceCode); + + isauthenticity = "1".equals(invoiceData[7]); + userid_new = Util.getIntValue(invoiceData[6]); + invoiceId = invoiceData[3]; + billingDate = invoiceData[0]; + invoicestatus = invoiceData[8]; + } + if("1".equals(invoicestatus)){ + throw new Exception(SystemEnv.getHtmlLabelName(383091,user.getLanguage())+"!"); + } + if("2".equals(invoicestatus)){ + throw new Exception(SystemEnv.getHtmlLabelName(383092,user.getLanguage())+"!"); + } + + //判断此张发票是否为真 + if(isauthenticity){ //为真,判断此张发票是否可以被当前用户使用 + if(user.getUID() != userid_new && !InvoiceSharerUtil.isSharerWithoutEidtAll(invoiceId, user)){ + throw new Exception(SystemEnv.getHtmlLabelName(517367,user.getLanguage())+"!");//已被其他用户使用 + } + returnObj.put("flag", "true"); + returnObj.put("invoiceId", invoiceId); + returnObj.put("invoiceNumber", invoiceNumber); + return returnObj; + }else{ //不为真需要查验 + /** 金额格式化对象;保留两位小数*/ + DecimalFormat df = new DecimalFormat("####################################################0.00"); + FnaInvoiceCommon fnaInvoiceCommon = new FnaInvoiceCommon(); + FnaAbstractInterface fnaAbstractInterface = fnaInvoiceCommon.getInterface(user); + String result = ""; + if("2".equals(invoiceType)){ + result = "01,01,"+invoiceCode+","+invoiceNumber+","+priceWithoutTax+","+billingDate.replace("-", "")+","+fnaInvoiceCommon.addCheckCode(checkcode)+",1111,"; + }else{ + result = "01,04,"+invoiceCode+","+invoiceNumber+","+priceWithoutTax+","+billingDate.replace("-", "")+","+fnaInvoiceCommon.addCheckCode(checkcode)+",1111,"; + } + JSONObject resultJson = fnaAbstractInterface.scanQRCodeCheck("0", result,null); + + + int status = resultJson.getInt("status"); + if(status!=0){//验票成功 + String invoiceNumberTrue = resultJson.getString("_invoiceNumber"); + String invoiceCodeTrue = resultJson.getString("_invoicecode"); + String billingDateTrue = resultJson.getString("_billingDate"); + String priceWithoutTaxTrue = resultJson.getString("_priceWithoutTax"); + String taxTrue = resultJson.getString("_tax"); + String taxIncludedPriceTrue = resultJson.getString("_taxIncludedPrice"); + String purchaserTrue = resultJson.getString("_purchaser");//1 + String sellerTrue = resultJson.getString("_seller"); + String salesTaxNoTrue = resultJson.getString("_salesTaxNo"); + String purchaserTaxNoTrue = resultJson.getString("_purchaserTaxNo");//2 + String taxRateTrue =resultJson.getString("_taxRate"); + + boolean protectInvoiceTaxpayerNumber = FnaInvoiceCommon.protectInvoiceTaxpayerNumber(purchaserTrue,purchaserTaxNoTrue); + + String updateSql = "update FnaInvoiceLedger set "; + + if(!protectInvoiceTaxpayerNumber){ + /*json.put("flag", false); + json.put("msg", SystemEnv.getHtmlLabelName(390260,user.getLanguage())); + return json;*/ + updateSql += " authenticity = 0,checkStatus = 3 "; + }else { + updateSql += " authenticity = 1,checkStatus = 1 "; + } + + + if(!"".equals(billingDateTrue)){ + updateSql += " ,billingDate = '"+StringEscapeUtils.escapeSql(billingDateTrue)+"' "; + } + if(!"".equals(priceWithoutTaxTrue)){ + updateSql += " ,priceWithoutTax = "+df.format(Util.getDoubleValue(priceWithoutTaxTrue,0.00)); + } + if(!"".equals(taxTrue)){ + updateSql += " ,tax = "+df.format(Util.getDoubleValue(taxTrue,0.00)); + } + if(!"".equals(taxIncludedPriceTrue)){ + updateSql += " ,taxIncludedPrice = "+df.format(Util.getDoubleValue(taxIncludedPriceTrue,0.00)); + } + if(!"".equals(purchaserTrue)){ + updateSql += " ,purchaser = '"+StringEscapeUtils.escapeSql(purchaserTrue)+"' "; + } + if(!"".equals(sellerTrue)){ + updateSql += " ,seller = '"+StringEscapeUtils.escapeSql(sellerTrue)+"' "; + } + if(!"".equals(purchaserTaxNoTrue)){ + updateSql += " ,purchaserTaxNo = '"+StringEscapeUtils.escapeSql(purchaserTaxNoTrue)+"' "; + } + if(!"".equals(salesTaxNoTrue)){ + updateSql += " ,salesTaxNo = '"+StringEscapeUtils.escapeSql(salesTaxNoTrue)+"' "; + } + if(!"".equals(taxRateTrue)){ + updateSql += " ,taxRate = "+df.format(Util.getDoubleValue(taxRateTrue,0.00)); + } + if(!"".equals(invoiceNumberTrue)){ + updateSql += " ,invoiceNumber = '"+StringEscapeUtils.escapeSql(invoiceNumberTrue)+"' "; + } + if(!"".equals(invoiceCodeTrue)){ + updateSql += " ,invoiceCode = '"+StringEscapeUtils.escapeSql(invoiceCodeTrue)+"' "; + } + updateSql += " where id = ? "; + + + //添加日志 + //插入日志1 + FnaLogSqlUtil fnaLogSqlUtil = new FnaLogSqlUtil(); + Map labelIdMap = new HashMap(); + Map beforeMap = fnaLogSqlUtil.getInvoiceMap(invoiceId,labelIdMap); + + rs.executeUpdate(updateSql,Util.getIntValue(invoiceId,0)); + if("10100".equals(invoiceType)||"10101".equals(invoiceType) || "10102".equals(invoiceType) || "10103".equals(invoiceType)){//增值税发票 + String remark = resultJson.getString("_remark"); + String sellerAddress = resultJson.getString("_sellerAddress"); + String purchaserAddress = resultJson.getString("_purchaserAddress"); + String salesBank = resultJson.getString("_salesBank"); + String purchaserBank = resultJson.getString("_purchaserBank"); + //保存FnaInvoiceLedgerDtl表信息 + InvoiceUtil.updateInsertFnaInvoiceLedgerDtl(1,Util.getIntValue(invoiceId,0),remark,"",sellerAddress,purchaserAddress,salesBank,purchaserBank); + saveInvoiceLedgerDetail(resultJson.getJSONArray("detaildata"),invoiceNumberTrue,invoiceCodeTrue,user); + } + + //插入日志2 + Map afterMap =fnaLogSqlUtil.getInvoiceMap(invoiceId,labelIdMap); + fnaLogSqlUtil.invoiceLedgerAddlog(user,ipAdress,"2",invoiceId,"1", + beforeMap,afterMap,labelIdMap); + + if(!protectInvoiceTaxpayerNumber){ + throw new Exception(SystemEnv.getHtmlLabelName(390260,user.getLanguage())); + } + }else{ + String msg = SystemEnv.getHtmlLabelName(509478,user.getLanguage()); + if(resultJson.containsKey("errMsg")){ + msg = Util.null2String(resultJson.getString("errMsg")); + } + throw new Exception(msg);//查验失败 + } + + } + returnObj.put("flag", "true"); + returnObj.put("invoiceId", invoiceId); + returnObj.put("invoiceNumber", invoiceNumber); + + }catch(Exception e){ + + returnObj.put("flag", "false"); + String msString = e.getMessage(); + new BaseBean().writeLog("msString:"+msString); + if("".equals(msString)){ + msString = SystemEnv.getHtmlLabelName(509478,user.getLanguage()); + } + new BaseBean().writeLog("msString:"+msString); + returnObj.put("msg", SystemEnv.getHtmlLabelName(132211,user.getLanguage())+invoiceNumber+msString);//发票 + } + + return returnObj; + } + + /** + * + * @Title: saveInvoiceLedgerDetail + * @Description: 保存发票明细 + * @param: @param detailArray + * @param: @param invoiceNumber + * @param: @param invoiceCode + * @param: @throws Exception + * @return: void + * @throws + */ + public static void saveInvoiceLedgerDetail( JSONArray detailArray,String invoiceNumber,String invoiceCode,User user) throws Exception { + BatchRecordSet brs = new BatchRecordSet(); + /** 金额格式化对象;保留两位小数*/ + DecimalFormat df = new DecimalFormat("####################################################0.00"); + RecordSet rs =new RecordSet(); + //查询出发票台账主表的id + int mainid =0; + rs.executeQuery("select id from fnaInvoiceLedger where invoiceNumber = ? and invoiceCode = ?",invoiceNumber,invoiceCode); + if(rs.next()){ + mainid = Util.getIntValue(rs.getString("id")); + } + if(mainid==0){ + throw new Exception(SystemEnv.getHtmlLabelName(517370,user.getLanguage())+"!");//发票主表信息不存在 + } + rs.executeUpdate("delete from FnaInvoiceLedgerDetail where mainid=?",mainid); + //writeLog("-----detailArray-----detailArray-----"+detailArray); + List insertList = new ArrayList(); + for(int i = 0;i idsList = new ArrayList<>(); + for(int i=0;i0) { + + sql = sql.replace("占位符标识", idsBuffer.toString()); + if("executeQuery".equals(type)){ + rs.executeQuery(sql,idsList); + }else if("executeUpdate".equals(type)){ + rs.executeUpdate(sql,idsList); + } + } + return rs; + } + + + /** + * 通过日期获取时间戳 精确到秒 + * @param date yyyy-MM-dd + * @return + */ + public static String getTimestamp(String date){ + String timestamp = ""; + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Date d = sdf.parse(date); + timestamp = Util.null2String(d.getTime()/1000); + }catch (Exception e){} + return timestamp; + } + +} diff --git a/weaver/fna/invoice/utils/HttpUtil.java b/weaver/fna/invoice/utils/HttpUtil.java new file mode 100644 index 0000000..2fbc442 --- /dev/null +++ b/weaver/fna/invoice/utils/HttpUtil.java @@ -0,0 +1,536 @@ +/* + * + * Copyright (c) 2001-2018 泛微软件. + * 泛微协同商务系统,版权所有. + * + */ +package weaver.fna.invoice.utils; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.UnsupportedEncodingException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.Proxy; +import java.net.URL; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.io.Charsets; +import org.apache.http.HttpEntity; +import org.apache.http.HttpResponse; +import org.apache.http.HttpStatus; +import org.apache.http.NameValuePair; +import org.apache.http.ParseException; +import org.apache.http.client.ClientProtocolException; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpUriRequest; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; +import org.dom4j.Document; +import org.dom4j.DocumentHelper; +import org.dom4j.Element; + +import net.sf.json.JSONObject; +import sun.misc.BASE64Encoder; +import weaver.conn.RecordSet; +import weaver.fna.invoice.Constants; +import weaver.fna.invoice.common.FnaInvoiceCommon; +import weaver.general.BaseBean; +import weaver.general.Util; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; + +/** + * @author zhangwj + * @Jan 23, 2019 + */ +@SuppressWarnings("unchecked") +public class HttpUtil { + + + /** + * post + * @param url + * @param params + * @return + */ + public static Map post(String url, Map params) { + CloseableHttpClient cilent = HttpClients.createDefault(); + Map reponseMap = new HashMap(); + try { + HttpPost post = postForm(url, params); + reponseMap = invoke(cilent, post); + } catch (Exception e) { + e.printStackTrace(); + }finally{ + try { + cilent.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + return reponseMap; + } + + /** + * invoke + * @param httpclient + * @param httpost + * @return + */ + private static Map invoke(CloseableHttpClient httpclient, + HttpUriRequest httpost) { + + Map returnMap = new HashMap(); + HttpResponse response = sendRequest(httpclient, httpost); + String body = paseResponse(response); + // 请求返回结果状态 + returnMap.put("statusCode", response.getStatusLine().getStatusCode()); + returnMap.put("response", body); + return returnMap; + } + + /** + * sendRequest + * @param httpclient + * @param httpost + * @return + */ + private static HttpResponse sendRequest(CloseableHttpClient httpclient, + HttpUriRequest httpost) { + + HttpResponse response = null; + try { + response = httpclient.execute(httpost); + } catch (ClientProtocolException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return response; + } + + /** + * paseResponse + * @param response + * @return + */ + private static String paseResponse(HttpResponse response) { + + HttpEntity entity = response.getEntity(); + + String body = null; + try { + body = EntityUtils.toString(entity, "UTF-8"); + } catch (ParseException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return body; + } + + /** + * 获取 HttpPost 对象 + * @param url + * @param params + * @return + */ + private static HttpPost postForm(String url, Map params) { + + HttpPost httpost = new HttpPost(url); + RequestConfig requestConfig = RequestConfig.custom() + .setConnectTimeout(120000).setConnectionRequestTimeout(120000) + .setSocketTimeout(120000).build(); + httpost.setConfig(requestConfig); + + if(params!=null){ + List nvps = new ArrayList(); + Set keySet = params.keySet(); + for (String key : keySet) { + nvps.add(new BasicNameValuePair(key, params.get(key))); + } + httpost.setEntity(new UrlEncodedFormEntity(nvps, Charsets.UTF_8)); + } + return httpost; + } + + /** + * Base64 加密 + * @param str + * @return + */ + public static String getBase64(String str) { + byte[] b = null; + String s = ""; + try { + b = str.getBytes("UTF-8"); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + if (b != null) { + s = new BASE64Encoder().encode(b); + } + return s; + } + + + public static JSONObject postImage(byte[] bytes,User user){ + new BaseBean().writeLog("开始调用发票识别接口..."); + RecordSet rs = new RecordSet(); + JSONObject jsonObject = new JSONObject(); + HttpURLConnection connection = null; + OutputStream outputStream = null; + + + boolean existEffectOcr=false; + boolean existEffectCloud=false; + int imageCatalog = 0; + //ocr + String interfaceurl = ""; + String appKey = ""; + String secret = ""; + //Cloud + String cid = ""; + String ocrUrl = ""; + String uploadFileUrl = ""; + String tokenUrl = ""; + String userName = ""; + String password = ""; + try { + JSONObject interfaceInfo = InvoiceCloudUtil.getInterfaceInfo(user, true, false, true); + JSONObject cloudInfo = interfaceInfo.getJSONObject("cloud"); + JSONObject ocrInfo = interfaceInfo.getJSONObject("ocr"); + existEffectCloud = cloudInfo.getBoolean("existEffectCloud"); + existEffectOcr = ocrInfo.getBoolean("existEffectOcr"); + if(existEffectCloud){ + imageCatalog = cloudInfo.getInt("imageCatalog"); + cid = cloudInfo.getString("cid"); + ocrUrl = cloudInfo.getString("ocrUrl"); + tokenUrl = cloudInfo.getString("tokenUrl"); + uploadFileUrl = cloudInfo.getString("uploadFileUrl"); + userName = cloudInfo.getString("userName"); + password = cloudInfo.getString("password"); + }else if(existEffectOcr){ + imageCatalog = ocrInfo.getInt("imageCatalog"); + interfaceurl = ocrInfo.getString("interfaceurl"); + appKey = ocrInfo.getString("appKey"); + secret = ocrInfo.getString("secret"); + } + if(!existEffectCloud && !existEffectOcr){ + throw new Exception(SystemEnv.getHtmlLabelName(520791, user.getLanguage()));//后台【预算】-【发票管理】-【发票接口配置】未配置生效的票据接口! + } + if(imageCatalog==0){ + throw new Exception("发票识别接口未配置发票图片目录"); + } + + if(existEffectCloud){ + JSONObject resultJsonObj = InvoiceCloudUtil.invoiceOCR(bytes, cid, ocrUrl,tokenUrl,uploadFileUrl, user, userName, password); + jsonObject.put("status", resultJsonObj.get("status")); + jsonObject.put("returnInfo", resultJsonObj.getJSONObject("returnInfo")); + }else{ + jsonObject = invoiceOCR(appKey,secret,interfaceurl,bytes,connection,outputStream); + } + } catch (Exception e) { + jsonObject.put("status", Constants.ERROR_CODE); + jsonObject.put("errMsg", e.getMessage()); + }finally { + if(connection!=null){ + connection.disconnect(); + } + } + FnaInvoiceCommon.addFnainvoiceLog("1",bytes,"","","","","", + jsonObject, user, "OCR",appKey); + new BaseBean().writeLog("结束调用发票识别接口..."); + new BaseBean().writeLog("jsonObject:"+jsonObject.toString()); + return jsonObject; + } + + + private static JSONObject invoiceOCR(String appKey,String secret,String interfaceurl,byte[] bytes, + HttpURLConnection connection,OutputStream outputStream) throws Exception { + JSONObject resultJsonObj = new JSONObject(); + Map params = new LinkedHashMap(); + String timestamp = System.currentTimeMillis() / 1000 +""; + + String type="0"; + String token=getEncode(appKey+"+"+timestamp+"+"+FnaInvoiceCommon.fnaDecrypt(secret)); + //key + params.put("app_key", appKey); + //token + params.put("token", token.toLowerCase()); + //当前时间戳 + params.put("timestamp", timestamp); + //识别类型 + params.put("type", type); + new BaseBean().writeLog("-----------------param-------------------"+params); + URL url = new URL(interfaceurl); + //判断是是否配置代理 + if(ProxyUtil.ifExistsProxy()){ + connection = (HttpURLConnection) url.openConnection(ProxyUtil.getProxy()); + Map propertyMap = ProxyUtil.getProxyProperty(); + String proxyUser = propertyMap.getOrDefault("proxyUser", "");//用户名 + String proxyPwd = propertyMap.getOrDefault("proxyPwd", "");//密码 + if(!"".equals(proxyUser)&&!"".equals(proxyPwd)){ + String headerkey = "Proxy-Authorization"; + String headerValue = "Basic "+Base64.encodeBase64String((proxyUser+":"+proxyPwd).getBytes());//帐号密码用:隔开,base64加密方式 + connection.setRequestProperty(headerkey, headerValue); + } + }else{ + connection = (HttpURLConnection) url.openConnection(); + } + connection.setRequestProperty("Content-Type", "multipart/form-data; boundary=----request"); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setRequestProperty("Accept-Language", "zh-CN,zh;q=0.8"); + connection.setRequestProperty("Accept", "*/*"); + connection.setRequestProperty("Range", "bytes="+""); + connection.setConnectTimeout(60000); + connection.setReadTimeout(60000); + connection.setRequestMethod("POST"); + StringBuffer buffer = new StringBuffer(); + for(Map.Entry entry:params.entrySet()){ + buffer.append("------request\r\n"); + buffer.append("Content-Disposition: form-data; name=\""); + buffer.append(entry.getKey()); + buffer.append("\"\r\n\r\n"); + buffer.append(entry.getValue()); + buffer.append("\r\n"); + } + outputStream = connection.getOutputStream(); + outputStream.write(buffer.toString().getBytes()); + outputStream.write(("------request\r\n").getBytes()); + outputStream.write(("Content-Disposition: form-data; name=\"image_file\";filename=\"发票1.jpg\"\r\n").getBytes()); + outputStream.write(("Content-Type: image/jpeg").getBytes()); + outputStream.write(("\"\r\n\r\n").getBytes()); + outputStream.write(bytes); + outputStream.write(("\r\n").getBytes()); + outputStream.write(("------request--\r\n").getBytes()); + outputStream.flush(); + outputStream.close(); + StringBuffer returnInfo = new StringBuffer(); + int resultCode = connection.getResponseCode(); + if(HttpURLConnection.HTTP_OK==resultCode){ + BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(),"utf-8")); + String line; + while ((line = reader.readLine()) != null){ + returnInfo.append(line.trim()); + } + reader.close(); + connection.disconnect(); + resultJsonObj.put("status", Constants.SUCCESS_CODE); + resultJsonObj.put("returnInfo", JSONObject.fromObject(returnInfo.toString())); + }else{ + throw new Exception("error responsecode :"+resultCode); + } + return resultJsonObj; + } + /** + * + * @Title: checkshibie + * @Description: 校验识别接口的配置 + * @param: @param user + * @param: @return + * @return: boolean + * @throws + */ + public static boolean checkIdentify(User user){ + boolean existEffectOcr=false; + RecordSet rs = new RecordSet(); + //如果有生效的未开启分部的ocr,直接使用 + rs.executeQuery("select * from fnainvoiceinterface where interfaceType=0 and status=1 and subIdStatus=0 "); + if(rs.next()){ + existEffectOcr = true; + } + if(!existEffectOcr){ + //查询当前人员所在分部的发票云接口 + rs.executeQuery("select * from fnainvoiceinterface where interfaceType=0 and status=1 and subIdStatus=1 "); + while (rs.next()){ + String subIds = Util.null2String(rs.getString("subIds")); + String[] subIds_split = subIds.split(","); + for(int i=0;i rootlist = rootElement.elements(); + for(int i = 0;i replayList = SERVICE.elements(); + for(int j = 0;j replayList = element.elements(); + for(int j = 0;j rootlist = rootElement.elements(); + for(int i = 0;i replayList = SERVICE.elements(); + for(int j = 0;j replayList = element.elements(); + for(int j = 0;j>> 4 & 0xf]; + str[k++] = HEXDIGITS[byte0 & 0xf]; + } + return new String(str); + } + +} diff --git a/weaver/fna/invoice/utils/ImageUtil.java b/weaver/fna/invoice/utils/ImageUtil.java new file mode 100644 index 0000000..d5610dd --- /dev/null +++ b/weaver/fna/invoice/utils/ImageUtil.java @@ -0,0 +1,196 @@ +/* + * + * Copyright (c) 2001-2018 泛微软件. + * 泛微协同商务系统,版权所有. + * + */ +package weaver.fna.invoice.utils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; + +import com.weaver.general.Util; +import net.coobird.thumbnailator.Thumbnails; +import weaver.fna.invoice.Constants; +import weaver.fna.invoice.common.FnaInvoiceCommon; +import weaver.general.BaseBean; + +import org.apache.commons.codec.binary.Base64; +import weaver.hrm.User; + +/** + * @author zhangwj + * @Jan 23, 2019 + */ +public class ImageUtil { + + /** + * 图片转换 + * @param fileData + * @return + * @throws Exception + */ + public static byte[] transformImage(String fileData) throws Exception{ + imageCheck(fileData); + BaseBean bb = new BaseBean(); + byte[] imageByte = Base64.decodeBase64(fileData); + long fileLen = imageByte.length; + //大于2.5M,进行压缩 + if (fileLen > Constants.MAX_BYTES) { + bb.writeLog("图片当前大小" + fileLen + ",需要压缩..."); + imageByte = compressImage(imageByte); + }else{ + bb.writeLog("图片当前大小" + fileLen + ",不需要压缩..."); + } + if (imageByte.length == 0) { + throw new Exception("图片出现问题,请联系系统管理员!"); + } + /*ByteArrayInputStream byteArrayInputStream = null; + ByteArrayOutputStream byteArrayOutputStream = null; + try { + byteArrayInputStream = new ByteArrayInputStream(imageByte); + byteArrayOutputStream = new ByteArrayOutputStream(); + Thumbnails.of(byteArrayInputStream).useExifOrientation(false).scale(1).outputQuality(1d).toOutputStream(byteArrayOutputStream); + String base64 = readImageBase64(byteArrayOutputStream); + imageByte = Base64.decodeBase64(base64.replace("data:image/jpeg;base64,", "")); + } catch (Exception e) { + }finally{ + try { + if(byteArrayOutputStream!=null){ + byteArrayOutputStream.close(); + } + } catch (Exception e0) {} + try { + if(byteArrayInputStream!=null){ + byteArrayInputStream.close(); + } + } catch (Exception e0) {} + }*/ + return imageByte; + } + + private static void imageCheck(String fileData) throws Exception{ + if ("".equals(fileData)) { + throw new Exception("请选择正确的图片文件!"); + } + } + + /** + * 图片压缩 + * @param imageBytes + * @return + */ + private static byte[] compressImage(byte[] imageBytes){ + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(imageBytes); + ByteArrayOutputStream byteArrayOutputStream = null; + BaseBean bb = new BaseBean(); + try { + int count = 5; + double quality = 1d; + while(quality > 0){ + quality = quality - 0.2d; + byteArrayInputStream = new ByteArrayInputStream(imageBytes); + byteArrayOutputStream = new ByteArrayOutputStream(); + //压缩图片 + Thumbnails.of(byteArrayInputStream).scale(quality).outputQuality(quality).toOutputStream(byteArrayOutputStream); + if(byteArrayOutputStream.toByteArray().length <= Constants.MAX_BYTES){ + break; + } + count--; + if(count == 0) { + break; + } + } + bb.writeLog("压缩质量:",quality); + } catch (Exception e) { + new BaseBean().writeLog("压缩出现错误:", e.getMessage()); + } finally { + try { + if(byteArrayOutputStream!=null) { + byteArrayOutputStream.close(); + } + } catch (Exception e) { + bb.writeLog("出现错误:", e.getMessage()); + } + try { + if(byteArrayInputStream!=null) { + byteArrayInputStream.close(); + } + } catch (Exception e) { + bb.writeLog("出现错误:", e.getMessage()); + } + } + return byteArrayOutputStream.toByteArray(); + } + + /** + * 图片截取 + * @param x + * @param y + * @param w + * @param h + * @param imageBytes + * @return + * @throws Exception + */ + public static String cutImg(int x,int y,int w,int h,byte[] imageBytes,String orientation) throws Exception { + ByteArrayInputStream byteArrayInputStream = null; + ByteArrayOutputStream byteArrayOutputStream = null; + try { + byteArrayOutputStream = new ByteArrayOutputStream(); + byteArrayInputStream = new ByteArrayInputStream(imageBytes); + Thumbnails.of(byteArrayInputStream).sourceRegion(x, y, w, h).size(w, h).rotate(Util.getDoubleValue(orientation,0.00)).toOutputStream(byteArrayOutputStream); + } catch (Exception e) { + throw e; + } finally { + try { + if(byteArrayOutputStream!=null) { + byteArrayOutputStream.close(); + } + } catch (Exception e) { + } + try { + if(byteArrayInputStream!=null) { + byteArrayInputStream.close(); + } + } catch (Exception e) { + } + } + String base64 = readImageBase64(byteArrayOutputStream); + return base64; + } + + /** + * 图片存储 + * @param base64 + * @return + * @throws Exception + */ + public static int saveImage(String base64, User user) throws Exception{ + base64 = base64.replaceFirst("data:image/jpeg;base64,", ""); + byte[] imageByte = Base64.decodeBase64(base64); + int imageid = FnaInvoiceCommon.saveImage(imageByte,user); + return imageid; + } + + /** + * 获取图片base64 + * @param byteArrayOutputStream + * @return + * @throws Exception + */ + private static String readImageBase64(ByteArrayOutputStream byteArrayOutputStream) throws Exception{ + String base64 = ""; + try{ + base64 = "data:image/jpeg;base64,"+Base64.encodeBase64String(byteArrayOutputStream.toByteArray()); + }finally{ + try { + if(byteArrayOutputStream!=null) { + byteArrayOutputStream.close(); + } + } catch (Exception e) { + } + } + return base64; + } +} diff --git a/weaver/fna/invoice/utils/InvoiceCloudUtil.java b/weaver/fna/invoice/utils/InvoiceCloudUtil.java new file mode 100644 index 0000000..7c3fb84 --- /dev/null +++ b/weaver/fna/invoice/utils/InvoiceCloudUtil.java @@ -0,0 +1,2455 @@ +package weaver.fna.invoice.utils; + + +import com.engine.personalIncomeTax.biz.RecordsBiz; +import net.sf.json.JSONArray; +import net.sf.json.JSONObject; +import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpStatus; +import org.apache.commons.httpclient.NTCredentials; +import org.apache.commons.httpclient.methods.PostMethod; +import org.apache.commons.httpclient.methods.multipart.FilePart; +import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity; +import org.apache.commons.httpclient.methods.multipart.Part; +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.http.HttpEntity; +import org.apache.http.HttpHost; +import org.apache.http.HttpResponse; +import org.apache.http.auth.AuthScope; +import org.apache.http.auth.UsernamePasswordCredentials; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.conn.params.ConnRouteParams; +import org.apache.http.entity.ContentType; +import org.apache.http.entity.StringEntity; + +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.util.EntityUtils; +import weaver.conn.RecordSet; +import weaver.fna.general.FnaCommon; +import weaver.fna.general.FnaLogSqlUtil; +import weaver.fna.invoice.Constants; +import weaver.fna.invoice.common.FnaAbstractInterface; +import weaver.fna.invoice.common.FnaInvoiceCommon; +import weaver.fna.invoice.sdk.SdkInvoiceUtil; +import weaver.general.BaseBean; +import weaver.general.GCONST; +import weaver.general.MD5; +import weaver.general.Util; +import weaver.hrm.HrmUserVarify; +import weaver.hrm.User; +import weaver.systeminfo.SystemEnv; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.*; +import java.math.BigInteger; +import java.net.Proxy; +import java.net.URLEncoder; +import java.nio.charset.Charset; +import java.security.MessageDigest; +import java.text.DecimalFormat; +import java.text.SimpleDateFormat; +import java.util.*; +/** + * @Author: lb2018 + * @Description:发票云工具类 + * @Date: 2020/6/9 10:45 + */ +public class InvoiceCloudUtil { + + + /** + * 判断是否有生效的ocr接口、查验接口、发票云接口,并返回相关接口信息 + * @param user + * @param queryOcr + * @param queryCheck + * @param queryCloud + * @return + */ + public static JSONObject getInterfaceInfo(User user,boolean queryOcr,boolean queryCheck,boolean queryCloud){ + JSONObject resultJson = new JSONObject(); + RecordSet rs = new RecordSet(); + if(queryOcr){ + boolean existEffectOcr=false; + int imageCatalog = 0; + String interfaceurl = ""; + String appKey = ""; + String secret = ""; + //如果有生效的未开启分部的ocr,直接使用 + rs.executeQuery("select * from fnainvoiceinterface where interfaceType=0 and status=1 and subIdStatus=0 "); + if(rs.next()){ + imageCatalog = Util.getIntValue(rs.getString("imageCatalog"),0); + interfaceurl = Util.null2String(rs.getString("interfaceurl")); + appKey = Util.null2String(rs.getString("username")); + secret = Util.null2String(rs.getString("password")); + existEffectOcr = true; + } + if(!existEffectOcr){ + //查询当前人员所在分部的ocr接口 + rs.executeQuery("select * from fnainvoiceinterface where interfaceType=0 and status=1 and subIdStatus=1 "); + while (rs.next()){ + String subIds = Util.null2String(rs.getString("subIds")); + String[] subIds_split = subIds.split(","); + for(int i=0;i map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","获取token",tokenurl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + String token = postToUrl(tokenurl, content, map, "",uuid); + + //将token存入表中 + boolean existHistory=false; + rs.executeQuery("select * from fnaInvoiceCloudToken where userId=?",user.getUID()); + if(rs.next()){ + existHistory = true; + } + + String time = Util.null2String(System.currentTimeMillis()); + String updateTime = Util.date(2); + if(existHistory){//update + rs.executeUpdate("update fnaInvoiceCloudToken set cid=?,token=?,updateTime=?,currentTimeMillis=? where userId=?", + cid,token,updateTime,time,user.getUID()); + }else{//insert + rs.executeUpdate("insert into fnaInvoiceCloudToken(cid,token,updateTime,currentTimeMillis,userId) values(?,?,?,?,?)", + cid,token,updateTime,time,user.getUID()); + } + jsonObject.put("flag",true); + jsonObject.put("token",token); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 获取cid + * @return + */ + public static JSONObject getCloudCid(String interfaceurl,String account,String corpName,String userName,String password){ + JSONObject jsonObject = new JSONObject(); + try{ + JSONObject param = new JSONObject(); + param.put("account",account); + param.put("corpName",corpName); + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","获取CID",interfaceurl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + String cid = postToUrl(interfaceurl, content, map, "",uuid); + jsonObject.put("flag",true); + jsonObject.put("cid",cid); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 更新应用数据 + * @return + */ + public static JSONObject updateAppInfo(String updateAppInfoUrl,String account,String oaUrl,String userName,String password){ + JSONObject jsonObject = new JSONObject(); + try{ + JSONObject param = new JSONObject(); + param.put("appName",account); + param.put("thirdAddr",oaUrl); + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","更新应用数据",updateAppInfoUrl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + postToUrl(updateAppInfoUrl, content, map, "",uuid); + jsonObject.put("flag",true); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 创建应用,获取AppId 和 secret + * @param interfaceurl + * @param appName + * @return + */ + public static JSONObject CreateApp(String interfaceurl,String appName,String thirdAppId,String thirdAddr){ + JSONObject jsonObject = new JSONObject(); + try{ + JSONObject param = new JSONObject(); + param.put("appName",appName); + param.put("appType",2); + param.put("thirdAppId",thirdAppId); + param.put("thirdAddr",thirdAddr); + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl) values(?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","创建应用",interfaceurl); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + String data = postToUrl(interfaceurl, param.toString(), null, "",uuid); + jsonObject.put("flag",true); + jsonObject.put("data",data); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 同步开票信息、同步发票信息 + * @param interfaceurl + * @param param + * @param userName + * @param password + * @return + */ + public static JSONObject synBillingInfo(String interfaceurl,JSONObject param,String userName,String password){ + JSONObject jsonObject = new JSONObject(); + try{ + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","实时同步开票、发票信息",interfaceurl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + String data = postToUrl(interfaceurl, content, map, "",uuid); + jsonObject.put("flag",true); + jsonObject.put("data",data); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 推送目录id + * @param synDocUrl + * @param cid + * @param secid + * @param userName + * @param password + * @return + */ + public static JSONObject pushSecid(String synDocUrl,String cid,String secid,String userName,String password,int userId){ + JSONObject jsonObject = new JSONObject(); + try{ + JSONObject param = new JSONObject(); + param.put("cid",cid); + param.put("secid",secid); + param.put("userId",userId); + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","同步目录",synDocUrl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + postToUrl(synDocUrl, content, map, "",uuid); + jsonObject.put("flag",true); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + + /** + * 获取json中的值 + * @param json + * @param key + * @return + */ + public static String getString(JSONObject json, String key){ + if(json.containsKey(key)){ + return json.getString(key); + }else{ + return ""; + } + } + + + public static String postToUrl(String url, String content,Map headers,String xmlEncoding,String uuid,String aesKey) throws Exception { + return postToUrl(url,content,headers,xmlEncoding,uuid,"",null,aesKey); + } + public static String postToUrl(String url, String content,Map headers,String xmlEncoding,String uuid) throws Exception { + return postToUrl(url,content,headers,xmlEncoding,uuid,"",null,""); + } + /** + * + * @param url + * @param content + * @param headers + * @param xmlEncoding + * @return + * @throws IOException + */ + public static String postToUrl(String url, String content,Map headers,String xmlEncoding,String uuid,String from,User user,String aesKey) throws Exception { + String errorMsg=""; + + String data=""; + if("".equals(xmlEncoding)){ + xmlEncoding = "UTF-8"; + } + DefaultHttpClient httpclient = null; + HttpPost httpPost = null; + try { + httpclient = new DefaultHttpClient(); + if(ProxyUtil.ifExistsProxy()){ + Map proxyProperty = ProxyUtil.getProxyProperty(); + String proxyUrl = proxyProperty.getOrDefault("proxyUrl",""); + int proxyPort = Util.getIntValue(proxyProperty.getOrDefault("proxyPort",""),8080); + String proxyUser = proxyProperty.getOrDefault("proxyUser",""); + String proxyPwd = proxyProperty.getOrDefault("proxyPwd",""); + + if(!"".equals(proxyUser)&&!"".equals(proxyPwd)) { + httpclient.getCredentialsProvider().setCredentials( + new AuthScope(proxyUrl, proxyPort), + new UsernamePasswordCredentials(proxyUser, proxyPwd) + ); + } + HttpHost proxy = new HttpHost(proxyUrl,proxyPort); + httpclient.getParams().setParameter(ConnRouteParams.DEFAULT_PROXY,proxy); + } + + httpPost = new HttpPost(url); + JSONObject response = null; + StringEntity s = new StringEntity(content, Charset.forName("UTF-8")); + httpPost.addHeader("Content-type", "application/json; charset=utf-8"); + httpPost.addHeader("Accept", "application/json"); + + //设置超时时间 + RequestConfig config = RequestConfig.custom().setConnectTimeout(130000) //连接超时时间 + .setConnectionRequestTimeout(130000) + .setSocketTimeout(130000) //数据传输的超时时间 + .setStaleConnectionCheckEnabled(true) //提交请求前测试连接是否可用 + .build(); + + + + httpPost.setConfig(config); + httpPost.setEntity(s); + + if (null != headers) { + for (Map.Entry entry : headers.entrySet()) { + httpPost.addHeader(entry.getKey(), entry.getValue()); + } + } + HttpResponse res = httpclient.execute(httpPost); + if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) { + HttpEntity entity = res.getEntity(); + String result = Util.null2String(EntityUtils.toString(res.getEntity())); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "returnResult", result, "uuid", uuid, "string"); + if ("".equals(result)) { + throw new Exception("发票云接口返回空!"); + } + try { + response = JSONObject.fromObject(result); + } catch (Exception e) { + throw new Exception("发票云接口返参数json格式化异常!"); + } + JSONObject actionMsg = response.getJSONObject("actionMsg"); + String code = actionMsg.getString("code"); + if ("0".equals(code)) {//创建成功 + if (response.containsKey("data")) { + data = response.getString("data"); + + //新接口,需要解密 + if (!"".equals(aesKey) && !"".equals(data)) { + data = InvoiceCloudAESUtil.decrypt(aesKey, data); + response.put("data", data); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "returnResult", response.toString(), "uuid", uuid, "string"); + } + } + } else { + errorMsg = actionMsg.getString("message"); + if ("check".equals(from)) { + new BaseBean().writeLog("checkException", errorMsg); + FnaInvoiceCommon.saveFailLog(user.getUID(), 1, errorMsg); + } + throw new Exception(errorMsg); + } + } else { + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "returnResult", "请求失败HttpStatus=" + res.getStatusLine().getStatusCode(), "uuid", uuid, "string"); + throw new Exception("请求失败!"); + } + }catch (Exception e){ + errorMsg = e.getMessage(); + }finally { + if(httpclient!=null){ + httpclient.close(); + } + } + if(!"".equals(errorMsg)){ + throw new Exception(errorMsg); + } + return data; + } + + /** + * 发票云加密 + * @param content + * @param secret + * @return + */ + public static String invoiceCloudEncode(String content,String secret){ + long time = System.currentTimeMillis(); + content = content+"&time="+time; + String md5Content = Md5Encode(content + "&secret=" + secret); + content = content+"&md5="+md5Content; + return content; + } + + /** + * 发票云加密 + * @param content + * @param secret + * @return + */ + public static String invoiceCloudEncode(String content,String secret,long time){ + content = content+"&time="+time; + String md5Content = Md5Encode(content + "&secret=" + secret); + return md5Content; + } + + /** + * md5加密 + * @param content + * @return + */ + public static String Md5Encode(String content){ + char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; + try { + byte[] btInput = content.getBytes("UTF-8"); + // 获得MD5摘要算法的 MessageDigest 对象 + MessageDigest mdInst = MessageDigest.getInstance("MD5"); + // 使用指定的字节更新摘要 + mdInst.update(btInput); + // 获得密文 + byte[] md = mdInst.digest(); + // 把密文转换成十六进制的字符串形式 + int j = md.length; + char str[] = new char[j * 2]; + int k = 0; + for (int i = 0; i < j; i++) { + byte byte0 = md[i]; + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + return new String(str); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * 根据sql获取发票信息 + * @return + */ + public static JSONArray getInvoiceInfos(String sql,int start_pos,int page_size){ + DecimalFormat df = new DecimalFormat("#############################0.00"); + JSONArray invoiceArray = new JSONArray(); + RecordSet rs = new RecordSet(); + RecordSet rs2 = new RecordSet(); + RecordSet rs3 = new RecordSet(); + RecordSet rs4 = new RecordSet(); + String fnainvoiceledger[] = {"id","billingDate","invoiceCode","invoiceNumber","invoiceType","seller","purchaser","invoiceServiceYype", + "priceWithoutTax","taxRate","tax","taxIncludedPrice","authenticity","reimbursementDate","reimbursePerson","requestId","userid_new", + "invoiceSource_new","checkcode","status","card_id_new","encrypt_code_new","openid_new","wechatstatus","imageID","purchaserTaxNo","salesTaxNo", + "entryTime","company_seal","form_type","form_name","kind","category","imageDocId","checkStatus","updateOperate","cloudId","codeConfirm","numberConfirm","requestName", + "receiptor","reviewer","issuer","province","city","travel_tax"}; + String fnainvoiceledgerdetail[]={"invoiceserviceyype","specification","unit","unitNumber2","originalUnitPrice","priceWithoutTax","taxRate","tax","startDate","endDate","numberPlate","type"}; + String fnaInvoiceLedgerDtl[]={"remark","checkCodeSix","sellerAddress","purchaserAddress","salesBank","purchaserBank"}; + String trainInvoice[]={"time","name","station_geton","station_getoff","train_number","seat"}; + String taxiInvoice[]={"time_geton","time_getoff","mileage","place"}; + String machineInvoice[]={"time","category","seller_tax_id","buyer_tax_id"}; + String tollInvoice[]={"time","entrance","export"}; + String carInvoice[]={"time","station_geton","station_getoff","name"}; + String second_carInvoice[]={"seller_id","buyer_id","company_name","company_tax_id","license_plate","registration_number","car_code","car_model"}; + String motor_VehicleInvoice[]={"machine_code","machine_number","pretax_amount","seller_tax_id","buyer_id","tax_authorities","tax_authorities_code", + "car_code","car_engine_code","car_model","certificate_number"}; + String airInvoice[]={"user_name","user_id","agentcode","issue_by","fare","fuel_surcharge","caac_development_fund","insurance"}; + String airDtlInvoice[]={"from_city","to_city","flight_number","airdate","airtime","seat","carrier"}; + String smallInvoice[]={"storename","time","tips","currency_code","type","discount"}; + + String fnaDidiInvoice[]={"startDate","endDate","phone"}; + String fnaDidiDtlInvoice[]={"carType","time_geton","city","station_geton","station_getoff","mileage","total"}; + String fnaBoatInvoice[]={"time","station_geton","station_getoff","name","currency_code"}; + + //报销状况 + String fnaInvoiceReimbursement[]={"requestid","reimbursementAmt","userid","reimbursementDate","requestName"}; + + int start=0; + rs.executeQuery(sql); + while (rs.next()){ + if(start>=start_pos && page_size>0 ) { + JSONObject fnainvoiceledgerJo = new JSONObject(); + int id = Util.getIntValue(rs.getString("id"), 0); + int invoiceType = Util.getIntValue(rs.getString("invoiceType"), 0); + int requestId = Util.getIntValue(rs.getString("requestId"), 0); + for (int i = 0; i < fnainvoiceledger.length; i++) { + String key = fnainvoiceledger[i]; + if("requestName".equals(key)){ + String requestName=""; + if(requestId>0){ + rs2.executeQuery("select requestName from workflow_requestBase where requestId=?",requestId); + if(rs2.next()){ + requestName = Util.null2String(rs2.getString("requestName")); + } + } + fnainvoiceledgerJo.put("requestName",requestName); + }else{ + fnainvoiceledgerJo.put(key, Util.null2String(rs.getString(key))); + } + + } + + JSONArray fnainvoiceledgerdetailJa = new JSONArray(); + rs2.executeQuery("select * from fnainvoiceledgerdetail where mainid=?", id); + while (rs2.next()) { + JSONObject fnainvoiceledgerdetailJo = new JSONObject(); + for (int i = 0; i < fnainvoiceledgerdetail.length; i++) { + String key = fnainvoiceledgerdetail[i]; + fnainvoiceledgerdetailJo.put(key, Util.null2String(rs2.getString(key))); + } + fnainvoiceledgerdetailJa.add(fnainvoiceledgerdetailJo); + } + fnainvoiceledgerJo.put("fnainvoiceledgerdetail", fnainvoiceledgerdetailJa); + if (invoiceType == 1 || invoiceType == 2 || invoiceType == 15 || invoiceType == 16 || invoiceType == 12 + || invoiceType == 3 || invoiceType == 17 || invoiceType == 19 || invoiceType == 20 || invoiceType == 21) { + rs3.executeQuery("select * from FnaInvoiceLedgerDtl where mainid=?", id); + if (rs3.next()) { + JSONObject FnaInvoiceLedgerDtlJo = new JSONObject(); + for (int i = 0; i < fnaInvoiceLedgerDtl.length; i++) { + String key = fnaInvoiceLedgerDtl[i]; + FnaInvoiceLedgerDtlJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("fnaInvoiceLedgerDtl", FnaInvoiceLedgerDtlJo); + } + } + if (invoiceType == 8) {//火车票 + rs3.executeQuery("select * from trainInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject trainInvoiceJo = new JSONObject(); + for (int i = 0; i < trainInvoice.length; i++) { + String key = trainInvoice[i]; + trainInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("trainInvoice", trainInvoiceJo); + } + } else if (invoiceType == 7) {//出租车发票 + rs3.executeQuery("select * from taxiInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject taxiInvoiceJo = new JSONObject(); + for (int i = 0; i < taxiInvoice.length; i++) { + String key = taxiInvoice[i]; + taxiInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("taxiInvoice", taxiInvoiceJo); + } + } else if (invoiceType == 3) {//通用机打发票 + rs3.executeQuery("select * from machineInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject machineInvoiceJo = new JSONObject(); + for (int i = 0; i < machineInvoice.length; i++) { + String key = machineInvoice[i]; + machineInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("machineInvoice", machineInvoiceJo); + } + } else if (invoiceType == 9) {//过路费发票表 + rs3.executeQuery("select * from tollInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject tollInvoiceJo = new JSONObject(); + for (int i = 0; i < tollInvoice.length; i++) { + String key = tollInvoice[i]; + tollInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("tollInvoice", tollInvoiceJo); + } + } else if (invoiceType == 10) {//客运汽车发票 + rs3.executeQuery("select * from carInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject carInvoiceJo = new JSONObject(); + for (int i = 0; i < carInvoice.length; i++) { + String key = carInvoice[i]; + carInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("carInvoice", carInvoiceJo); + } + } else if (invoiceType == 11) {//二手车销售统一发票表 + rs3.executeQuery("select * from second_carInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject second_carInvoiceJo = new JSONObject(); + for (int i = 0; i < second_carInvoice.length; i++) { + String key = second_carInvoice[i]; + second_carInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("second_carInvoice", second_carInvoiceJo); + } + } else if (invoiceType == 12) {//机动车销售统一发票 + rs3.executeQuery("select * from motor_VehicleInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject motor_VehicleInvoiceJo = new JSONObject(); + for (int i = 0; i < motor_VehicleInvoice.length; i++) { + String key = motor_VehicleInvoice[i]; + motor_VehicleInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("motor_VehicleInvoice", motor_VehicleInvoiceJo); + } + } else if (invoiceType == 14) {//航空运输电子客票行程单 + rs3.executeQuery("select * from airInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject airInvoiceJo = new JSONObject(); + for (int i = 0; i < airInvoice.length; i++) { + String key = airInvoice[i]; + airInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("airInvoice", airInvoiceJo); + } + + rs3.executeQuery("select * from airDtlInvoice where mainid=?", id); + JSONArray airDtlInvoiceJa = new JSONArray(); + while (rs3.next()) { + JSONObject airDtlInvoiceJo = new JSONObject(); + for (int i = 0; i < airDtlInvoice.length; i++) { + String key = airDtlInvoice[i]; + airDtlInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + airDtlInvoiceJa.add(airDtlInvoiceJo); + } + fnainvoiceledgerJo.put("airDtlInvoice", airDtlInvoiceJa); + } else if (invoiceType == 13) {//国际小票 + rs3.executeQuery("select * from smallInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject smallInvoiceJo = new JSONObject(); + for (int i = 0; i < smallInvoice.length; i++) { + String key = smallInvoice[i]; + smallInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("smallInvoice", smallInvoiceJo); + } + } else if (invoiceType == 22) {//滴滴出行行程单 + rs3.executeQuery("select * from fnaDidiInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject fnaDidiInvoiceJo = new JSONObject(); + for (int i = 0; i < fnaDidiInvoice.length; i++) { + String key = fnaDidiInvoice[i]; + fnaDidiInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("fnaDidiInvoice", fnaDidiInvoice); + } + + rs3.executeQuery("select * from fnaDidiDtlInvoice where mainid=?", id); + JSONArray fnaDidiDtlInvoiceJa = new JSONArray(); + while (rs3.next()) { + JSONObject fnaDidiDtlInvoiceJo = new JSONObject(); + for (int i = 0; i < fnaDidiDtlInvoice.length; i++) { + String key = fnaDidiDtlInvoice[i]; + fnaDidiDtlInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnaDidiDtlInvoiceJa.add(fnaDidiDtlInvoiceJo); + } + fnainvoiceledgerJo.put("fnaDidiDtlInvoice", fnaDidiDtlInvoiceJa); + } else if (invoiceType == 23) {//船票 + rs3.executeQuery("select * from fnaBoatInvoice where mainid=?", id); + if (rs3.next()) { + JSONObject fnaBoatInvoiceJo = new JSONObject(); + for (int i = 0; i < fnaBoatInvoice.length; i++) { + String key = fnaBoatInvoice[i]; + fnaBoatInvoiceJo.put(key, Util.null2String(rs3.getString(key))); + } + fnainvoiceledgerJo.put("fnaBoatInvoice", fnaBoatInvoiceJo); + } + } + + JSONArray fnaInvoiceReimbursementJa = new JSONArray(); + rs3.executeQuery("select * from fnaInvoiceReimbursement where mainid=?", id); + while (rs3.next()) { + int requestid3 = Util.getIntValue(rs3.getString("requestId"),0); + JSONObject fnaInvoiceReimbursementJo = new JSONObject(); + for (int i = 0; i < fnaInvoiceReimbursement.length; i++) { + String key = fnaInvoiceReimbursement[i]; + if("requestName".equals(key)){ + String requestName=""; + if(requestid3>0){ + rs4.executeQuery("select requestName from workflow_requestBase where requestId=?",requestid3); + if(rs4.next()){ + requestName = Util.null2String(rs4.getString("requestName")); + } + } + fnaInvoiceReimbursementJo.put("requestName",requestName); + }else{ + fnaInvoiceReimbursementJo.put(key, Util.null2String(rs3.getString(key))); + } + + } + fnaInvoiceReimbursementJa.add(fnaInvoiceReimbursementJo); + } + fnainvoiceledgerJo.put("fnaInvoiceReimbursement", fnaInvoiceReimbursementJa); + invoiceArray.add(fnainvoiceledgerJo); + page_size--; + } + start++; + + } + return invoiceArray; + } + + /** + * 实时同步更新发票信息 + * @param infoJson + * @return cloudId和id + */ + public static JSONObject updateInvoiceInfo(JSONObject infoJson,String ipAdress) throws Exception { + JSONObject jsonObject = new JSONObject(); + + String fnainvoiceledger[] = {"billingDate","invoiceCode","invoiceNumber","invoiceType","seller","purchaser","invoiceServiceYype", + "priceWithoutTax","taxRate","tax","taxIncludedPrice","authenticity","userid_new",//"reimbursementDate","reimbursePerson","requestId" 报销信息无需从发票云获取 + "invoiceSource_new","checkcode","status","card_id_new","encrypt_code_new","openid_new","wechatstatus","imageID","purchaserTaxNo","salesTaxNo", + "entryTime","company_seal","form_type","form_name","kind","category","imageDocId","checkStatus","updateOperate","cloudId","codeConfirm","numberConfirm", + "receiptor","reviewer","issuer","province","city","travel_tax"}; + String fnainvoiceledgerdetail[]={"invoiceserviceyype","specification","unit","unitNumber2","originalUnitPrice","priceWithoutTax","taxRate","tax","startDate","endDate","numberPlate","type"}; + String fnaInvoiceLedgerDtl[]={"remark","checkCodeSix","sellerAddress","purchaserAddress","salesBank","purchaserBank"}; + String trainInvoice[]={"time","name","station_geton","station_getoff","train_number","seat"}; + String taxiInvoice[]={"time_geton","time_getoff","mileage","place"}; + String machineInvoice[]={"time","category","seller_tax_id","buyer_tax_id"}; + String tollInvoice[]={"time","entrance","export"}; + String carInvoice[]={"time","station_geton","station_getoff","name"}; + String second_carInvoice[]={"seller_id","buyer_id","company_name","company_tax_id","license_plate","registration_number","car_code","car_model"}; + String motor_VehicleInvoice[]={"machine_code","machine_number","pretax_amount","seller_tax_id","buyer_id","tax_authorities","tax_authorities_code", + "car_code","car_engine_code","car_model","certificate_number"}; + String airInvoice[]={"user_name","user_id","agentcode","issue_by","fare","fuel_surcharge","caac_development_fund","insurance"}; + String airDtlInvoice[]={"from_city","to_city","flight_number","airdate","airtime","seat","carrier"}; + String smallInvoice[]={"storename","time","tips","currency_code","type","discount"}; + + String fnaDidiInvoice[]={"startDate","endDate","phone"}; + String fnaDidiDtlInvoice[]={"carType","time_geton","city","station_geton","station_getoff","mileage","total"}; + String fnaBoatInvoice[]={"time","station_geton","station_getoff","name","currency_code"}; + + String formatDoubleColumn="priceWithoutTax,taxRate,tax,taxIncludedPrice,mileage,pretax_amount,travel_tax,total";//需要格式化金额的列,用逗号隔开 + List formatDoubleList = Arrays.asList(formatDoubleColumn.split(",")); + + String formatIntColumn="invoiceType,authenticity,reimbursePerson,requestId,userid_new,invoiceSource_new," + + "status,imageID,company_seal,imageDocId,checkStatus,updateOperate"; + List formatIntList = Arrays.asList(formatIntColumn.split(",")); + + int id = Util.getIntValue(infoJson.getString("id"),0); + + + String cloudId= Util.null2String(infoJson.getString("cloudId")); + int invoiceType = Util.getIntValue(infoJson.getString("invoiceType"),0); + int userid_new = Util.getIntValue(infoJson.getString("userid_new"),0); + String invoiceNumber= Util.null2String(infoJson.getString("invoiceNumber")); + String invoiceCode= Util.null2String(infoJson.getString("invoiceCode")); + RecordSet rs = new RecordSet(); + ListvalueList =new ArrayList(); + + //脏数据优化 + if(id==0){ + rs.executeQuery("select id from fnainvoiceLedger where invoicenumber=? and invoiceCode=?",invoiceNumber,invoiceCode); + if(rs.next()){ + id = Util.getIntValue(rs.getString("id"),0); + } + }else{ + //判断该id在台账中是否存在 + int cnt = 0; + rs.executeQuery("select count(id) cnt from fnainvoiceLedger where id=?",id); + if(rs.next()){ + cnt= Util.getIntValue(rs.getString("cnt"),0); + } + if(cnt==0){ + id=0; + } + } + synchronized(InvoiceCloudUtil.class) { + //插入日志1 + FnaLogSqlUtil fnaLogSqlUtil = new FnaLogSqlUtil(); + Map labelIdMap = new HashMap(); + Map beforeMap = new HashMap(); + String opType="0"; + if(id>0){ + opType="2"; + beforeMap = fnaLogSqlUtil.getInvoiceMap(String.valueOf(id),labelIdMap); + } + + //修改主表数据 fnainvoiceledger + String sql = getsqlByColumn(id, fnainvoiceledger, infoJson, valueList, formatDoubleList,formatIntList,"fnainvoiceledger"); + rs.executeUpdate(sql,valueList); + if(id<=0){ + rs.executeQuery("select id from fnainvoiceledger where cloudId=?",cloudId); + if(rs.next()){ + id = Util.getIntValue(rs.getString("id")); + } + } + + + //修改明细表数据 fnainvoiceledgerdetail + rs.executeUpdate("delete from fnainvoiceledgerdetail where mainid=?", id); + if (infoJson.containsKey("fnainvoiceledgerdetail")) { + String fnainvoiceledgerdetailStr = infoJson.getString("fnainvoiceledgerdetail"); + if (fnainvoiceledgerdetailStr != null && !"".equals(fnainvoiceledgerdetailStr)) { + JSONArray infoJsonArray = infoJson.getJSONArray("fnainvoiceledgerdetail"); + for (int i = 0; i < infoJsonArray.size(); i++) { + JSONObject infoJsonDtl = infoJsonArray.getJSONObject(i); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, fnainvoiceledgerdetail, infoJsonDtl, valueList, formatDoubleList, formatIntList, "fnainvoiceledgerdetail"); + rs.executeUpdate(sql, valueList); + } + } + } + + } + + if (invoiceType == 1 || invoiceType == 2 || invoiceType == 15 || invoiceType == 16 || invoiceType == 12 + || invoiceType == 3 || invoiceType == 17 || invoiceType == 19 || invoiceType == 20 || invoiceType == 21) { + //修改明细表数据 fnaInvoiceLedgerDtl + rs.executeUpdate("delete from fnaInvoiceLedgerDtl where mainid=?", id); + if (infoJson.containsKey("fnaInvoiceLedgerDtl")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("fnaInvoiceLedgerDtl"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, fnaInvoiceLedgerDtl, infoJsonDtl, valueList, formatDoubleList, formatIntList, "fnaInvoiceLedgerDtl"); + rs.executeUpdate(sql, valueList); + } + } + } + if (invoiceType == 8) {//火车票 + //修改明细表数据 trainInvoice + rs.executeUpdate("delete from trainInvoice where mainid=?", id); + if (infoJson.containsKey("trainInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("trainInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, trainInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "trainInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 7) {//出租车发票 + //修改明细表数据 taxiInvoice + rs.executeUpdate("delete from taxiInvoice where mainid=?", id); + if (infoJson.containsKey("taxiInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("taxiInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, taxiInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "taxiInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 3) {//通用机打发票 + //修改明细表数据 machineInvoice + rs.executeUpdate("delete from machineInvoice where mainid=?", id); + if (infoJson.containsKey("machineInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("machineInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, machineInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "machineInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 9) {//过路费发票表 + //修改明细表数据 tollInvoice + rs.executeUpdate("delete from tollInvoice where mainid=?", id); + if (infoJson.containsKey("tollInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("tollInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, tollInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "tollInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 10) {//客运汽车发票 + //修改明细表数据 carInvoice + rs.executeUpdate("delete from carInvoice where mainid=?", id); + if (infoJson.containsKey("carInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("carInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, carInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "carInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 11) {//二手车销售统一发票表 + //修改明细表数据 second_carInvoice + rs.executeUpdate("delete from second_carInvoice where mainid=?", id); + if (infoJson.containsKey("second_carInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("second_carInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, second_carInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "second_carInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 12) {//机动车销售统一发票 + //修改明细表数据 motor_VehicleInvoice + rs.executeUpdate("delete from motor_VehicleInvoice where mainid=?", id); + if (infoJson.containsKey("motor_VehicleInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("motor_VehicleInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, motor_VehicleInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "motor_VehicleInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 14) {//航空运输电子客票行程单 + //修改明细表数据 airInvoice + rs.executeUpdate("delete from airInvoice where mainid=?", id); + if (infoJson.containsKey("airInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("airInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, airInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "airInvoice"); + rs.executeUpdate(sql, valueList); + } + } + rs.executeUpdate("delete from airDtlInvoice where mainid=?", id); + if (infoJson.containsKey("airDtlInvoice")) { + String airDtlInvoiceStr = infoJson.getString("airDtlInvoice"); + if (airDtlInvoiceStr != null && !"".equals(airDtlInvoiceStr)) { + JSONArray infoJsonArray = infoJson.getJSONArray("airDtlInvoice"); + for (int i = 0; i < infoJsonArray.size(); i++) { + JSONObject infoJsonDtl = infoJsonArray.getJSONObject(i); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, airDtlInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "airDtlInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } + } + } else if (invoiceType == 13) {//国际小票 + //修改明细表数据 smallInvoice + rs.executeUpdate("delete from smallInvoice where mainid=?", id); + if (infoJson.containsKey("smallInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("smallInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, smallInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "smallInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 22) {//船票 + //修改明细表数据 fnaBoatInvoice + rs.executeUpdate("delete from fnaBoatInvoice where mainid=?", id); + if (infoJson.containsKey("fnaBoatInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("fnaBoatInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, fnaBoatInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "fnaBoatInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } else if (invoiceType == 23) {//滴滴出行行程单 + //修改明细表数据 fnaDidiInvoice + rs.executeUpdate("delete from fnaDidiInvoice where mainid=?", id); + if (infoJson.containsKey("fnaDidiInvoice")) { + JSONObject infoJsonDtl = infoJson.getJSONObject("fnaDidiInvoice"); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, fnaDidiInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "fnaDidiInvoice"); + rs.executeUpdate(sql, valueList); + } + } + rs.executeUpdate("delete from fnaDidiDtlInvoice where mainid=?", id); + if (infoJson.containsKey("fnaDidiDtlInvoice")) { + String fnaDidiDtlInvoiceStr = infoJson.getString("fnaDidiDtlInvoice"); + if (fnaDidiDtlInvoiceStr != null && !"".equals(fnaDidiDtlInvoiceStr)) { + JSONArray infoJsonArray = infoJson.getJSONArray("fnaDidiDtlInvoice"); + for (int i = 0; i < infoJsonArray.size(); i++) { + JSONObject infoJsonDtl = infoJsonArray.getJSONObject(i); + if (infoJsonDtl != null && infoJsonDtl.size() > 0) { + sql = getsqlByColumn(id, fnaDidiDtlInvoice, infoJsonDtl, valueList, formatDoubleList, formatIntList, "fnaDidiDtlInvoice"); + rs.executeUpdate(sql, valueList); + } + } + } + + } + } + + + //插入日志2 + Map afterMap = fnaLogSqlUtil.getInvoiceMap(String.valueOf(id), labelIdMap); + fnaLogSqlUtil.invoiceLedgerAddlog(new User(1), ipAdress, opType, String.valueOf(id), "2", + beforeMap, afterMap, labelIdMap); + } + jsonObject.put("id",String.valueOf(id)); + jsonObject.put("cloudId",cloudId); + return jsonObject; + } + + /** + * 通过数据库字段获取sql + * @return + */ + public static String getsqlByColumn(int id,String tableNameArray[] ,JSONObject infoJson,ListvalueList, + List formatDoubleList,List formatIntList,String tableName){ + DecimalFormat df = new DecimalFormat("###############################0.00"); + StringBuffer sql=new StringBuffer(); + StringBuffer sqlPlaceHolder=new StringBuffer(); + valueList.clear(); + if(id<=0 || !"fnainvoiceledger".equals(tableName)){ + sql.append("insert into ").append(tableName).append("("); + sqlPlaceHolder.append(" values("); + if(!"fnainvoiceledger".equals(tableName)){//明细表,插入mainid + sql.append("mainid,"); + sqlPlaceHolder.append("?,"); + valueList.add(String.valueOf(id)); + } + for(int i=0;i map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid, Util.date(2), "OA发送请求", "发票识别-发票云", ocrUrl, userName, password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content", content, "uuid", uuid, "string"); + + String data = postToUrl(ocrUrl, content, map, "", uuid, "check", user,""); + new BaseBean().writeLog("--------fnaLog--------发票云返回data:" + data); + JSONObject dataJson = JSONObject.fromObject(data); + + //解析报文开始 + JSONObject dataJsonObj = new JSONObject(); //封装的接口返回标准信息 + JSONArray identify_results = new JSONArray(); //识别结果数据 + + JSONArray infoArrayJson = dataJson.getJSONArray("infos"); + int infoArrayJson_len = infoArrayJson.size(); + for (int i = 0; i < infoArrayJson_len; i++) { + JSONObject infoArrayJsonElt = infoArrayJson.getJSONObject(i); + + String ret = infoArrayJsonElt.getString("ret"); + if ("0".equals(ret)) { + //获取发票云相关信息对象 + JSONObject infoJson = infoArrayJsonElt.getJSONObject("info"); + JSONObject modify_infoJson = infoJson.getJSONObject("modify_info"); + JSONObject comm_infoJson = infoJson.getJSONObject("comm_info"); + JSONObject proJson = comm_infoJson.getJSONObject("pro"); + JSONObject priceJson = comm_infoJson.getJSONObject("price"); + JSONObject buyerJson = comm_infoJson.getJSONObject("buyer"); + JSONObject payerJson = comm_infoJson.getJSONObject("payer"); + + //不常用信息 + String ext = infoJson.getString("ext"); + JSONObject extJson = JSONObject.fromObject(ext); + + + //转化为标准的结构 + JSONObject identifyObj = new JSONObject(); + JSONObject detailsObj = new JSONObject(); + String type = proJson.getString("type"); + + String standardType =Constants.STANDARDTYPE.get(type); + if ("".equals(standardType)) { + //识别失败 + resultJsonObj.put("result", 0); + resultJsonObj.put("message", "发票识别失败!"); + return resultJsonObj; + } + identifyObj.put("type", standardType); + identifyObj.put("orientation", ""); + identifyObj.put("region", infoJson.getString("region")); + if ("1".equals(type) || "2".equals(type) || "3".equals(type) || "4".equals(type) || "5".equals(type) || "22".equals(type) || "28".equals(type) ) { //增值税 + //if ("1".equals(type) || "2".equals(type) || "3".equals(type) || "5".equals(type)) { //增值税 + + detailsObj.put("code", getString(infoJson, "code")); + detailsObj.put("number", getString(infoJson, "number")); + detailsObj.put("date", getString(proJson, "date")); + detailsObj.put("pretax_amount", getString(priceJson, "amount")); + detailsObj.put("total", getString(priceJson, "total")); + detailsObj.put("tax", getString(extJson, "ttax")); + detailsObj.put("check_code", getString(proJson, "chcode")); + detailsObj.put("seller", getString(payerJson, "company")); + detailsObj.put("seller_tax_id", getString(payerJson, "tcode")); + detailsObj.put("buyer", getString(buyerJson, "company")); + detailsObj.put("buyer_tax_id", getString(buyerJson, "tcode")); + detailsObj.put("company_seal", getString(extJson, "corp_seal")); + detailsObj.put("form_type", getString(extJson, "form_type")); + detailsObj.put("form_name", getString(extJson, "form_name")); + detailsObj.put("kind", getString(proJson, "kind")); + detailsObj.put("ciphertext", getString(extJson, "ciphertext")); + detailsObj.put("transit_mark", getString(extJson, "transit")); + detailsObj.put("oil_mark", getString(extJson, "oil_mark")); + detailsObj.put("machine_code", getString(extJson, "machine_code")); + detailsObj.put("travel_tax", getString(extJson, "travel_tax")); + detailsObj.put("receiptor", getString(extJson, "receiptor")); + detailsObj.put("reviewer", getString(extJson, "reviewer")); + detailsObj.put("issuer", getString(extJson, "issuer")); + detailsObj.put("province", getString(extJson, "province")); + detailsObj.put("city", getString(extJson, "city")); + detailsObj.put("service_name", getString(extJson, "service_name")); + detailsObj.put("remark", getString(extJson, "comment")); + + detailsObj.put("code_confirm", getString(extJson, "code_confirm")); + detailsObj.put("number_confirm", getString(extJson, "number_confirm")); + + String item_names = ""; + if(extJson.containsKey("products")) { + JSONArray productsArrayJson = extJson.getJSONArray("products"); + for (int j = 0; j < productsArrayJson.size(); j++) { + if (!"".equals(item_names)) { + item_names += ","; + } + item_names += productsArrayJson.getJSONObject(j).get("name"); + } + } + detailsObj.put("item_names", item_names); + detailsObj.put("agent_mark", getString(extJson, "agent_mark")); + detailsObj.put("acquisition_mark", getString(extJson, "acquisition")); + detailsObj.put("block_chain", getString(extJson, "block_chain")); + if("22".equals(type)){//区块链发票 + detailsObj.put("block_chain", "1"); + } + if("5".equals(type)){//通行费 + detailsObj.put("transit_mark", "1"); + } + + detailsObj.put("code_confirm", getString(extJson, "code_confirm")); + detailsObj.put("number_confirm", getString(extJson, "number_confirm")); + + + + + JSONArray items = new JSONArray();//发票明细 + if(extJson.containsKey("products")){ + JSONArray productsArray = extJson.getJSONArray("products"); + for(int j=0;j map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid, Util.date(2),"OA发送请求","发票查验",checkUrl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + String data = postToUrl(checkUrl, content, map, "", uuid,"check",user,""); + JSONObject dataJson = JSONObject.fromObject(data); + + //解析报文开始 + JSONObject infoJson = dataJson.getJSONObject("info"); + JSONObject comm_infoJson = infoJson.getJSONObject("comm_info"); + JSONObject proJson = comm_infoJson.getJSONObject("pro"); + JSONObject priceJson = comm_infoJson.getJSONObject("price"); + JSONObject buyerJson = comm_infoJson.getJSONObject("buyer"); + JSONObject payerJson = comm_infoJson.getJSONObject("payer"); + + String ext = infoJson.getString("ext"); + JSONObject extJson = JSONObject.fromObject(ext); + + String status = getString(proJson,"status");//状态 + if("2".equals(status)){ + //记录错误信息 + FnaInvoiceCommon.saveFailLog(user.getUID(), 1, SystemEnv.getHtmlLabelName(509480, user.getLanguage())); + throw new Exception(SystemEnv.getHtmlLabelName(509480, user.getLanguage())); + } + + String type = getString(proJson,"type");//标题 + + String title = getString(proJson,"cname");//标题 + String _taxIncludedPrice = getString(priceJson,"total");//价税合计 + String _priceWithoutTax = getString(priceJson,"amount");//不含税金额 + String _tax = getString(extJson,"ttax"); + String _invoiceNumber = getString(infoJson,"number");//发票号码 + String _invoicecode = getString(infoJson,"code");//代码 + String _checkCode = getString(proJson,"chcode");//校验码 + String _purchaser = getString(buyerJson,"company");//购买方 + String _seller = getString(payerJson,"company");//销售方 + String _purchaserTaxNo = getString(buyerJson,"tcode");//购买方纳税人识别号 + String _salesTaxNo = getString(payerJson,"tcode");//销售方纳税人识别号 + String _billingDate = getString(proJson,"date");//开票日期 + String _remark = getString(extJson,"comment");//备注信息 + String _sellerAddress = getString(extJson,"pcontact");//销售方电话、地址 + String _purchaserAddress = getString(extJson,"bcontact");//购买方电话、地址 + String _salesBank = getString(extJson,"pbank");//销售方开户行及账号 + String _purchaserBank = getString(extJson,"bbank");//购买方开户行及账号 + String _taxRate = getString(extJson,"trate");//税率 + String _invoiceServiceYype = "";//货物或应税服务类型 + JSONArray items = new JSONArray();//发票明细 + if(extJson.containsKey("products")){ + JSONArray productsArray = extJson.getJSONArray("products"); + for(int i=0;i map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid, Util.date(2), "OA发送请求", "同步转移归属人/共享人信息到发票云", interfaceurl, userName, password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content", content, "uuid", uuid, "string"); + + String data = postToUrl(interfaceurl, content, map, "", uuid); + jsonObject.put("flag", true); + jsonObject.put("data", data); + } catch (Exception e) { + jsonObject.put("flag", false); + jsonObject.put("msg", e.getMessage()); + } + return jsonObject; + } + + /** + * @Description: 同步共享人信息到发票云 + * @param interfaceurl + * @param param + * @param userName + * @param password + * @return: net.sf.json.JSONObject + * @Author: konghang + * @Date: 10:04 2020/10/14 + */ + public static JSONObject sysSharerInfo(String interfaceurl, JSONObject param, String userName, String password) { + JSONObject jsonObject = new JSONObject(); + try { + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid, Util.date(2), "OA发送请求", "同步共享人信息到发票云", interfaceurl, userName, password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content", content, "uuid", uuid, "string"); + + String data = postToUrl(interfaceurl, content, map, "", uuid); + jsonObject.put("flag", true); + jsonObject.put("data", data); + } catch (Exception e) { + jsonObject.put("flag", false); + jsonObject.put("msg", e.getMessage()); + } + return jsonObject; + } + + + /** + * 获取发票使用次数接口 + * @param cid + * @param userId + * @return + */ + public static JSONObject getInvoiceUsedNumberInfo(String cid,int userId){ + JSONObject invoiceCloudUrl = InvoiceCloudUtil.getInvoiceCloudUrl(); + RecordSet rs = new RecordSet(); + String userName=""; + String password=""; + String javaUrl=""; + rs.executeQuery("select * from fnaInvoiceInterface where cid=?",cid); + if(rs.next()){ + userName = Util.null2String(rs.getString("userName")); + password = FnaInvoiceCommon.fnaDecrypt(Util.null2String(rs.getString("password"))); + javaUrl = Util.null2String(rs.getString("javaUrl")); + } + return getInvoiceUsedNumberInfo(javaUrl+"/"+invoiceCloudUrl.getString("invoiceUsedNumberInfo"),cid,userName,password,userId); + } + + /** + * 获取发票使用次数接口 + * @param invoiceUsedNumberInfoUrl + * @param cid + * @param userName + * @param password + * @param userId + * @return + */ + public static JSONObject getInvoiceUsedNumberInfo(String invoiceUsedNumberInfoUrl,String cid,String userName,String password,int userId){ + JSONObject jsonObject = new JSONObject(); + try{ + JSONObject param = new JSONObject(); + param.put("cid",cid); + param.put("userId",userId); + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","获取发票使用次数",invoiceUsedNumberInfoUrl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + String data = postToUrl(invoiceUsedNumberInfoUrl, content, map, "",uuid); + jsonObject.put("flag",true); + jsonObject.put("data",data); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 获取AES加密的key + * @param invoiceUsedNumberInfoUrl + * @param cid + * @param userName + * @param password + * @param userId + * @return + */ + public static JSONObject createAesKey(String createAesKeyUrl,String password,String userName){ + JSONObject jsonObject = new JSONObject(); + try{ + + String content = invoiceCloudEncode("", password); + Map map = new HashMap(); + map.put("appkey", userName); + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求","获取AES加密的key",createAesKeyUrl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + String data = postToUrl(createAesKeyUrl, content, map, "",uuid); + jsonObject.put("flag",true); + jsonObject.put("data",data); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + return jsonObject; + } + + /** + * 报销校验 + * @param reimburseUrl + * @param aesKey + * @param bodyJson + * @param userName + * @param password + * @param description + * @return + */ + public static JSONObject reimburseInvoice(String reimburseUrl,String aesKey ,JSONObject bodyJson ,String userName,String password,String description){ + JSONObject jsonObject = new JSONObject(); + try{ + String bodyStr = InvoiceCloudAESUtil.encrypt(aesKey,bodyJson.toString()); + String content = invoiceCloudEncode(bodyStr.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid,Util.date(2),"OA发送请求",description,reimburseUrl,userName,password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", bodyJson.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content",content, "uuid", uuid, "string"); + + String data = postToUrl(reimburseUrl, content, map, "",uuid,aesKey); + + jsonObject.put("flag",true); + jsonObject.put("data",data); + }catch (Exception e){ + jsonObject.put("flag",false); + jsonObject.put("msg",e.getMessage()); + } + + return jsonObject; + } + + + /** + * 发票云附件上传 + * @param imageBytes + * @param cid + * @param ocrUrl + * @param tokenUrl + * @param uploadUrl + * @param user + * @param userName + * @param password + * @return + * @throws Exception + */ + public static JSONArray uploadFileInvoice(byte[] imageBytes, String cid, String ocrUrl,String localCheckUrl,String tokenUrl,String uploadUrl, User user, String userName, String password) throws Exception { + JSONArray uoloadFileArray = new JSONArray(); + + //1.先上传图片获取图片id + String imageId = getImageId(imageBytes,cid,tokenUrl,uploadUrl,user, userName, password); + //2.识别 + JSONObject param = new JSONObject(); + param.put("cid", cid); + param.put("userId", user.getUID()); + param.put("image_index", imageId); + param.put("operate_type", "0"); + param.put("is_save", "0"); + String content = invoiceCloudEncode(param.toString(), password); + Map map = new HashMap(); + map.put("appkey", userName); + //插入日志表fnaInvoiceCloudLog + RecordSet rs = new RecordSet(); + String uuid = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid, Util.date(2), "OA发送请求", "发票识别新-发票云", ocrUrl, userName, password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param.toString(), "uuid", uuid, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content", content, "uuid", uuid, "string"); + String data = postToUrl(ocrUrl, content, map, "", uuid, "check", user,""); + JSONObject dataJson = JSONObject.fromObject(data); + + //插入调用记录日志 + JSONObject jo = new JSONObject(); + jo.put("status","0"); + jo.put("returnInfo", dataJson); + FnaInvoiceCommon.addFnainvoiceLog("1",imageBytes,"","","","","", + jo, user, "OCR",""); + + JSONArray infoArrayJson = dataJson.getJSONArray("infos"); + String open_valid = Util.null2String(getString(dataJson,"open_valid")); + int infoArrayJson_len = infoArrayJson.size(); + if(infoArrayJson_len==0){ + FnaInvoiceCommon.saveFailLog(user.getUID(), 0, SystemEnv.getHtmlLabelName(509482, user.getLanguage()));//识别结果为空! + throw new Exception(SystemEnv.getHtmlLabelName( 509587,user.getLanguage())); + } + for (int i = 0; i < infoArrayJson_len; i++) { + JSONObject uploadFileJson = new JSONObject(); + JSONObject infoArrayJsonElt = infoArrayJson.getJSONObject(i); + String ret = Util.null2String(getString(infoArrayJsonElt,"ret")); + JSONObject infoJson = infoArrayJsonElt.getJSONObject("info"); + JSONObject comm_info = infoJson.getJSONObject("comm_info"); + JSONObject pro = comm_info.getJSONObject("pro"); + String type = Util.null2String(getString(infoJson,"type")); + String cloudId = Util.null2String(getString(infoJson,"fid")); + String invoiceNumber = Util.null2String(getString(infoJson,"number")); + if ("0".equals(ret)) { + if("1".equals(open_valid) && ("1".equals(type) || "2".equals(type) || "3".equals(type) || "4".equals(type) || "5".equals(type) || "6".equals(type) || "7".equals(type))){//需要查验 + JSONObject param1 = new JSONObject(); + param1.put("fid", cloudId); + String content1 = invoiceCloudEncode(param1.toString(), password); + Map map1 = new HashMap(); + map1.put("appkey", userName); + String uuid1 = FnaCommon.getPrimaryKeyGuid1(); + rs.executeUpdate("insert into fnaInvoiceCloudLog(uuid,enterTime,requestType,description,interfaceurl,userName,password) values(?,?,?,?,?,?,?)", + uuid1, Util.date(2), "OA发送请求", "发票查验新-发票云", localCheckUrl, userName, password); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "param", param1.toString(), "uuid", uuid1, "string"); + FnaCommon.updateDbClobOrTextFieldValue("fnaInvoiceCloudLog", "md5Content", content1, "uuid", uuid1, "string"); + try{ + String data1 = postToUrl(localCheckUrl, content1, map1, "", uuid1,"check",user,""); + JSONObject dataJson1 = JSONObject.fromObject(data1); + JSONObject infoJson1 = dataJson1.getJSONObject("info"); + JSONObject comm_infoJson = infoJson1.getJSONObject("comm_info"); + JSONObject proJson = comm_infoJson.getJSONObject("pro"); + String status = getString(proJson,"status");//状态 + if("2".equals(status)){ + //记录错误信息 + FnaInvoiceCommon.saveFailLog(user.getUID(), 1, SystemEnv.getHtmlLabelName(509480, user.getLanguage())); + uploadFileJson.put("msg",invoiceNumber+":"+SystemEnv.getHtmlLabelName(509480, user.getLanguage())); + uploadFileJson.put("flag",false); + }else{ + uploadFileJson.put("flag",true); + } + }catch (Exception e){ + uploadFileJson.put("flag",false); + uploadFileJson.put("msg",invoiceNumber+":"+e.getMessage()); + } + }else{ + uploadFileJson.put("flag",true); + } + uploadFileJson.put("cloudId",cloudId); + }else{ + uploadFileJson.put("cloudId",cloudId); + uploadFileJson.put("msg",Util.null2String(getString(infoArrayJsonElt,"message"))); + uploadFileJson.put("flag",true); + } + + uoloadFileArray.add(uploadFileJson); + } + return uoloadFileArray; + } +} diff --git a/weaver/ofs/webservices/OfsTodoDataWebServiceImpl.java b/weaver/ofs/webservices/OfsTodoDataWebServiceImpl.java new file mode 100644 index 0000000..3d65441 --- /dev/null +++ b/weaver/ofs/webservices/OfsTodoDataWebServiceImpl.java @@ -0,0 +1,470 @@ +/* + * + * Copyright (c) 2001-2016 泛微软件. + * 泛微协同商务系统,版权所有. + * + */ +package weaver.ofs.webservices; + +import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang3.StringUtils; +import org.codehaus.xfire.MessageContext; +import org.codehaus.xfire.service.invoker.AbstractInvoker; +import org.codehaus.xfire.transport.http.XFireServletController; +import org.codehaus.xfire.util.dom.DOMInHandler; +import org.dom4j.io.DOMReader; +import weaver.integration.cache.OfsSettingCacheNew; +import weaver.integration.logging.Logger; +import weaver.integration.logging.LoggerFactory; +import weaver.ofs.manager.IOfsTodoDataManager; +import weaver.ofs.manager.OfsTodoDataManagerNew; + +import javax.servlet.http.HttpServletRequest; +import java.util.HashMap; +import java.util.Map; + +/** + * + * 统一待办webservice接口实现类 + * @author liurui + */ +public class OfsTodoDataWebServiceImpl implements OfsTodoDataWebService { + + private static Logger log = LoggerFactory.getLogger("ofs", OfsTodoDataWebServiceImpl.class.getName()); + /** + * 统一待办业务处理对象 + */ + private IOfsTodoDataManager ofsTodoDataManager = new OfsTodoDataManagerNew(); + /** + * 接收待办流程(标准格式) + * @param dataMap + * @return + */ + public Map receiveTodoRequestByMap(Map dataMap){ + + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + + return ofsTodoDataManager.receiveTodoRequestByMap(dataMap2); + } + + /** + * 处理待办流程(变为已办)(标准格式) + * @param dataMap + * @return + */ + public Map processDoneRequestByMap(Map dataMap){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + + return ofsTodoDataManager.processDoneRequestByMap(dataMap2); + } + + /** + * 处理办结流程(变为办结)(标准格式) + * @param dataMap + * @return + */ + public Map processOverRequestByMap(Map dataMap){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + + return ofsTodoDataManager.processOverRequestByMap(dataMap2); + } + + /** + * 接收异构系统流程(标准格式) + * @param dataMap + * @return + */ + public Map receiveRequestInfoByMap(Map dataMap){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + + return ofsTodoDataManager.receiveRequestInfoByMap(dataMap2); + } + private String getXML(String xmlOld){ + + /*MessageContext context = AbstractInvoker.getContext(); + + org.w3c.dom.Document localDocument = (org.w3c.dom.Document)context.getInMessage().getProperty("dom.message");*/ +// 2021-09-30 EBU7-dev1 ayh修改(项目经理要求) + MessageContext context; + org.w3c.dom.Document localDocument; + try { + context = AbstractInvoker.getContext(); + + localDocument = (org.w3c.dom.Document)context.getInMessage().getProperty("dom.message"); + }catch (Exception e){ + return xmlOld; + } + // 2021-09-30 EBU7-dev1 ayh修改(项目经理要求) end + if(localDocument != null){ + String xml = buildDocment(localDocument).asXML(); + if(StringUtils.isBlank(xml)){ + return xmlOld; + } + + int start = xml.indexOf(""); + int end = xml.indexOf(""); + + if(start<0){ + + start = xml.indexOf(""); + start = start+9; + }else{ + start = start+5; + } + if(end<0){ + end = xml.indexOf(""); + } + + xml = xml.substring(start,end); + + log.info("截取需要的xml:"+xml); + + xml = StringEscapeUtils.unescapeHtml(xml); + + log.error("getXML:"+xml); + + return xml; + }else{ + return xmlOld; + } + + } + private String getJson(String jsonOld){ + + /*MessageContext context = AbstractInvoker.getContext(); + + org.w3c.dom.Document localDocument = (org.w3c.dom.Document)context.getInMessage().getProperty(DOMInHandler.DOM_MESSAGE);*/ + +// 2021-09-30 UEB7-dev1 ayh修改(项目经理提的需求) + org.w3c.dom.Document localDocument; + MessageContext context; + try { + context = AbstractInvoker.getContext(); + + localDocument = (org.w3c.dom.Document)context.getInMessage().getProperty(DOMInHandler.DOM_MESSAGE); + }catch(Exception e){ + return jsonOld; + } +// 2021-09-30 UEB7-dev1 ayh修改 end + if(localDocument != null){ + String xml = buildDocment(localDocument).asXML(); + if(StringUtils.isBlank(xml)){ + return jsonOld; + } + + int start = xml.indexOf(""); + int end = xml.indexOf(""); + + if(start<0){ + + start = xml.indexOf(""); + start = start+9; + }else{ + start = start+5; + } + if(end<0){ + end = xml.indexOf(""); + } + String json = xml.substring(start,end); + + log.info("截取需要的json:"+json); + + return json; + }else{ + return jsonOld; + } + + } + /** + * 接收待办流程(json格式) + * @param json + * @return + */ + public String receiveTodoRequestByJson(String json){ + + json = getJson(json); + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + + return ofsTodoDataManager.receiveTodoRequestByJson(json); + } + + /** + * 处理待办流程(变为已办)(json格式) + * @param json + * @return + */ + public String processDoneRequestByJson (String json){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + json = getJson(json); + return ofsTodoDataManager.processDoneRequestByJson(json); + } + + /** + * 处理办结流程(变为办结)(json格式) + * @param json + * @return + */ + public String processOverRequestByJson (String json){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + json = getJson(json); + return ofsTodoDataManager.processOverRequestByJson(json); + } + private org.dom4j.Document buildDocment(org.w3c.dom.Document paramDocument) + { + DOMReader localDOMReader = new DOMReader(); + return localDOMReader.read(paramDocument); + } + /** + * 接收异构系统流程(json格式) + * @param json + * @return + */ + public String receiveRequestInfoByJson (String json){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + + json = getJson(json); + return ofsTodoDataManager.receiveRequestInfoByJson(json); + } + + /** + * 接收待办流程(xml格式) + * @param xml + * @return + */ + public String receiveTodoRequestByXml(String xml){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + xml = getXML(xml); + return ofsTodoDataManager.receiveTodoRequestByXml(xml); + } + + /** + * 处理待办流程(变为已办)(xml格式) + * @param xml + * @return + */ + public String processDoneRequestByXml (String xml){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + xml = getXML(xml); + + return ofsTodoDataManager.processDoneRequestByXml(xml); + } + + /** + * 处理办结流程(变为办结)(xml格式) + * @param xml + * @return + */ + public String processOverRequestByXml (String xml){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + xml = getXML(xml); + return ofsTodoDataManager.processOverRequestByXml(xml); + } + /** + * 接收异构系统流程(xml格式) + * @param xml + * @return + */ + public String receiveRequestInfoByXml (String xml){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + + xml = getXML(xml); + return ofsTodoDataManager.receiveRequestInfoByXml(xml); + } + + /** + * XFIRE获取客户端IP地址 + * + * @Author MH + * @return + */ + private String getClientIpXfire() { + String ip = ""; + try { + HttpServletRequest request = XFireServletController.getRequest(); + ip = getRemoteAddress(request); + return ip; + } catch (Exception e) { + e.printStackTrace(); + return ""; + } + } + + /** + * 在JSP里,获取客户端的IP地址的方法是:request.getRemoteAddr(),这种方法在大部分情况下都是有效的。 + * 但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了 + * 经过代理以后,由于在客户端和服务之间增加了中间层,因此服务器无法直接拿到客户端的IP,服务器端应用也无法直接通过转发请求的地址返回给客户端。 + * 但是在转发请求的HTTP头信息中,增加了X-FORWARDED-FOR信息。用以跟踪原有的客户端IP地址和原来客户端请求的服务器地址 + * 如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值, + * 取X-Forwarded-For中第一个非unknown的有效IP字符串。 + * + * @param request + * @return + */ + private String getRemoteAddress(HttpServletRequest request) { + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || ip.equalsIgnoreCase("unknown")) { + ip = request.getRemoteAddr(); + } + if ((ip.indexOf(",") >= 0)){ + ip = ip.substring(0 , ip.indexOf(",")); + } + return ip; + } + + /** + * 删除异构系统流程(map格式) + * @param dataMap + * @return + */ + public Map deleteRequestInfoByMap( + Map dataMap) { + // TODO Auto-generated method stub + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + return ofsTodoDataManager.deleteRequestInfoByMap(dataMap2); + } + + /** + * 删除异构系统用户某条流程(map格式) + * @param dataMap + * @return + */ + public Map deleteUserRequestInfoByMap( + Map dataMap) { + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + return ofsTodoDataManager.deleteUserRequestInfoByMap(dataMap2); + } + /** + * 删除异构系统流程(Json格式) + * @param json + * @return + */ + public String deleteRequestInfoByJson( + String json) { + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + json = getJson(json); + return ofsTodoDataManager.deleteRequestInfoByJson(json); + } + + /** + * 删除异构系统流程(xml格式) + * @param xml + * @return + */ + public String deleteRequestInfoByXML( + String xml) { + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + xml = getXML(xml); + return ofsTodoDataManager.deleteRequestInfoByXML(xml); + } + + /** + * 删除异构系统用户某条流程(json格式) + * @param json + * @return + */ + public String deleteUserRequestInfoByJson( + String json) { + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + json = getJson(json); + return ofsTodoDataManager.deleteUserRequestInfoByJson(json); + } + /** + * 删除异构系统用户某条流程(xml格式) + * @param xml + * @return + */ + public String deleteUserRequestInfoByXML( + String xml) { + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + xml = getXML(xml); + return ofsTodoDataManager.deleteUserRequestInfoByXML(xml); + } + + /** + * 接收抄送流程(json格式) + * @param json + * @return + */ + public String receiveCCRequestByJson(String json){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + json = getJson(json); + return ofsTodoDataManager.receiveCCRequestByJson(json); + } + + /** + * 接收抄送流程(json格式) + */ + public Map receiveCCRequestByMap(Map dataMap){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + return ofsTodoDataManager.receiveCCRequestByMap(dataMap2); + } + + /** + * 接收抄送流程(json格式) + * @param xml + * @return + */ + public String receiveCCRequestByXml(String xml){ + ofsTodoDataManager.setClientIp(getClientIpXfire());//设置当前IP,为了做IP安全校验 + xml = getXML(xml); + return ofsTodoDataManager.receiveCCRequestByXml(xml); + } + + /** + * 接收抄送流程(json格式) + * @param json + * @return + */ + public String receiveReadRequestByJson(String json){ + ofsTodoDataManager.setClientIp(getClientIpXfire()); + json = getJson(json); + return ofsTodoDataManager.receiveReadRequestByJson(json); + } + + /** + * 接收抄送流程(json格式) + */ + public Map receiveReadRequestByMap(Map dataMap){ + ofsTodoDataManager.setClientIp(getClientIpXfire()); + Map dataMap2 = new HashMap(); + dataMap2.putAll(dataMap); + return ofsTodoDataManager.receiveReadRequestByMap(dataMap2); + } + + /** + * 接收抄送流程(json格式) + * @param xml + * @return + */ + public String receiveReadRequestByXml(String xml){ + ofsTodoDataManager.setClientIp(getClientIpXfire()); + xml = getXML(xml); + return ofsTodoDataManager.receiveReadRequestByXml(xml); + } +}