diff --git a/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.15__add_item_typequery.sql b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.15__add_item_typequery.sql new file mode 100644 index 0000000000..bfd6d0dc3a --- /dev/null +++ b/epmet-admin/epmet-admin-server/src/main/resources/db/migration/V0.0.15__add_item_typequery.sql @@ -0,0 +1,9 @@ +INSERT INTO `epmet_admin`.`sys_dict_type` (`id`, `dict_type`, `dict_name`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518396655261097986', 'item_type_query', '居民信息组件查询方式', '', 18, 0, 0, '1', '2022-04-25 09:09:08', '1', '2022-04-25 09:09:45'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518420223504064513', 1518396655261097986, 'equal', 'cascader', '0', '级联组件', 8, 0, 0, '1', '2022-04-25 10:42:47', '1', '2022-04-25 10:42:47'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518398370672713730', 1518396655261097986, 'list_equal', 'checkbox', '0', '多选框', 6, 0, 0, '1', '2022-04-25 09:15:57', '1', '2022-04-25 09:15:57'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397686728531969', 1518396655261097986, 'daterange', 'datepicker', '0', '日期', 3, 0, 0, '1', '2022-04-25 09:13:14', '1', '2022-04-25 09:13:14'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518398756393492482', 1518396655261097986, 'daterange', 'daterange', '0', '时间范围组件eg:参战时间', 7, 0, 0, '1', '2022-04-25 09:17:29', '1', '2022-04-25 09:17:29'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397589986910209', 1518396655261097986, 'like', 'input', '0', '文本输入框', 2, 0, 0, '1', '2022-04-25 09:12:51', '1', '2022-04-25 09:12:51'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518398274627346434', 1518396655261097986, 'equal', 'radio', '0', '单选框', 5, 0, 0, '1', '2022-04-25 09:15:34', '1', '2022-04-25 09:15:34'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397514623655938', 1518396655261097986, 'equal', 'select', '0', '下拉框', 1, 0, 0, '1', '2022-04-25 09:12:33', '1', '2022-04-25 09:12:33'); +INSERT INTO `epmet_admin`.`sys_dict_data` (`id`, `dict_type_id`, `dict_label`, `dict_value`, `dict_p_value`, `remark`, `sort`, `DEL_FLAG`, `REVISION`, `CREATED_BY`, `CREATED_TIME`, `UPDATED_BY`, `UPDATED_TIME`) VALUES ('1518397787941281794', 1518396655261097986, 'like', 'textarea', '0', '文本域', 4, 0, 0, '1', '2022-04-25 09:13:38', '1', '2022-04-25 09:13:38'); \ No newline at end of file diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java new file mode 100644 index 0000000000..1cbbd2a887 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/annotation/MaskResponse.java @@ -0,0 +1,44 @@ +package com.epmet.commons.tools.annotation; + +import com.epmet.commons.tools.enums.RequirePermissionEnum; +import javassist.runtime.Inner; + +import java.lang.annotation.*; +import java.util.function.Function; + +/** + * 标记一个接口,它的返回值中的某些字段需要打掩码 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface MaskResponse { + + /** + * 掩码类型 + */ + String MASK_TYPE_ID_CARD = "ID_CARD"; + String MASK_TYPE_MOBILE = "MOBILE"; + + ///** + // * 默认的一些字段,如果没有手动指定,就会使用默认的。如果手动指定了,就不再使用默认的 + // */ + //String[] defaultFieldnames = {"idCard","mobile","phone"}; + // + ///** + // * 默认字段对应的掩码类型 + // */ + //String[] defaultFieldsMaskType = { MASK_TYPE_ID_CARD, MASK_TYPE_MOBILE, MASK_TYPE_MOBILE }; + + /** + * 要打码的字段列表。会递归的着这些字段 + * @return + */ + String[] fieldNames() default {"idCard","mobile","phone"}; + + /** + * 要打码的类型 + * @return + */ + String[] fieldsMaskType() default { MASK_TYPE_ID_CARD, MASK_TYPE_MOBILE, MASK_TYPE_MOBILE }; +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/MaskResponseAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/MaskResponseAspect.java new file mode 100644 index 0000000000..c3883c45b0 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/MaskResponseAspect.java @@ -0,0 +1,36 @@ +package com.epmet.commons.tools.aspect; + +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.processor.MaskProcessor; +import com.epmet.commons.tools.utils.Result; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +@Aspect +@Component +@Order(0) +public class MaskResponseAspect { + + @AfterReturning(pointcut = "@annotation(com.epmet.commons.tools.annotation.MaskResponse)", returning = "result") + public Object proceed(JoinPoint point, Result result) throws Throwable { + MethodSignature signature = (MethodSignature) point.getSignature(); + MaskResponse maskResponseAnno = signature.getMethod().getAnnotation(MaskResponse.class); + + String[] fieldNames = maskResponseAnno.fieldNames(); + String[] fieldsMaskType = maskResponseAnno.fieldsMaskType(); + + if (fieldNames.length != fieldsMaskType.length) { + String msg = "掩码配置错误"; + throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), msg, msg); + } + + new MaskProcessor(fieldNames, fieldsMaskType).mask(result); + return null; + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java new file mode 100644 index 0000000000..aa3a9d43b2 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportItemListFormDTO.java @@ -0,0 +1,69 @@ +package com.epmet.commons.tools.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +public class IcExportItemListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + @NotEmpty(message = "请至少添加一个导出项") + private List children; + + /** + * 父id + */ + private String pid; + + /** + * ic_form_item.id + */ + @NotBlank(message = "itemId不能为空",groups = AddGroup.class) + private String itemId; + + /** + * 表头宽度 + */ + private Integer width; + + /** + * 项标签 + */ + @NotBlank(message = "名称不能为空",groups = AddGroup.class) + private String label; + + /** + * 排序 + */ + private Integer sort; + + /** + * 表名 + */ + private String tableName; + + /** + * 列名 + */ + private String columnName; + + /** + * 只有远程获取的才有值 + */ + private String optionSourceValue; + + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportTemplateSaveFormDTO.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportTemplateSaveFormDTO.java new file mode 100644 index 0000000000..8c82c71473 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/IcExportTemplateSaveFormDTO.java @@ -0,0 +1,58 @@ +package com.epmet.commons.tools.dto.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import lombok.Data; +import org.hibernate.validator.constraints.Length; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.io.Serializable; +import java.util.List; + + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +public class IcExportTemplateSaveFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 是否保存为模板 是:true 否:false + */ + private Boolean isSaveTemp = false; + + /** + * 表单CODE,从字典获取 + */ + @NotBlank(message = "表单CODE不能为空",groups = AddGroup.class) + private String formCode; + + /** + * 模板名称 + */ + @Length(max = 20, message = "模板名称最多为20个字", groups = { AddGroup.class }) + private String name; + + /** + * 0:动态;1:文件 + */ + private Integer type; + + /** + * 排序 + */ + private Integer sort; + + + /** + * 父id + */ + @NotEmpty(message = "请至少添加一个导出项") + private List itemList; + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java index 7afc85aab1..6375462f14 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java @@ -22,6 +22,7 @@ public enum DictTypeEnum { AGE_GROUP("age_group", "年龄范围", 11), PATROL_WORK_TYPE("patrol_work_type", "例行工作分类", 13), GRID_TYPE("grid_type", "网格类型", 12), + ITEM_TYPE_QUERY("item_type_query","居民信息组件查询方式",14), ; private final String code; diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java new file mode 100644 index 0000000000..353fb06a47 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/processor/MaskProcessor.java @@ -0,0 +1,183 @@ +package com.epmet.commons.tools.processor; + +import cn.hutool.core.util.StrUtil; +import com.epmet.commons.tools.annotation.MaskResponse; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.springframework.util.CollectionUtils; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.regex.Pattern; + +@Slf4j +public class MaskProcessor { + + + public static final String EPMET_PACKAGE_PREFIX = "com.epmet"; + + private List fieldNames; + private List fieldsMaskType; + + public MaskProcessor(String[] fields, String[] fieldsMaskType) { + if (fields != null && fields.length > 0) { + this.fieldNames = Arrays.asList(fields); + this.fieldsMaskType = Arrays.asList(fieldsMaskType); + } + } + + /** + * 为dto中的属性打掩码 + * @param object + */ + public void mask(Object object) { + if (object == null) { + return; + } + + if (object instanceof Result) { + mask(((Result) object).getData()); + return; + } else if (object instanceof PageData) { + mask(((PageData) object).getList()); + return; + } else if (object instanceof List) { + ((List)object).forEach(e -> mask(e)); + return; + } else if (object instanceof Map) { + maskMap((Map) object); + return; + } else if (object.getClass().getName().startsWith(EPMET_PACKAGE_PREFIX)) { + // 自定义bean,走反射 + maskEpmetBean(object); + return; + } + } + + /** + * 为map打码,只打value中的码 + * - 如果value是epmet的dto,那么去反射它 + * - 如果value是字符串,那么直接给他打码 + * - 如果value是其他类型,跳过 + * @param map + */ + private void maskMap(Map map) { + if (CollectionUtils.isEmpty(map)) { + return; + } + + for (Map.Entry entry : map.entrySet()) { + Object value = entry.getValue(); + Object key = entry.getKey(); + if (value != null && value.getClass().getName().startsWith(EPMET_PACKAGE_PREFIX)) { + // 是epmet的对象 + maskEpmetBean(value); + continue; + } else if (value instanceof String) { + int index = fieldNames.indexOf(key); + if (index != -1) { + String maskResult = maskString((String) value, fieldsMaskType.get(index)); + entry.setValue(maskResult); + } + continue; + } + } + } + + /** + * 反射 + * @param object + */ + private void maskEpmetBean(Object object) { + Field[] declaredFields = object.getClass().getDeclaredFields(); + for (Field currentField : declaredFields) { + currentField.setAccessible(true); + try { + String fieldName = currentField.getName(); + Object value = currentField.get(object); + // 是epmet的类,继续下钻 + if (currentField.getClass().getName().startsWith(EPMET_PACKAGE_PREFIX)) { + maskEpmetBean(value); + continue; + } + + // 是字符串 + String fieldValue; + if (value instanceof String && StringUtils.isNotBlank(fieldValue = (String) value)) { + int fieldIndexInAnnoAttrs = fieldNames.indexOf(fieldName); + if (fieldIndexInAnnoAttrs != -1) { + String product = maskString(fieldValue, fieldsMaskType.get(fieldIndexInAnnoAttrs)); + currentField.set(object, product); + } + continue; + } + + // 非字符串,非epmet类的其他类型 + mask(value); + } catch (IllegalAccessException e) { + log.error("【mask一些字段报错】{}", ExceptionUtils.getErrorStackTrace(e)); + } + } + } + + /** + * 把字符串变更为掩码 + * @param originString + * @return + */ + public String maskString(String originString, String maskType) { + if (MaskResponse.MASK_TYPE_ID_CARD.equals(maskType)) { + return maskIdCard(originString); + } else if (MaskResponse.MASK_TYPE_MOBILE.equals(maskType)) { + return maskMobile(originString); + } else { + return originString; + } + } + + /** + * 将明文字符串打码变为掩码。保留前6,后面打码 + * @param originString + * @return + */ + private String maskIdCard(String originString) { + // 仅将6位之后的全都打码 + int length = originString.length(); + if (length <= 6) { + return originString; + } + + String maskStr = StrUtil.repeatByLength("*", length - 6); + + return originString.replaceAll("^(\\d{6})[a-zA-Z0-9]*$", new StringBuilder("$1").append(maskStr).toString()); + } + + /** + * 将明文字符串打码变为掩码。保留前3后4,中间打码 + * 187****3461 + * @param originString + * @return + */ + private String maskMobile(String originString) { + int length = originString.length(); + if (length <= 7) { + return originString; + } + + String maskStr = StrUtil.repeatByLength("*", length - 7); + + return originString.replaceAll("^(1\\d{2})\\d*(\\d{4})$", new StringBuilder("$1").append(maskStr).append("$2").toString()); + } + + public static void main(String[] args) { + String[] idc = {"idCard"}; + String[] idct = {MaskResponse.MASK_TYPE_ID_CARD}; + String r = new MaskProcessor(idc, idct).maskString("333333333333333333", MaskResponse.MASK_TYPE_ID_CARD); + System.out.println(r); + } +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AuthCodeUtil.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AuthCodeUtil.java new file mode 100644 index 0000000000..53dfcd5411 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/AuthCodeUtil.java @@ -0,0 +1,389 @@ +package com.epmet.commons.tools.utils; + +import lombok.extern.slf4j.Slf4j; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.util.*; + +/** + * desc: 市北大数据局的工具 + * + * @return + * @author LiuJanJun + * @date 2022/4/22 5:19 下午 + */ +@Slf4j +public class AuthCodeUtil { + + public enum DiscuzAuthcodeMode { + Encode, Decode + } + + /** + * + * 从字符串的指定位置截取指定长度的子字符串￿ + * + * 原字符串 + * 子字符串的起始位置 + * 子字符串的长度 + * 子字符串 + */ + public static String CutString(String str, int startIndex, int length) { + if (startIndex >= 0) { + if (length < 0) { + length = length * -1; + if (startIndex - length < 0) { + length = startIndex; + startIndex = 0; + } else { + startIndex = startIndex - length; + } + } + + if (startIndex > str.length()) { + return ""; + } + + } else { + if (length < 0) { + return ""; + } else { + if (length + startIndex > 0) { + length = length + startIndex; + startIndex = 0; + } else { + return ""; + } + } + } + + if (str.length() - startIndex < length) { + + length = str.length() - startIndex; + } + + return str.substring(startIndex, startIndex + length); + } + + /** + * + * 从字符串的指定位置开始截取到字符串结尾的了符串 + * + * 原字符串 + * 子字符串的起始位置 + * 子字符串 + */ + public static String CutString(String str, int startIndex) { + return CutString(str, startIndex, str.length()); + } + + /** + * + * 返回文件是否存在 + * + * 文件名 + * 是否存在 + */ + public static boolean FileExists(String filename) { + File f = new File(filename); + return f.exists(); + } + + /** + * + * MD5函数 + * + * 原始字符串 + * MD5结果 + */ + public static String MD5(String str) { + StringBuffer sb = new StringBuffer(); + String part = null; + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + byte[] md5 = md.digest(str.getBytes()); + + for (int i = 0; i < md5.length; i++) { + part = Integer.toHexString(md5[i] & 0xFF); + if (part.length() == 1) { + part = "0" + part; + } + sb.append(part); + } + + } catch (NoSuchAlgorithmException ex) { + } + return sb.toString(); + } + + /** + * + * 字段串是否为Null或为""(空) + * + * + * + */ + public static boolean StrIsNullOrEmpty(String str) { + // if NET1 + if (str == null || str.trim().equals("")) { + return true; + } + + return false; + } + + /** + * + * 用于 RC4 处理密码 + * + * 密码字串 + * 密钥长度,一般为 256 + * + */ + static private byte[] GetKey(byte[] pass, int kLen) { + byte[] mBox = new byte[kLen]; + + for (int i = 0; i < kLen; i++) { + mBox[i] = (byte) i; + } + + int j = 0; + for (int i = 0; i < kLen; i++) { + + j = (j + (int) ((mBox[i] + 256) % 256) + pass[i % pass.length]) + % kLen; + + byte temp = mBox[i]; + mBox[i] = mBox[j]; + mBox[j] = temp; + } + + return mBox; + } + + /** + * + * 生成随机字符 + * + * 随机字符长度 + * 随机字符 + */ + public static String RandomString(int lens) { + char[] CharArray = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', + 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', + 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}; + int clens = CharArray.length; + String sCode = ""; + Random random = new Random(); + for (int i = 0; i < lens; i++) { + sCode += CharArray[Math.abs(random.nextInt(clens))]; + } + return sCode; + } + + /** + * + * 使用 Discuz authcode 方法对字符串加密 + * + * 原始字符串 + * 密钥 + * 加密字串有效时间,单位是秒 + * 加密结果 + */ + public static String authcodeEncode(String source, String key, int expiry) { + return authcode(source, key, DiscuzAuthcodeMode.Encode, expiry); + + } + + /** + * + * 使用 Discuz authcode 方法对字符串加密 + * + * 原始字符串 + * 密钥 + * 加密结果 + */ + public static String authcodeEncode(String source, String key) { + return authcode(source, key, DiscuzAuthcodeMode.Encode, 0); + + } + + /** + * + * 使用 Discuz authcode 方法对字符串解密 + * + * 原始字符串 + * 密钥 + * 解密结果 + */ + public static String authcodeDecode(String source, String key) { + return authcode(source, key, DiscuzAuthcodeMode.Decode, 0); + + } + + /** + * + * 使用 变形的 rc4 编码方法对字符串进行加密或者解密 + * + * 原始字符串 + * 密钥 + * 操作 加密还是解密 + * 加密字串过期时间 + * 加密或者解密后的字符串 + */ + private static String authcode(String source, String key, + DiscuzAuthcodeMode operation, int expiry) { + try { + if (source == null || key == null) { + return ""; + } + + int ckey_length = 4; + String keya, keyb, keyc, cryptkey, result; + + key = MD5(key); + + keya = MD5(CutString(key, 0, 16)); + + keyb = MD5(CutString(key, 16, 16)); + + keyc = ckey_length > 0 ? (operation == DiscuzAuthcodeMode.Decode ? CutString( + source, 0, ckey_length) : RandomString(ckey_length)) + : ""; + + cryptkey = keya + MD5(keya + keyc); + + if (operation == DiscuzAuthcodeMode.Decode) { + byte[] temp; + + temp = Base64.getDecoder().decode(CutString(source, ckey_length)); + result = new String(RC4(temp, cryptkey)); + if (CutString(result, 10, 16).equals( + CutString(MD5(CutString(result, 26) + keyb), 0, 16))) { + return CutString(result, 26); + } else { + temp = Base64.getDecoder().decode(CutString(source + "=", ckey_length)); + result = new String(RC4(temp, cryptkey)); + if (CutString(result, 10, 16) + .equals(CutString( + MD5(CutString(result, 26) + keyb), 0, 16))) { + return CutString(result, 26); + } else { + temp = Base64.getDecoder().decode(CutString(source + "==", + ckey_length)); + result = new String(RC4(temp, cryptkey)); + if (CutString(result, 10, 16).equals( + CutString(MD5(CutString(result, 26) + keyb), 0, + 16))) { + return CutString(result, 26); + } else { + return "2"; + } + } + } + } else { + source = "0000000000" + CutString(MD5(source + keyb), 0, 16) + + source; + + byte[] temp = RC4(source.getBytes("GBK"), cryptkey); + + return keyc + Base64.getEncoder().encode(temp); + + } + } catch (Exception e) { + return ""; + } + + } + + /** + * + * RC4 原始算法 + * + * 原始字串数组 + * 密钥 + * 处理后的字串数组 + */ + private static byte[] RC4(byte[] input, String pass) { + if (input == null || pass == null) + return null; + + byte[] output = new byte[input.length]; + byte[] mBox = GetKey(pass.getBytes(), 256); + + // 加密 + int i = 0; + int j = 0; + + for (int offset = 0; offset < input.length; offset++) { + i = (i + 1) % mBox.length; + j = (j + (int) ((mBox[i] + 256) % 256)) % mBox.length; + + byte temp = mBox[i]; + mBox[i] = mBox[j]; + mBox[j] = temp; + byte a = input[offset]; + + // byte b = mBox[(mBox[i] + mBox[j] % mBox.Length) % mBox.Length]; + // mBox[j] 一定比 mBox.Length 小,不需要在取模 + byte b = mBox[(toInt(mBox[i]) + toInt(mBox[j])) % mBox.length]; + + output[offset] = (byte) ((int) a ^ (int) toInt(b)); + } + + return output; + } + + public static int toInt(byte b) { + return (int) ((b + 256) % 256); + } + + public long getUnixTimestamp() { + Calendar cal = Calendar.getInstance(); + return cal.getTimeInMillis() / 1000; + } + + public static void main(String[] args) throws IOException { + getStr(); + //readFile02("/Users/liujianjun/Downloads/abc.txt"); + } + + + /** + * 读取一个文本 一行一行读取 + * + * @param path + * @return + * @throws IOException + */ + private static void readFile02(String path) throws IOException { + // 使用一个字符串集合来存储文本中的路径 ,也可用String []数组 + List list = new ArrayList(); + FileInputStream fis = new FileInputStream(path); + // 防止路径乱码 如果utf-8 乱码 改GBK eclipse里创建的txt 用UTF-8,在电脑上自己创建的txt 用GBK + InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8); + BufferedReader br = new BufferedReader(isr); + String line = ""; + String result = null; + while ((line = br.readLine()) != null) { + String key = "TvFwHe6tGA"; + result = AuthCodeUtil.authcodeDecode(line, key); + System.out.println(result); + } + br.close(); + isr.close(); + fis.close(); + System.out.println("==========end"); + } + + private static void getStr(){ + String tel = "4fb1lYySlVqMUaf/LnlBEM1nDZgCKnX+Q52azUGgSLCV0hioBvLFFZoJS1Vu"; + tel = "a1孙1增勤"; + String result = AuthCodeUtil.authcodeDecode(tel, "TvFwHe6tGA"); + System.out.println(result); + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java new file mode 100644 index 0000000000..bff1f1a999 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/ExcelFillCellMergeStrategy.java @@ -0,0 +1,122 @@ +package com.epmet.commons.tools.utils.poi.excel.handler; + +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.write.handler.CellWriteHandler; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteTableHolder; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.util.CellRangeAddress; + +import java.util.List; + +/** + * desc:单元格合并策略 + * + * @author liujianjun + */ +public class ExcelFillCellMergeStrategy implements CellWriteHandler { + + /** + * 需要合并的列 下标 + */ + private int[] mergeColumnIndex; + /** + * 从下标n行开始合并 + */ + private int mergeRowIndex; + + public ExcelFillCellMergeStrategy() { + } + + public ExcelFillCellMergeStrategy(int mergeRowIndex, int[] mergeColumnIndex) { + this.mergeRowIndex = mergeRowIndex; + this.mergeColumnIndex = mergeColumnIndex; + } + + @Override + public void beforeCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, Head head, Integer columnIndex, Integer relativeRowIndex, Boolean isHead) { + + } + + @Override + public void afterCellCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) { + // 隐藏id列 + writeSheetHolder.getSheet().setColumnHidden(0, true); + } + + @Override + public void afterCellDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, List> list, Cell cell, Head head, Integer integer, Boolean aBoolean) { + int curRowIndex = cell.getRowIndex(); + int curColIndex = cell.getColumnIndex(); + if (curRowIndex <= mergeRowIndex) { + return; + } + //如果不指定 合并的列则全部列进行 合并判断 + if (mergeColumnIndex == null) { + mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); + } else { + //合并指定的列号 + for (int columnIndex : mergeColumnIndex) { + if (curColIndex == columnIndex) { + mergeWithPrevRow(writeSheetHolder, cell, curRowIndex, curColIndex); + break; + } + } + } + } + + /** + * 当前单元格向上合并 + * + * @param writeSheetHolder + * @param cell 当前单元格 + * @param curRowIndex 当前行 + * @param curColIndex 当前列 + */ + private void mergeWithPrevRow(WriteSheetHolder writeSheetHolder, Cell cell, int curRowIndex, int curColIndex) { + // 当前行的第一个Cell + Cell curFirstCell = cell.getSheet().getRow(curRowIndex).getCell(0); + Object curFirstData = curFirstCell.getCellType() == CellType.STRING ? curFirstCell.getStringCellValue() : curFirstCell.getNumericCellValue(); + // 上一行的第一个Cell + Cell preFirstCell = cell.getSheet().getRow(curRowIndex - 1).getCell(0); + Object preFirstData = preFirstCell.getCellType() == CellType.STRING ? preFirstCell.getStringCellValue() : preFirstCell.getNumericCellValue(); + + if (curFirstData.equals(preFirstData)) { + Object curData = cell.getCellType() == CellType.STRING ? cell.getStringCellValue() : cell.getNumericCellValue(); + Cell preCell = cell.getSheet().getRow(curRowIndex - 1).getCell(curColIndex); + Object preData = preCell.getCellType() == CellType.STRING ? preCell.getStringCellValue() : preCell.getNumericCellValue(); + // 将当前单元格数据与上一个单元格数据比较 + Boolean dataBool = preData.equals(curData); + //此处需要注意:因为我是按照序号确定是否需要合并的,所以获取每一行第一列数据和上一行第一列数据进行比较,如果相等合并 + Boolean bool = cell.getRow().getCell(0).getStringCellValue().equals(cell.getSheet().getRow(curRowIndex - 1).getCell(0).getStringCellValue()); + + if (!dataBool || !bool) { + return; + } + Sheet sheet = writeSheetHolder.getSheet(); + List mergeRegions = sheet.getMergedRegions(); + boolean isMerged = false; + for (int i = 0; i < mergeRegions.size() && !isMerged; i++) { + CellRangeAddress cellRangeAddr = mergeRegions.get(i); + // 若上一个单元格已经被合并,则先移出原有的合并单元,再重新添加合并单元 + if (cellRangeAddr.isInRange(curRowIndex - 1, curColIndex)) { + sheet.removeMergedRegion(i); + cellRangeAddr.setLastRow(curRowIndex); + sheet.addMergedRegion(cellRangeAddr); + isMerged = true; + } + } + // 若上一个单元格未被合并,则新增合并单元 + if (!isMerged) { + CellRangeAddress cellRangeAddress = new CellRangeAddress(curRowIndex - 1, curRowIndex, curColIndex, curColIndex); + sheet.addMergedRegion(cellRangeAddress); + } + + } + } + +} diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/FreezeAndFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/FreezeAndFilter.java similarity index 95% rename from epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/FreezeAndFilter.java rename to epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/FreezeAndFilter.java index 6b5d5e55c5..13ef447219 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/FreezeAndFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/poi/excel/handler/FreezeAndFilter.java @@ -1,4 +1,4 @@ -package com.epmet.commons.tools.utils.poi.excel; +package com.epmet.commons.tools.utils.poi.excel.handler; /** * desc:easyExcel 冻结标题 diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/group/ExportGroup.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/group/ExportGroup.java new file mode 100644 index 0000000000..4b6f21b833 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/validator/group/ExportGroup.java @@ -0,0 +1,19 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.validator.group; + +/** + * 导出 Group + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public interface ExportGroup { + +} diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 1283594191..5f1005a628 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -287,6 +287,7 @@ lb://epmet-demo-server lb://oper-customize-server + lb://oper-crm-server diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java index 5c71e7bcf1..133cb6200c 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/EpmetHeartOpenFeignClient.java @@ -1,6 +1,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; import com.epmet.dto.VolunteerInfoDTO; @@ -103,4 +104,7 @@ public interface EpmetHeartOpenFeignClient { */ @GetMapping("/heart/serviceitem/initCustomer/{customerId}") Result customerInit(@PathVariable(value = "customerId") String customerId); + + @PostMapping("/heart/icresidemanddict/demandoption") + Result> getDemandOptions(); } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java index 28e1fc50b8..a0af921435 100644 --- a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/feign/fallback/EpmetHeartOpenFeignClientFallback.java @@ -1,6 +1,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.ActInfoDTO; @@ -102,4 +103,9 @@ public class EpmetHeartOpenFeignClientFallback implements EpmetHeartOpenFeignCli public Result customerInit(String customerId) { return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "customerInit", customerId); } + + @Override + public Result> getDemandOptions() { + return ModuleUtils.feignConError(ServiceConstant.EPMET_HEART_SERVER, "getDemandOptions", null); + } } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java index 4d9aa11d17..2bb91a53ec 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcBuildingDTO.java @@ -85,6 +85,16 @@ public class IcBuildingDTO implements Serializable { */ private Integer totalHouseNum; + /** + * 楼长姓名 + */ + private String buildingLeaderName; + + /** + * 楼长电话 + */ + private String buildingLeaderMobile; + /** * 中心点位:经度 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java index 2bec463b9b..755d3ff086 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcHouseDTO.java @@ -17,9 +17,10 @@ package com.epmet.dto; +import lombok.Data; + import java.io.Serializable; import java.util.Date; -import lombok.Data; /** @@ -57,12 +58,12 @@ public class IcHouseDTO implements Serializable { * 所属楼栋id */ private String buildingId; - + private String buildingName; /** * 所属单元id */ private String buildingUnitId; - + private String unitName; /** * 房屋名字后台插入时生成 */ @@ -77,17 +78,17 @@ public class IcHouseDTO implements Serializable { * 房屋类型,这里存储字典value就可以 */ private String houseType; - + private String houseTypeName; /** * 存储字典value */ private String purpose; - + private String purposeName; /** * 1出租;0未出租 */ private Integer rentFlag; - + private String rentName; /** * 房主姓名 */ diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java index 1144b24e8d..82f276ebaf 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/ImportGeneralDTO.java @@ -45,6 +45,16 @@ public class ImportGeneralDTO implements Serializable { private String buildingName; private String buildingId; + /** + * 楼长姓名 + */ + private String buildingLeaderName; + + /** + * 楼长电话 + */ + private String buildingLeaderMobile; + /** * 房屋类型 */ @@ -157,4 +167,9 @@ public class ImportGeneralDTO implements Serializable { * 小区重复状态 */ private Boolean neighborHoodExistStatus = false; + + /** + * 排序 + */ + private Integer sort; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java new file mode 100644 index 0000000000..6d3d8f433a --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/HouseChartFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author sun + * @dscription 【人房】房屋总数饼图-接口入参 + */ +@Data +public class HouseChartFormDTO implements Serializable { + + private static final long serialVersionUID = 405799151478155056L; + + /** + * 组织、网格、小区Id + */ + private String orgId; + /** + * 组织、网格、小区类型 agency grid village + */ + private String orgType; + + //token这信息 + private String customerId; + private String userId; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java index e476297ec6..0039390e15 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/IcBulidingAddFormDTO.java @@ -123,6 +123,16 @@ public class IcBulidingAddFormDTO implements Serializable { private String latitude; + /** + * 楼长姓名 + */ + private String buildingLeaderName; + + /** + * 楼长电话 + */ + private String buildingLeaderMobile; + diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java new file mode 100644 index 0000000000..7a4e974162 --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseChartResultDTO.java @@ -0,0 +1,57 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author sun + * @dscription 【人房】房屋总数饼图-接口返参 + */ +@Data +public class HouseChartResultDTO implements Serializable { + /** + * 组织、网格、小区Id + */ + private String orgId; + /** + * 组织、网格、小区类型 agency grid village + */ + private String orgType; + /** + * 房屋总数 + */ + private Integer houseTotal = 0; + /** + * 房屋自住总数 + */ + private Integer zzHouseTotal = 0; + /** + * 房屋自住总数占比(保留两位小数,带百分号的) + */ + private Double zzHouseRatio = 0.0; + /** + * 房屋常住总数 + */ + private Integer czHouseTotal = 0; + /** + * 房屋常住总数占比(保留两位小数,带百分号的) + */ + private Double czHouseRatio = 0.0; + /** + * 房屋闲置总数 + */ + private Integer xzHouseTotal = 0; + /** + * 房屋闲置总数占比(保留两位小数,带百分号的) + */ + private Double xzHouseRatio = 0.0; + + @JsonIgnore + private Integer num; + //1:出租 0:自住 2:闲置 + @JsonIgnore + private Integer rentFlag; + +} diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseListResultDTO.java index a63f415e94..c3ae6f07e1 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/HouseListResultDTO.java @@ -18,6 +18,7 @@ public class HouseListResultDTO implements Serializable { private static final long serialVersionUID = 2063032844842070847L; private String houseId; private String houseName; + private String rentFlag; private List categoryList; @NoArgsConstructor diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java index ebaf6ca58e..550938c23e 100644 --- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/IcBuildingListResultDTO.java @@ -17,7 +17,16 @@ public class IcBuildingListResultDTO extends PageFormDTO { private static final long serialVersionUID = -8277921228438123299L; private String gridName; + + /** + * 设计的房屋总数,就是这个楼上实际有几个 + */ private Integer totalHouseNum; + + /** + * 实际录入房屋总数 + */ + private Integer realTotalHouseNum; private String latitude; private String agencyId; private Integer sort; @@ -32,4 +41,14 @@ public class IcBuildingListResultDTO extends PageFormDTO { private Integer totalUnitNum; private String longitude; private String buildingType; + + /** + * 楼长姓名 + */ + private String buildingLeaderName; + + /** + * 楼长电话 + */ + private String buildingLeaderMobile; } diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java new file mode 100644 index 0000000000..905dca051f --- /dev/null +++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/SubUserHouseListResultDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @author sun + * @dscription 【人房】下级人房概览列表-接口返参 + */ +@Data +public class SubUserHouseListResultDTO implements Serializable { + /** + * 组织、网格、小区Id + */ + private String orgId; + /** + * 组织、网格、小区名称 + */ + private String orgName; + /** + * 组织、网格、小区类型 agency grid village + */ + private String orgType; + /** + * 房屋总数 + */ + private Integer houseTotal = 0; + /** + * 房屋自住总数 + */ + private Integer zzHouseTotal = 0; + /** + * 房屋自住总数占比(保留两位小数,带百分号的) + */ + private Double zzHouseRatio = 0.0; + /** + * 房屋常住总数 + */ + private Integer czHouseTotal = 0; + /** + * 房屋常住总数占比(保留两位小数,带百分号的) + */ + private Double czHouseRatio = 0.0; + /** + * 房屋闲置总数 + */ + private Integer xzHouseTotal = 0; + /** + * 房屋闲置总数占比(保留两位小数,带百分号的) + */ + private Double xzHouseRatio = 0.0; + /** + * 居民总数 + */ + private Integer userTotal = 0; + /** + * 常住人口总数 + */ + private Integer czUserTotal = 0; + /** + * 常住人口占比(保留两位小数,带百分号的) + */ + private Double czUserRatio = 0.0; + /** + * 流动人口总数 + */ + private Integer ldUserTotal = 0; + /** + * 流动人口占比(保留两位小数,带百分号的) + */ + private Double ldUserRatio = 0.0; + +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/aspect/RequestLogAspect.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/aspect/RequestLogAspect.java index 49581cf63c..f9be4267e8 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/aspect/RequestLogAspect.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/aspect/RequestLogAspect.java @@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletRequest; */ @Aspect @Component -@Order(0) +@Order(1) public class RequestLogAspect extends BaseRequestLogAspect { @Override diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java index 7be2f59dac..8d8c3afd4b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java @@ -19,6 +19,7 @@ package com.epmet.controller; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; @@ -31,10 +32,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.form.*; -import com.epmet.dto.result.HouseInfoDTO; -import com.epmet.dto.result.IcHouseListResultDTO; -import com.epmet.dto.result.ImportTaskCommonResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.service.HouseService; @@ -47,7 +45,10 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Set; /** @@ -69,9 +70,10 @@ public class HouseController implements ResultDataResolver { @Autowired private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; - @PostMapping("houselist") - public Result> houseList(@LoginUser TokenDto loginUser, @RequestBody IcHouseListFormDTO formDTO) { + @MaskResponse(fieldNames = {"ownerIdCard", "ownerPhone"}, + fieldsMaskType = { MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE }) + public Result> houseList(@RequestBody IcHouseListFormDTO formDTO) { //效验数据 LoginUserDetailsResultDTO loginUserDetail = getLoginUserDetailsResultDTO(loginUser, "【查询房屋】查询当前staff所在组织信息失败"); formDTO.setAgencyId(loginUserDetail.getAgencyId()); @@ -269,4 +271,27 @@ public class HouseController implements ResultDataResolver { } return new Result().ok(houseService.getHouseInfoDTO(tokenDto.getCustomerId(), houseId)); } + + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + @PostMapping("housechart") + public Result houseChart(@LoginUser TokenDto tokenDto, @RequestBody HouseChartFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(houseService.houseChart(formDTO)); + } + + /** + * @Author sun + * @Description 【人房】下级人房概览列表 + **/ + @PostMapping("subuserhouselist") + public Result> subUserHouseList(@LoginUser TokenDto tokenDto, @RequestBody HouseChartFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result>().ok(houseService.subUserHouseList(formDTO)); + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java index 8c17130cd9..05d4c86990 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcHouseDao.java @@ -3,10 +3,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.IcHouseListFormDTO; -import com.epmet.dto.result.HouseInfoDTO; -import com.epmet.dto.result.HousesNameResultDTO; -import com.epmet.dto.result.IcHouseListResultDTO; -import com.epmet.dto.result.NeighborHoodManageDelResultDTO; +import com.epmet.dto.result.*; import com.epmet.entity.IcHouseEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -91,4 +88,9 @@ public interface IcHouseDao extends BaseDao { */ void houseUpdateHouseName(@Param("buildingId")String buildingId); + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + List houseChart(@Param("orgId") String orgId, @Param("orgType") String orgType); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java index 520cd65337..25dfd0c23e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcNeighborHoodDao.java @@ -20,6 +20,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.NeighborHoodAndManagementDTO; +import com.epmet.dto.IcNeighborHoodDTO; import com.epmet.dto.form.IcNeighborHoodListFormDTO; import com.epmet.dto.result.IcNeighborHoodResultDTO; import com.epmet.entity.IcHouseEntity; @@ -77,4 +78,5 @@ public interface IcNeighborHoodDao extends BaseDao { */ void neighborHoodPropertyUpdate(@Param("list")List updateNeighborHoodAndManagement); + List selectNeighborList(@Param("gridId")String gridId); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java index b4d4811caa..98b4d54012 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/entity/IcBuildingEntity.java @@ -80,6 +80,16 @@ public class IcBuildingEntity extends BaseEpmetEntity { */ private Integer totalHouseNum; + /** + * 楼长姓名 + */ + private String buildingLeaderName; + + /** + * 楼长电话 + */ + private String buildingLeaderMobile; + /** * 中心点位:经度 */ diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java index dac7c09015..81495c3da6 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/BuildingInfoModel.java @@ -36,6 +36,12 @@ public class BuildingInfoModel { @ExcelProperty(value = "户数") private Integer totalHouseNum; + @ExcelProperty(value = "楼长姓名") + private String buildingLeaderName; + + @ExcelProperty(value = "楼长电话") + private String buildingLeaderMobile; + @ExcelIgnore private Integer num; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java index 08eb31a9cc..31471fb3ed 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportHouseInfoListener.java @@ -34,6 +34,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; import static com.epmet.constant.ImportErrorMsgConstants.*; diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java index 6e294a8e7b..3c034cb85d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java @@ -23,6 +23,8 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.IcHouseListResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; @@ -75,4 +77,16 @@ public interface HouseService { void allDelete(NeighborHoodManageDelFormDTO formDTO); HouseInfoDTO getHouseInfoDTO(String customerId,String houseId); + + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + HouseChartResultDTO houseChart(HouseChartFormDTO formDTO); + + /** + * @Author sun + * @Description 【人房】下级人房概览列表 + **/ + List subUserHouseList(HouseChartFormDTO formDTO); } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java index 3866a9c6ad..4e8ccd0e93 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java @@ -430,14 +430,11 @@ public class BuildingServiceImpl implements BuildingService { if (null != count && count > 0) { throw new RenException(EpmetErrorCode.BUILDING_NAME_EXITED.getCode(), EpmetErrorCode.BUILDING_NAME_EXITED.getMsg()); } - IcBuildingDTO icBuilding = icBuildingService.get(formDTO.getBuildingId()); - if (!icBuilding.getNeighborHoodId().equals(formDTO.getNeighborHoodId())) { //更新对应房屋小区id List icHouseEntities = icHouseDao.selectList(new QueryWrapper().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId())); if (!CollectionUtils.isEmpty(icHouseEntities)) { - // throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(), "楼栋单元下存在房屋,无法更新"); } } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java index 75efdc6e38..b4adf3c814 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java @@ -6,6 +6,7 @@ import com.alibaba.excel.ExcelReader; import com.alibaba.excel.read.metadata.ReadSheet; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.enums.OrgTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; @@ -13,20 +14,16 @@ import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.CustomerGridConstant; import com.epmet.constants.ImportTaskConstants; -import com.epmet.dao.IcBuildingDao; -import com.epmet.dao.IcBuildingUnitDao; -import com.epmet.dao.IcHouseDao; -import com.epmet.dao.IcNeighborHoodDao; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.dto.IcBuildingDTO; -import com.epmet.dto.IcBuildingUnitDTO; -import com.epmet.dto.IcHouseDTO; +import com.epmet.dao.*; +import com.epmet.dto.*; import com.epmet.dto.form.*; +import com.epmet.dto.result.*; import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.IcHouseListResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; @@ -54,8 +51,11 @@ import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; +import java.text.NumberFormat; import java.util.*; import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @Slf4j @@ -90,9 +90,12 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; @Autowired private ExecutorService executorService; - @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; + @Autowired + private CustomerAgencyDao customerAgencyDao; + @Autowired + private CustomerGridDao customerGridDao; @Override @@ -356,4 +359,159 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver { } return houseInfo; } + + /** + * @Author sun + * @Description 【人房】房屋总数饼图 + **/ + @Override + public HouseChartResultDTO houseChart(HouseChartFormDTO formDTO) { + HouseChartResultDTO resultDTO = new HouseChartResultDTO(); + //计算百分比使用,保留小数点后两位 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.TWO); + //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //2.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + //2.根据入参值查询对应的房屋统计数据 + List list = icHouseDao.houseChart(formDTO.getOrgId(), formDTO.getOrgType()); + //3.汇总数据 + AtomicInteger houseTotal = new AtomicInteger(); + list.forEach(l -> { + houseTotal.addAndGet(l.getNum()); + if (l.getRentFlag() == 0) { + resultDTO.setZzHouseTotal(l.getNum()); + } else if (l.getRentFlag() == 1) { + resultDTO.setCzHouseTotal(l.getNum()); + } else { + resultDTO.setXzHouseTotal(l.getNum()); + } + }); + resultDTO.setHouseTotal(houseTotal.get()); + resultDTO.setZzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getZzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getZzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setCzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getCzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setXzHouseRatio(Double.valueOf((resultDTO.getHouseTotal() == 0 || resultDTO.getXzHouseTotal() > resultDTO.getHouseTotal()) ? "0" : numberFormat.format(((float) resultDTO.getXzHouseTotal() / (float) resultDTO.getHouseTotal()) * 100))); + resultDTO.setOrgId(formDTO.getOrgId()); + resultDTO.setOrgType(formDTO.getOrgType()); + return resultDTO; + } + + /** + * @Author sun + * @Description 【人房】下级人房概览列表 + **/ + @Override + public List subUserHouseList(HouseChartFormDTO formDTO) { + List resultList = new ArrayList<>(); + //1.判断入参没值的赋值当前工作人员缓存所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + if ("village".equals(formDTO.getOrgType())) { + return new ArrayList<>(); + } + //2.根据入参值查询直属下级列表(组织、网格、小区列表) + List idList = new ArrayList<>(); + Map map = new HashMap<>(); + String orgType = ""; + if ("agency".equals(formDTO.getOrgType())) { + //获取组织缓存,判断组织级别 + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getOrgId()); + if (null == agencyInfo) { + throw new RenException(String.format("查询组织信息失败%s", formDTO.getOrgId())); + } + //直属下级网格列表 + if ("community".equals(agencyInfo.getLevel())) { + orgType = "grid"; + List list = customerGridDao.selectGridList(formDTO.getOrgId()); + idList = list.stream().map(GridListResultDTO::getGridId).collect(Collectors.toList()); + map = list.stream().collect(Collectors.toMap(GridListResultDTO::getGridId, GridListResultDTO::getGridName, (k1, k2) -> k1)); + } else { + //直属下级组织列表 + orgType = "agency"; + List list = customerAgencyDao.selectAgencyList(formDTO.getOrgId()); + idList = list.stream().map(AgencyListResultDTO::getAgencyId).collect(Collectors.toList()); + map = list.stream().collect(Collectors.toMap(AgencyListResultDTO::getAgencyId, AgencyListResultDTO::getAgencyName, (k1, k2) -> k1)); + } + } else if ("grid".equals(formDTO.getOrgType())) { + //网格直属小区列表 + orgType = "village"; + List list = icNeighborHoodDao.selectNeighborList(formDTO.getOrgId()); + idList = list.stream().map(IcNeighborHoodDTO::getId).collect(Collectors.toList()); + map = list.stream().collect(Collectors.toMap(IcNeighborHoodDTO::getId, IcNeighborHoodDTO::getNeighborHoodName, (k1, k2) -> k1)); + } + + //3.分别查询直属下级列表的房屋、居民统计数据 + resultList = houseUserChartList(idList, map, orgType); + + return resultList; + } + + /** + * @Author sun + * @Description 【人房】房屋、居民统计列表数据 + **/ + private List houseUserChartList(List idList, Map map, String orgType) { + List list = new ArrayList<>(); + //1.直属下级列表的房屋数据 + List houseList = new ArrayList<>(); + HouseChartFormDTO houseDTO = new HouseChartFormDTO(); + houseDTO.setOrgType(orgType); + for (String id : idList) { + houseDTO.setOrgId(id); + houseList.add(houseChart(houseDTO)); + } + //2.直属下级列表的居民数据 + UserChartFormDTO userDTO = new UserChartFormDTO(); + userDTO.setOrgType(orgType); + userDTO.setIdList(idList); + Result> userResult = epmetUserOpenFeignClient.userChartList(userDTO); + if (!userResult.success()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取居民人房统计数据失败" + userResult.getInternalMsg(), userResult.getMsg()); + } + //3.汇总封装数据 + SubUserHouseListResultDTO dto = null; + for (String id : idList) { + dto = new SubUserHouseListResultDTO(); + dto.setOrgId(id); + dto.setOrgName(map.get(id)); + dto.setOrgType(orgType); + for (HouseChartResultDTO h : houseList) { + if (h.getOrgId().equals(id)) { + dto.setHouseTotal(h.getHouseTotal()); + dto.setZzHouseTotal(h.getZzHouseTotal()); + dto.setZzHouseRatio(h.getZzHouseRatio()); + dto.setCzHouseTotal(h.getCzHouseTotal()); + dto.setCzHouseRatio(h.getCzHouseRatio()); + dto.setXzHouseTotal(h.getXzHouseTotal()); + dto.setXzHouseRatio(h.getXzHouseRatio()); + } + } + for (UserChartResultDTO u : userResult.getData()) { + if (u.getOrgId().equals(id)) { + dto.setUserTotal(u.getUserTotal()); + dto.setCzUserTotal(u.getCzUserTotal()); + dto.setCzUserRatio(u.getCzUserRatio()); + dto.setLdUserTotal(u.getLdUserTotal()); + dto.setLdUserRatio(u.getLdUserRatio()); + } + } + list.add(dto); + } + return list; + } + } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java index 102dbc168f..c2ca4fba8e 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcHouseServiceImpl.java @@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; @@ -18,11 +19,17 @@ import com.epmet.dto.IcResiCategoryStatsConfigDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.ImportGeneralDTO; import com.epmet.dto.form.HouseFormDTO; +import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.HouseListResultDTO; import com.epmet.dto.result.HousesNameResultDTO; import com.epmet.entity.IcHouseEntity; +import com.epmet.enums.HousePurposeEnums; +import com.epmet.enums.HouseRentFlagEnums; +import com.epmet.enums.HouseTypeEnums; +import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.redis.IcHouseRedis; import com.epmet.service.IcHouseService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; @@ -47,6 +54,10 @@ public class IcHouseServiceImpl extends BaseServiceImpl categories = new ArrayList<>(); if (null != countMap && CollectionUtils.isNotEmpty(categoryList)) { for (IcResiCategoryStatsConfigDTO category : categoryList) { diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java index 9e1d9fb39c..bd266465ca 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java @@ -608,6 +608,8 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl NumConstant.ZERO) { //设置楼宇单元 diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.17__edit_building_and_house.sql b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.17__edit_building_and_house.sql new file mode 100644 index 0000000000..1117c368b7 --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/db/migration/V0.0.17__edit_building_and_house.sql @@ -0,0 +1,2 @@ +alter table ic_building add COLUMN BUILDING_LEADER_NAME VARCHAR(11) comment '楼长姓名' AFTER TOTAL_HOUSE_NUM; +alter table ic_building add COLUMN BUILDING_LEADER_MOBILE VARCHAR(11) comment '楼长电话' AFTER BUILDING_LEADER_NAME; diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx index cffd4abd69..1a9b2d2d25 100644 Binary files a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx and b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/building_template.xlsx differ diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx index cf5681e1f4..31d9ea9120 100644 Binary files a/epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx and b/epmet-module/gov-org/gov-org-server/src/main/resources/excel/house_template.xlsx differ diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml index 49358680aa..e8d2451a52 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcBuildingDao.xml @@ -93,9 +93,11 @@ a.SORT as sort, a.LONGITUDE as longitude, a.LATITUDE as latitude, - a.TYPE as buildingTypeKey + a.TYPE as buildingTypeKey, + (SELECT COUNT(1) FROM ic_house WHERE DEL_FLAG = '0' AND BUILDING_ID = a.ID) AS realTotalHouseNum, + a.BUILDING_LEADER_NAME, + a.BUILDING_LEADER_MOBILE from ic_building a - LEFT JOIN ic_neighbor_hood b on a.NEIGHBOR_HOOD_ID = b.ID and b.DEL_FLAG='0' left join customer_agency c on b.AGENCY_ID = c.ID and c.DEL_FLAG='0' left join customer_grid d on b.GRID_ID = d.ID and d.DEL_FLAG='0' diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml index 9b475f8444..cb0bbd299d 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml @@ -300,4 +300,38 @@ ) GROUP BY h.OWNER_ID_CARD + + + diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml index 591fec22d0..4d29dbe1d3 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcNeighborHoodDao.xml @@ -266,4 +266,22 @@ ) + + diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcExportTemplateDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcExportTemplateDTO.java new file mode 100644 index 0000000000..af12ebcf29 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcExportTemplateDTO.java @@ -0,0 +1,60 @@ +package com.epmet.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +public class IcExportTemplateDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 所属机关ID(customer_agency.id) + */ + private String agencyId; + + /** + * 所有上级组织机构ID(以英文:隔开)包含本身id + */ + private String pids; + + /** + * 表单CODE,从字典获取 + */ + private String formCode; + + /** + * 模板名称 + */ + private String name; + + /** + * 排序 + */ + private Integer sort; + private Integer isSelf; + + private String createdBy; + @JsonFormat(pattern = "yyyy-MM-dd HH:mm", timezone = "GMT+8") + private Date createdTime; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java index 5fe8d5de36..e9d4a34b8c 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/IcFormItemGroupDTO.java @@ -20,7 +20,6 @@ package com.epmet.dto; import lombok.Data; import java.io.Serializable; -import java.util.Date; /** @@ -79,34 +78,4 @@ public class IcFormItemGroupDTO implements Serializable { */ private Boolean display; - /** - * 0未删除,1已删除 - */ - private Integer delFlag; - - /** - * 乐观锁 - */ - private Integer revision; - - /** - * 创建人 - */ - private String createdBy; - - /** - * 创建时间 - */ - private Date createdTime; - - /** - * 更新人 - */ - private String updatedBy; - - /** - * 更新时间 - */ - private Date updatedTime; - -} \ No newline at end of file +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/EditIFormItemFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/EditIFormItemFormDTO.java new file mode 100644 index 0000000000..9e0b100717 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/EditIFormItemFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.dto.form; + +import com.epmet.dto.result.OptionDTO; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.List; + + +@Data +public class EditIFormItemFormDTO implements Serializable { + /** + * 客户id + * 可空,为空时,修改所有客户符合条件的记录 + */ + private String customerId; + + /** + * ic_form_item.id + */ + private String formItemId; + + /** + * 组件名称对应的是ic_form_item.label + */ + @NotBlank(message = "label不能为空") + private String label; + + /** + * 组件类型 + */ + private String itemType; + + /** + * ic_form_item_options + */ + private List options; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcExportTemplateQueryFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcExportTemplateQueryFormDTO.java new file mode 100644 index 0000000000..1400043890 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcExportTemplateQueryFormDTO.java @@ -0,0 +1,38 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; +import com.epmet.commons.tools.validator.group.ExportGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +public class IcExportTemplateQueryFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 模板主键 + */ + private String tempId; + + /** + * 客户id + */ + @NotBlank(message = "客户Id不能为空",groups = ExportGroup.class) + private String customerId; + + /** + * 页面上的导出配置参数 + */ + private IcExportTemplateSaveFormDTO exportConfig; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcFormItemGroupLisFormDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcFormItemGroupLisFormDTO.java new file mode 100644 index 0000000000..49624a71d1 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/form/IcFormItemGroupLisFormDTO.java @@ -0,0 +1,84 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.PageFormDTO; +import com.epmet.commons.tools.validator.group.QueryGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + + +/** + * 表单项分组查询条件 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-10-26 + */ +@Data +public class IcFormItemGroupLisFormDTO extends PageFormDTO { + + private static final long serialVersionUID = 1L; + + /** + * 分组id + */ + private String id; + + /** + * 客户ID + */ + @NotBlank(message = "客户Id不能为空", groups = QueryGroup.class) + private String customerId; + + /** + * 表单ID + */ + private String formId; + + /** + * 表单编码 + */ + @NotBlank(message = "表单编码不能为空", groups = QueryGroup.class) + private String formCode; + + /** + * 对应的子表名称 + */ + private String tableName; + + /** + * 是否支持添加一行,1支持,默认0不支持 + */ + private Boolean supportAdd; + + /** + * 名称 + */ + private String label; + + /** + * 排序 + */ + private Integer sort; + + /** + * 1展示,0不展示,默认1 + */ + private Boolean display; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResDTO.java new file mode 100644 index 0000000000..db50d133ba --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResDTO.java @@ -0,0 +1,23 @@ +package com.epmet.dto.result; + + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +@Data +public class ConditionResDTO implements Serializable { + /** + * 分组ID,'默认,NONE' + */ + private String itemGroupId; + + /** + * 分组名称 + * 基础信息、教育信息.... + */ + private String groupName; + + private List queryItemList; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java index 07953ef95c..4d0a000b8a 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/ConditionResultDTO.java @@ -14,7 +14,7 @@ import java.util.List; public class ConditionResultDTO implements Serializable { private static final long serialVersionUID = -2021200288758478252L; /** - * 父项ID + * ID */ private String itemId; @@ -88,6 +88,13 @@ public class ConditionResultDTO implements Serializable { */ private String queryType; + private String funType; + private List options; + + /** + * 这个表 是否支持添加 即是否是多对一 eg:居民需求是多个对一个 + */ + private boolean supportAdd; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult.java index dfe0b85ffa..2aad76f805 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/FormItemResult.java @@ -16,7 +16,7 @@ public class FormItemResult implements Serializable { private static final long serialVersionUID = 7443085469505238040L; /** - * 父项ID + * ID */ private String itemId; diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcCustomExportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcCustomExportResultDTO.java new file mode 100644 index 0000000000..31f09c2be0 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcCustomExportResultDTO.java @@ -0,0 +1,69 @@ +package com.epmet.dto.result; + +import com.epmet.commons.tools.constant.NumConstant; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import org.springframework.util.CollectionUtils; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + + +/** + * 自定义表单导出模板配置项 for 导出时使用 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +public class IcCustomExportResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 表头 + */ + private List> headers = new ArrayList<>(); + + + + private Integer headerRow; + + + /** + * sql中要返回的 列名 顺序跟表头顺序一致 + */ + private List showSqlColumns; + + /** + * sql中要返回的关联的列 (与显示的要去重) + */ + private List hiddenSqlColumns; + + @NoArgsConstructor + @AllArgsConstructor + @Data + public static class SqlColumn { + private String itemId; + private String tableName; + private Boolean manyToOne; + private String columnName; + private String optionSourceType; + } + + /** + * desc:获取有几行头 + * @return + */ + public Integer getHeaderRow() { + if (CollectionUtils.isEmpty(headers)){ + return NumConstant.ZERO; + } + return headers.stream().mapToInt(List::size).max().orElse(0); + } + + + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcExportTemplateForExportResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcExportTemplateForExportResultDTO.java new file mode 100644 index 0000000000..6906649cbb --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/IcExportTemplateForExportResultDTO.java @@ -0,0 +1,67 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 自定义表单导出模板配置项 for 导出时使用 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +public class IcExportTemplateForExportResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + + /** + * 父id + */ + private String pid; + + /** + * 表头宽度 + */ + private Integer width; + + /** + * 项标签 + */ + private String label; + + /** + * 排序 + */ + private Integer sort; + + /** + * itemId + */ + private String itemId; + + /** + * 表名 + */ + private String tableName; + /** + * 列名 + */ + private String columnName; + + private String optionSourceValue; + + private String optionSourceType; + /** + * 是否支持添加 即是否是多对一 eg:居民需求是多个对一个 + */ + private boolean supportAdd; + +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java index a7b950d891..e0ccb7c850 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/SubTableJoinDTO.java @@ -10,4 +10,8 @@ public class SubTableJoinDTO implements Serializable { private static final long serialVersionUID = 8243764437194993736L; private String tableName; private String joinTableSql; + /** + * 是否支持添加一行,1支持,默认0不支持 + */ + private Boolean supportAdd; } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/TemplateDetailResultDTO.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/TemplateDetailResultDTO.java new file mode 100644 index 0000000000..6f5fb03c8d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/result/TemplateDetailResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2022/4/25 16:25 + */ +@Data +public class TemplateDetailResultDTO implements Serializable { + private static final long serialVersionUID = 8954669603105326916L; + private String id; + private String label; + private List children; +} diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java index c714bd77e1..9ad09ea7b0 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/OperCustomizeOpenFeignClient.java @@ -1,6 +1,7 @@ package com.epmet.feign; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; import com.epmet.dto.IcFormItemOptionsDTO; @@ -25,7 +26,7 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:16 */ -// @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallbackFactory = OperCustomizeOpenFeignClientFallbackFactory.class,url = "http://localhost:8089") + // @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallbackFactory = OperCustomizeOpenFeignClientFallbackFactory.class,url = "http://localhost:8089") @FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallbackFactory = OperCustomizeOpenFeignClientFallbackFactory.class) public interface OperCustomizeOpenFeignClient { @@ -161,4 +162,19 @@ public interface OperCustomizeOpenFeignClient { */ @PostMapping("/oper/customize/icformitem/resi-category-items/list") Result> listResiCategoryItems(@RequestParam("customer-id") String customerId); + + /** + * 查询要导出的表头和sql返回结果的列的 用于导出 + * @param param + * @return + */ + @PostMapping("/oper/customize/icExportTemplate/getExcelHeaderAndSqlColumnForExport") + Result getExcelHeaderAndSqlColumnForExport(@RequestBody IcExportTemplateQueryFormDTO param); + + /** + * @author sun + * @Description 居民信息自定义模板导出--保存模板 + */ + @PostMapping("/oper/customize/icExportTemplate/save") + Result> save(@RequestBody IcExportTemplateSaveFormDTO formDTO); } diff --git a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java index a8fdcbff41..91e4772d8a 100644 --- a/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java +++ b/epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/feign/fallback/OperCustomizeOpenFeignClientFallback.java @@ -1,6 +1,7 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerFootBarDTO; @@ -124,4 +125,14 @@ public class OperCustomizeOpenFeignClientFallback implements OperCustomizeOpenFe public Result> listResiCategoryItems(String customerId) { return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "listResiCategoryItems", customerId); } + + @Override + public Result getExcelHeaderAndSqlColumnForExport(IcExportTemplateQueryFormDTO param) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getExcelHeaderAndSqlColumnForExport", param); + } + + @Override + public Result> save(IcExportTemplateSaveFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "save", formDTO); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index 71b33b7510..f98d34991c 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -89,6 +89,12 @@ 2.0.0 compile + + com.epmet + epmet-admin-client + 2.0.0 + compile + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcExportTemplateController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcExportTemplateController.java new file mode 100644 index 0000000000..d296ab44b5 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcExportTemplateController.java @@ -0,0 +1,96 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.ExportGroup; +import com.epmet.dto.IcExportTemplateDTO; +import com.epmet.dto.form.IcExportTemplateQueryFormDTO; +import com.epmet.dto.result.IcCustomExportResultDTO; +import com.epmet.dto.result.IcExportTemplateForExportResultDTO; +import com.epmet.dto.result.TemplateDetailResultDTO; +import com.epmet.service.IcExportTemplateService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.Map; + + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@RestController +@RequestMapping("icExportTemplate") +public class IcExportTemplateController { + + @Autowired + private IcExportTemplateService icExportTemplateService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = icExportTemplateService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id) { + IcExportTemplateDTO data = icExportTemplateService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result> save(@RequestBody IcExportTemplateSaveFormDTO formDTO) { + return new Result>().ok(icExportTemplateService.save(formDTO)); + } + + + @PostMapping("delete") + public Result delete(@LoginUser TokenDto tokenDto, @RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + icExportTemplateService.delete(tokenDto.getUserId(), ids); + return new Result(); + } + + /** + * desc:查询要导出的表头和sql返回结果的列的 用于导出 + * + * @param param + * @return + */ + @PostMapping("getExcelHeaderAndSqlColumnForExport") + public Result getExcelHeaderAndSqlColumnForExport(@RequestBody IcExportTemplateQueryFormDTO param) { + ValidatorUtils.validateEntity(param, ExportGroup.class); + return new Result().ok(icExportTemplateService.getTemplateConfigForExport(param)); + } + + /** + * 获取模板列表 + * + * @Param tokenDto + * @Return {@link Result< List< IcExportTemplateDTO>>} + * @Author zhaoqifeng + * @Date 2022/4/25 14:28 + */ + @PostMapping("templateList") + public Result> getTemplateList(@LoginUser TokenDto tokenDto, @RequestBody IcExportTemplateDTO formDTO) { + return new Result>().ok(icExportTemplateService.getTemplateList(tokenDto, formDTO)); + } + + @PostMapping("templateDetail") + public Result> getTemplateDetail(@RequestBody IcExportTemplateDTO formDTO) { + return new Result>().ok(icExportTemplateService.getTemplateDetail(formDTO)); + } + + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java index b247addf24..ef443587d2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormController.java @@ -102,6 +102,19 @@ public class IcFormController { return new Result>().ok(icFormItemService.queryConditionList(formDto)); } + /** + * 查询条件, 分组显示 + * @param tokenDto + * @param formDto + * @return + */ + @PostMapping("conditionlist-bygroup") + public Result> queryConditionListByGroup(@LoginUser TokenDto tokenDto, @RequestBody CustomerFormQueryDTO formDto){ + formDto.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDto,CustomerFormQueryDTO.AddUserInternalGroup.class); + return new Result>().ok(icFormItemService.queryConditionListByGroup(formDto)); + } + /** * 居民信息列表_表头 * @param tokenDto diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemController.java index f38a16f323..80d6f47037 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemController.java @@ -18,7 +18,10 @@ package com.epmet.controller; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.EditIFormItemFormDTO; import com.epmet.dto.result.ColumnTableNameResultDTO; +import com.epmet.dto.result.FormItemResult; import com.epmet.dto.result.ResiCategoryItemResultDTO; import com.epmet.service.IcFormItemService; import org.springframework.beans.factory.annotation.Autowired; @@ -60,4 +63,40 @@ public class IcFormItemController { return new Result().ok(r); } + + /** + * 修改组件的类型 + * 来源于需求: + * 16、所患大病、所患慢病更改为下拉框选择,慢病类型:高血压、类风湿、心脏病、肝硬化、糖尿病、其他;大病类别:恶性肿瘤、肾功能衰竭、肝硬化或急性肝坏死、脑中风、急性心机梗塞、急性坏死性胰腺炎、器官移植、系统性红斑狼疮、再生障碍性贫血、其他 + * 17、人户状况更改为下拉框选择,类别:人户一致,人在户不在,户在人不在 + * 18、居住情况类别缺少针对夫妻两人居住的类别,增加“其他”分类,类别:与子女同住、空巢、独居、其他 + * @param formDTO + * @return + */ + @PostMapping("edit-item-type") + public Result editItemType(@RequestBody EditIFormItemFormDTO formDTO ){ + ValidatorUtils.validateEntity(formDTO); + icFormItemService.editItemType(formDTO); + return new Result(); + } + + /** + * 初始化默认的查询组件:ic_form_item.SEARCH_DISPLAY='1'的 + * @return + */ + @PostMapping("init-query-builder") + public Result initQueryBuilder(@RequestParam("customerId")String customerId){ + icFormItemService.initQueryBuilder(customerId); + return new Result(); + } + + /** + * 根据分组id 获取分组下的item + * @return + */ + @PostMapping("getItemList/{groupId}") + public Result> getItemListByGroupId(@RequestHeader String customerId, @PathVariable("groupId") String groupId){ + List list = icFormItemService.getItemListByGroupId(customerId,groupId); + return new Result().ok(list); + } } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemGroupController.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemGroupController.java index b4d0079637..94fdaecbd9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemGroupController.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/IcFormItemGroupController.java @@ -17,23 +17,20 @@ package com.epmet.controller; -import com.epmet.commons.tools.page.PageData; -import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.AddGroup; -import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.QueryGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; import com.epmet.dto.IcFormItemGroupDTO; -import com.epmet.excel.IcFormItemGroupExcel; +import com.epmet.dto.form.IcFormItemGroupLisFormDTO; import com.epmet.service.IcFormItemGroupService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import javax.servlet.http.HttpServletResponse; import java.util.List; -import java.util.Map; /** @@ -45,14 +42,16 @@ import java.util.Map; @RestController @RequestMapping("icformitemgroup") public class IcFormItemGroupController { - + @Autowired private IcFormItemGroupService icFormItemGroupService; - @GetMapping("page") - public Result> page(@RequestParam Map params){ - PageData page = icFormItemGroupService.page(params); - return new Result>().ok(page); + @PostMapping("list") + public Result> page(@RequestHeader String customerId, @RequestBody IcFormItemGroupLisFormDTO param){ + param.setCustomerId(customerId); + ValidatorUtils.validateEntity(param, QueryGroup.class); + List page = icFormItemGroupService.list(param); + return new Result>().ok(page); } @GetMapping("{id}") @@ -85,10 +84,5 @@ public class IcFormItemGroupController { return new Result(); } - @GetMapping("export") - public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = icFormItemGroupService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, IcFormItemGroupExcel.class); - } -} \ No newline at end of file +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcExportTemplateConfigDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcExportTemplateConfigDao.java new file mode 100644 index 0000000000..baaec72abd --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcExportTemplateConfigDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.IcExportTemplateConfigEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 自定义表单导出模板配置项 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Mapper +public interface IcExportTemplateConfigDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcExportTemplateDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcExportTemplateDao.java new file mode 100644 index 0000000000..fdf33b6754 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcExportTemplateDao.java @@ -0,0 +1,38 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.IcExportTemplateDTO; +import com.epmet.dto.form.IcExportTemplateQueryFormDTO; +import com.epmet.dto.result.IcExportTemplateForExportResultDTO; +import com.epmet.dto.result.TemplateDetailResultDTO; +import com.epmet.entity.IcExportTemplateEntity; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Mapper +public interface IcExportTemplateDao extends BaseDao { + + List getTemplateConfigForExport(IcExportTemplateQueryFormDTO param); + + List selectByAgencyId(@Param("agencyId") String agencyId); + + /** + * 获取模板详情 + * + * @Param tempId + * @Return {@link List< TemplateDetailResultDTO>} + * @Author zhaoqifeng + * @Date 2022/4/25 16:33 + */ + List getTemplateDetail(@Param("tempId") String tempId); + + List getChildrenTemplateDetail(@Param("pid") String pid); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java index 41928a94ce..3c98b74b98 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormDao.java @@ -47,7 +47,7 @@ public interface IcFormDao extends BaseDao { */ CustomerFormResultDTO selectByCode(@Param("customerId") String customerId, @Param("formCode") String formCode); - List selectItemList(@Param("formId") String formId, @Param("dynamic") Boolean dynamic); + List selectItemList(@Param("itemGroupId")String itemGroupId,@Param("formId") String formId, @Param("dynamic") Boolean dynamic); List selectItemListByGroupId(String groupId); List selectListOption(String itemId); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java index d20a49202a..2647805d6f 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemDao.java @@ -37,6 +37,17 @@ public interface IcFormItemDao extends BaseDao { List selectConditionList(@Param("customerId") String customerId, @Param("formCode") String formCode); + List selectConditionListByGroupId(String groupId); + + /** + * 查询组件列表 + * + * @param customerId + * @param formCode + * @return + */ + List selectConditionListGroup(@Param("customerId") String customerId, @Param("formCode") String formCode, @Param("itemIdList") List itemIdList); + List queryTableHeaderList(@Param("customerId") String customerId, @Param("formCode") String formCode); /** @@ -44,28 +55,54 @@ public interface IcFormItemDao extends BaseDao { * * @param customerId * @param formCode - * @return java.util.List + * @return java.util.List * @author yinzuomei * @date 2021/11/1 12:58 下午 */ - List queryConditions(@Param("customerId") String customerId, @Param("formCode")String formCode); + List queryConditions(@Param("customerId") String customerId, @Param("formCode") String formCode); /** * 构造出所有子表关联语句 * * @param customerId * @param formCode - * @return java.util.List + * @return java.util.List * @author yinzuomei * @date 2021/11/1 1:25 下午 */ - List querySubTables(@Param("customerId") String customerId, @Param("formCode")String formCode); + List querySubTables(@Param("customerId") String customerId, @Param("formCode") String formCode); - Set queryIcResiSubTables(@Param("customerId") String customerId, @Param("formCode")String formCode); + Set queryIcResiSubTables(@Param("customerId") String customerId, @Param("formCode") String formCode); /** * @Author sun * @Description 居民信息新增查询各表必填字段 **/ - List getMustColumn(@Param("customerId")String customerId); -} \ No newline at end of file + List getMustColumn(@Param("customerId") String customerId); + + /** + * desc:获取需要远程获取并带有关联item的参数的 item项 + * + * @param customerId + * @param formCode + * @return + */ + List getConditionRemoteItems(@Param("customerId") String customerId, @Param("formCode") String formCode); + + /** + * desc:根据Id获取item对应的表名和item属性 + * + * @param itemId + * @return + */ + ConditionResultDTO getConditionItem(@Param("itemId") String itemId); + + /** + * desc:根据客户Id 和groupId 获取item配置项 + * + * @param customerId + * @param groupId + * @return + */ + List getItemListByGroupId(@Param("customerId") String customerId, @Param("groupId") String groupId); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java index d731505e3d..8bd6c3412b 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormItemOptionsDao.java @@ -41,4 +41,5 @@ public interface IcFormItemOptionsDao extends BaseDao { */ List volunteerLabelByValues(@Param("volunteers") List volunteers,@Param("customerId")String customerId); + int deleteByItemId(@Param("itemId") String itemId, @Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormQueryBuilderDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormQueryBuilderDao.java index a142d8d637..67a3f319cb 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormQueryBuilderDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/IcFormQueryBuilderDao.java @@ -20,6 +20,9 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.entity.IcFormQueryBuilderEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 表单查询项 @@ -29,5 +32,8 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface IcFormQueryBuilderDao extends BaseDao { - + + IcFormQueryBuilderEntity selectDefaultQueryItem(@Param("itemId") String itemId,@Param("itemType") String itemType, @Param("queryType")String queryType); + + List selectItemId(@Param("customerId") String customerId, @Param("formCode") String formCode); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcExportTemplateConfigEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcExportTemplateConfigEntity.java new file mode 100644 index 0000000000..60a8094221 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcExportTemplateConfigEntity.java @@ -0,0 +1,56 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 自定义表单导出模板配置项 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_export_template_config") +public class IcExportTemplateConfigEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 模板主键id + */ + private String tempId; + + /** + * 项标签 + */ + private String label; + + /** + * 父id + */ + private String pid; + + /** + * ic_form_item.id + */ + private String itemId; + + /** + * 表头宽度 + */ + private Integer width; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcExportTemplateEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcExportTemplateEntity.java new file mode 100644 index 0000000000..8ed160e28c --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcExportTemplateEntity.java @@ -0,0 +1,51 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("ic_export_template") +public class IcExportTemplateEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 所属机关ID(customer_agency.id) + */ + private String agencyId; + + /** + * 所有上级组织机构ID(以英文:隔开)包含本身id + */ + private String pids; + + /** + * 表单CODE,从字典获取 + */ + private String formCode; + + /** + * 模板名称 + */ + private String name; + + /** + * 排序 + */ + private Integer sort; + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormQueryBuilderEntity.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormQueryBuilderEntity.java index 4713b01dd3..22f83887ba 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormQueryBuilderEntity.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/IcFormQueryBuilderEntity.java @@ -45,6 +45,11 @@ public class IcFormQueryBuilderEntity extends BaseEpmetEntity { */ private String formItemId; + /** + * 项标签 + */ + private String label; + /** * ic_form.form_code,举例:resi_base_info * @see com.epmet.commons.tools.enums.IcFormCodeEnum @@ -52,11 +57,26 @@ public class IcFormQueryBuilderEntity extends BaseEpmetEntity { */ private String formCode; + /** + * 组件类型 + */ + private String itemType; + /** * 查询类型: equal, like,daterange.... */ private String queryType; + /** + * 值转换类型 + */ + private String funType; + + /** + * 手机号:mobile; 身份证:id_card;只能输入数字:num + */ + private String validType; + /** * 排序 */ diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcExportTemplateConfigService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcExportTemplateConfigService.java new file mode 100644 index 0000000000..d3ef346e50 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcExportTemplateConfigService.java @@ -0,0 +1,21 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.entity.IcExportTemplateConfigEntity; + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +public interface IcExportTemplateConfigService extends BaseService { + /** + * 删除模板配置 + * @Param tempId + * @Return + * @Author zhaoqifeng + * @Date 2022/4/26 9:56 + */ + void deleteByTempId(String tempId); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcExportTemplateService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcExportTemplateService.java new file mode 100644 index 0000000000..1b20573367 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcExportTemplateService.java @@ -0,0 +1,104 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.IcExportTemplateDTO; +import com.epmet.dto.form.IcExportTemplateQueryFormDTO; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; +import com.epmet.dto.result.IcCustomExportResultDTO; +import com.epmet.dto.result.IcExportTemplateForExportResultDTO; +import com.epmet.dto.result.TemplateDetailResultDTO; +import com.epmet.entity.IcExportTemplateEntity; + +import java.util.List; +import java.util.Map; + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +public interface IcExportTemplateService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-04-21 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-04-21 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return IcExportTemplateDTO + * @author generator + * @date 2022-04-21 + */ + IcExportTemplateDTO get(String id); + + /** + * 默认保存 + * + * @param formDTO + * @return void + * @author generator + * @date 2022-04-21 + */ + List save(IcExportTemplateSaveFormDTO formDTO); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-04-21 + */ + void delete(String userId, String[] ids); + + /** + * desc: 获取导出配置 + * + * @param param + * @return java.util.List + * @author LiuJanJun + * @date 2022/4/22 3:55 下午 + */ + IcCustomExportResultDTO getTemplateConfigForExport(IcExportTemplateQueryFormDTO param); + + /** + * 获取模板列表 + * + * @Param tokenDto + * @Return {@link List< IcExportTemplateDTO>} + * @Author zhaoqifeng + * @Date 2022/4/25 14:29 + */ + List getTemplateList(TokenDto tokenDto, IcExportTemplateDTO formDTO); + + /** + * 获取模板详情 + * + * @Param formDTO + * @Return {@link List< TemplateDetailResultDTO>} + * @Author zhaoqifeng + * @Date 2022/4/25 16:29 + */ + List getTemplateDetail(IcExportTemplateDTO formDTO); +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemGroupService.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemGroupService.java index 79402d6273..ac28a4e8d2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemGroupService.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/IcFormItemGroupService.java @@ -18,12 +18,11 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; -import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcFormItemGroupDTO; +import com.epmet.dto.form.IcFormItemGroupLisFormDTO; import com.epmet.entity.IcFormItemGroupEntity; import java.util.List; -import java.util.Map; /** * 表单项分组 @@ -33,16 +32,6 @@ import java.util.Map; */ public interface IcFormItemGroupService extends BaseService { - /** - * 默认分页 - * - * @param params - * @return PageData - * @author generator - * @date 2021-10-26 - */ - PageData page(Map params); - /** * 默认查询 * @@ -51,7 +40,7 @@ public interface IcFormItemGroupService extends BaseService list(Map params); + List list(IcFormItemGroupLisFormDTO params); /** * 单条查询 @@ -92,4 +81,4 @@ public interface IcFormItemGroupService extends BaseService { */ List queryConditionList(CustomerFormQueryDTO formDto); + List queryConditionListByGroup(CustomerFormQueryDTO formDto); + List queryTableHeaderList(CustomerFormQueryDTO formDto); List queryConditions(String customerId,String formCode); @@ -62,4 +65,30 @@ public interface IcFormItemService extends BaseService { * @return */ List listResiCategoryItems(String customerId); + + /** + * 修改组件的类型 + * 来源于需求: + * 16、所患大病、所患慢病更改为下拉框选择,慢病类型:高血压、类风湿、心脏病、肝硬化、糖尿病、其他;大病类别:恶性肿瘤、肾功能衰竭、肝硬化或急性肝坏死、脑中风、急性心机梗塞、急性坏死性胰腺炎、器官移植、系统性红斑狼疮、再生障碍性贫血、其他 + * 17、人户状况更改为下拉框选择,类别:人户一致,人在户不在,户在人不在 + * 18、居住情况类别缺少针对夫妻两人居住的类别,增加“其他”分类,类别:与子女同住、空巢、独居、其他 + * + * @param formDTO + * @return + */ + void editItemType(EditIFormItemFormDTO formDTO); + + /** + * 初始化默认的查询组件:ic_form_item.SEARCH_DISPLAY='1'的 + * @param customerId + */ + void initQueryBuilder(String customerId); + + /** + * desc:根据groupId 获取itemlist + * @param customerId + * @param groupId + * @return + */ + List getItemListByGroupId(String customerId, String groupId); } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateConfigServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateConfigServiceImpl.java new file mode 100644 index 0000000000..35010da319 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateConfigServiceImpl.java @@ -0,0 +1,38 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.dao.IcExportTemplateConfigDao; +import com.epmet.entity.IcExportTemplateConfigEntity; +import com.epmet.service.IcExportTemplateConfigService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Slf4j +@Service +public class IcExportTemplateConfigServiceImpl extends BaseServiceImpl implements IcExportTemplateConfigService { + + /** + * 删除模板配置 + * + * @param tempId + * @Param tempId + * @Return + * @Author zhaoqifeng + * @Date 2022/4/26 9:56 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void deleteByTempId(String tempId) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcExportTemplateConfigEntity::getTempId, tempId); + baseDao.delete(wrapper); + } +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateServiceImpl.java new file mode 100644 index 0000000000..3186d60146 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcExportTemplateServiceImpl.java @@ -0,0 +1,322 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.IcExportItemListFormDTO; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.EpmetRequestHolder; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.dao.IcExportTemplateDao; +import com.epmet.dao.IcFormItemDao; +import com.epmet.dto.IcExportTemplateDTO; +import com.epmet.dto.form.IcExportTemplateQueryFormDTO; +import com.epmet.dto.result.ConditionResultDTO; +import com.epmet.dto.result.IcCustomExportResultDTO; +import com.epmet.dto.result.IcExportTemplateForExportResultDTO; +import com.epmet.dto.result.TemplateDetailResultDTO; +import com.epmet.entity.IcExportTemplateConfigEntity; +import com.epmet.entity.IcExportTemplateEntity; +import com.epmet.service.IcExportTemplateConfigService; +import com.epmet.service.IcExportTemplateService; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * 自定义表单导出模板 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-21 + */ +@Slf4j +@Service +public class IcExportTemplateServiceImpl extends BaseServiceImpl implements IcExportTemplateService { + + @Autowired + private IcExportTemplateDao icExportTemplateDao; + @Autowired + private IcFormItemDao icFormItemDao; + @Autowired + private IcExportTemplateConfigService icExportTemplateConfigService; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, IcExportTemplateDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, IcExportTemplateDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public IcExportTemplateDTO get(String id) { + IcExportTemplateEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, IcExportTemplateDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public List save(IcExportTemplateSaveFormDTO formDTO) { + //效验数据 + ValidatorUtils.validateEntity(formDTO, AddGroup.class); + + List resultList = new ArrayList<>(); + IcExportTemplateEntity tempEntity = new IcExportTemplateEntity(); + List itemList = new ArrayList<>(); + String customerId = EpmetRequestHolder.getHeader(AppClientConstant.CUSTOMER_ID); + String staffId = EpmetRequestHolder.getHeader(AppClientConstant.USER_ID); + //1.获取工作人员所属组织缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", EpmetRequestHolder.getHeader(AppClientConstant.USER_ID))); + } + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + if (null == agencyInfo) { + throw new RenException(String.format("获取组织缓存信息失败%s", staffInfo.getAgencyId())); + } + + //2.根据是否保存判断查询当前组织已存在模板的最大sort值 + int sort = 1; + String tempId = ""; + if (formDTO.getIsSaveTemp()) { + List templist = baseDao.selectByAgencyId(agencyInfo.getId()); + if (!CollectionUtils.isEmpty(templist)) { + sort = templist.get(NumConstant.ZERO).getSort() + NumConstant.ONE; + } + tempId = UUID.randomUUID().toString().replace("-", ""); + tempEntity.setId(tempId); + tempEntity.setCustomerId(customerId); + tempEntity.setAgencyId(agencyInfo.getId()); + tempEntity.setPids(StringUtils.isEmpty(agencyInfo.getPids()) ? agencyInfo.getId() : agencyInfo.getPids() + ":" + agencyInfo.getId()); + tempEntity.setFormCode(formDTO.getFormCode()); + tempEntity.setName(formDTO.getName()); + /*tempEntity.setType(); + tempEntity.setUrl();*/ + tempEntity.setSort(sort); + } + + //3.递归遍历组装待保存和待返回数据对象【目前业务表单项是两层,此方法支持多层】 + packageData(formDTO.getItemList(), "0", customerId, tempId, resultList, itemList); + + //4.执行数据保存 + if (formDTO.getIsSaveTemp()) { + baseDao.insert(tempEntity); + icExportTemplateConfigService.insertBatch(itemList); + } + //5.返回组装数据对象 + return resultList; + } + + /** + * @Author sun + * @Description 递归处理可能存在的多层表单数据[目前业务上是两次] + **/ + private void packageData(List dataList, String pid, String customerId, String tempId, + List resultList, List itemList) { + int num = 0; + //1.遍历一级表单项 + for (IcExportItemListFormDTO dto : dataList) { + IcExportTemplateConfigEntity itemEntity = ConvertUtils.sourceToTarget(dto, IcExportTemplateConfigEntity.class); + itemEntity.setId(UUID.randomUUID().toString().replace("-", "")); + itemEntity.setPid(pid); + itemEntity.setCustomerId(customerId); + itemEntity.setTempId(tempId); + num += 1; + itemEntity.setSort(num); + itemList.add(itemEntity); + IcExportTemplateForExportResultDTO resultDTO = ConvertUtils.sourceToTarget(dto, IcExportTemplateForExportResultDTO.class); + resultDTO.setId(itemEntity.getId()); + resultDTO.setPid(itemEntity.getPid()); + resultDTO.setSort(itemEntity.getSort()); + resultList.add(resultDTO); + //2.递归遍历子集表单项 + if (!CollectionUtils.isEmpty(dto.getChildren())) { + packageData(dto.getChildren(), itemEntity.getId(), customerId, tempId, resultList, itemList); + } + } + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String userId, String[] ids) { + // 逻辑删除(@TableLogic 注解) + List idList = Arrays.asList(ids); + idList.forEach(id -> { + IcExportTemplateEntity entity = baseDao.selectById(id); + if (!userId.equals(entity.getCreatedBy())) { + throw new EpmetException("只能删除自己创建的模板"); + } + }); + baseDao.deleteBatchIds(idList); + idList.forEach(id -> { + icExportTemplateConfigService.deleteByTempId(id); + }); + } + + @Override + public IcCustomExportResultDTO getTemplateConfigForExport(IcExportTemplateQueryFormDTO param) { + String tempId = param.getTempId(); + List list = null; + + if (StringUtils.isNotBlank(tempId)){ + list = icExportTemplateDao.getTemplateConfigForExport(param); + }else { + list = this.save(param.getExportConfig()); + } + + + if (CollectionUtils.isEmpty(list)) { + return null; + } + //todo 删除多余的方法 + // List remoteItemList = icFormItemDao.getConditionRemoteItems(param.getCustomerId(), param.getFormCode()); + Map> resultTemp = list.stream().collect(Collectors.groupingBy(IcExportTemplateForExportResultDTO::getPid, LinkedHashMap::new, Collectors.toList())); + List> headerList = new ArrayList<>(); + List showSqlColumns = new ArrayList<>(); + List hiddenSqlColumns = new ArrayList<>(); + Set hasExistColumnSet = new HashSet<>(); + resultTemp.get(NumConstant.ZERO_STR).forEach(root -> { + digui(resultTemp, root, headerList, showSqlColumns, hiddenSqlColumns, hasExistColumnSet); + }); + //组织 关联item项的 + if (hasExistColumnSet.size() > NumConstant.ZERO) { + Set configItemIdSet = list.stream().map(IcExportTemplateForExportResultDTO::getItemId).collect(Collectors.toSet()); + + Set conditionItemIdSet = new HashSet<>(hasExistColumnSet); + conditionItemIdSet.removeAll(configItemIdSet); + conditionItemIdSet.forEach(itemId -> { + ConditionResultDTO item = icFormItemDao.getConditionItem(itemId); + if (item == null || StringUtils.isBlank(item.getColumnName())) { + log.error("getTemplateConfigForExport item 不存在 id:{}", itemId); + return; + } + hiddenSqlColumns.add(new IcCustomExportResultDTO.SqlColumn(item.getItemId(),item.getTableName(), item.isSupportAdd(),item.getColumnName(),item.getOptionSourceType())); + }); + } + + IcCustomExportResultDTO result = new IcCustomExportResultDTO(); + result.setHeaders(headerList); + result.setShowSqlColumns(showSqlColumns); + result.setHiddenSqlColumns(hiddenSqlColumns); + return result; + } + + /** + * 获取模板列表 + * + * @param tokenDto + * @Param tokenDto + * @Return {@link List< IcExportTemplateDTO>} + * @Author zhaoqifeng + * @Date 2022/4/25 14:29 + */ + @Override + public List getTemplateList(TokenDto tokenDto, IcExportTemplateDTO formDTO) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null == staffInfo) { + throw new EpmetException("获取工作人员信息失败"); + } + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcExportTemplateEntity::getAgencyId, staffInfo.getAgencyId()); + wrapper.eq(IcExportTemplateEntity::getFormCode, formDTO.getFormCode()); + wrapper.orderByAsc(IcExportTemplateEntity::getSort); + List list = baseDao.selectList(wrapper); + List result = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(list)) { + result = list.stream().map(item -> { + IcExportTemplateDTO dto = new IcExportTemplateDTO(); + dto.setId(item.getId()); + dto.setName(item.getName()); + dto.setCreatedTime(item.getCreatedTime()); + CustomerStaffInfoCacheResult staff = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), item.getCreatedBy()); + if (null == staff) { + throw new EpmetException("获取工作人员信息失败"); + } + dto.setCreatedBy(staff.getRealName()); + if (tokenDto.getUserId().equals(item.getCreatedBy())) { + dto.setIsSelf(NumConstant.ONE); + } else { + dto.setIsSelf(NumConstant.ZERO); + } + return dto; + }).collect(Collectors.toList()); + } + return result; + } + + /** + * 获取模板详情 + * + * @param formDTO + * @Param formDTO + * @Return {@link List< TemplateDetailResultDTO >} + * @Author zhaoqifeng + * @Date 2022/4/25 16:29 + */ + @Override + public List getTemplateDetail(IcExportTemplateDTO formDTO) { + return baseDao.getTemplateDetail(formDTO.getId()); + } + + private void digui(Map> resultTemp, IcExportTemplateForExportResultDTO root, List> headerList, List showSqlColumns, List hiddenSqlColumns, Set hasExistColumnSet) { + if (StringUtils.isNotBlank(root.getColumnName())) { + showSqlColumns.add(new IcCustomExportResultDTO.SqlColumn(root.getItemId(),root.getTableName(),root.isSupportAdd(), root.getColumnName(),root.getOptionSourceType())); + if (StringUtils.isNotBlank(root.getOptionSourceValue())&&root.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)) { + String[] paramArr = root.getOptionSourceValue().split(StrConstant.QUESTION_MARK_TRANSFER)[NumConstant.ONE].split(StrConstant.AND_MARK); + //先remote中再添加 然后移除item中有的 + hasExistColumnSet.addAll(Arrays.asList(paramArr)); + } + } + List children = resultTemp.get(root.getId()); + if (CollectionUtils.isEmpty(children)) { + return; + } + children.forEach(o -> { + List headerGroupList = new ArrayList<>(); + headerGroupList.add(root.getLabel()); + headerGroupList.add(o.getLabel()); + headerList.add(headerGroupList); + digui(resultTemp, o, headerList, showSqlColumns, hiddenSqlColumns, hasExistColumnSet); + }); + } + +} diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemGroupServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemGroupServiceImpl.java index 2de0adc908..7eee10c186 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemGroupServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormItemGroupServiceImpl.java @@ -17,23 +17,19 @@ package com.epmet.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; -import com.epmet.commons.tools.constant.FieldConstant; -import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.dao.IcFormItemGroupDao; import com.epmet.dto.IcFormItemGroupDTO; +import com.epmet.dto.form.IcFormItemGroupLisFormDTO; import com.epmet.entity.IcFormItemGroupEntity; import com.epmet.service.IcFormItemGroupService; -import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; import java.util.List; -import java.util.Map; /** * 表单项分组 @@ -46,29 +42,15 @@ public class IcFormItemGroupServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, false), - getWrapper(params) - ); - return getPageData(page, IcFormItemGroupDTO.class); - } - - @Override - public List list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public List list(IcFormItemGroupLisFormDTO params) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(IcFormItemGroupEntity::getCustomerId, params.getCustomerId()) + .orderByAsc(IcFormItemGroupEntity::getSort); + List entityList = baseDao.selectList(wrapper); return ConvertUtils.sourceToTarget(entityList, IcFormItemGroupDTO.class); } - private QueryWrapper getWrapper(Map params){ - String id = (String)params.get(FieldConstant.ID_HUMP); - - QueryWrapper wrapper = new QueryWrapper<>(); - wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); - - return wrapper; - } @Override public IcFormItemGroupDTO get(String id) { @@ -97,4 +79,4 @@ public class IcFormItemGroupServiceImpl extends BaseServiceImpl implements IcFormItemService { + @Autowired + private IcFormItemOptionsDao icFormItemOptionsDao; + @Autowired + private IcFormQueryBuilderDao icFormQueryBuilderDao; + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; /** * 获取居民信息的查询条件,组件列表 @@ -56,6 +78,16 @@ public class IcFormItemServiceImpl extends BaseServiceImpl queryConditionListByGroup(CustomerFormQueryDTO formDto) { + List itemIdList=icFormQueryBuilderDao.selectItemId(formDto.getCustomerId(),formDto.getFormCode()); + if(CollectionUtils.isEmpty(itemIdList)){ + return new ArrayList<>(); + } + List list=baseDao.selectConditionListGroup(formDto.getCustomerId(),formDto.getFormCode(),itemIdList); + return list; + } + /** * 居民信息列表_表头 * @param formDto @@ -152,4 +184,130 @@ public class IcFormItemServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper().lambda() + .eq(StringUtils.isNotBlank(formDTO.getCustomerId()), IcFormItemEntity::getCustomerId, formDTO.getCustomerId()) + .eq(StringUtils.isNotBlank(formDTO.getFormItemId()), IcFormItemEntity::getId, formDTO.getFormItemId()) + .eq(IcFormItemEntity::getLabel, formDTO.getLabel()); + List list = baseDao.selectList(queryWrapper); + if (CollectionUtils.isEmpty(list)) { + return; + } + for (IcFormItemEntity entity : list) { + //修改组件类型 + entity.setItemType(formDTO.getItemType()); + baseDao.updateById(entity); + if (!CollectionUtils.isEmpty(formDTO.getOptions())) { + icFormItemOptionsDao.deleteByItemId(entity.getId(), entity.getCustomerId()); + int sort = 1; + for (OptionDTO optionDTO : formDTO.getOptions()) { + IcFormItemOptionsEntity optionsEntity = new IcFormItemOptionsEntity(); + optionsEntity.setCustomerId(entity.getCustomerId()); + optionsEntity.setFormCode(entity.getFormCode()); + optionsEntity.setFormId(entity.getFormId()); + optionsEntity.setItemId(entity.getId()); + optionsEntity.setOptionLabel(optionDTO.getLabel()); + optionsEntity.setOptionValue(optionDTO.getValue()); + optionsEntity.setSort(sort); + icFormItemOptionsDao.insert(optionsEntity); + sort++; + } + } + } + } + + /** + * 初始化默认的查询组件:ic_form_item.SEARCH_DISPLAY='1'的 + * + * @param customerId + */ + @Override + public void initQueryBuilder(String customerId) { + //查询所有的查询组件 + LambdaQueryWrapper queryWrapper = new QueryWrapper().lambda() + .eq(StringUtils.isNotBlank(customerId), IcFormItemEntity::getCustomerId, customerId) + .isNotNull(IcFormItemEntity::getColumnName) + .eq(IcFormItemEntity::getSearchDisplay, NumConstant.ONE); + List itemList = baseDao.selectList(queryWrapper); + if (CollectionUtils.isEmpty(itemList)) { + return; + } + for (IcFormItemEntity item : itemList) { + IcFormQueryBuilderEntity builderEntity = new IcFormQueryBuilderEntity(); + builderEntity.setCustomerId(item.getCustomerId()); + builderEntity.setFormItemId(item.getId()); + builderEntity.setLabel(item.getLabel()); + builderEntity.setFormCode(item.getFormCode()); + builderEntity.setItemType(item.getItemType()); + builderEntity.setQueryType(queryType(item.getItemType())); + builderEntity.setFunType(StrConstant.EPMETY_STR); + builderEntity.setSort(item.getSort()); + builderEntity.setCreatedBy("init"); + builderEntity.setUpdatedBy("init"); + //item默认的查询组件已经有了,就不插入了 + IcFormQueryBuilderEntity entity = icFormQueryBuilderDao.selectDefaultQueryItem(item.getId(), item.getItemType(), builderEntity.getQueryType()); + if (null == entity) { + icFormQueryBuilderDao.insert(builderEntity); + } + } + } + + @Override + public List getItemListByGroupId(String customerId, String groupId) { + return baseDao.getItemListByGroupId(customerId,groupId); + } + + + private String queryType(String itemType) { + /*switch (itemType) { + case "select": + queryType = "equal"; + break; + case "input": + queryType = "like"; + break; + case "datepicker": + queryType = "daterange"; + break; + case "textarea": + queryType = "like"; + break; + case "radio": + queryType = "equal"; + break; + //多选的,查询时应该是 and (columnname like '%XXX%' or columnname like '%XXX%') + case "checkbox": + queryType = "list_equal"; + break; + case "daterange": + queryType = "daterange"; + break; + case "cascader": + queryType = "equal"; + break; + default: + queryType = "like"; + }*/ + String queryType = "like"; + Result> queryTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ITEM_TYPE_QUERY.getCode()); + if (queryTypeMap.success() && MapUtils.isNotEmpty(queryTypeMap.getData())) { + queryType = queryTypeMap.getData().get(itemType); + } + log.warn("itemType="+itemType+";queryType="+queryType); + return queryType; + } + + } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java index 3e88b05f7b..6002398fbd 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java @@ -99,7 +99,8 @@ public class IcFormServiceImpl extends BaseServiceImpl if (null == resultDTO) { throw new RenException(EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getCode(), EpmetErrorCode.CUSTOMER_FORM_NOT_EXITS.getMsg()); } - List itemList = baseDao.selectItemList(resultDTO.getFormId(), formDto.getDynamic()); + String itemGroupId=formDto.getCustomerId().concat(StrConstant.UNDER_LINE).concat(NumConstant.ZERO_STR); + List itemList = baseDao.selectItemList(itemGroupId,resultDTO.getFormId(), formDto.getDynamic()); List groupList = baseDao.selectListGroup(resultDTO.getFormId()); resultDTO.setItemList(itemList); resultDTO.setGroupList(groupList); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.21__addcol_item_build.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.21__addcol_item_build.sql new file mode 100644 index 0000000000..94ef459adf --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.21__addcol_item_build.sql @@ -0,0 +1,13 @@ +alter table ic_form_query_builder add COLUMN ITEM_TYPE VARCHAR(32) NOT NULL COMMENT '组件类型' after FORM_CODE; +alter table ic_form_query_builder add COLUMN LABEL VARCHAR(32) NOT NULL COMMENT '项标签' after FORM_ITEM_ID; +alter table ic_form_query_builder add COLUMN FUN_TYPE VARCHAR(32) COMMENT '值转换类型' after QUERY_TYPE; + +update ic_form_query_builder set item_type=( +select i.ITEM_TYPE from ic_form_item i where i.id=FORM_ITEM_ID +and i.CUSTOMER_ID=CUSTOMER_ID +)where DEL_FLAG='0'; + +update ic_form_query_builder set LABEL=( +select i.LABEL from ic_form_item i where i.id=FORM_ITEM_ID +and i.CUSTOMER_ID=CUSTOMER_ID +)where DEL_FLAG='0'; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.22__update_search_col.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.22__update_search_col.sql new file mode 100644 index 0000000000..396cf2f803 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.22__update_search_col.sql @@ -0,0 +1,8 @@ +update ic_form_item set SEARCH_DISPLAY='1',UPDATED_BY='YZM',UPDATED_TIME=NOW() +WHERE DEL_FLAG='0' +AND SEARCH_DISPLAY='0' +AND LABEL IN( +'文化程度','兴趣特长','残疾类别','残疾等级','所患大病','所患慢性病', +'是否参保','救助金额','人户状况','户籍所在地','居住情况','该居民有无赡养人', +'需求类别','参战时间','是否办理公益性岗位','志愿者类别','特殊人群类别' +); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.23__update_group_sort.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.23__update_group_sort.sql new file mode 100644 index 0000000000..0d6a04eb2d --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.23__update_group_sort.sql @@ -0,0 +1,18 @@ +update ic_form_item_group set SORT='0' where DEL_FLAG='0' and LABEL='基础信息'; +update ic_form_item_group set SORT='1' where DEL_FLAG='0' and LABEL='教育信息'; +update ic_form_item_group set SORT='2' where DEL_FLAG='0' and LABEL='兴趣爱好'; +update ic_form_item_group set SORT='3' where DEL_FLAG='0' and LABEL='宗教信仰'; +update ic_form_item_group set SORT='4' where DEL_FLAG='0' and LABEL='健康信息'; +update ic_form_item_group set SORT='5' where DEL_FLAG='0' and LABEL='工作信息'; +update ic_form_item_group set SORT='6' where DEL_FLAG='0' and LABEL='经济状况'; +update ic_form_item_group set SORT='7' where DEL_FLAG='0' and LABEL='居住信息'; +update ic_form_item_group set SORT='8' where DEL_FLAG='0' and LABEL='家庭信息'; +update ic_form_item_group set SORT='9' where DEL_FLAG='0' and LABEL='党员信息'; +update ic_form_item_group set SORT='10' where DEL_FLAG='0' and LABEL='保障房信息'; +update ic_form_item_group set SORT='11' where DEL_FLAG='0' and LABEL='失业信息'; +update ic_form_item_group set SORT='12' where DEL_FLAG='0' and LABEL='退役军人信息'; +update ic_form_item_group set SORT='13' where DEL_FLAG='0' and LABEL='志愿者信息'; +update ic_form_item_group set SORT='14' where DEL_FLAG='0' and LABEL='特殊人群信息'; +update ic_form_item_group set SORT='15' where DEL_FLAG='0' and LABEL='统战人员'; +update ic_form_item_group set SORT='16' where DEL_FLAG='0' and LABEL='老年人信息'; +update ic_form_item_group set SORT='17' where DEL_FLAG='0' and LABEL='居民需求信息'; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.24__add_validtype_forbuild.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.24__add_validtype_forbuild.sql new file mode 100644 index 0000000000..0565333344 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.24__add_validtype_forbuild.sql @@ -0,0 +1,6 @@ +alter table ic_form_query_builder add COLUMN VALID_TYPE VARCHAR(32) COMMENT '手机号:mobile; 身份证:id_card;只能输入数字:num' after FUN_TYPE; + +update ic_form_query_builder set VALID_TYPE=( +select i.VALID_TYPE from ic_form_item i where i.id=FORM_ITEM_ID +and i.CUSTOMER_ID=CUSTOMER_ID +)where DEL_FLAG='0'; \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.25__add_export_temp.sql b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.25__add_export_temp.sql new file mode 100644 index 0000000000..2b8fc4eb78 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.25__add_export_temp.sql @@ -0,0 +1,48 @@ +CREATE TABLE `ic_export_template` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL DEFAULT '' COMMENT '客户id', + `AGENCY_ID` varchar(64) NOT NULL COMMENT '所属机关ID(customer_agency.id)', + `PIDS` varchar(1024) DEFAULT NULL COMMENT '所有上级组织机构ID(以英文:隔开)包含本身id', + `FORM_CODE` varchar(32) NOT NULL COMMENT '表ic_form中的CODE', + `NAME` varchar(64) NOT NULL DEFAULT '' COMMENT '模板名称', + `SORT` int(11) NOT NULL COMMENT '排序', + `DEL_FLAG` int(10) NOT NULL COMMENT '0未删除,1已删除', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义表单导出模板'; + +CREATE TABLE `ic_export_template_config` ( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `TEMP_ID` varchar(64) NOT NULL COMMENT '模板主键id', + `PID` varchar(64) NOT NULL DEFAULT '0' COMMENT '当前表的id', + `ITEM_ID` varchar(64) NOT NULL DEFAULT '' COMMENT 'ic_form_item.id', + `WIDTH` int(4) DEFAULT NULL COMMENT '表头宽度', + `LABEL` varchar(32) NOT NULL COMMENT '项标签', + `SORT` int(11) NOT NULL COMMENT '排序', + `DEL_FLAG` int(10) NOT NULL COMMENT '0未删除,1已删除', + `REVISION` int(10) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`) USING BTREE, + KEY `idx_temp_id` (`TEMP_ID`) USING BTREE COMMENT '模板主键Id' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自定义表单导出模板配置项'; + +#add 基础信息group +INSERT INTO ic_form_item_group +SELECT DISTINCT CONCAT( CUSTOMER_ID, '_0' ) ID, CUSTOMER_ID, `FORM_ID`, `FORM_CODE`, `TABLE_NAME`, `SUPPORT_ADD`, '基础信息' AS `LABEL`, 0 AS `SORT`, 0 AS `DISPLAY`, `DEL_FLAG`, `REVISION`, 'ljj' AS `CREATED_BY`, NOW() CREATED_TIME, 'ljj' AS `UPDATED_BY`, NOW() AS UPDATED_TIME +FROM ic_form_item_group WHERE DEL_FLAG = '0' +GROUP BY customer_id; + +#更新 0分组为0 groupId +UPDATE ic_form_item m set m.ITEM_GROUP_ID = CONCAT(m.CUSTOMER_ID,'_',m.ITEM_GROUP_ID) WHERE m.ITEM_GROUP_ID = '0'; + +#更新表名 +UPDATE ic_form_item_group SET TABLE_NAME='ic_resi_user' where (TABLE_NAME='' or TABLE_NAME is null) and DEL_FLAG='0'; + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcExportTemplateConfigDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcExportTemplateConfigDao.xml new file mode 100644 index 0000000000..0c92cd18e0 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcExportTemplateConfigDao.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcExportTemplateDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcExportTemplateDao.xml new file mode 100644 index 0000000000..a299cd8865 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcExportTemplateDao.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml index d3c2c0261e..3fd2eae45e 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormDao.xml @@ -111,7 +111,7 @@ AND fi.DYNAMIC = #{dynamic} - AND fi.ITEM_GROUP_ID = '0' + AND fi.ITEM_GROUP_ID = #{itemGroupId} ORDER BY fi.SORT ASC @@ -232,7 +232,8 @@ fi.LIST_DISPLAY, fi.DATA_ANALYSE, fi.COLUMN_NAME, - fi.COLUMN_NUM + fi.COLUMN_NUM, + fi.MULTI_SELECT FROM ic_form_item fi left join ic_form_item_group g on (fi.ITEM_GROUP_ID = g.ID and fi.DEL_FLAG = 0 and g.DEL_FLAG = 0) left join ic_form_item pitem on (pitem.DEL_FLAG = 0 and fi.PARENT_ITEM_ID = pitem.ID) diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml index 4c78e1cc14..9c787dcadd 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemDao.xml @@ -19,6 +19,8 @@ + + @@ -48,7 +50,8 @@ b.SORT, IFNULL(i.PLACEHOLDER,'') as PLACEHOLDER, IFNULL(i.COLUMN_NAME,'')as COLUMN_NAME, - b.QUERY_TYPE + b.QUERY_TYPE, + b.FUN_TYPE FROM ic_form_query_builder b inner join ic_form_item i on(i.id=b.FORM_ITEM_ID and i.DEL_FLAG='0') LEFT JOIN ic_form_item_group g ON ( i.ITEM_GROUP_ID = g.id ) @@ -59,6 +62,38 @@ ORDER BY b.SORT asc + @@ -100,7 +135,7 @@ temp.LABEL from ( SELECT - ifnull(g.TABLE_NAME,'ic_resi_user') AS table_name, + IF(LENGTH(g.TABLE_NAME)>0,g.TABLE_NAME,'ic_resi_user') AS table_name, #( CASE WHEN M.ITEM_GROUP_ID = '0' THEN 'ic_resi_user' ELSE g.TABLE_NAME END ) AS table_name, m.COLUMN_NAME AS columnName, m.LABEL @@ -119,16 +154,17 @@ @@ -163,4 +198,82 @@ AND a.customer_id = #{customerId} + + + + + + + + + + + + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml index 36daa2158d..df920c1b33 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormItemOptionsDao.xml @@ -16,4 +16,11 @@ ) + + + delete from ic_form_item_options + where DEL_FLAG = 0 + and ITEM_ID = #{itemId} + AND CUSTOMER_ID = #{customerId} + \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormQueryBuilderDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormQueryBuilderDao.xml index 62281279fa..6ec0f6dae9 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormQueryBuilderDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/IcFormQueryBuilderDao.xml @@ -18,5 +18,26 @@ + + \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java index 19c09dc284..85f0e83a89 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcTripReportRecordDTO.java @@ -5,9 +5,11 @@ import com.alibaba.excel.annotation.ExcelProperty; import com.alibaba.excel.annotation.write.style.ColumnWidth; import com.alibaba.excel.annotation.write.style.HeadStyle; import com.alibaba.excel.enums.poi.FillPatternTypeEnum; +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; import java.util.Date; @@ -24,11 +26,15 @@ public class IcTripReportRecordDTO implements Serializable { private static final long serialVersionUID = 1L; + public interface DetailViewGroup { + } + /** * 主键ID */ + @NotBlank(message = "id不能为空", groups = DetailViewGroup.class) @ExcelIgnore - private String id; + private String id; /** * 居民端用户所在网格id,数字社区居民所属网格id diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVeteransDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVeteransDTO.java index 351b60a933..363dd18934 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVeteransDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcVeteransDTO.java @@ -89,6 +89,11 @@ public class IcVeteransDTO implements Serializable { */ private String xjyqk; + /** + * 是否办理公益性岗位,0422新增 + */ + private String isHandleJob; + /** * 删除标识 0.未删除 1.已删除 */ diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java new file mode 100644 index 0000000000..4d53cebb86 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ExportResiUserFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description 居民信息自定义导出 + * @Author yinzuomei + * @Date 2021/10/27 2:06 下午 + */ +@Data +public class ExportResiUserFormDTO implements Serializable { + private static final long serialVersionUID = 8777535966834678256L; + /** + * 表单查询条件 + */ + private IcResiUserPageFormDTO searchForm; + /** + * 模板id + */ + private String templateId; + + /** + * 自定义的导出表单参数 + */ + private IcExportTemplateSaveFormDTO exportConfig; + +} + diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserPageFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserPageFormDTO.java index 462353b404..66ece366cc 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserPageFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcResiUserPageFormDTO.java @@ -1,9 +1,9 @@ package com.epmet.dto.form; +import com.epmet.commons.tools.dto.form.PageFormDTO; import lombok.Data; import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; import java.io.Serializable; import java.util.List; @@ -13,29 +13,22 @@ import java.util.List; * @Date 2021/10/27 2:06 下午 */ @Data -public class IcResiUserPageFormDTO implements Serializable { +public class IcResiUserPageFormDTO extends PageFormDTO implements Serializable { public interface AddUserInternalGroup { } - @NotNull(message = "pageNo不能为空", groups = AddUserInternalGroup.class) - private Integer pageNo; - - @NotNull(message = "pageSize不能为空", groups = AddUserInternalGroup.class) - private Integer pageSize; - - @NotBlank(message = "formCode不能为空", groups = AddUserInternalGroup.class) + @NotBlank(message = "formCode不能为空", groups = {AddUserInternalGroup.class}) private String formCode; - @NotBlank(message = "customerId不能为空", groups = AddUserInternalGroup.class) + @NotBlank(message = "customerId不能为空", groups = {AddUserInternalGroup.class}) private String customerId; /** * 表对应的字段及值 */ private List conditions; - private Boolean pageFlag; - @NotBlank(message = "当前用户id不能为空", groups = AddUserInternalGroup.class) + @NotBlank(message = "当前用户id不能为空", groups = {AddUserInternalGroup.class}) private String staffId; /** diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java index 80ecb83186..da2e899d96 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PageTripReportFormDTO.java @@ -52,4 +52,9 @@ public class PageTripReportFormDTO extends PageFormDTO implements Serializable { * 工作人员所属组织id */ private String agencyId; + + /** + * 查看详情时此列有值 + */ + private String id; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java index 56f7c244c4..4815b87ba0 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/SearchByNameFormDTO.java @@ -29,6 +29,15 @@ public class SearchByNameFormDTO implements Serializable { @NotBlank(message = "columnName不能为空",groups = SearchByCategoryForm.class) private String columnName; + //id与level是 /epmetuser/statsresiwarn/list 接口的入参 + /** + * 组织id + */ + @NotBlank(message = "id不能为空", groups = SearchByCategoryForm.class) + private String id; + + @NotBlank(message = "level不能为空", groups = SearchByCategoryForm.class) + private String level; private String customerId; private String userId; diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java index 174fc429b2..58acc41b0f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/StatsResiWarnFormDTO.java @@ -22,7 +22,6 @@ import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import java.io.Serializable; -import java.util.Date; import java.util.List; @@ -40,7 +39,7 @@ public class StatsResiWarnFormDTO implements Serializable { public interface ListSelectedBuilding {} public interface ListSelectedUser {} - + public interface AllUser {} /** * 当前页 @@ -57,10 +56,11 @@ public class StatsResiWarnFormDTO implements Serializable { @NotBlank(message = "组织id不能为空",groups = {ListSelectedBuilding.class}) private String agencyId; - @NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class}) + @NotBlank(message = "配置id不能为空",groups = {ListSelectedUser.class, AllUser.class}) private String configId; @NotNull(message = "楼栋不能为空",groups = {ListSelectedUser.class}) private List buildingIdList; - - + @NotBlank(message = "楼栋不能为空",groups = {AllUser.class}) + private String buildingId; + private String customerId; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java new file mode 100644 index 0000000000..14675f3046 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/UserChartFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + +/** + * @author sun + * @dscription 【人房】居民总数饼图-接口入参 + */ +@Data +public class UserChartFormDTO implements Serializable { + + private static final long serialVersionUID = 405799151478155056L; + + /** + * 组织、网格、小区Id + */ + private String orgId; + /** + * 组织、网格、小区类型 agency grid village + */ + private String orgType; + + //id集合 + private List idList; + + //token这信息 + private String customerId; + private String userId; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java index 63d55d69c0..9e87b11df7 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcStatsResiWarnUserResultDTO.java @@ -43,6 +43,7 @@ public class IcStatsResiWarnUserResultDTO implements Serializable { private String neighborhoodName; private String buildingName; private String residentNames; + private Integer count; private List userList; } \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java index 33416972ae..f0766f2b0b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/StaffBasicInfoResultDTO.java @@ -96,4 +96,9 @@ public class StaffBasicInfoResultDTO implements Serializable { * 地区编码全路径:例如:37,3702,370203,370203005,370203005015 */ private List areaCodePath; + + /** + * 工作人员所属组织的行政地区编码 + */ + private String areaCode; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java new file mode 100644 index 0000000000..12f87fd20d --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserChartResultDTO.java @@ -0,0 +1,49 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; + +import java.io.Serializable; + +/** + * @author sun + * @dscription 【人房】居民总数饼图-接口返参 + */ +@Data +public class UserChartResultDTO implements Serializable { + /** + * 组织、网格、小区Id + */ + private String orgId; + /** + * 组织、网格、小区类型 agency grid village + */ + private String orgType; + /** + * 居民总数 + */ + private Integer userTotal = 0; + /** + * 常住人口总数 + */ + private Integer czUserTotal = 0; + /** + * 常住人口占比(保留两位小数,带百分号的) + */ + private Double czUserRatio = 0.0; + /** + * 流动人口总数 + */ + private Integer ldUserTotal = 0; + /** + * 流动人口占比(保留两位小数,带百分号的) + */ + private Double ldUserRatio = 0.0; + + @JsonIgnore + private Integer num; + //是否是流动人口【是:1 否:0】 + @JsonIgnore + private String isFloating; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java index f1d6690b46..b4b1e6547e 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/UserWarnNameListResultDTO.java @@ -21,4 +21,13 @@ public class UserWarnNameListResultDTO implements Serializable { private String residentName; private String userId; + + @JsonIgnore + private String unitId; + private String unitName; + @JsonIgnore + private String homeId; + private String doorName; + private String mobile; + private String idCard; } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index fba6650314..0029c42100 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -1,9 +1,7 @@ package com.epmet.feign; -import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.*; @@ -25,8 +23,8 @@ import java.util.Set; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ -// @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") -@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) + @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class, url = "localhost:8087") +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallbackFactory = EpmetUserOpenFeignClientFallbackFactory.class) public interface EpmetUserOpenFeignClient { /** @@ -650,9 +648,6 @@ public interface EpmetUserOpenFeignClient { @GetMapping(value = "/epmetuser/user/queryUserClient/{userId}") Result queryUserClient(@PathVariable("userId") String userId); - @PostMapping("/epmetuser/icresidemanddict/demandoption") - Result> getDemandOptions(); - @PostMapping("/epmetuser/icresiuser/categorycount") Result>> getHomeUserCategoryCount(@RequestBody IcResiUserDTO formDTO); @@ -743,4 +738,6 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/icresiuser/rent/tenantData") Result tenantData(@RequestBody RentTenantDataFormDTO formDTO); + @PostMapping("/epmetuser/icresiuser/userchartlist") + Result> userChartList(@RequestBody UserChartFormDTO userDTO); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index eb14ab22d7..30d7a6d4e5 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -1,7 +1,6 @@ package com.epmet.feign.fallback; import com.epmet.commons.tools.constant.ServiceConstant; -import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; @@ -467,11 +466,6 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "queryUserClient", userId); } - @Override - public Result> getDemandOptions() { - return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getDemandOptions", null); - } - @Override public Result>> getHomeUserCategoryCount(IcResiUserDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getHomeUserCategoryCount", formDTO); @@ -543,4 +537,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result tenantData(@RequestBody RentTenantDataFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "tenantData", formDTO); } + + @Override + public Result> userChartList(UserChartFormDTO userDTO) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "userChartList", userDTO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/aspect/RequestLogAspect.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/aspect/RequestLogAspect.java index 49581cf63c..f9be4267e8 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/aspect/RequestLogAspect.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/aspect/RequestLogAspect.java @@ -17,7 +17,7 @@ import javax.servlet.http.HttpServletRequest; */ @Aspect @Component -@Order(0) +@Order(1) public class RequestLogAspect extends BaseRequestLogAspect { @Override diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java index c490634108..3fd2bd60fc 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicPreventionController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; @@ -58,6 +59,7 @@ public class IcEpidemicPreventionController{ * @Date 2022/3/29 14:25 */ @PostMapping("page") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result> search(@LoginUser TokenDto tokenDto, @RequestBody EpidemicPreventionFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setStaffId(tokenDto.getUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java index b2d1ea6249..60bb98cc89 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcEpidemicSpecialAttentionController.java @@ -2,6 +2,7 @@ package com.epmet.controller; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.dto.form.PageFormDTO; @@ -58,6 +59,7 @@ public class IcEpidemicSpecialAttentionController { * @date 2022/3/28 10:29 */ @PostMapping("list") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result vaccinationList(@RequestBody VaccinationListFormDTO formDTO, @LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(formDTO, PageFormDTO.AddUserInternalGroup.class, VaccinationListFormDTO.VaccinationListForm.class); formDTO.setCustomerId(tokenDto.getCustomerId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java index b3ed2ab6d8..7428da58be 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcFollowUpRecordController.java @@ -12,7 +12,7 @@ import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; -import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.AssertUtils; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.group.DefaultGroup; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java index e65121e55d..bcb2a2d134 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcNatController.java @@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -15,12 +16,11 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; -import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; import com.epmet.dto.IcNatDTO; import com.epmet.dto.form.AddIcNatFormDTO; -import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.MyNatListFormDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; import com.epmet.dto.result.MyNatListResultDTO; @@ -114,6 +114,7 @@ public class IcNatController implements ResultDataResolver { **/ @NoRepeatSubmit @PostMapping("natlist") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result> natList(@LoginUser TokenDto tokenDto, @RequestBody MyNatListFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java index c25f04bc2b..54314229cf 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiCollectController.java @@ -1,6 +1,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.page.PageData; @@ -71,6 +72,8 @@ public class IcResiCollectController { * @date 2022/3/18 19:23 */ @PostMapping("list") + @MaskResponse(fieldNames = { "memberIdNum", "memberMobile" }, + fieldsMaskType = { MaskResponse.MASK_TYPE_ID_CARD, MaskResponse.MASK_TYPE_MOBILE }) public Result> getCollectList(@RequestBody CollectListFormDTO formDTO, @LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(formDTO,CollectListFormDTO.CollectListForm.class); formDTO.setUserId(tokenDto.getUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index 4576a0d599..8ee3448fc3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -21,8 +21,10 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.fill.FillWrapper; +import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.Constant; @@ -43,7 +45,7 @@ import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.*; -import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.SystemMessageType; import com.epmet.constants.ImportTaskConstants; @@ -57,10 +59,10 @@ import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.feign.OssFeignClient; +import com.epmet.service.IcResiUserExportService; import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserService; import feign.RequestInterceptor; -import jodd.io.FileUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FileUtils; @@ -70,9 +72,6 @@ import org.apache.commons.lang3.StringUtils; import org.apache.poi.poifs.filesystem.OfficeXmlFileException; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.http.HttpHeaders; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -127,6 +126,8 @@ public class IcResiUserController implements ResultDataResolver { @Autowired private IcResiUserImportService icResiUserImportService; @Autowired + private IcResiUserExportService icResiUserExportService; + @Autowired private RedisUtils redisUtils; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; @@ -303,6 +304,7 @@ public class IcResiUserController implements ResultDataResolver { } @PostMapping("listresi") + @MaskResponse(fieldNames = { "MOBILE", "ID_CARD" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result>> queryListResi1(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO) { //pageFormDTO.setCustomerId("45687aa479955f9d06204d415238f7cc"); pageFormDTO.setCustomerId(tokenDto.getCustomerId()); @@ -345,9 +347,9 @@ public class IcResiUserController implements ResultDataResolver { */ @NoRepeatSubmit @RequestMapping(value = "/exportExcel") - public void exportExcelByEasyExcel(@RequestHeader String customerId, @LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { - //tokenDto.setUserId("9e37adcce6472152e6508a19d3683e02"); + public void exportExcelByEasyExcel(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserPageFormDTO pageFormDTO, HttpServletResponse response) throws Exception { long startM = System.currentTimeMillis(); + String customerId = tokenDto.getCustomerId(); CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(customerId, tokenDto.getUserId()); String staffOrgPath = null; if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { @@ -356,7 +358,7 @@ public class IcResiUserController implements ResultDataResolver { staffOrgPath = staffInfoCacheResult.getAgencyId(); } pageFormDTO.setCustomerId(customerId); - pageFormDTO.setPageFlag(false); + pageFormDTO.setIsPage(false); //获取模版文件 File file = getIcResiTemplateFile(customerId, IcUserTemplateEnums.IC_RESI_EXPORT_TEMPLATE); @@ -434,6 +436,30 @@ public class IcResiUserController implements ResultDataResolver { } } + /** + * desc: 自定义导出居民信息 + * + * @param tokenDto + * @param pageFormDTO + * @param response + * @return void + * @author LiuJanJun + * @date 2021/11/19 4:24 下午 + * @remark:分页批量导出 oss目录在 各个环境对应的前缀文件夹/file-template/resi-template/客户ID.xlsx, + * 如果某个客户需要更新模版 则替换掉上面的模版文件;然后 更新缓存里的值或者删除也行 再导出就会下载新的模版了 + */ + @NoRepeatSubmit + @RequestMapping(value = "/exportExcelCustom") + public void exportExcelCustom(@LoginUser TokenDto tokenDto, @RequestBody ExportResiUserFormDTO pageFormDTO, HttpServletResponse response) throws Exception { + //获取导出配置 + String aDefault = tokenDto.getCustomerId().concat(StrConstant.UNDER_LINE).concat("default"); + if (pageFormDTO.getTemplateId().equals(aDefault)){ + log.info("通过原来的模板下载,tokenDto:{}", JSON.toJSONString(tokenDto)); + this.exportExcelByEasyExcel(tokenDto,pageFormDTO.getSearchForm(),response); + }else{ + icResiUserExportService.exportIcResiUser(tokenDto,pageFormDTO,response); + } + } /** * desc:根据客户id 先从oss下载模版,如果有没有则使用系统默认模板 如果不存在则返回null * @@ -696,6 +722,7 @@ public class IcResiUserController implements ResultDataResolver { * @Date 2021/12/10 17:54 */ @PostMapping("partymemberagelist") + @MaskResponse(fieldNames = { "mobile" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE }) public Result> partyMemberAgelist(@RequestBody PartyMemberListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(icResiUserService.getPartyMemberAgeList(formDTO)); @@ -774,6 +801,7 @@ public class IcResiUserController implements ResultDataResolver { * @Date 2021/12/10 17:58 */ @PostMapping("partymembereducationlist") + @MaskResponse(fieldNames = { "mobile" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE }) public Result> partyMemberEducationlist(@RequestBody PartyMemberListFormDTO formDTO) { ValidatorUtils.validateEntity(formDTO); return new Result>().ok(icResiUserService.getPartyMemberEducationList(formDTO)); @@ -900,7 +928,8 @@ public class IcResiUserController implements ResultDataResolver { * @date 2022/1/17 4:25 下午 */ @PostMapping("personwarn/rightlist") - public Result personWarnRightList(@RequestBody PersonWarnRightListFormDTO formDTO, @LoginUser TokenDto tokenDto) { + @MaskResponse(fieldNames = "mobile", fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE }) + public Result personWarnRightList(@RequestBody PersonWarnRightListFormDTO formDTO,@LoginUser TokenDto tokenDto){ ValidatorUtils.validateEntity(formDTO, PersonWarnRightListFormDTO.PersonWarnRightListForm.class); return new Result().ok(icResiUserService.personWarnRightList(formDTO, tokenDto)); } @@ -917,21 +946,24 @@ public class IcResiUserController implements ResultDataResolver { return new Result>().ok(icResiUserService.getExistUserByHouseIds(ids)); } -// public static ThreadLocal tl = new ThreadLocal(); + /** + * @Author sun + * @Description 【人房】居民总数饼图 + **/ + @PostMapping("userchart") + public Result userChart(@LoginUser TokenDto tokenDto, @RequestBody UserChartFormDTO formDTO) { + formDTO.setCustomerId(tokenDto.getCustomerId()); + formDTO.setUserId(tokenDto.getUserId()); + return new Result().ok(icResiUserService.userChart(formDTO)); + } - @PostMapping("test-async") - public Result testAsync(HttpServletRequest request) { -// tl.set("wxz"); - executorService.submit(() -> { - try { - Thread.sleep(500l); - log.info("[我是子线程]:" + EpmetRequestHolder.getHeader("app")); - System.out.println("---"); - } catch (InterruptedException e) { - log.error("method exception", e); - } - icResiUserImportService.testAsync(); - }); - return new Result(); + /** + * @Author sun + * @Description 【人房】居民总数列表数据 + **/ + @PostMapping("userchartlist") + public Result> userChartList(@RequestBody UserChartFormDTO formDTO) { + return new Result>().ok(icResiUserService.userChartList(formDTO)); } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java index 9bae2a9826..6e1aff48ff 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcTripReportRecordController.java @@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -16,7 +17,7 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; -import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constant.IcResiUserConstant; import com.epmet.constants.ImportTaskConstants; @@ -72,6 +73,7 @@ public class IcTripReportRecordController implements ResultDataResolver { * @return */ @PostMapping("page") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result> page(@LoginUser TokenDto tokenDto,@RequestBody PageTripReportFormDTO formDTO){ formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); @@ -80,6 +82,21 @@ public class IcTripReportRecordController implements ResultDataResolver { return new Result>().ok(page); } + /** + * 查看详情 + * @param formDTO + * @return + */ + @PostMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto,@RequestBody IcTripReportRecordDTO formDTO){ + ValidatorUtils.validateEntity(formDTO,IcTripReportRecordDTO.DetailViewGroup.class); + PageTripReportFormDTO pageTripReportFormDTO=new PageTripReportFormDTO(); + pageTripReportFormDTO.setCustomerId(tokenDto.getCustomerId()); + pageTripReportFormDTO.setUserId(tokenDto.getUserId()); + pageTripReportFormDTO.setId(formDTO.getId()); + return new Result().ok(icTripReportRecordService.detail(pageTripReportFormDTO)); + } + /** * pc: 行程上报-新增 * @param formDTO diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java index 166cdecf32..9eaefe9513 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcVaccineController.java @@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.write.metadata.WriteSheet; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.annotation.MaskResponse; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -15,10 +16,9 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.*; -import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.constants.ImportTaskConstants; -import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.form.VaccineListFormDTO; import com.epmet.dto.result.IcVaccineListCommonExcelResultDTO; import com.epmet.dto.result.IcVaccineListResultDTO; @@ -68,6 +68,7 @@ public class IcVaccineController implements ResultDataResolver { **/ @NoRepeatSubmit @PostMapping("vaccine-list") + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) public Result> vaccineList(@LoginUser TokenDto tokenDto, @RequestBody VaccineListFormDTO formDTO) { formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setUserId(tokenDto.getUserId()); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java index 5f7ea56e4a..866e4a9d46 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/StatsResiWarnController.java @@ -18,6 +18,7 @@ package com.epmet.controller; import com.epmet.commons.tools.annotation.LoginUser; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -29,6 +30,7 @@ import com.epmet.dto.form.StatsResiWarnFormDTO; import com.epmet.dto.result.IcStatsResiResultDTO; import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; import com.epmet.dto.result.IcUserWarnNoticeResultDTO; +import com.epmet.dto.result.UserWarnNameListResultDTO; import com.epmet.service.IcStatsResiWarnService; import com.epmet.service.StatsResiWarnService; import org.springframework.beans.factory.annotation.Autowired; @@ -115,6 +117,13 @@ public class StatsResiWarnController { return new Result().ok(statsResiWarnService.userWarnList(customerId,formDTO.getConfigId(), formDTO.getBuildingIdList(),formDTO.getPageNo(),formDTO.getPageSize())); } + @PostMapping("alluserwarnlist") + public Result> allUserWarnList(@LoginUser TokenDto tokenDto, @RequestBody StatsResiWarnFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, StatsResiWarnFormDTO.AllUser.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result>().ok(statsResiWarnService.allUserWarnList(formDTO)); + } + /** * 统计所有 * @return diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 93c49beb7f..9b14469258 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -62,7 +62,8 @@ public interface IcResiUserDao extends BaseDao { @Param("currentStaffAgencyId") String currentStaffAgencyId, @Param("staffOrgPath") String staffOrgPath, @Param("resultTableName") String resultTableName, - @Param("keyword") String keyword); + @Param("keyword") String keyword, + @Param("groupByTables")Set groupByTables); /** * 查询主表 @@ -98,6 +99,7 @@ public interface IcResiUserDao extends BaseDao { * @param customerId 客户id * @param resultTableName 获取哪个表的数据??? * @param conditions 前端传入的查询入参 + * @param showSqlColumns * @return java.util.List> * @author yinzuomei * @date 2021/11/2 10:35 上午 @@ -106,8 +108,9 @@ public interface IcResiUserDao extends BaseDao { @Param("resultTableName") String resultTableName, @Param("conditions") List conditions, @Param("subTables") List subTables, - @Param("currentStaffAgencyId") String currentStaffAgencyId, - @Param("staffOrgPath") String staffOrgPath); + @Param("showSqlColumns") List showSqlColumns, @Param("currentStaffAgencyId") String currentStaffAgencyId, + @Param("staffOrgPath") String staffOrgPath, + @Param("groupByTables") List groupByTables); /** * @param userId @@ -124,7 +127,12 @@ public interface IcResiUserDao extends BaseDao { * @author zxc * @date 2021/11/3 2:05 下午 */ - List searchByName(@Param("name") String name, @Param("columnName") String columnName, @Param("agencyId") String agencyId, @Param("pageNo") Integer pageNo); + List searchByName(@Param("name") String name, + @Param("columnName") String columnName, + @Param("level")String level, + @Param("id")String id, + @Param("agencyId") String agencyId, + @Param("pageNo") Integer pageNo); Set selectUserDemandCode(String icResiUserId); @@ -290,4 +298,6 @@ public interface IcResiUserDao extends BaseDao { List vaccineList(EpidemicPreventionFormDTO formDTO); IcResiUserEntity selectResiNoDelFlag(@Param("icResiUserId") String icResiUserId); + + List userChart(@Param("orgId") String orgId, @Param("orgType") String orgType); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVeteransEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVeteransEntity.java index 076d6f33fe..0aa295885b 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVeteransEntity.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcVeteransEntity.java @@ -85,6 +85,11 @@ public class IcVeteransEntity extends BaseEpmetEntity { */ private String xjyqk; + /** + * 是否办理公益性岗位,0422新增 + */ + private String isHandleJob; + /** * 预留字段1 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVeteransExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVeteransExcel.java index 3109a7fa4d..daa0d616bd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVeteransExcel.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcVeteransExcel.java @@ -64,6 +64,12 @@ public class IcVeteransExcel { @Excel(name = "现就业情况") private String xjyqk; + /** + * 是否办理公益性岗位,0422新增 + */ + @Excel(name = "是否办理公益性岗位") + private String isHandleJob; + @Excel(name = "删除标识 0.未删除 1.已删除") private Integer delFlag; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java new file mode 100644 index 0000000000..53f9bee81f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserExportService.java @@ -0,0 +1,27 @@ +package com.epmet.service; + +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.dto.form.ExportResiUserFormDTO; + +import javax.servlet.http.HttpServletResponse; + +/** + *@Description 居民信息导出service + *@Author wangxianzhang + *@Date 2021/11/4 + */ +public interface IcResiUserExportService { + + /** + * desc: 根据条件查询居民信息并根据配置模板导出 + * + * + * @param tokenDto + * @param exportResiUserFormDTO + * @param response + * @return void + * @author LiuJanJun + * @date 2022/4/22 1:35 下午 + */ + void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response); +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java index f3451f3e13..ada878c1be 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserImportService.java @@ -1,10 +1,13 @@ package com.epmet.service; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.dto.result.FormItemResult; +import com.epmet.service.impl.IcResiUserImportServiceImpl; import javax.servlet.http.HttpServletResponse; import java.nio.file.Path; import java.util.List; +import java.util.Map; /** *@Description 居民信息导入service @@ -33,5 +36,31 @@ public interface IcResiUserImportService { */ void finishImportTask(String importTaskId, String operatorId, String processStatus, String resultDesc, String resultDescPath); - Object testAsync(); + /** + * 分割sourceUrl为纯url和父itemId + * @param fullUri + * @return [ pureUri, cascadeItemId(父itemId) ] + */ + String[] splitOptionSourceUrl(String fullUri); + /** + * desc:获取远程 选项 + * @param pureUri + * @param cascadeItemId + * @param columnWrappers + * @param currUserAgencyId + * @param purpose + * @return + */ + Map listRemoteOptions(String pureUri, String cascadeItemId, Map columnWrappers, String currUserAgencyId, String purpose); + + /** + * desc:获取级联的远程 选项 + * @param part + * @param part1 + * @param columnWrappers + * @param currentStaffAgencyId + * @param query + * @return + */ + Map listRemoteCascadeOptions(String part, String part1, Map columnWrappers, String currentStaffAgencyId, String query); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index bb652c4870..5c6c9d2f01 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -264,4 +264,18 @@ public interface IcResiUserService extends BaseService { * @Date 2022/3/29 16:25 */ EpidemicPreventionInfoDTO getEpidemicPreventionInfo(EpidemicPreventionFormDTO formDTO); + + /** + * @Author sun + * @Description 【人房】居民总数饼图 + **/ + UserChartResultDTO userChart(UserChartFormDTO formDTO); + + /** + * @Author sun + * @Description 【人房】居民总数列表数据 + **/ + List userChartList(UserChartFormDTO formDTO); + + List> dynamicQuery(String loginUserCustomerId, String formCode, String icResiUser, List showSqlColumns, List conditions, String agencyId, String finalStaffOrgPath); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java index ffd9f3db8d..32447f2d74 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcTripReportRecordService.java @@ -31,6 +31,8 @@ public interface IcTripReportRecordService extends BaseService page(PageTripReportFormDTO formDTO); + IcTripReportRecordDTO detail(PageTripReportFormDTO formDTO); + /** * 默认查询 * diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java index babce11f37..33a41f51a5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/StatsResiWarnService.java @@ -17,11 +17,14 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; import com.epmet.dto.form.IcUserWarnNoticeFormDTO; import com.epmet.dto.form.StatsResiListFormDTO; +import com.epmet.dto.form.StatsResiWarnFormDTO; import com.epmet.dto.result.IcStatsResiResultDTO; import com.epmet.dto.result.IcStatsResiWarnBuildingResultDTO; import com.epmet.dto.result.IcUserWarnNoticeResultDTO; +import com.epmet.dto.result.UserWarnNameListResultDTO; import java.util.List; import java.util.Map; @@ -53,6 +56,8 @@ public interface StatsResiWarnService{ */ Map userWarnList(String customerId, String configId, List buildingIdList, Integer pageNo, Integer pageSize); + PageData allUserWarnList(StatsResiWarnFormDTO formDTO); + List list(String customerId,String id, String level); List list2(StatsResiListFormDTO formDTO); diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java index 72b43b0506..01283f45c4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/CustomerStaffServiceImpl.java @@ -25,6 +25,7 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; @@ -731,20 +732,21 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl>().ok(listResultDTO); } - @Override - public Result selectStaffBasicInfo(String userId,String customerId) { + @Override + public Result selectStaffBasicInfo(String userId, String customerId) { StaffBasicInfoResultDTO resultDTO = baseDao.selectStaffBasicInfo(userId); - if(null!=resultDTO){ - resultDTO.setRoleList(baseDao.selectStaffRoles(userId,resultDTO.getCustomerId())); + if (null != resultDTO) { + resultDTO.setRoleList(baseDao.selectStaffRoles(userId, resultDTO.getCustomerId())); CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, userId); - if (null != staffInfo){ + if (null != staffInfo) { resultDTO.setAgencyId(staffInfo.getAgencyId()); resultDTO.setAgencyName(staffInfo.getAgencyName()); resultDTO.setLevel(staffInfo.getLevel()); resultDTO.setLongitude(staffInfo.getLongitude()); resultDTO.setLatitude(staffInfo.getLatitude()); - AgencyInfoCache agency= CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); + AgencyInfoCache agency = CustomerOrgRedis.getAgencyInfo(staffInfo.getAgencyId()); resultDTO.setAreaCodePath(null != agency && !CollectionUtils.isEmpty(agency.getAreaCodePath()) ? agency.getAreaCodePath() : new ArrayList<>()); + resultDTO.setAreaCode(null != agency && StringUtils.isNotBlank(agency.getAreaCode()) ? agency.getAreaCode() : StrConstant.EPMETY_STR); } //获取工作人员所属客户名 CustomerDTO dto = new CustomerDTO(); @@ -757,8 +759,8 @@ public class CustomerStaffServiceImpl extends BaseServiceImpl().ok(resultDTO); - } + return new Result().ok(resultDTO); + } /** * @param formDTO diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java new file mode 100644 index 0000000000..873568d2b1 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java @@ -0,0 +1,383 @@ +package com.epmet.service.impl; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; +import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.constant.Constant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.IcExportTemplateSaveFormDTO; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.dto.result.OptionResultDTO; +import com.epmet.commons.tools.enums.FormItemTypeEnum; +import com.epmet.commons.tools.enums.IcFormCodeEnum; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.security.dto.TokenDto; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.ExcelFillCellMergeStrategy; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.constant.IcResiUserConstant; +import com.epmet.dto.form.ExportResiUserFormDTO; +import com.epmet.dto.form.IcExportTemplateQueryFormDTO; +import com.epmet.dto.form.IcResiUserPageFormDTO; +import com.epmet.dto.result.FormItemResult; +import com.epmet.dto.result.IcCustomExportResultDTO; +import com.epmet.dto.result.OptionDTO; +import com.epmet.excel.support.ExportResiUserItemDTO; +import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.service.IcResiUserExportService; +import com.epmet.service.IcResiUserImportService; +import com.epmet.service.IcResiUserService; +import com.github.pagehelper.Page; +import com.github.pagehelper.PageHelper; +import com.google.common.base.Joiner; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.jetbrains.annotations.Nullable; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +/** + * desc: + * + * @author: LiuJanJun + * @date: 2022/4/22 1:36 下午 + * @version: 1.0 + */ +@Slf4j +@Service +public class IcResiUserExportServiceImpl implements IcResiUserExportService { + @Autowired + private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; + @Autowired + private IcResiUserService icResiUserService; + @Autowired + private IcResiUserImportService icResiUserImportService; + + /** + * desc: 根据条件查询居民信息并根据配置模板导出 + * + * @param tokenDto + * @param exportResiUserFormDTO + * @param response + * @return void + * @author LiuJanJun + * @date 2022/4/22 1:35 下午 + */ + @Override + public void exportIcResiUser(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO, HttpServletResponse response) { + //校验参数 + validateSearchForm(tokenDto, exportResiUserFormDTO); + IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); + + String templateId = exportResiUserFormDTO.getTemplateId(); + + + ExcelWriter excelWriter = null; + try { + //获取用户配置的导出条件 + Result exportConfigResult = getIcCustomExportConfig(searchForm.getCustomerId(), templateId, exportResiUserFormDTO.getExportConfig()); + + Map itemOriginMap = getItemMap(searchForm.getCustomerId()); + IcCustomExportResultDTO exportConfigData = exportConfigResult.getData(); + log.info("查询到的模板配置信息:{}", JSON.toJSONString(exportConfigData)); + + CustomerStaffInfoCacheResult staffInfoCacheResult = CustomerStaffRedis.getStaffInfo(searchForm.getCustomerId(), searchForm.getStaffId()); + if (staffInfoCacheResult == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取工作人员信息失败"); + } + + List allShowColumns = new ArrayList<>(exportConfigData.getShowSqlColumns()); + + + //需要合并的列 + List mergeColumnIndexList = new ArrayList<>(); + for (int i = 0; i < allShowColumns.size(); i++) { + IcCustomExportResultDTO.SqlColumn sqlColumn = allShowColumns.get(i); + if (!sqlColumn.getManyToOne()) { + mergeColumnIndexList.add(i); + } + } + + int[] mergeColumnIndex = mergeColumnIndexList.stream().filter(Objects::nonNull).mapToInt(i -> i).toArray(); + // 从那一列开始合并 + int mergeRowIndex = exportConfigData.getHeaderRow(); + + // 头的策略 + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + // 背景设置为红色 + headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + FreezeAndFilter writeHandler = new FreezeAndFilter(); + //从第几行开始冻结 + writeHandler.rowSplit = exportConfigData.getHeaderRow(); + excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response)) + .registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex)) + .registerWriteHandler(horizontalCellStyleStrategy) + .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) + .registerWriteHandler(writeHandler).build(); + + WriteSheet writeSheet = EasyExcel.writerSheet().head(exportConfigData.getHeaders()).build(); + + String staffOrgPath = null; + if (StringUtils.isNotBlank(staffInfoCacheResult.getAgencyPIds()) && !NumConstant.ZERO_STR.equals(staffInfoCacheResult.getAgencyPIds())) { + staffOrgPath = staffInfoCacheResult.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfoCacheResult.getAgencyId()); + } else { + staffOrgPath = staffInfoCacheResult.getAgencyId(); + } + Page> mapListPage = null; + + allShowColumns.addAll(exportConfigData.getHiddenSqlColumns()); + do { + String finalStaffOrgPath = staffOrgPath; + mapListPage = PageHelper.startPage(searchForm.getPageNo(), searchForm.getPageSize(), searchForm.getIsPage()).doSelectPage(() -> { + icResiUserService.dynamicQuery(searchForm.getCustomerId(), searchForm.getFormCode(), IcResiUserConstant.IC_RESI_USER, allShowColumns, searchForm.getConditions(), staffInfoCacheResult.getAgencyId(), finalStaffOrgPath); + }); + searchForm.setPageNo(searchForm.getPageNo() + NumConstant.ONE); + + List> result = mapListPage.getResult(); + + List> resultData = new ArrayList<>(); + + result.forEach(o -> { + List singleResult = new ArrayList<>(); + Map originalConditionMap = new ConcurrentHashMap<>(); + o.forEach((key, value) -> { + List showSqlColumns = exportConfigData.getShowSqlColumns(); + Map itemMap = showSqlColumns.stream().collect(Collectors.toMap(IcCustomExportResultDTO.SqlColumn::getColumnName, item -> item)); + + IcCustomExportResultDTO.SqlColumn columnDTO = itemMap.get(key); + if (singleResult.size() < showSqlColumns.size()) { + + + IcCustomExportResultDTO.SqlColumn sqlColumn = itemMap.get(key); + String tableName = sqlColumn.getTableName(); + String itemId = sqlColumn.getItemId(); + String columnName = columnDTO.getColumnName(); + + String vauleStr = value == null ? StrConstant.EPMETY_STR : value.toString(); + //保留原始值 便于remote条件获取 + originalConditionMap.putIfAbsent(columnName, vauleStr); + ExportResiUserItemDTO exportResiUserItemDTO = itemOriginMap.get(tableName); + FormItemResult formItemResult = exportResiUserItemDTO.getItemMap().get(columnName); + + String newValue = vauleStr; + if (Constant.OPITON_SOURCE_REMOTE.equals(sqlColumn.getOptionSourceType()) && StringUtils.isNotBlank(vauleStr)) { + putRemoteValue(exportResiUserItemDTO.getRemoteItemConditionMap().get(itemId), staffInfoCacheResult.getAgencyId(), o, originalConditionMap, formItemResult, columnName, vauleStr); + newValue = String.valueOf(o.get(columnName)); + } else if (Constant.OPITON_SOURCE_LOCAL.equals(sqlColumn.getOptionSourceType())) { + newValue = putOptionValue(formItemResult, vauleStr); + } + singleResult.add(newValue); + } + }); + resultData.add(singleResult); + }); + excelWriter.write(resultData, writeSheet); + break; + } while (mapListPage.getResult().size() == searchForm.getPageSize()); + } catch (IOException e) { + log.error("exportIcResiUser exception", e); + } finally { + if (excelWriter != null) { + excelWriter.finish(); + } + } + } + + /** + * desc:校验查询表单参数 + * + * @param tokenDto + * @param exportResiUserFormDTO + */ + public void validateSearchForm(TokenDto tokenDto, ExportResiUserFormDTO exportResiUserFormDTO) { + IcResiUserPageFormDTO searchForm = exportResiUserFormDTO.getSearchForm(); + searchForm.setCustomerId(tokenDto.getCustomerId()); + searchForm.setStaffId(tokenDto.getUserId()); + ValidatorUtils.validateEntity(searchForm, IcResiUserPageFormDTO.AddUserInternalGroup.class); + searchForm.setIsPage(false); + searchForm.setPageSize(NumConstant.TEN_THOUSAND); + } + + @Nullable + public Result getIcCustomExportConfig(String customerId, String templateId, IcExportTemplateSaveFormDTO exportConfig) { + //通过配置导出 + IcExportTemplateQueryFormDTO param = new IcExportTemplateQueryFormDTO(); + param.setCustomerId(customerId); + param.setTempId(templateId); + param.setExportConfig(exportConfig); + Result exportConfigResult = operCustomizeOpenFeignClient.getExcelHeaderAndSqlColumnForExport(param); + if (!exportConfigResult.success() || exportConfigResult.getData() == null) { + log.error("获取模板失败"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取模板失败" + exportConfigResult.getInternalMsg()); + } + IcCustomExportResultDTO data = exportConfigResult.getData(); + + //添加一个虚拟列Id 用于分组 + data.getShowSqlColumns().add(0, new IcCustomExportResultDTO.SqlColumn(null, "ic_resi_user", false, "ID", "local")); + List id = new ArrayList<>(); + id.add("ID"); + data.getHeaders().add(0, id); + return exportConfigResult; + } + + + /** + * key:itemId,value: key:columnName,中文 + */ + private static Map> remoteOptionCacheMap = new HashMap<>(); + + private void putRemoteValue(Set conditionItemSet, String currentStaffAgencyId, Map map, Map originalConditionMap, FormItemResult e, String columnName, String vauleStr) { + try { + Map columnWrappers = new HashMap<>(); + if (e.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)) { + for (FormItemResult o : conditionItemSet) { + String conditionColumnName = o.getColumnNum() == NumConstant.ZERO ? o.getColumnName() : o.getColumnName().concat(o.getColumnNum().toString()); + Object conditionValue = originalConditionMap.getOrDefault(conditionColumnName, map.get(conditionColumnName)); + originalConditionMap.putIfAbsent(conditionColumnName, conditionValue.toString()); + IcResiUserImportServiceImpl.ColumnWrapper value = new IcResiUserImportServiceImpl.ColumnWrapper(); + value.setColValue(conditionValue.toString()); + columnWrappers.put(o.getItemId(), value); + } + } + Cache cache = remoteOptionCacheMap.getOrDefault(e.getItemId(), CacheBuilder.newBuilder().maximumSize(NumConstant.FIVE_HUNDRED).build()); + remoteOptionCacheMap.putIfAbsent(e.getItemId(), cache); + String cacheValue = cache.getIfPresent(vauleStr); + if (StringUtils.isNotBlank(cacheValue)) { + map.put(columnName, cacheValue); + } else { + String[] parts = icResiUserImportService.splitOptionSourceUrl(e.getOptionSourceValue()); + + if (FormItemTypeEnum.CASCADER.getCode().equals(e.getItemType())) { + Map remoteOptionMap = icResiUserImportService.listRemoteCascadeOptions(parts[0], parts[1], columnWrappers, currentStaffAgencyId, "query"); + List listOptions = new ArrayList<>(); + String[] split = vauleStr.split(StrConstant.COMMA); + Arrays.stream(split).forEach((value) -> { + //todo 看看怎么更好的利用本地缓存 + OptionResultDTO optionResultDTO = remoteOptionMap.get(value); + if (optionResultDTO != null) { + listOptions.add(optionResultDTO.getLabel()); + } + }); + String join = Joiner.on("-").join(listOptions); + cache.put(vauleStr, join); + map.put(columnName, join); + } else { + //todo 不支持多个itemId + Map remoteOptions = icResiUserImportService.listRemoteOptions(parts[0], parts[1], columnWrappers, currentStaffAgencyId, "query"); + if (FormItemTypeEnum.CHECKBOX.getCode().equals(e.getItemType())) { + remoteOptions.forEach((label, value) -> map.put(value, vauleStr.contains(value) ? StrConstant.YES : StrConstant.NO)); + } else if (FormItemTypeEnum.SELECT.getCode().equals(e.getItemType())) { + remoteOptions.forEach((label, value) -> { + if (vauleStr.equals(value)) { + map.put(columnName, label); + } + //放if外面是为了下次取得时候 可以有值 + cache.put(value, label); + }); + } + } + + } + } catch (Exception ex) { + log.warn("listRemoteOptions url", ex); + } + } + + private String putOptionValue(FormItemResult e, String valueStr) { + if (e == null) { + return valueStr; + } + FormItemTypeEnum itemTypeEnum = FormItemTypeEnum.getEnum(e.getItemType()); + switch (itemTypeEnum) { + case CHECKBOX: + //如果是多选 则返回顿号隔开 + if (e.getMultiSelect()) { + List valueList = new ArrayList<>(); + e.getOptions().forEach(option -> { + if (valueStr.contains(option.getValue())) { + valueList.add(option.getLabel()); + } + }); + return Joiner.on("、").join(valueList); + + } + for (OptionDTO dto : e.getOptions()) { + return valueStr.contains(dto.getValue()) ? StrConstant.YES : StrConstant.NO; + } + break; + case SELECT: + case RADIO: + for (OptionDTO optionDTO : e.getOptions()) { + if (optionDTO.getValue().equals(valueStr)) { + return optionDTO.getLabel(); + } + } + break; + default: + } + return valueStr; + } + + /** + * desc:获取表单配置 + * + * @param customerId + * @return map key:tableName ,value:ExportResiUserItemDTO + */ + private Map getItemMap(String customerId) { + //获取表单项 + IcResiUserService icResiUserService = SpringContextUtils.getBean(IcResiUserService.class); + if (icResiUserService == null) { + log.error("获取bean IcResiUserService 失败"); + return null; + } + List resiFormAllItems = this.icResiUserService.listFormItems(customerId, IcFormCodeEnum.RESI_BASE_INFO.getCode()); + Map allItemMap = resiFormAllItems.stream().collect(Collectors.toMap(FormItemResult::getItemId, o -> o)); + Map map = new HashMap<>(); + allItemMap.values().forEach(item -> { + String tableName = item.getTableName(); + ExportResiUserItemDTO exportItem = map.getOrDefault(tableName, new ExportResiUserItemDTO()); + map.putIfAbsent(tableName, exportItem); + String columnName = item.getColumnName().concat(item.getColumnNum() == NumConstant.ZERO ? StrConstant.EPMETY_STR : item.getColumnNum().toString()); + exportItem.getItemMap().put(columnName, item); + if (Constant.OPITON_SOURCE_REMOTE.equals(item.getOptionSourceType()) && item.getOptionSourceValue().contains(StrConstant.QUESTION_MARK)) { + //多个参数 + String[] paramArr = item.getOptionSourceValue().split(StrConstant.QUESTION_MARK_TRANSFER)[NumConstant.ONE].split(StrConstant.AND_MARK); + Arrays.stream(paramArr).forEach(o -> { + FormItemResult value = allItemMap.get(o); + if (value == null) { + return; + } + Set conditionSet = exportItem.getRemoteItemConditionMap().getOrDefault(item.getItemId(), new HashSet<>()); + conditionSet.add(value); + exportItem.getRemoteItemConditionMap().putIfAbsent(item.getItemId(), conditionSet); + }); + } + }); + return map; + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java index 07e97ea7b8..5596554999 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java @@ -8,8 +8,8 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcelFactory; import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.bean.ResiImportCategoryData; -import com.epmet.bean.ResiImportResiCategoryChangedCache; import com.epmet.bean.ResiImportChangedData; +import com.epmet.bean.ResiImportResiCategoryChangedCache; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.StrConstant; @@ -23,17 +23,17 @@ import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.common.CustomerStaffRedis; -import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.EpmetRequestHolder; -import com.epmet.commons.tools.utils.FileUtils; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.*; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcUserChangeDetailedDao; import com.epmet.dao.IcUserChangeRecordDao; import com.epmet.dao.IcUserTransferRecordDao; import com.epmet.dto.*; -import com.epmet.dto.form.*; +import com.epmet.dto.form.GridOptionFormDTO; +import com.epmet.dto.form.HouseFormDTO; +import com.epmet.dto.form.IcResiUserOrgMsgFormDTO; +import com.epmet.dto.form.ImportTaskCommonFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcUserChangeDetailedEntity; @@ -43,14 +43,14 @@ import com.epmet.enums.IcResiUserTableEnum; import com.epmet.excel.handler.IcResiImportDynamicExcelListener; import com.epmet.excel.handler.IcResiVirtualSheetImportListener; import com.epmet.feign.*; -import com.epmet.service.*; +import com.epmet.service.IcResiUserImportService; +import com.epmet.service.UserService; import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import lombok.Data; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.fileupload.FileItem; -import org.apache.commons.fileupload.FileItemFactory; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; @@ -60,9 +60,15 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.servlet.http.HttpServletResponse; -import java.io.*; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; import java.nio.file.Path; +import java.time.LocalDate; +import java.time.Period; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import java.util.stream.Collectors; /** @@ -79,10 +85,14 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res public static final List controlGroup1 = Arrays.asList("input", "textarea", "datepicker", "daterange"); public static final List controlGroup2 = Arrays.asList("select", "radio"); + // 身份证号的正则表达式 + private final Pattern PATTERN_15_ID = Pattern.compile("^\\d{6}(?\\d{2})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)$"); + private final Pattern PATTERN_18_ID = Pattern.compile("^\\d{6}(?\\d{4})(?0[1-9]|1[0-2])(?[0-2][0-9]|3[0-1])\\d{2}(?\\d)[0-9a-xA-X]$"); + /** * 身份证号列序号 */ - public static final Integer ID_CARD_COLUMN_NO = 9; + public static final Integer ID_CARD_COLUMN_NO = 8; /** * 姓名列序号 */ @@ -113,34 +123,26 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res @Autowired private EpmetUserOpenFeignClient epmetUserOpenFeignClient; - + @Autowired + private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient; @Autowired private EpmetAdminOpenFeignClient adminOpenFeignClient; - @Autowired private GovOrgOpenFeignClient govOrgOpenFeignClient; - @Autowired private IcResiUserDao icResiUserDao; - @Autowired private OperCustomizeOpenFeignClient operCustomizeOpenFeignClient; - @Autowired private IcUserChangeRecordDao icUserChangeRecordDao; - @Autowired private IcUserChangeDetailedDao icUserChangeDetailedDao; - @Autowired private IcUserTransferRecordDao icUserTransferRecordDao; - @Autowired private UserService userService; - @Autowired private RedisUtils redisUtils; - @Autowired private EpmetCommonServiceOpenFeignClient commonServiceOpenFeignClient; @Autowired @@ -433,16 +435,17 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res try { convertColumnWrappers2Map4Persist(itemIdAndColumnWrapper, row, currUserAgencyId, checkBoxOptionColumnIdxAndLabel, columnAndValues, true); - // 执行指定的检查 - specifiedCheck(columnAndValues); + // 执行指定的检查以及数据补充 + execSpecifiedCheckAndFill(columnAndValues); String idCard = columnAndValues.get("ID_CARD"); Map existingResiMap = icResiUserDao.selectResiInfoMap(idCard, null); if (existingResiMap == null) { // 新导入的居民,因为还没有读取子sheet,所以这些居民类别没有办法获取,先默认设置成0,后面读取子sheet的时候再更新 + // 注释掉的代码:根据已存在的必填信息,能解析出来该字段,所以不再赋值 columnAndValues.put("IS_ENSURE_HOUSE", "0"); - columnAndValues.put("IS_OLD_PEOPLE", "0"); + //columnAndValues.put("IS_OLD_PEOPLE", "0"); columnAndValues.put("IS_PARTY", "0"); columnAndValues.put("IS_SPECIAL", "0"); columnAndValues.put("IS_UNEMPLOYED", "0"); @@ -464,7 +467,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } else { // 该居民已存在,要做更新操作,因为还没有读取子sheet,所以这些居民最新类别没有办法获取,先设置上旧的数据 columnAndValues.put("IS_ENSURE_HOUSE", existingResiMap.get("IS_ENSURE_HOUSE")); - columnAndValues.put("IS_OLD_PEOPLE", existingResiMap.get("IS_OLD_PEOPLE")); + //columnAndValues.put("IS_OLD_PEOPLE", existingResiMap.get("IS_OLD_PEOPLE")); columnAndValues.put("IS_PARTY", existingResiMap.get("IS_PARTY")); columnAndValues.put("IS_SPECIAL", existingResiMap.get("IS_SPECIAL")); columnAndValues.put("IS_UNEMPLOYED", existingResiMap.get("IS_UNEMPLOYED")); @@ -544,16 +547,17 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } /** - * 执行指定的检查 + * 执行指定的检查以及数据的补充 * @param columnAndValues */ - private void specifiedCheck(LinkedHashMap columnAndValues) { + private void execSpecifiedCheckAndFill(LinkedHashMap columnAndValues) { String idCard = columnAndValues.get("ID_CARD"); String mobile = columnAndValues.get("MOBILE"); String name = columnAndValues.get("NAME"); List errors = new ArrayList<>(); + // 执行检查 if (StringUtils.isBlank(idCard)) { log.debug("【居民信息导入】specifiedCheck身份证号为空的:{},{}", mobile, name); @@ -561,14 +565,12 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } - if (idCard.length() > 18) { - // 身份证号超长了哦,不可以的 - errors.add("身份证号过长"); + if (idCard.length() != 18 && idCard.length() != 15) { + errors.add("身份证号长度错误"); } if (StringUtils.isNotBlank(mobile) && mobile.length() > 15) { - // 手机号超长也是不可以的 - errors.add("手机号过长"); + errors.add("手机号长度错误"); } if (errors.size() > 0) { @@ -576,6 +578,50 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res String errorMsg = String.join(";", errors); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), errorMsg, errorMsg); } + + // ================== 数据补充 =================== + String year; + String month; + String day; + String sex; + + if (idCard.length() == 15) { + Matcher matcher = PATTERN_15_ID.matcher(idCard); + if (matcher.matches()) { + year = "19".concat(matcher.group("year")); + month = matcher.group("month"); + day = matcher.group("day"); + sex = matcher.group("sex"); + } else { + String s = "身份证号解析错误"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); + } + } else if (idCard.length() == 18) { + Matcher matcher = PATTERN_18_ID.matcher(idCard); + if (matcher.matches()) { + year = matcher.group("year"); + month = matcher.group("month"); + day = matcher.group("day"); + sex = matcher.group("sex"); + } else { + String s = "身份证号解析错误"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); + } + } else { + String s = "身份证号位数错误"; + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), s, s); + } + + // 出生日期 & 年龄 + LocalDate birthday = LocalDate.of(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day)); + int age = Period.between(birthday, LocalDate.now()).getYears(); + + // 性别 & 生日 & 老年人 + Boolean isMale = (Integer.parseInt(sex) % 2) == 1; + columnAndValues.put("BIRTHDAY", String.join("-", Arrays.asList(year, month,day))); + columnAndValues.put("GENDER", isMale ? "1" : "2"); + columnAndValues.put("IS_OLD_PEOPLE", age > 60 ? "1" : "0"); + System.out.println(6); } /** @@ -1099,6 +1145,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param fullUri * @return [ pureUri, cascadeItemId(父itemId) ] */ + @Override public String[] splitOptionSourceUrl(String fullUri) { String pureUri = null; String cascadeItemId = null; @@ -1118,6 +1165,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * 远程获取options * @return */ + @Override public Map listRemoteOptions(String pureUri, String cascadeItemId, Map columnWrappers, String currUserAgencyId, String purpose) { ColumnWrapper cascadeItemColumnWrapper = null; @@ -1128,10 +1176,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res List options = null; switch (pureUri) { - case "/epmetuser/icresidemanddict/demandoption": - options = getResultDataOrThrowsException(epmetUserOpenFeignClient.getDemandOptions(), ServiceConstant.EPMET_USER_SERVER, - EpmetErrorCode.SERVER_ERROR.getCode(), null, null); - break; case "/gov/org/customergrid/gridoption": GridOptionFormDTO form = new GridOptionFormDTO(); form.setAgencyId(currUserAgencyId); @@ -1226,6 +1270,46 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res } + @Override + public Map listRemoteCascadeOptions(String pureUri, String cascadeItemId, Map columnWrappers, String currentStaffAgencyId, String query) { + ColumnWrapper cascadeItemColumnWrapper = null; + + // 根据uri上的id,找到关联的itemid,从而找到关联的item的值 + if (columnWrappers != null && StringUtils.isNotBlank(cascadeItemId)){ + cascadeItemColumnWrapper = columnWrappers.get(cascadeItemId); + } + + List options = null; + switch (pureUri) { + case "/heart/icresidemanddict/demandoption": + options = getResultDataOrThrowsException(epmetHeartOpenFeignClient.getDemandOptions(), ServiceConstant.EPMET_USER_SERVER, + EpmetErrorCode.SERVER_ERROR.getCode(), null, null); + break; + } + if (options == null) { + return null; + } + Map resultMap = new HashMap<>(); + options.forEach(option-> getChildren(option,resultMap)); + return resultMap; + } + + /** + * desc:递归获取children + * @param option + * @param resultMap + * todo 利用泛型 提取到公共类中 + */ + public void getChildren(OptionResultDTO option, Map resultMap) { + resultMap.put(option.getValue(),option); + if (CollectionUtils.isNotEmpty(option.getChildren())){ + option.getChildren().forEach(o->{ + resultMap.put(o.getValue(),o); + getChildren(o,resultMap); + }); + } + } + /** * 更新主表中人员类别标记 * @param icResiUserTableEnum @@ -1919,6 +2003,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param bizType * @return */ + @Override public String createImportTaskRecord(String operatorId, String bizType, String originFilename) { ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); importTaskForm.setOperatorId(operatorId); @@ -1940,6 +2025,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res * @param resultDesc 结果描述,非必填 * @param resultDescPath 结果描述文件,excel等文件,有错误的话需要传入,成功则不需要 */ + @Override public void finishImportTask(String importTaskId, String operatorId, String processStatus, String resultDesc, String resultDescPath) { ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); importFinishTaskForm.setTaskId(importTaskId); @@ -1954,11 +2040,4 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res importTaskId, processStatus, operatorId, resultDesc, resultDescPath); } } - - @Override - public Object testAsync() { - IcNeighborHoodDTO nform = new IcNeighborHoodDTO(); - govOrgOpenFeignClient.getNeighborHoodOptions(nform); - return null; - } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 5744c10f62..2b9e300dc0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -67,6 +67,7 @@ import com.google.common.cache.CacheBuilder; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; @@ -77,6 +78,7 @@ import java.math.BigDecimal; import java.math.RoundingMode; import java.sql.Date; import java.sql.Timestamp; +import java.text.NumberFormat; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.TimeUnit; @@ -576,16 +578,20 @@ public class IcResiUserServiceImpl extends BaseServiceImpl finalSubTables = new ArrayList<>(); - subTables.forEach(subTable -> { - if (tables.contains(subTable.getTableName())) { + List finalSubTables =new ArrayList<>(); + //groupBy用到的表 + Set groupByTables=new HashSet<>(); + subTables.forEach(subTable->{ + if(tables.contains(subTable.getTableName())){ finalSubTables.add(subTable.getJoinTableSql()); + if(subTable.getSupportAdd()){ + groupByTables.add(subTable.getTableName()); + } } }); - - PageInfo> pageInfo = new PageInfo<>(); - if (null == formDTO.getPageFlag() || formDTO.getPageFlag()) { + PageInfo> pageInfo=new PageInfo<>(); + if (null == formDTO.getIsPage()||formDTO.getIsPage()) { //分页 String finalStaffOrgPath = staffOrgPath; pageInfo = PageHelper.startPage(formDTO.getPageNo(), @@ -594,7 +600,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> list = baseDao.selectListResiMap(formDTO.getCustomerId(), formDTO.getFormCode(), @@ -602,9 +609,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl nameList = new ArrayList<>(); - for (String codePath : demandCodePath) { + Set nameList=new HashSet<>(); + for(String codePath:demandCodePath){ if (StringUtils.isNotBlank(codePath) && codePath.contains(StrConstant.COMMA)) { String[] codeAtt = codePath.split(StrConstant.COMMA); String code = codeAtt[codeAtt.length - 1]; @@ -764,38 +772,50 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> dynamicQuery(String customerId, - String formCode, - String resultTableName, - List conditions, - String currentStaffAgencyId, - String staffOrgPath) { - CustomerFormQueryDTO queryDTO = new CustomerFormQueryDTO(); + public List> dynamicQuery(String customerId, + String formCode, + String resultTableName, + List conditions, + String currentStaffAgencyId, + String staffOrgPath){ + // List finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions); + Map> map=getFinalSubables(customerId, formCode, resultTableName, conditions, null); + return baseDao.dynamicQuery(customerId,resultTableName,conditions,map.get("finalSubTables"), null, currentStaffAgencyId,staffOrgPath,map.get("groupByTables")); + } + + @NotNull + public Map> getFinalSubables(String customerId, String formCode, String resultTableName, List conditions, List exportNeedTableList) { + Map> map=new HashMap<>(); + CustomerFormQueryDTO queryDTO=new CustomerFormQueryDTO(); queryDTO.setCustomerId(customerId); queryDTO.setFormCode(formCode); //所有的子表 - Result> subTablesRes = operCustomizeOpenFeignClient.querySubTables(queryDTO); - /*List subTablesBak=new ArrayList<>(); - if(subTablesRes.success()&&CollectionUtils.isNotEmpty(subTablesRes.getData())){ - subTablesBak =subTablesRes.getData().stream().map(SubTableJoinDTO::getJoinTableSql).collect(Collectors.toList()); - }*/ - List subTables = subTablesRes.getData(); + Result> subTablesRes=operCustomizeOpenFeignClient.querySubTables(queryDTO); + + List subTables =subTablesRes.getData(); // log.info("1、所有的子表subTables:"+JSON.toJSONString(subTables,true)); //关联哪些子表:查询条件用到的表名+查询的列对应的表 并集去重 - Set whereConditionTables = conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); - Set tables = new HashSet<>(); - tables.addAll(whereConditionTables); + Set tables = conditions.stream().map(ResiUserQueryValueDTO::getTableName).collect(Collectors.toSet()); tables.add(resultTableName); + if (CollectionUtils.isNotEmpty(exportNeedTableList)){ + tables.addAll(exportNeedTableList); + } // log.info("2、查询条件+查询列对应的tables并集去重:"+ JSON.toJSONString(tables,true)); //最终关联的子表对应的sql: - List finalSubTables = new ArrayList<>(); - subTables.forEach(subTable -> { - if (tables.contains(subTable.getTableName())) { + List finalSubTables =new ArrayList<>(); + //groupBy用到的表 + Set groupByTables=new HashSet<>(); + subTables.forEach(subTable->{ + if(tables.contains(subTable.getTableName())){ finalSubTables.add(subTable.getJoinTableSql()); + if(subTable.getSupportAdd()){ + groupByTables.add(subTable.getTableName()); + } } }); - - return baseDao.dynamicQuery(customerId, resultTableName, conditions, finalSubTables, currentStaffAgencyId, staffOrgPath); + map.put("finalSubTables",finalSubTables); + map.put("groupByTables", new ArrayList<>(groupByTables)); + return map; } /** @@ -906,7 +926,12 @@ public class IcResiUserServiceImpl extends BaseServiceImpl pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), formDTO.getColumnName(), staffInfo.getAgencyId(), no)); + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.searchByName(formDTO.getName(), + formDTO.getColumnName(), + formDTO.getLevel(), + formDTO.getId(), + staffInfo.getAgencyId(), + no)); List result = pageInfo.getList(); if (CollectionUtils.isEmpty(result)) { return new PageData<>(new ArrayList<>(), pageInfo.getTotal()); @@ -949,7 +974,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl> getDataForExport(ExportResiUserItemDTO formItemMap, String baseTableName, IcResiUserPageFormDTO pageFormDTO, String currentStaffAgencyId, String staffOrgPath) { - Page> mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getPageFlag()).doSelectPage(() -> { + Page> mapListPage = PageHelper.startPage(pageFormDTO.getPageNo(), pageFormDTO.getPageSize(), pageFormDTO.getIsPage()).doSelectPage(() -> { this.dynamicQuery(pageFormDTO.getCustomerId(), pageFormDTO.getFormCode(), baseTableName, pageFormDTO.getConditions(), currentStaffAgencyId, staffOrgPath); }); mapListPage.getResult().parallelStream().filter(Objects::nonNull).forEach(resiUser -> { @@ -1026,13 +1051,6 @@ public class IcResiUserServiceImpl extends BaseServiceImpl cache = remoteOptionCacheMap.getOrDefault(e.getItemId(), CacheBuilder.newBuilder().maximumSize(NumConstant.FIVE_HUNDRED).build()); remoteOptionCacheMap.putIfAbsent(e.getItemId(), cache); String cacheValue = cache.getIfPresent(vauleStr); @@ -1627,4 +1645,70 @@ public class IcResiUserServiceImpl extends BaseServiceImpl(list, null == list ? NumConstant.ZERO : list.size()); } + + /** + * @Author sun + * @Description 【人房】居民总数饼图 + **/ + @Override + public UserChartResultDTO userChart(UserChartFormDTO formDTO) { + UserChartResultDTO resultDTO = new UserChartResultDTO(); + //计算百分比使用,保留小数点后两位 + NumberFormat numberFormat = NumberFormat.getInstance(); + numberFormat.setMaximumFractionDigits(NumConstant.TWO); + //1.判断入参是否有值,没有值则赋值当前工作人员缓存中所属组织信息 + if (StringUtils.isEmpty(formDTO.getOrgId())) { + //2.获取工作人员缓存信息 + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId()); + if (null == staffInfo) { + throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId())); + } + formDTO.setOrgId(staffInfo.getAgencyId()); + formDTO.setOrgType("agency"); + } + //2.根据入参值查询对应的房屋统计数据 + List list = baseDao.userChart(formDTO.getOrgId(), formDTO.getOrgType()); + //3.汇总数据 + AtomicInteger userTotal = new AtomicInteger(); + list.forEach(l -> { + userTotal.addAndGet(l.getNum()); + if ("0".equals(l.getIsFloating())) { + resultDTO.setCzUserTotal(l.getNum()); + } else { + resultDTO.setLdUserTotal(l.getNum()); + } + }); + resultDTO.setUserTotal(userTotal.get()); + resultDTO.setCzUserRatio(Double.valueOf((resultDTO.getUserTotal() == 0 || resultDTO.getCzUserTotal() > resultDTO.getUserTotal()) ? "0" : numberFormat.format(((float) resultDTO.getCzUserTotal() / (float) resultDTO.getUserTotal()) * 100))); + resultDTO.setLdUserRatio(Double.valueOf((resultDTO.getUserTotal() == 0 || resultDTO.getLdUserTotal() > resultDTO.getUserTotal()) ? "0" : numberFormat.format(((float) resultDTO.getLdUserTotal() / (float) resultDTO.getUserTotal()) * 100))); + resultDTO.setOrgId(formDTO.getOrgId()); + resultDTO.setOrgType(formDTO.getOrgType()); + + return resultDTO; + } + + /** + * @Author sun + * @Description 【人房】居民总数列表数据 + **/ + @Override + public List userChartList(UserChartFormDTO formDTO) { + List userList = new ArrayList<>(); + UserChartFormDTO userDTO = new UserChartFormDTO(); + userDTO.setOrgType(formDTO.getOrgType()); + for (String id : formDTO.getIdList()) { + userDTO.setOrgId(id); + userList.add(userChart(userDTO)); + } + return userList; + } + + @Override + public List> dynamicQuery(String customerId, String formCode, String resultTableName, List showSqlColumns, List conditions, String currentStaffAgencyId, String staffOrgPath) { + // List finalSubTables = getFinalSubables(customerId, formCode, resultTableName, conditions); + List exportNeedTableList = showSqlColumns.stream().map(IcCustomExportResultDTO.SqlColumn::getTableName).collect(Collectors.toList()); + Map> map=getFinalSubables(customerId, formCode, resultTableName, conditions, exportNeedTableList); + return baseDao.dynamicQuery(customerId,resultTableName,conditions,map.get("finalSubTables"),showSqlColumns,currentStaffAgencyId,staffOrgPath,map.get("groupByTables")); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java index af4c3c0357..97f5ed43e0 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcTripReportRecordServiceImpl.java @@ -426,4 +426,40 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl list = baseDao.pageList(formDTO); + if (CollectionUtils.isEmpty(list)) { + return null; + } + //3.查询最近一次通知时间、核算检测关注名单 + Map latestNotice = new HashMap<>(); + List gzIdCardList = new ArrayList<>(); + List idCardList = list.stream().map(m -> m.getIdCard()).distinct().collect(Collectors.toList()); + //如果不分页可能会有很多个身份证号 + List> partionList = ListUtils.partition(idCardList, NumConstant.ONE_HUNDRED); + partionList.forEach(l -> { + Map map = icNoticeService.getUserLatestNoticeTime(formDTO.getCustomerId(), l); + List gzIdCards = epidemicSpecialAttentionService.getHeSuanIdCardList(formDTO.getCustomerId(), l); + latestNotice.putAll(map); + gzIdCardList.addAll(gzIdCards); + }); + for (IcTripReportRecordDTO dto : list) { + //默认未加入 + dto.setHeSuanCheck(false); + dto.setHeSuanCheckDesc("未加入"); + if (CollectionUtils.isNotEmpty(gzIdCardList) && gzIdCardList.contains(dto.getIdCard())) { + dto.setHeSuanCheck(true); + dto.setHeSuanCheckDesc("已加入"); + } + if (MapUtils.isNotEmpty(latestNotice) && latestNotice.containsKey(dto.getIdCard())) { + dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard())); + } + } + return list.get(NumConstant.ZERO); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java index c3ba03acb8..af95579b47 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/PatrolRoutineWorkServiceImpl.java @@ -42,7 +42,7 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ExcelUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.YuShanSysApiService; -import com.epmet.commons.tools.utils.poi.excel.FreezeAndFilter; +import com.epmet.commons.tools.utils.poi.excel.handler.FreezeAndFilter; import com.epmet.constant.SystemMessageType; import com.epmet.dao.PatrolRoutineWorkDao; import com.epmet.dao.StatsStaffPatrolRecordDailyDao; diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java index 08685568dc..13645f9047 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/StatsResiWarnServiceImpl.java @@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; import com.epmet.commons.tools.redis.common.bean.BuildingInfoCache; import com.epmet.commons.tools.utils.ConvertUtils; @@ -16,6 +18,7 @@ import com.epmet.dto.IcResiCategoryWarnConfigDTO; import com.epmet.dto.form.IcResiCategoryStatsConfigFormDTO; import com.epmet.dto.form.IcUserWarnNoticeFormDTO; import com.epmet.dto.form.StatsResiListFormDTO; +import com.epmet.dto.form.StatsResiWarnFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; import com.epmet.entity.IcStatsResiWarnEntity; @@ -24,12 +27,13 @@ import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.service.IcStatsResiWarnService; import com.epmet.service.StatsResiWarnService; import com.github.pagehelper.PageHelper; +import com.github.pagehelper.PageInfo; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.CollectionUtils; import javax.annotation.Resource; import java.math.BigDecimal; @@ -173,20 +177,18 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { //根据buildingID,tableName he columnName获取名字 //限制条数 一栋楼内最多显示1000 即可 for (String s : buildingIdList) { - PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_HUNDRED,false).doSelectPage(()->{ - List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, Arrays.asList(s), icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); - if (!CollectionUtils.isEmpty(dtos)){ - Map> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); - result.forEach(item->{ - item.setConfigId(configId); - groupByBuild.forEach((k,v) -> { - if (item.getBuildingId().equals(k)){ - item.setUserList(v); - } - }); + List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, Arrays.asList(s), icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); + if (!CollectionUtils.isEmpty(dtos)){ + Map> groupByBuild = dtos.stream().collect(Collectors.groupingBy(UserWarnNameListResultDTO::getBuildingId)); + result.forEach(item->{ + item.setConfigId(configId); + groupByBuild.forEach((k,v) -> { + if (item.getBuildingId().equals(k)){ + item.setCount(v.size()); + } }); - } - }); + }); + } } /*PageHelper.startPage(NumConstant.ONE,NumConstant.ONE_THOUSAND,false).doSelectPage(()->{ List dtos = icStatsResiWarnDao.userWarnListDTO(customerId, buildingIdList, icResiCategoryWarnConfigDTO.getTableName(), icResiCategoryWarnConfigDTO.getColumnName()); @@ -205,6 +207,41 @@ public class StatsResiWarnServiceImpl implements StatsResiWarnService { return mapResult; } + @Override + public PageData allUserWarnList(StatsResiWarnFormDTO formDTO) { + //获取configId预警配置信息 + IcResiCategoryWarnConfigDTO formDto = new IcResiCategoryWarnConfigDTO(); + formDto.setId(formDTO.getConfigId()); + Result warnResult = operCustomizeOpenFeignClient.resiCategoryWarnInfoById(formDto); + if (!warnResult.success() || null == warnResult.getData()) { + throw new RenException("获取预警配置信息失败,configId="+ formDTO.getConfigId()); + } + IcResiCategoryWarnConfigDTO icResiCategoryWarnConfigDTO = warnResult.getData(); + + PageHelper.startPage(formDTO.getPageNo(),formDTO.getPageSize()); + List list = icStatsResiWarnDao.userWarnListDTO(formDTO.getCustomerId(), + Collections.singletonList(formDTO.getBuildingId()), + icResiCategoryWarnConfigDTO.getTableName(), + icResiCategoryWarnConfigDTO.getColumnName()); + PageInfo pageInfo = new PageInfo<>(list); + if (CollectionUtils.isNotEmpty(list)) { + Set homeIds = list.stream().map(UserWarnNameListResultDTO::getHomeId).collect(Collectors.toSet()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(homeIds, formDTO.getCustomerId()); + if (!houseInfoRes.success() || CollectionUtils.isEmpty(houseInfoRes.getData())){ + throw new EpmetException("查询居民所属房屋失败..."); + } + Map houseMap = houseInfoRes.getData().stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); + list.forEach(item -> { + HouseInfoDTO houseInfo = houseMap.get(item.getHomeId()); + if (null != houseInfo) { + item.setUnitName(houseInfo.getUnitName()); + item.setDoorName(houseInfo.getDoorName()); + } + }); + } + return new PageData<>(list, pageInfo.getTotal()); + } + @Override public List list(String customerId,String id, String level) { //获取所有配置类项 getshow diff --git a/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.41__add_is_handle_job.sql b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.41__add_is_handle_job.sql new file mode 100644 index 0000000000..b1a71547c7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.41__add_is_handle_job.sql @@ -0,0 +1,3 @@ +-- 退役军人表增加此列 +ALTER TABLE ic_veterans ADD COLUMN IS_HANDLE_JOB CHAR(1) COMMENT '是否办理公益性岗位,0422新增' AFTER XJYQK; +update ic_veterans set ic_veterans.IS_HANDLE_JOB='0' where ic_veterans.IS_HANDLE_JOB is null or ic_veterans.IS_HANDLE_JOB=''; \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls index f8169a18bb..99f2034351 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_import_template.xls differ diff --git a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx index 708221ffea..0dfc8ad7f4 100644 Binary files a/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx and b/epmet-user/epmet-user-server/src/main/resources/excel/ic_resi_info_cid_for_easy_excel.xlsx differ diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 054839bf02..bdbab0392f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -73,6 +73,23 @@ and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]} + + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + + + and (${subCondition.tableName}.${subCondition.columnName} is null + or ${subCondition.tableName}.${subCondition.columnName} ='') + + + + + + ${subCondition.tableName}.${subCondition.columnName} like concat('%',#{colValue},'%') + + @@ -101,6 +118,17 @@ and ${subCondition.tableName}.${subCondition.columnName} between #{subCondition.columnValue[0]} and #{subCondition.columnValue[1]} + + + + and ${subCondition.tableName}.${subCondition.columnName} is not null + and ${subCondition.tableName}.${subCondition.columnName} !='' + + + and (${subCondition.tableName}.${subCondition.columnName} is null + or ${subCondition.tableName}.${subCondition.columnName} ='') + + @@ -132,6 +160,11 @@ group by IC_RESI_USER.id + + + ${groupTableName}.ID + + order by ic_resi_user.CREATED_TIME desc @@ -143,9 +176,16 @@ update ${subTalbeName} set del_flag='1' where IC_RESI_USER=#{icResiUserId} - select - ${resultTableName}.* + + + + ${column.tableName}.${column.columnName} + + + ${resultTableName}.* + FROM ic_resi_user @@ -158,6 +198,11 @@ group by IC_RESI_USER.id + + + ${groupTableName}.ID + + order by ic_resi_user.CREATED_TIME desc @@ -208,7 +253,20 @@ IFNULL(REMARKS,'') AS REMARKS FROM ic_resi_user WHERE DEL_FLAG = '0' - AND (AGENCY_ID = #{agencyId} OR PIDS LIKE CONCAT('%',#{agencyId},'%')) + + + AND (AGENCY_ID = #{id} OR PIDS LIKE CONCAT('%',#{id},'%')) + + + AND GRID_ID = #{id} + + + AND VILLAGE_ID = #{id} + + + AND BUILD_ID = #{id} + + AND `NAME` LIKE CONCAT('%',#{name},'%') @@ -832,4 +890,27 @@ + + + diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml index 4e2dae8afa..24e607f3c7 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcStatsResiWarnDao.xml @@ -153,11 +153,16 @@