Browse Source
Conflicts: epmet-auth-client/pom.xml epmet-auth/src/main/java/com/epmet/controller/GovWebController.java epmet-auth/src/main/java/com/epmet/service/GovWebService.java epmet-auth/src/main/java/com/epmet/service/impl/GovWebServiceImpl.java epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.javarelease
178 changed files with 5466 additions and 658 deletions
@ -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'); |
@ -0,0 +1,25 @@ |
|||
package com.epmet.auth.dto.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
/** |
|||
* @ClassName BlockChainStaffAuthResultDTO |
|||
* @Description 区块链用户认证结果 |
|||
* @Author wangxianzhang |
|||
* @Date 2022/1/20 10:41 上午 |
|||
*/ |
|||
@Data |
|||
@NoArgsConstructor |
|||
@AllArgsConstructor |
|||
public class BlockChainStaffAuthResultDTO { |
|||
|
|||
private String userId; |
|||
private String realName; |
|||
private String phone; |
|||
private String headUrl; |
|||
private String agencyId; |
|||
private String agencyName; |
|||
|
|||
} |
@ -0,0 +1,24 @@ |
|||
package com.epmet.dto.form; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
|
|||
/** |
|||
* @ClassName BcAdminLoginFormDTO |
|||
* @Description 区块链管理系统staff身份认证 |
|||
* @Author wangxianzhang |
|||
* @Date 2022/1/17 10:11 下午 |
|||
*/ |
|||
@Data |
|||
public class BcStaffAuthenticationFormDTO { |
|||
|
|||
@NotBlank(message = "客户ID必填") |
|||
private String customerId; |
|||
|
|||
@NotBlank(message = "手机号必填") |
|||
private String mobile; |
|||
|
|||
@NotBlank(message = "密码必填") |
|||
private String password; |
|||
} |
@ -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 }; |
|||
} |
@ -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; |
|||
} |
|||
} |
@ -0,0 +1,73 @@ |
|||
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<IcExportItemListFormDTO> 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; |
|||
|
|||
/** |
|||
* item选项 值 |
|||
*/ |
|||
private String optionSourceValue; |
|||
/** |
|||
* item选项 值获取方式 |
|||
*/ |
|||
private String optionSourceType; |
|||
|
|||
|
|||
} |
@ -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<IcExportItemListFormDTO> itemList; |
|||
|
|||
} |
@ -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<String> fieldNames; |
|||
private List<String> 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<Object, Object> map) { |
|||
if (CollectionUtils.isEmpty(map)) { |
|||
return; |
|||
} |
|||
|
|||
for (Map.Entry<Object, Object> 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); |
|||
} |
|||
} |
@ -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 |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 从字符串的指定位置截取指定长度的子字符串 |
|||
* </summary> |
|||
* <param name="str">原字符串</param> |
|||
* <param name="startIndex">子字符串的起始位置</param> |
|||
* <param name="length">子字符串的长度</param> |
|||
* <returns>子字符串</returns> |
|||
*/ |
|||
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); |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 从字符串的指定位置开始截取到字符串结尾的了符串 |
|||
* </summary> |
|||
* <param name="str">原字符串</param> |
|||
* <param name="startIndex">子字符串的起始位置</param> |
|||
* <returns>子字符串</returns> |
|||
*/ |
|||
public static String CutString(String str, int startIndex) { |
|||
return CutString(str, startIndex, str.length()); |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 返回文件是否存在 |
|||
* </summary> |
|||
* <param name="filename">文件名</param> |
|||
* <returns>是否存在</returns> |
|||
*/ |
|||
public static boolean FileExists(String filename) { |
|||
File f = new File(filename); |
|||
return f.exists(); |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* MD5函数 |
|||
* </summary> |
|||
* <param name="str">原始字符串</param> |
|||
* <returns>MD5结果</returns> |
|||
*/ |
|||
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(); |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 字段串是否为Null或为""(空) |
|||
* </summary> |
|||
* <param name="str"></param> |
|||
* <returns></returns> |
|||
*/ |
|||
public static boolean StrIsNullOrEmpty(String str) { |
|||
// if NET1
|
|||
if (str == null || str.trim().equals("")) { |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 用于 RC4 处理密码 |
|||
* </summary> |
|||
* <param name="pass">密码字串</param> |
|||
* <param name="kLen">密钥长度,一般为 256</param> |
|||
* <returns></returns> |
|||
*/ |
|||
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; |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 生成随机字符 |
|||
* </summary> |
|||
* <param name="lens">随机字符长度</param> |
|||
* <returns>随机字符</returns> |
|||
*/ |
|||
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; |
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 使用 Discuz authcode 方法对字符串加密 |
|||
* </summary> |
|||
* <param name="source">原始字符串</param> |
|||
* <param name="key">密钥</param> |
|||
* <param name="expiry">加密字串有效时间,单位是秒</param> |
|||
* <returns>加密结果</returns> |
|||
*/ |
|||
public static String authcodeEncode(String source, String key, int expiry) { |
|||
return authcode(source, key, DiscuzAuthcodeMode.Encode, expiry); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 使用 Discuz authcode 方法对字符串加密 |
|||
* </summary> |
|||
* <param name="source">原始字符串</param> |
|||
* <param name="key">密钥</param> |
|||
* <returns>加密结果</returns> |
|||
*/ |
|||
public static String authcodeEncode(String source, String key) { |
|||
return authcode(source, key, DiscuzAuthcodeMode.Encode, 0); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 使用 Discuz authcode 方法对字符串解密 |
|||
* </summary> |
|||
* <param name="source">原始字符串</param> |
|||
* <param name="key">密钥</param> |
|||
* <returns>解密结果</returns> |
|||
*/ |
|||
public static String authcodeDecode(String source, String key) { |
|||
return authcode(source, key, DiscuzAuthcodeMode.Decode, 0); |
|||
|
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* 使用 变形的 rc4 编码方法对字符串进行加密或者解密 |
|||
* </summary> |
|||
* <param name="source">原始字符串</param> |
|||
* <param name="key">密钥</param> |
|||
* <param name="operation">操作 加密还是解密</param> |
|||
* <param name="expiry">加密字串过期时间</param> |
|||
* <returns>加密或者解密后的字符串</returns> |
|||
*/ |
|||
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 ""; |
|||
} |
|||
|
|||
} |
|||
|
|||
/** |
|||
* <summary> |
|||
* RC4 原始算法 |
|||
* </summary> |
|||
* <param name="input">原始字串数组</param> |
|||
* <param name="pass">密钥</param> |
|||
* <returns>处理后的字串数组</returns> |
|||
*/ |
|||
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<String> list = new ArrayList<String>(); |
|||
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); |
|||
} |
|||
|
|||
} |
@ -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<WriteCellData<?>> 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<CellRangeAddress> 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); |
|||
} |
|||
|
|||
} |
|||
} |
|||
|
|||
} |
@ -1,4 +1,4 @@ |
|||
package com.epmet.commons.tools.utils.poi.excel; |
|||
package com.epmet.commons.tools.utils.poi.excel.handler; |
|||
|
|||
/** |
|||
* desc:easyExcel 冻结标题 |
@ -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 { |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
Binary file not shown.
Binary file not shown.
@ -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; |
|||
} |
@ -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<OptionDTO> options; |
|||
} |
@ -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; |
|||
|
|||
} |
@ -0,0 +1,84 @@ |
|||
/** |
|||
* Copyright 2018 人人开源 https://www.renren.io
|
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* 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. |
|||
* <p> |
|||
* You should have received a copy of the GNU General Public License |
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
|
|||
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; |
|||
} |
@ -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<ConditionResultDTO> queryItemList; |
|||
} |
@ -0,0 +1,59 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
/** |
|||
* @Description 基础表单项 |
|||
* @Author yinzuomei |
|||
* @Date 2021/10/26 2:15 下午 |
|||
*/ |
|||
@Data |
|||
public class FormItemBaseResult implements Serializable { |
|||
|
|||
private static final long serialVersionUID = 5946318248252730101L; |
|||
/** |
|||
* ID |
|||
*/ |
|||
private String itemId; |
|||
|
|||
|
|||
|
|||
/** |
|||
* 项标签 |
|||
*/ |
|||
private String label; |
|||
|
|||
/** |
|||
* 分组ID,'默认,NONE' |
|||
*/ |
|||
private String itemGroupId; |
|||
|
|||
/** |
|||
* 排序 |
|||
*/ |
|||
private Integer sort; |
|||
|
|||
/** |
|||
* 默认:ic_resi_user |
|||
*/ |
|||
private String tableName; |
|||
|
|||
/** |
|||
* 拼好的列名 |
|||
*/ |
|||
private String columnName; |
|||
|
|||
/** |
|||
* 选项来源,REMOTE;LOCAL;如果是动态加载的下拉框或者CHECKBOX等的情况下使用。URL:接口获取(LABEL,VALUE);JSON:直接从JSON中取 |
|||
*/ |
|||
private String optionSourceType; |
|||
|
|||
/** |
|||
* 来源地址,REMOTE才有,固定格式;如果OPTIONS_SOURCE是URL,则此处填写要调用的接口的URL相对路径,例如:/API/GOV/ORG/XXXX。此处不应设置参数,若需要参数应当完全由后端,通过TOKEN信息来获取 |
|||
*/ |
|||
private String optionSourceValue; |
|||
|
|||
} |
|||
|
@ -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<List<String>> headers = new ArrayList<>(); |
|||
|
|||
|
|||
|
|||
private Integer headerRow; |
|||
|
|||
|
|||
/** |
|||
* sql中要返回的 列名 顺序跟表头顺序一致 |
|||
*/ |
|||
private List<SqlColumn> showSqlColumns; |
|||
|
|||
/** |
|||
* sql中要返回的关联的列 (与显示的要去重) |
|||
*/ |
|||
private List<SqlColumn> 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); |
|||
} |
|||
|
|||
|
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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<TemplateDetailResultDTO> children; |
|||
} |
@ -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<PageData<IcExportTemplateDTO>> page(@RequestParam Map<String, Object> params) { |
|||
PageData<IcExportTemplateDTO> page = icExportTemplateService.page(params); |
|||
return new Result<PageData<IcExportTemplateDTO>>().ok(page); |
|||
} |
|||
|
|||
@RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) |
|||
public Result<IcExportTemplateDTO> get(@PathVariable("id") String id) { |
|||
IcExportTemplateDTO data = icExportTemplateService.get(id); |
|||
return new Result<IcExportTemplateDTO>().ok(data); |
|||
} |
|||
|
|||
@NoRepeatSubmit |
|||
@PostMapping("save") |
|||
public Result<List<IcExportTemplateForExportResultDTO>> save(@RequestBody IcExportTemplateSaveFormDTO formDTO) { |
|||
return new Result<List<IcExportTemplateForExportResultDTO>>().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<IcCustomExportResultDTO> 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<List<IcExportTemplateDTO>> getTemplateList(@LoginUser TokenDto tokenDto, @RequestBody IcExportTemplateDTO formDTO) { |
|||
return new Result<List<IcExportTemplateDTO>>().ok(icExportTemplateService.getTemplateList(tokenDto, formDTO)); |
|||
} |
|||
|
|||
@PostMapping("templateDetail") |
|||
public Result<List<TemplateDetailResultDTO>> getTemplateDetail(@RequestBody IcExportTemplateDTO formDTO) { |
|||
return new Result<List<TemplateDetailResultDTO>>().ok(icExportTemplateService.getTemplateDetail(formDTO)); |
|||
} |
|||
|
|||
|
|||
} |
@ -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<IcExportTemplateConfigEntity> { |
|||
|
|||
} |
@ -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<IcExportTemplateEntity> { |
|||
|
|||
List<IcExportTemplateForExportResultDTO> getTemplateConfigForExport(IcExportTemplateQueryFormDTO param); |
|||
|
|||
List<IcExportTemplateDTO> selectByAgencyId(@Param("agencyId") String agencyId); |
|||
|
|||
/** |
|||
* 获取模板详情 |
|||
* |
|||
* @Param tempId |
|||
* @Return {@link List< TemplateDetailResultDTO>} |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/4/25 16:33 |
|||
*/ |
|||
List<TemplateDetailResultDTO> getTemplateDetail(@Param("tempId") String tempId); |
|||
|
|||
List<TemplateDetailResultDTO> getChildrenTemplateDetail(@Param("pid") String pid); |
|||
} |
@ -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; |
|||
|
|||
} |
@ -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; |
|||
|
|||
} |
@ -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<IcExportTemplateConfigEntity> { |
|||
/** |
|||
* 删除模板配置 |
|||
* @Param tempId |
|||
* @Return |
|||
* @Author zhaoqifeng |
|||
* @Date 2022/4/26 9:56 |
|||
*/ |
|||
void deleteByTempId(String tempId); |
|||
} |
Some files were not shown because too many files changed in this diff
Loading…
Reference in new issue