diff --git a/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java new file mode 100644 index 0000000..10ead82 --- /dev/null +++ b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/redis/RedisKeys.java @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.plugin.commons.redis; + +/** + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public class RedisKeys { + + /** + * redis前缀 + */ + private static String rootPrefix = "epmet:"; + + /** + * 海康accessToken + */ + public static String getHikTokenKey() { + return rootPrefix.concat("hik:token"); + } + + /** + * 大华publicKey + */ + public static String getDhPublicKey() { + return rootPrefix.concat("dh:public"); + } + + /** + * 大华token + */ + public static String getDhToken() { + return rootPrefix.concat("dh:token"); + } + +} diff --git a/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java new file mode 100644 index 0000000..58dfec3 --- /dev/null +++ b/epmet-plugins-common/src/main/java/com/epmet/plugin/commons/utils/NumUtils.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.commons.utils; + +import com.epmet.commons.tools.constant.NumConstant; + +/*** + * 数字处理相关通用方法 + * @author work@yujt.net.cn + * @date 2022/5/12/0012 10:02 + */ +public class NumUtils { + + public final static int ONE_THOUSAND = 1000; + + /** + * 获取数值 + * + * @param number 数值,可能为空 + * @param excludeZero 数字不能为0 + * @param defaultNumber 默认值(数字为空值时 或 数值为0但excludeZero == true 时,使用默认值) + * @return int + * @author work@yujt.net.cn + * @date 2022/5/12/0012 10:11 + */ + public static int getNumberInt(Integer number, boolean excludeZero, int defaultNumber) { + if (null == number || (excludeZero && NumConstant.ZERO == number)) { + return defaultNumber; + } + return number; + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/.gitkeep b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java index eb088e2..86cd108 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisServiceStationFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; @Data @@ -9,7 +10,7 @@ public class PowerAxisServiceStationFormDTO implements Serializable { private static final long serialVersionUID = -8446905334792655596L; /** - *动力主轴节点id + * 动力主轴节点id */ private String axisStructId; /** @@ -19,5 +20,11 @@ public class PowerAxisServiceStationFormDTO implements Serializable { /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; + /** + * 组织id + */ + @NotBlank(message = "所属组织不能为空") + private String agencyId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructLeaderFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructLeaderFormDTO.java index b71d1db..64a51cf 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructLeaderFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructLeaderFormDTO.java @@ -3,7 +3,6 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; import java.io.Serializable; -import java.util.Date; /** @@ -32,5 +31,10 @@ public class PowerAxisStructLeaderFormDTO implements Serializable { */ private String leaderName; + /** + * 客户id + */ + private String customerId; + -} \ No newline at end of file +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java index c22c881..a597f68 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerAxisStructViewFormDTO.java @@ -2,6 +2,7 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; import java.io.Serializable; @Data @@ -11,10 +12,12 @@ public class PowerAxisStructViewFormDTO implements Serializable { /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; /** * 组织id */ + @NotBlank(message = "所属组织不能为空") private String agencyId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java index c6ef16e..6f68885 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelHouseHoldViewListFormDTO.java @@ -2,6 +2,8 @@ package com.epmet.plugin.power.dto.axis.form; import lombok.Data; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; @Data @@ -17,15 +19,24 @@ public class PowerKernelHouseHoldViewListFormDTO implements Serializable { /** * 页码 */ - private int pageNo; + @NotNull(message = "页码不能为空") + private Integer pageNo; /** * 条数 */ - private int pageSize; + @NotNull(message = "页容量不能为空") + private Integer pageSize; + + /** + * 组织id + */ + @NotBlank(message = "所属组织不能为空") + private String agencyId; /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java index b2eb8ee..3486538 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/form/PowerKernelListPostitionFormDTO.java @@ -13,16 +13,19 @@ public class PowerKernelListPostitionFormDTO implements Serializable { /** * 动力主轴id */ - @NotBlank(message = "动力主轴节点不能为空") private String axisStructId; /** * 条数 */ - private int limit; + private Integer limit; /** * 客户id */ + @NotBlank(message = "所属客户不能为空") private String customerId; + + @NotBlank(message = "所属组织不能为空") + private String agencyId; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java index 5944990..fafb304 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/axis/result/PowerAxisStructViewResultDTO.java @@ -22,7 +22,7 @@ public class PowerAxisStructViewResultDTO implements Serializable { /** * 党员数 */ - private int partyMemberNum; +// private int partyMemberNum; /** * 党员中心户数 @@ -37,5 +37,5 @@ public class PowerAxisStructViewResultDTO implements Serializable { /** * 志愿队伍数 */ - private int volunteerTeamNum; +// private int volunteerTeamNum; } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikCommunityInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikCommunityInfoDTO.java new file mode 100644 index 0000000..72e1d58 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikCommunityInfoDTO.java @@ -0,0 +1,94 @@ +package com.epmet.plugin.power.dto.hik; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class HikCommunityInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 客户ID + */ + private String customerId; + + /** + * 社区ID + */ + private String communityId; + + /** + * 社区名称 + */ + private String communityName; + + /** + * 省代号 + */ + private String provinceCode; + + /** + * 市代号 + */ + private String cityCode; + + /** + * 区代号 + */ + private String countyCode; + + /** + * 经度坐标值 + */ + private String longitude; + + /** + * 维度坐标值 + */ + private String latitude; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikDeviceInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikDeviceInfoDTO.java new file mode 100644 index 0000000..dc9bac4 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikDeviceInfoDTO.java @@ -0,0 +1,94 @@ +package com.epmet.plugin.power.dto.hik; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class HikDeviceInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 客户ID + */ + private String customerId; + + /** + * 社区ID + */ + private String communityId; + + /** + * 设备ID + */ + private String deviceId; + + /** + * 设备名称 + */ + private String deviceName; + + /** + * 设备型号 + */ + private String deviceModel; + + /** + * 设备序列号 + */ + private String deviceSerial; + + /** + * 设备状态,0:离线,1:在线 + */ + private String deviceStatus; + + /** + * 设备路径 + */ + private String devicePath; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikErrorInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikErrorInfoDTO.java new file mode 100644 index 0000000..a06778c --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/HikErrorInfoDTO.java @@ -0,0 +1,79 @@ +package com.epmet.plugin.power.dto.hik; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@Data +public class HikErrorInfoDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 客户ID + */ + private String customerId; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 错误类型 0:token,1:人员,2权限 + */ + private String errorType; + + /** + * 错误详情 + */ + private String errorInfo; + + /** + * 引用ID + */ + private String referenceId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/form/HikAuthorityFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/form/HikAuthorityFormDTO.java new file mode 100644 index 0000000..3f436c1 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/form/HikAuthorityFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.hik.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员权限信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class HikAuthorityFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String communityId; + + private String personId; + + private Integer personType; + + private String deviceId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/form/HikPersonFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/form/HikPersonFormDTO.java new file mode 100644 index 0000000..1a7eedc --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/hik/form/HikPersonFormDTO.java @@ -0,0 +1,33 @@ +package com.epmet.plugin.power.dto.hik.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class HikPersonFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String unionId; + + private String personName; + + private Integer gender; + + private Integer credentialType; + + private String credentialNumber; + + private String mobile; + + private String faceUrl; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java index f0ff8cb..4a10bb4 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentBlacklistDTO.java @@ -28,6 +28,11 @@ public class RentBlacklistDTO implements Serializable { @NotBlank(message = "用户ID不能为空") private String userId; + /** + * epmet网格ID + */ + private String gridId; + /** * 姓名 */ diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractFileDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractFileDTO.java index 51f4ab8..34faf2b 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractFileDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractFileDTO.java @@ -32,7 +32,7 @@ public class RentContractFileDTO implements Serializable { private String fileUrl; /** - * 文件类型 0:图片,1 文件(合同) + * 文件类型 0:图片(人脸/头像),1 文件(合同),2 身份证照片,3 中介资料 */ private String fileType; @@ -66,4 +66,4 @@ public class RentContractFileDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java index c540588..6e38aa5 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentContractInfoDTO.java @@ -123,6 +123,17 @@ public class RentContractInfoDTO implements Serializable { @NotBlank(message = "出租人手机不能为空") private String lessorMobile; + /** + * 出租人与户主关系 + */ + private String lessorRelation; + + /** + * 出租人现居住地址 + */ + @NotBlank(message = "出租人现居住地址不能为空") + private String lessorLiveAddress; + /** * 承租人姓名 */ @@ -141,6 +152,17 @@ public class RentContractInfoDTO implements Serializable { @NotBlank(message = "承租人手机不能为空") private String lesseeMobile; + /** + * 承租人单位 + */ + private String lesseeUnit; + + /** + * 承租人户籍地地址 + */ + @NotBlank(message = "承租人户籍地地址不能为空") + private String lesseeHouseAddress; + /** * 签署日期 */ @@ -181,8 +203,18 @@ public class RentContractInfoDTO implements Serializable { @NotEmpty private List fileList; + /** + * 中介资料 + */ + private List agencyImgList; + /** * 是否黑名单 */ private String isBlack; -} \ No newline at end of file + + /** + * 是否是PC录入(0:否,1:是) + */ + private String isPcInput; +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java new file mode 100644 index 0000000..34008cb --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentHouseDTO.java @@ -0,0 +1,195 @@ +package com.epmet.plugin.power.dto.rent; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Data +public class RentHouseDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 房屋主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 片区id,neighbor_hood_part.id,可为空。 + */ + private String partId; + + /** + * 所属楼栋id + */ + private String buildingId; + + /** + * 所属单元id + */ + private String buildingUnitId; + + /** + * 房屋名字后台插入时生成 + */ + private String houseName; + + /** + * 门牌号 + */ + private String doorName; + + /** + * 房屋类型,1楼房,2平房,3别墅 + */ + private String houseType; + + /** + * 存储字典value + */ + private String purpose; + + /** + * 1:出租 0:自住 2:闲置 + */ + private Integer rentFlag; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证号 + */ + private String ownerIdCard; + + /** + * 排序 + */ + private BigDecimal sort; + + /** + * 删除标识 0未删除、1已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 社区ID + */ + private String communityId; + + /** + * 社区 + */ + private String communityName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格 + */ + private String gridName; + + /** + * 房屋小区ID + */ + private String villageId; + + /** + * 房屋小区 + */ + private String villageName; + + /** + * 楼号ID + */ + private String buildId; + + /** + * 楼号 + */ + private String buildName; + + /** + * 单元ID + */ + private String unitId; + + /** + * 单元 + */ + private String unitName; + + /** + * 房屋ID + */ + private String homeId; + + /** + * 房屋 + */ + private String homeName; + + /** + * 购房日期 + */ + private String purchaseDate; + + /** + * 是否更新 + */ + private Boolean needUpdate; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java index e7ffb7b..700b825 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/rent/RentTenantInfoDTO.java @@ -1,10 +1,12 @@ package com.epmet.plugin.power.dto.rent; +import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.io.Serializable; +import java.util.Date; import java.util.List; @@ -58,10 +60,58 @@ public class RentTenantInfoDTO implements Serializable { @NotBlank(message = "人员类型不能为空") private String type; + /** + * 审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用) + */ + private String state; + + /** + * 审核-原因 + */ + private String reason; + + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss", + timezone = "GMT+8" + ) + private Date createdTime; + + @JsonFormat( + pattern = "yyyy-MM-dd HH:mm:ss", + timezone = "GMT+8" + ) + private Date updatedTime; + + /** + * 政治面貌 + */ + private String politicalStatus; + + /** + * 是否服兵役【是:1 否:0】 + */ + private String isMilitary; + + /** + * 国籍 + */ + private String nation; + + /** + * 工作单位 + */ + private String unit; + /** * 头像列表 */ @NotEmpty private List imgList; + /** + * 身份证列表 + */ + @NotEmpty + private List idCardImgList; + } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/DhTokenDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/DhTokenDTO.java new file mode 100644 index 0000000..bd9732d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/DhTokenDTO.java @@ -0,0 +1,39 @@ +package com.epmet.plugin.power.dto.visit; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 大华设备鉴权信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-04-22 + */ +@Data +public class DhTokenDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * loginName + */ + private String loginName; + + /** + * token + */ + private String token; + + /** + * publicKey + */ + private String publicKey; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/VisitVisitorDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/VisitVisitorDTO.java new file mode 100644 index 0000000..dec7fd5 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/VisitVisitorDTO.java @@ -0,0 +1,163 @@ +package com.epmet.plugin.power.dto.visit; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 性别 + */ + private String gender; + + /** + * 手机号 + */ + private String mobile; + + /** + * 人员类型 0:访客 1:租客 + */ + private String type; + + /** + * 审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用) + */ + private String state; + + /** + * 审核原因 + */ + private String reason; + + /** + * 删除标记 0:未删除,1:已删除 + */ + private String delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + + /** + * 客户ID + */ + private String customerId; + + /** + * 来访事由 + */ + private String visitReason; + + /** + * 头像 + */ + private String faceImg; + + /** + * 小区 + */ + private String residential; + + /** + * 楼栋 + */ + private String building; + + /** + * 单元 + */ + private String unit; + + /** + * 房屋 + */ + private String room; + + /** + * 组织id + */ + private String agencyId; + + /** + * 上级组织id + */ + private String parentAgencyId; + + /** + * 组织的所有上级组织id + */ + private String agencyPids; + + /** + * 网格id + */ + private String gridId; + + /** + * 小区ID + */ + private String neighborhoodId; + + /** + * 楼栋ID + */ + private String buildingId; + + /** + * 单元ID + */ + private String unitId; + + /** + * 房屋ID + */ + private String houseId; +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhAuthFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhAuthFormDTO.java new file mode 100644 index 0000000..0f5062e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhAuthFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.visit.form; + +import com.epmet.plugin.power.dto.visit.result.DhChannelResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhAuthFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String cardNumber; + + private String timeQuantumId; + + private List cardPrivilegeDetails; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhCardPageFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhCardPageFormDTO.java new file mode 100644 index 0000000..b72df21 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhCardPageFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhCardPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String personCode; + + private String cardNumber; + + private String cardStatus; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhChannelPageFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhChannelPageFormDTO.java new file mode 100644 index 0000000..5bb210f --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhChannelPageFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhChannelPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String deviceGenre; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhDeptFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhDeptFormDTO.java new file mode 100644 index 0000000..456179d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhDeptFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.visit.form; + +import com.epmet.plugin.power.dto.visit.result.DhChannelResultDTO; +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhDeptFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private String description; + + private Long parentId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhIdentityFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhIdentityFormDTO.java new file mode 100644 index 0000000..c30adda --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhIdentityFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhIdentityFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String name; + + private Double subsidyAmount; + + private Integer isCashRecharge; + + private Integer isMachineRecharge; + + private String description; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhLoginPassFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhLoginPassFormDTO.java new file mode 100644 index 0000000..42e4c95 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhLoginPassFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhLoginPassFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String loginName; + + private String loginPass; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonCardFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonCardFormDTO.java new file mode 100644 index 0000000..0c53aa0 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonCardFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonCardFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Long personId; + + private String personName; + + private String cardNumber; + + private String cardType; + + private String category; + + private String cardStatus; + + private String startDate; + + private String endDate; + + private String cardPassword; + + private String subSystems; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonCardListFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonCardListFormDTO.java new file mode 100644 index 0000000..7a734c8 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonCardListFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonCardListFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List objectList; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonDelFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonDelFormDTO.java new file mode 100644 index 0000000..6a2c810 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonDelFormDTO.java @@ -0,0 +1,22 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; +import java.util.List; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonDelFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private List personIds; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonFormDTO.java new file mode 100644 index 0000000..3cfcc53 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonFormDTO.java @@ -0,0 +1,39 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String paperType; + + private String paperNumber; + + private String name; + + private String code; + + private Long deptId; + + private String sex; + + private String birthday; + + private String phone; + + private String status; + + private String personIdentityId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonImgFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonImgFormDTO.java new file mode 100644 index 0000000..62c0e89 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonImgFormDTO.java @@ -0,0 +1,23 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonImgFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String personCode; + + private String base64file; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonPageFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonPageFormDTO.java new file mode 100644 index 0000000..a053eab --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPersonPageFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPersonPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String code; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanFormDTO.java new file mode 100644 index 0000000..7719a5a --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPlanFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String detail; + + private String memo; + + private String name; + + private Integer type; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanPageFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanPageFormDTO.java new file mode 100644 index 0000000..9b6f7c6 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPlanPageFormDTO.java @@ -0,0 +1,25 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPlanPageFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pageNum; + + private Integer pageSize; + + private String singleCondition; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPublicKeyFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPublicKeyFormDTO.java new file mode 100644 index 0000000..5400419 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/DhPublicKeyFormDTO.java @@ -0,0 +1,21 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhPublicKeyFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String loginName; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorChartFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorChartFormDTO.java new file mode 100644 index 0000000..e15769d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorChartFormDTO.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.dto.visit.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorChartFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 时间 + */ + private String date; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorFormDTO.java new file mode 100644 index 0000000..37233a8 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitVisitorFormDTO.java @@ -0,0 +1,109 @@ +package com.epmet.plugin.power.dto.visit.form; + +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; +import java.util.Date; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String name; + + /** + * 身份证 + */ + @NotBlank(message = "身份证号不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String idCard; + + /** + * 性别 + */ + @NotBlank(message = "性别不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String gender; + + /** + * 手机号 + */ + @NotBlank(message = "联系方式不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String mobile; + + /** + * 人员类型 0:访客 1:租客 + */ + private String type; + + /** + * 来访事由 + */ + private String visitReason; + + /** + * 头像 + */ + private String faceImg; + + /** + * 小区ID + */ + private String neighborhoodId; + + /** + * 楼栋ID + */ + private String buildingId; + + /** + * 单元ID + */ + private String unitId; + + /** + * 房屋ID + */ + private String houseId; + + /** + * 小区 + */ + private String residential; + + /** + * 楼栋 + */ + private String building; + + /** + * 单元 + */ + private String unit; + + /** + * 房屋 + */ + private String room; + + /** + * 客户ID + */ + @NotBlank(message = "客户ID不能为空",groups = {AddGroup.class, DefaultGroup.class}) + private String customerId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitorLogoutFormDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitorLogoutFormDTO.java new file mode 100644 index 0000000..2059be3 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/form/VisitorLogoutFormDTO.java @@ -0,0 +1,29 @@ +package com.epmet.plugin.power.dto.visit.form; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 访客登出 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-27 + */ +@Data +public class VisitorLogoutFormDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 数据更新至:yyyyMMdd; + */ + private String dateId; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/result/DhChannelResultDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/result/DhChannelResultDTO.java new file mode 100644 index 0000000..737b3e8 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/result/DhChannelResultDTO.java @@ -0,0 +1,23 @@ +package com.epmet.plugin.power.dto.visit.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 海康社区人员信息下放 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class DhChannelResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + private String privilegeType; + + private String resouceCode; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/result/VisitVisitorChartResultDTO.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/result/VisitVisitorChartResultDTO.java new file mode 100644 index 0000000..a5dcd69 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/dto/visit/result/VisitVisitorChartResultDTO.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.dto.visit.result; + +import lombok.Data; + +import java.io.Serializable; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorChartResultDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 时间 + */ + private String hour; + + /** + * 数量 + */ + private String num; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/.gitkeep b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java new file mode 100644 index 0000000..cfb4135 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/PliPowerFeignClient.java @@ -0,0 +1,24 @@ +package com.epmet.plugin.power.feign; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; +import com.epmet.plugin.power.feign.impl.PliPowerFeignClientFallBackFactory; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +/** + * desc: 数据统计 对外feign client + * + * @return: + * @date: 2020/6/22 17:39 + * @author: jianjun liu + */ +@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = PliPowerFeignClientFallBackFactory.class) +public interface PliPowerFeignClient { + + @PostMapping("/pli/power/visitVisitor/logout") + Result visitorLogout(@RequestBody VisitorLogoutFormDTO formDTO); + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java new file mode 100644 index 0000000..232235e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBack.java @@ -0,0 +1,24 @@ +package com.epmet.plugin.power.feign.impl; + +import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.utils.ModuleUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; +import com.epmet.plugin.power.feign.PliPowerFeignClient; + +/** + * desc: + * + * @return: + * @date: 2020/6/22 9:38 + * @author: jianjun liu + * email:liujianjun@git.elinkit.com.cn + */ +public class PliPowerFeignClientFallBack implements PliPowerFeignClient { + + @Override + public Result visitorLogout(VisitorLogoutFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "logout",formDTO); + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBackFactory.java b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBackFactory.java new file mode 100644 index 0000000..99e35fa --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-client/src/main/java/com/epmet/plugin/power/feign/impl/PliPowerFeignClientFallBackFactory.java @@ -0,0 +1,20 @@ +package com.epmet.plugin.power.feign.impl; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.plugin.power.feign.PliPowerFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class PliPowerFeignClientFallBackFactory implements FallbackFactory { + + private PliPowerFeignClientFallBack fallback = new PliPowerFeignClientFallBack(); + + @Override + public PliPowerFeignClient create(Throwable cause) { + log.error(String.format("FeignClient调用发生异常,异常信息:%s", ExceptionUtils.getThrowableErrorStackTrace(cause))); + return fallback; + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml index af1b196..c95ef81 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml @@ -83,6 +83,11 @@ RELEASE compile + + net.coobird + thumbnailator + 0.4.8 + @@ -164,6 +169,15 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + https://api2.hik-cloud.com + 111 + 222 + + http://112.6.213.175:8314 + shundeju + hg123456 @@ -177,10 +191,10 @@ - + - root - Abc@123456 + epmet_pli_power_user + EpmEt-db-UsEr 0 192.168.1.140 @@ -193,7 +207,7 @@ false - 192.168.43.104 + 192.168.43.33 false @@ -214,6 +228,15 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + https://api2.hik-cloud.com + 111 + 222 + + http://112.6.213.175:8314 + shundeju + hg123456 @@ -268,6 +291,15 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + https://api2.hik-cloud.com + 111 + 222 + + http://112.6.213.175:8314 + shundeju + hg123456 @@ -317,6 +349,15 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 + + http://112.6.213.175:8314 + shundeju + hg123456 @@ -369,6 +410,15 @@ 60 epmet-user callerRunsPolicy + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 + + http://112.6.213.175:8314 + shundeju + hg123456 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/config/DhCloudProperties.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/config/DhCloudProperties.java new file mode 100644 index 0000000..ece4248 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/config/DhCloudProperties.java @@ -0,0 +1,56 @@ +package com.epmet.plugin.power.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * 海康设备参数 + * + * @author zhy + * @date 2022/5/20 14:59 + */ +@Configuration +@ConfigurationProperties(prefix = "dh.cloud") +public class DhCloudProperties { + + /** + * URL + */ + private String url; + + /** + * 账号 + */ + private String loginName; + + + /** + * 账号密码 + */ + private String loginPass; + + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getLoginName() { + return loginName; + } + + public void setLoginName(String loginName) { + this.loginName = loginName; + } + + public String getLoginPass() { + return loginPass; + } + + public void setLoginPass(String loginPass) { + this.loginPass = loginPass; + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/config/HikCloudProperties.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/config/HikCloudProperties.java new file mode 100644 index 0000000..815d47f --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/config/HikCloudProperties.java @@ -0,0 +1,54 @@ +package com.epmet.plugin.power.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +/** + * 海康设备参数 + * + * @author zhy + * @date 2022/5/20 14:59 + */ +@Configuration +@ConfigurationProperties(prefix = "hik.cloud") +public class HikCloudProperties { + + /** + * 应用ID + */ + private String url; + + /** + * 应用KEY + */ + private String client; + + /** + * 生成AccessToken密钥 + */ + private String secret; + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java index d1c1615..8242c23 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisDataVisualController.java @@ -46,7 +46,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/22 19:53 */ @PostMapping("serviceStation/listPosition") - public Result> getListPostition(@RequestBody PowerAxisServiceStationFormDTO form) { + public Result> getListPostition(@RequestBody PowerAxisServiceStationFormDTO form, @LoginUser TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); return new Result().ok(powerServiceStationService.getListPosition(form)); } @@ -59,7 +61,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("axis/statistics") - public Result getStatistics(@RequestBody PowerAxisStructViewFormDTO form) { + public Result getStatistics(@RequestBody PowerAxisStructViewFormDTO form, @LoginUser TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); PowerAxisStructViewResultDTO result = powerAxisStructService.getStatistics(form); return new Result().ok(result); } @@ -115,7 +119,9 @@ public class PowerAxisDataVisualController { * @date 2022/4/23 10:20 */ @PostMapping("kernelHousehold/list") - public ResultDTO getList(@RequestBody PowerKernelHouseHoldViewListFormDTO form) { + public ResultDTO getList(@RequestBody PowerKernelHouseHoldViewListFormDTO form, @LoginUser TokenDto tokenDto) { + form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); List dto = powerKernelHouseholdService.getList(form); return ResultDTO.success("查询成功", dto, powerKernelHouseholdService.getTotal(form)); } @@ -130,8 +136,8 @@ public class PowerAxisDataVisualController { */ @PostMapping("kernelHousehold/listPosition") public Result> getListPosition(@RequestBody PowerKernelListPostitionFormDTO form, @LoginUser TokenDto tokenDto) { - ValidatorUtils.validateEntity(form); form.setCustomerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(form); return new Result().ok(powerKernelHouseholdService.getListPosition(form)); } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructController.java index 250a4f8..83cef7c 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisStructController.java @@ -1,9 +1,12 @@ package com.epmet.plugin.power.modules.axis.controller; +import com.alibaba.excel.util.StringUtils; import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.page.PageData; +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; @@ -97,7 +100,15 @@ public class PowerAxisStructController { * @date 2022/4/19/0019 14:17 */ @PostMapping("list4Tree") - public Result> selectAllForTree(@RequestBody PowerAxisStructLeaderFormDTO formDto) { + public Result> selectAllForTree(@RequestBody PowerAxisStructLeaderFormDTO formDto,@LoginUser TokenDto tokenDto) { + String agencyId = formDto.getAgencyId(); + if (StringUtils.isBlank(agencyId)) { + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId()); + if (null != staffInfo && StringUtils.isNotBlank(staffInfo.getAgencyId())) { + formDto.setAgencyId(staffInfo.getAgencyId()); + } + } + formDto.setCustomerId(tokenDto.getCustomerId()); return new Result().ok(powerAxisStructService.selectAllForTree(formDto)); } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java index 38379a3..aaa1d95 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerAxisTagController.java @@ -38,8 +38,8 @@ public class PowerAxisTagController { private PowerAxisTagService powerAxisTagService; @RequestMapping("page") - public Result> page(@RequestParam Map params) { - PageData page = powerAxisTagService.page(params); + public Result> page(@LoginUser TokenDto tokenDto,@RequestParam Map params) { + PageData page = powerAxisTagService.page(tokenDto,params); return new Result>().ok(page); } @@ -102,8 +102,8 @@ public class PowerAxisTagController { * @date 2022/4/19/0019 9:24 */ @PostMapping("listSimpleAll") - public Result> listSimpleAll() { - return new Result().ok(powerAxisTagService.listSimpleAll()); + public Result> listSimpleAll(@LoginUser TokenDto tokenDto) { + return new Result().ok(powerAxisTagService.listSimpleAll(tokenDto)); } } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java index cc183e1..61d5ba9 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/controller/PowerServiceStationController.java @@ -1,8 +1,10 @@ package com.epmet.plugin.power.modules.axis.controller; +import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.page.PageData; +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.validator.AssertUtils; @@ -48,7 +50,8 @@ public class PowerServiceStationController { @NoRepeatSubmit @PostMapping("save") - public Result save(@RequestBody PowerServiceStationDTO dto){ + public Result save(@RequestBody PowerServiceStationDTO dto, @LoginUser TokenDto tokenDto){ + dto.setCustomerId(tokenDto.getCustomerId()); //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); powerServiceStationService.save(dto); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java index 401925c..391ebe2 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisStructDao.java @@ -2,16 +2,18 @@ package com.epmet.plugin.power.modules.axis.dao; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.plugin.power.dto.axis.PowerAxisStructDTO; -import com.epmet.plugin.power.dto.axis.form.*; -import com.epmet.plugin.power.dto.axis.result.*; +import com.epmet.plugin.power.dto.axis.form.PowerAxisListPositionFormDTO; +import com.epmet.plugin.power.dto.axis.form.PowerAxisStructFormDTO; +import com.epmet.plugin.power.dto.axis.form.PowerAxisStructLeaderFormDTO; +import com.epmet.plugin.power.dto.axis.form.PowerAxisStructStructTreeFormDTO; +import com.epmet.plugin.power.dto.axis.result.PowerAxisListPositionResultDTO; +import com.epmet.plugin.power.dto.axis.result.PowerAxisStructLeaderResultDTO; +import com.epmet.plugin.power.dto.axis.result.PowerAxisStructResultDTO; +import com.epmet.plugin.power.dto.axis.result.PowerAxisStructTreeResultDTO; import com.epmet.plugin.power.modules.axis.entity.PowerAxisStructEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; -import java.util.List; -import java.util.Map; - import java.util.List; /** @@ -75,19 +77,19 @@ public interface PowerAxisStructDao extends BaseDao { List getIdsByAgencyId(String agencyId, String customerId); - int queryGridParty(@Param("agencyId") String agencyId,@Param("customerId") String customerId,@Param("gridCateGoryCode") String gridCateGoryCode); + int queryGridParty(@Param("agencyId") String agencyId, @Param("customerId") String customerId, @Param("gridCateGoryCode") String gridCateGoryCode); - int queryGroupParty(@Param("agencyId") String agencyId,@Param("customerId") String customerId,@Param("groupCateGoryCode") String groupCateGoryCode); + int queryGroupParty(@Param("agencyId") String agencyId, @Param("customerId") String customerId, @Param("groupCateGoryCode") String groupCateGoryCode); - int getKernelHouseHold(PowerAxisStructViewFormDTO form); + int getKernelHouseHold(@Param("agencyId") String agencyId, @Param("customerId") String customerId); - int getServiceStation(PowerAxisStructViewFormDTO form); + int getServiceStation(@Param("agencyId") String agencyId, @Param("customerId") String customerId); List getStructTree(PowerAxisStructStructTreeFormDTO form); String queryCategoryCode(PowerAxisListPositionFormDTO form); - List querylistPosition(@Param("customerId") String customerId,@Param("code") String code ,@Param("agencyId") String agencyId); + List querylistPosition(@Param("customerId") String customerId, @Param("code") String code, @Param("agencyId") String agencyId); /** * 根据节点接报,组装其上级节点树 @@ -111,4 +113,19 @@ public interface PowerAxisStructDao extends BaseDao { * @date 2022/4/24 19:29 */ String getCateGoryCode(String customerId, int level, String tagCateGory); -} \ No newline at end of file + + /** + * 查询动力主轴跟节点 + * + * @param customerId 客户 + * @param agencyId 组织 + * @param structLevel 级别 {@link com.epmet.plugin.power.enums.PowerTagLevelEnum#ROOT} + * @return java.lang.String + * @author work@yujt.net.cn + * @date 2022/5/12/0012 9:52 + */ + String getRootAxisStructId(@Param("customerId") String customerId, + @Param("agencyId") String agencyId, + @Param("structLevel") int structLevel); + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java index ef10c7e..96c38cd 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/dao/PowerAxisTagDao.java @@ -1,12 +1,15 @@ package com.epmet.plugin.power.modules.axis.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.dto.axis.PowerAxisTagDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisAllTagCategoryResultDTO; +import com.epmet.plugin.power.dto.axis.result.PowerAxisTagCategoryResultDTO; import com.epmet.plugin.power.modules.axis.entity.PowerAxisTagEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; +import java.util.Map; /** * 动力主轴标签 @@ -24,7 +27,7 @@ public interface PowerAxisTagDao extends BaseDao { * @author work@yujt.net.cn * @date 2022/4/19/0019 9:14 */ - List listSimpleAll(); + List listSimpleAll(@Param("customerId") String customerId); /** * 根据ID查询节点等级 @@ -39,4 +42,9 @@ public interface PowerAxisTagDao extends BaseDao { Integer selectStructLevelById(@Param("customerId") String customerId, @Param("tagCategory") String tagCategory, @Param("axisStructId") String axisStructId); -} \ No newline at end of file + + List selectByTagCategory(@Param("tagCategory") String tagCategory, + @Param("customerId") String customerId); + + List getPageList(Map params); +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java index 29a10ef..1e1c231 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisStructService.java @@ -122,7 +122,6 @@ public interface PowerAxisStructService extends BaseService getIdByAgencyId(String agencyId); /** - * * 关键指标统计 * * @param form @@ -142,7 +141,7 @@ public interface PowerAxisStructService extends BaseService getStructTree(PowerAxisStructStructTreeFormDTO form); - List getListPosition(int structLevel,PowerAxisDataListPositionFormDTO form); + List getListPosition(int structLevel, PowerAxisDataListPositionFormDTO form); /** * 根据节点接报,组装其上级节点树 @@ -154,4 +153,16 @@ public interface PowerAxisStructService extends BaseService listParentTreeByLevel(String structLevel, String customerId); -} \ No newline at end of file + + /** + * 获取动力主轴根节点ID + * + * @param rootStructId 根节点ID,不为空直接返回该值 + * @param customerId 客户 + * @param agencyId 组织 + * @return java.lang.String + * @author work@yujt.net.cn + * @date 2022/5/12/0012 10:26 + */ + String getRootAxisStructId(String rootStructId, String customerId, String agencyId); +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java index decaebf..6de234f 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/PowerAxisTagService.java @@ -3,6 +3,7 @@ package com.epmet.plugin.power.modules.axis.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.plugin.power.dto.axis.PowerAxisTagDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisAllTagCategoryResultDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisTagCategoryResultDTO; @@ -27,7 +28,7 @@ public interface PowerAxisTagService extends BaseService { * @author generator * @date 2022-04-18 */ - PageData page(Map params); + PageData page(TokenDto tokenDto,Map params); /** * 默认查询 @@ -96,7 +97,7 @@ public interface PowerAxisTagService extends BaseService { * @author work@yujt.net.cn * @date 2022/4/19/0019 9:23 */ - List listSimpleAll(); + List listSimpleAll(TokenDto tokenDto); /** * 根据标签编码,查询节点级别 @@ -121,4 +122,4 @@ public interface PowerAxisTagService extends BaseService { * @date 2022/4/23/0023 15:51 */ Integer selectStructLevelById(String customerId, String tagCategory, String axisStructId); -} \ No newline at end of file +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java index cddd027..da4ee30 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisStructServiceImpl.java @@ -2,7 +2,6 @@ package com.epmet.plugin.power.modules.axis.service.impl; 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.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; @@ -10,12 +9,11 @@ import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; -import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.TreeUtils; -import com.epmet.dto.CustomerAgencyDTO; -import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.plugin.power.dto.axis.PowerAxisStructDTO; import com.epmet.plugin.power.dto.axis.form.*; import com.epmet.plugin.power.dto.axis.result.*; @@ -44,9 +42,6 @@ import java.util.Map; @Service public class PowerAxisStructServiceImpl extends BaseServiceImpl implements PowerAxisStructService { - @Autowired - private GovOrgOpenFeignClient govOrgOpenFeignClient; - @Autowired private PowerAxisTagService powerAxisTagService; @@ -148,8 +143,9 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl NumConstant.ONE) { + Integer parentStructLevel = powerAxisTagService.selectStructLevelById(customerId, PowerTagCategoryEnum.STRUCT.category(), structDto.getPid()); + parentStructLevel = parentStructLevel == null?0:parentStructLevel; + if (structLevel.intValue() - parentStructLevel.intValue() > NumConstant.ONE) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "无法跨级添加节点"); } } @@ -185,11 +181,7 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl agencyInfoResult = govOrgOpenFeignClient.getAgencyById(agencyId); - if (!agencyInfoResult.success()) { - throw new EpmetException(agencyInfoResult.getCode(), agencyInfoResult.getMsg()); - } - CustomerAgencyDTO agencyInfo = agencyInfoResult.getData(); + AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); struct.setAgencyId(agencyInfo.getId()); struct.setAgencyName(agencyInfo.getOrganizationName()); struct.setAgencyType(agencyInfo.getLevel()); @@ -227,19 +219,19 @@ public class PowerAxisStructServiceImpl extends BaseServiceImpl result = baseDao.listParentTreeByLevel(Integer.parseInt(structLevel), customerId); return TreeUtils.build(result); } -} \ No newline at end of file + + @Override + public String getRootAxisStructId(String rootStructId, String customerId, String agencyId) { + if (StringUtils.isNotBlank(rootStructId)) { + return rootStructId; + } + return baseDao.getRootAxisStructId(customerId, agencyId, PowerTagLevelEnum.ROOT.level()); + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java index 36ef95e..ebf5d03 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerAxisTagServiceImpl.java @@ -10,6 +10,7 @@ import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.plugin.power.dto.axis.PowerAxisTagDTO; @@ -41,12 +42,16 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl page(Map params) { - IPage page = baseDao.selectPage( - getPage(params, FieldConstant.CREATED_TIME, true), - getWrapper(params) - ); - return getPageData(page, PowerAxisTagDTO.class); + public PageData page(TokenDto tokenDto,Map params) { +// IPage page = baseDao.selectPage( +// getPage(params, FieldConstant.CREATED_TIME, true), +// getWrapper(params) +// ); +// return getPageData(page, PowerAxisTagDTO.class); + params.put("customerId", tokenDto.getCustomerId()); + IPage page = getPage(params); + List list = baseDao.getPageList(params); + return new PageData<>(list, page.getTotal()); } @Override @@ -102,18 +107,22 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); - wrapper.eq("TAG_CATEGORY", tagCategory) - .eq("FORBIDDEN_FLAG", EpmetDelFlagEnum.NORMAL.value()) - .eq(FieldConstant.CUSTOMER_ID, customerId) - .orderByAsc("STRUCT_LEVEL", FieldConstant.CREATED_TIME); + List res = baseDao.selectByTagCategory(tagCategory,customerId); + return res; + - return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), PowerAxisTagCategoryResultDTO.class); +// QueryWrapper wrapper = new QueryWrapper<>(); +// wrapper.eq("TAG_CATEGORY", tagCategory) +// .eq("FORBIDDEN_FLAG", EpmetDelFlagEnum.NORMAL.value()) +// .eq(FieldConstant.CUSTOMER_ID, customerId) +// .orderByAsc("STRUCT_LEVEL", FieldConstant.CREATED_TIME); +// +// return ConvertUtils.sourceToTarget(baseDao.selectList(wrapper), PowerAxisTagCategoryResultDTO.class); } @Override - public List listSimpleAll() { - return baseDao.listSimpleAll(); + public List listSimpleAll(TokenDto tokenDto) { + return baseDao.listSimpleAll(tokenDto.getCustomerId()); } @Override @@ -135,4 +144,4 @@ public class PowerAxisTagServiceImpl extends BaseServiceImpl page(Map params) { @@ -121,8 +128,12 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl getList(PowerKernelHouseHoldViewListFormDTO form) { - form.setPageNo((form.getPageNo() - 1) * form.getPageSize()); - form.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), form.getCustomerId(), form.getAgencyId()); + if (StringUtils.isBlank(axisStructId)) { + return Lists.newArrayList(); + } + form.setAxisStructId(axisStructId); + form.setPageNo((form.getPageNo() - NumConstant.ONE) * form.getPageSize()); List list = baseDao.getList(form); for (PowerKernelHouseHoldViewListResultDTO dto : list) { List nameList = dto.getKernelMemberList().stream().map(PowerkernelMemberListResultDTO::getKernelMemberName).distinct().collect(Collectors.toList()); @@ -133,13 +144,17 @@ public class PowerKernelHouseholdServiceImpl extends BaseServiceImpl getListPosition(PowerKernelListPostitionFormDTO form) { - return baseDao.queryListPosition(form.getAxisStructId(), form.getCustomerId(), form.getLimit()); + String customerId = form.getCustomerId(); + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), customerId, form.getAgencyId()); + if (StringUtils.isBlank(axisStructId)) { + return Lists.newArrayList(); + } + return baseDao.queryListPosition(axisStructId, customerId, NumUtils.getNumberInt(form.getLimit(), true, NumUtils.ONE_THOUSAND)); } @Override diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java index 41268f5..379cf79 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/axis/service/impl/PowerServiceStationServiceImpl.java @@ -6,14 +6,16 @@ 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.page.PageData; -import com.epmet.commons.tools.security.user.LoginUserUtil; import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.plugin.commons.utils.NumUtils; import com.epmet.plugin.power.dto.axis.PowerServiceStationDTO; import com.epmet.plugin.power.dto.axis.form.PowerAxisServiceStationFormDTO; import com.epmet.plugin.power.dto.axis.result.PowerAxisServiceStationResultDTO; import com.epmet.plugin.power.modules.axis.dao.PowerServiceStationDao; import com.epmet.plugin.power.modules.axis.entity.PowerServiceStationEntity; +import com.epmet.plugin.power.modules.axis.service.PowerAxisStructService; import com.epmet.plugin.power.modules.axis.service.PowerServiceStationService; +import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -32,9 +34,8 @@ import java.util.Map; @Service public class PowerServiceStationServiceImpl extends BaseServiceImpl implements PowerServiceStationService { - @Autowired - private LoginUserUtil loginUser; + private PowerAxisStructService powerAxisStructService; @Override public PageData page(Map params) { @@ -74,7 +75,6 @@ public class PowerServiceStationServiceImpl extends BaseServiceImpl getListPosition(PowerAxisServiceStationFormDTO form) { - form.setCustomerId(loginUser.getLoginUserCustomerId()); - List list = baseDao.getListPosition(form); - return list; + String axisStructId = powerAxisStructService.getRootAxisStructId(form.getAxisStructId(), form.getCustomerId(), form.getAgencyId()); + if (StringUtils.isBlank(axisStructId)) { + return Lists.newArrayList(); + } + form.setAxisStructId(axisStructId); + form.setLimit(NumUtils.getNumberInt(form.getLimit(), true, NumUtils.ONE_THOUSAND)); + return baseDao.getListPosition(form); } } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikCommunityInfoController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikCommunityInfoController.java new file mode 100644 index 0000000..1639f11 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikCommunityInfoController.java @@ -0,0 +1,94 @@ +package com.epmet.plugin.power.modules.hik.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.plugin.power.dto.hik.HikCommunityInfoDTO; +import com.epmet.plugin.power.modules.hik.excel.HikCommunityInfoExcel; +import com.epmet.plugin.power.modules.hik.service.HikCommunityInfoService; +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; + + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@RestController +@RequestMapping("hikCommunityInfo") +public class HikCommunityInfoController { + + @Autowired + private HikCommunityInfoService hikCommunityInfoService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = hikCommunityInfoService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + HikCommunityInfoDTO data = hikCommunityInfoService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody HikCommunityInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + hikCommunityInfoService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody HikCommunityInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + hikCommunityInfoService.update(dto); + return new Result(); + } + + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + hikCommunityInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = hikCommunityInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, HikCommunityInfoExcel.class); + } + + /** + * @Description: 同步社区列表信息 + * @Param: [formDto] + * @return: com.elink.esua.epdc.commons.tools.utils.Result<> + * @Author: wgf + * @Date: 2022-05-23 + */ + @GetMapping("getCommunityList") + public Result getCommunityList() { + return hikCommunityInfoService.getCommunityList(); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikDeviceInfoController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikDeviceInfoController.java new file mode 100644 index 0000000..f1bc823 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikDeviceInfoController.java @@ -0,0 +1,94 @@ +package com.epmet.plugin.power.modules.hik.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.plugin.power.dto.hik.HikDeviceInfoDTO; +import com.epmet.plugin.power.modules.hik.excel.HikDeviceInfoExcel; +import com.epmet.plugin.power.modules.hik.service.HikDeviceInfoService; +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; + + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@RestController +@RequestMapping("hikDeviceInfo") +public class HikDeviceInfoController { + + @Autowired + private HikDeviceInfoService hikDeviceInfoService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = hikDeviceInfoService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + HikDeviceInfoDTO data = hikDeviceInfoService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody HikDeviceInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + hikDeviceInfoService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody HikDeviceInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + hikDeviceInfoService.update(dto); + return new Result(); + } + + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + hikDeviceInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = hikDeviceInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, HikDeviceInfoExcel.class); + } + + /** + * @Description: 同步设备列表信息 + * @Param: [formDto] + * @return: com.elink.esua.epdc.commons.tools.utils.Result<> + * @Author: wgf + * @Date: 2022-05-23 + */ + @GetMapping("getDeviceList") + public Result getDeviceList() { + return hikDeviceInfoService.getDeviceList(); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikErrorInfoController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikErrorInfoController.java new file mode 100644 index 0000000..abea6e8 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/controller/HikErrorInfoController.java @@ -0,0 +1,82 @@ +package com.epmet.plugin.power.modules.hik.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.plugin.power.dto.hik.HikErrorInfoDTO; +import com.epmet.plugin.power.modules.hik.excel.HikErrorInfoExcel; +import com.epmet.plugin.power.modules.hik.service.HikErrorInfoService; +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; + + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@RestController +@RequestMapping("hikErrorInfo") +public class HikErrorInfoController { + + @Autowired + private HikErrorInfoService hikErrorInfoService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = hikErrorInfoService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + HikErrorInfoDTO data = hikErrorInfoService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody HikErrorInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + hikErrorInfoService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody HikErrorInfoDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + hikErrorInfoService.update(dto); + return new Result(); + } + + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + hikErrorInfoService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = hikErrorInfoService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, HikErrorInfoExcel.class); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikCommunityInfoDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikCommunityInfoDao.java new file mode 100644 index 0000000..c25e7b3 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikCommunityInfoDao.java @@ -0,0 +1,21 @@ +package com.epmet.plugin.power.modules.hik.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.dto.hik.HikCommunityInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikCommunityInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Mapper +public interface HikCommunityInfoDao extends BaseDao { + + List getCommunityInfoAll(); + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikDeviceInfoDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikDeviceInfoDao.java new file mode 100644 index 0000000..6b91224 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikDeviceInfoDao.java @@ -0,0 +1,16 @@ +package com.epmet.plugin.power.modules.hik.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.hik.entity.HikDeviceInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Mapper +public interface HikDeviceInfoDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikErrorInfoDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikErrorInfoDao.java new file mode 100644 index 0000000..95268f5 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/dao/HikErrorInfoDao.java @@ -0,0 +1,27 @@ +package com.epmet.plugin.power.modules.hik.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Map; + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@Mapper +public interface HikErrorInfoDao extends BaseDao { + + /** + * 物理删除 + * + * @param params + * @return void + * @author zhy + * @date 2022/4/24 14:08 + */ + void deletePhysical(Map params); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikCommunityInfoEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikCommunityInfoEntity.java new file mode 100644 index 0000000..3b3e83e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikCommunityInfoEntity.java @@ -0,0 +1,64 @@ +package com.epmet.plugin.power.modules.hik.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_hik_community_info") +public class HikCommunityInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 社区ID + */ + private String communityId; + + /** + * 社区名称 + */ + private String communityName; + + /** + * 省代号 + */ + private String provinceCode; + + /** + * 市代号 + */ + private String cityCode; + + /** + * 区代号 + */ + private String countyCode; + + /** + * 经度坐标值 + */ + private String longitude; + + /** + * 维度坐标值 + */ + private String latitude; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikDeviceInfoEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikDeviceInfoEntity.java new file mode 100644 index 0000000..4ad17cc --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikDeviceInfoEntity.java @@ -0,0 +1,64 @@ +package com.epmet.plugin.power.modules.hik.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_hik_device_info") +public class HikDeviceInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 社区ID + */ + private String communityId; + + /** + * 设备ID + */ + private String deviceId; + + /** + * 设备名称 + */ + private String deviceName; + + /** + * 设备型号 + */ + private String deviceModel; + + /** + * 设备序列号 + */ + private String deviceSerial; + + /** + * 设备状态,0:离线,1:在线 + */ + private String deviceStatus; + + /** + * 设备路径 + */ + private String devicePath; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikErrorInfoEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikErrorInfoEntity.java new file mode 100644 index 0000000..134ea93 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/entity/HikErrorInfoEntity.java @@ -0,0 +1,48 @@ +package com.epmet.plugin.power.modules.hik.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_hik_error_info") +public class HikErrorInfoEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户ID + */ + private String customerId; + + /** + * 身份证号 + */ + private String idCard; + + /** + * 错误类型 0:token,1:人员,2权限 + */ + private String errorType; + + /** + * 错误详情 + */ + private String errorInfo; + + /** + * 引用ID + */ + private String referenceId; +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikCommunityInfoExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikCommunityInfoExcel.java new file mode 100644 index 0000000..c230129 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikCommunityInfoExcel.java @@ -0,0 +1,63 @@ +package com.epmet.plugin.power.modules.hik.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class HikCommunityInfoExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "社区ID") + private String communityId; + + @Excel(name = "社区名称") + private String communityName; + + @Excel(name = "省代号") + private String provinceCode; + + @Excel(name = "市代号") + private String cityCode; + + @Excel(name = "区代号") + private String countyCode; + + @Excel(name = "经度坐标值") + private String longitude; + + @Excel(name = "维度坐标值") + private String latitude; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikDeviceInfoExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikDeviceInfoExcel.java new file mode 100644 index 0000000..9cd4f02 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikDeviceInfoExcel.java @@ -0,0 +1,63 @@ +package com.epmet.plugin.power.modules.hik.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Data +public class HikDeviceInfoExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "社区ID") + private String communityId; + + @Excel(name = "设备ID") + private String deviceId; + + @Excel(name = "设备名称") + private String deviceName; + + @Excel(name = "设备型号") + private String deviceModel; + + @Excel(name = "设备序列号") + private String deviceSerial; + + @Excel(name = "设备状态,0:离线,1:在线") + private String deviceStatus; + + @Excel(name = "设备路径") + private String devicePath; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikErrorInfoExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikErrorInfoExcel.java new file mode 100644 index 0000000..7be08bd --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/excel/HikErrorInfoExcel.java @@ -0,0 +1,51 @@ +package com.epmet.plugin.power.modules.hik.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@Data +public class HikErrorInfoExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "身份证号") + private String idCard; + + @Excel(name = "错误类型 0:token,1:人员,2权限") + private String errorType; + + @Excel(name = "错误详情") + private String errorInfo; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikCommunityInfoRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikCommunityInfoRedis.java new file mode 100644 index 0000000..24a6b3a --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikCommunityInfoRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.hik.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Component +public class HikCommunityInfoRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikDeviceInfoRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikDeviceInfoRedis.java new file mode 100644 index 0000000..045d049 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikDeviceInfoRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.hik.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Component +public class HikDeviceInfoRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikErrorInfoRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikErrorInfoRedis.java new file mode 100644 index 0000000..970dac0 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/redis/HikErrorInfoRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.hik.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@Component +public class HikErrorInfoRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikCommunityInfoService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikCommunityInfoService.java new file mode 100644 index 0000000..9a47eb5 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikCommunityInfoService.java @@ -0,0 +1,87 @@ +package com.epmet.plugin.power.modules.hik.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.dto.hik.HikCommunityInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikCommunityInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +public interface HikCommunityInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return HikCommunityInfoDTO + * @author generator + * @date 2022-05-20 + */ + HikCommunityInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-20 + */ + void save(HikCommunityInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-20 + */ + void update(HikCommunityInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-20 + */ + void delete(String[] ids); + + + /** + * 同步社区信息 + * @param + * @return + */ + Result getCommunityList(); +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikDeviceInfoService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikDeviceInfoService.java new file mode 100644 index 0000000..abdbe1c --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikDeviceInfoService.java @@ -0,0 +1,86 @@ +package com.epmet.plugin.power.modules.hik.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.dto.hik.HikDeviceInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikDeviceInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +public interface HikDeviceInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-20 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-20 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return HikDeviceInfoDTO + * @author generator + * @date 2022-05-20 + */ + HikDeviceInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-20 + */ + void save(HikDeviceInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-20 + */ + void update(HikDeviceInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-20 + */ + void delete(String[] ids); + + /** + * 同步设备信息 + * @param + * @return + */ + Result getDeviceList(); +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikErrorInfoService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikErrorInfoService.java new file mode 100644 index 0000000..bde8c62 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/HikErrorInfoService.java @@ -0,0 +1,88 @@ +package com.epmet.plugin.power.modules.hik.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity; + +import java.util.List; +import java.util.Map; + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +public interface HikErrorInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-23 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-23 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return HikErrorInfoDTO + * @author generator + * @date 2022-05-23 + */ + HikErrorInfoDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-23 + */ + void save(HikErrorInfoDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-23 + */ + void update(HikErrorInfoDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-23 + */ + void delete(String[] ids); + + /** + * 物理删除 + * + * @param params + * @return void + * @author zhy + * @date 2022/4/24 14:08 + */ + void deletePhysical(Map params); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikCommunityInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikCommunityInfoServiceImpl.java new file mode 100644 index 0000000..d026706 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikCommunityInfoServiceImpl.java @@ -0,0 +1,167 @@ +package com.epmet.plugin.power.modules.hik.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.modules.hik.dao.HikCommunityInfoDao; +import com.epmet.plugin.power.dto.hik.HikCommunityInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikCommunityInfoEntity; +import com.epmet.plugin.power.modules.hik.redis.HikCommunityInfoRedis; +import com.epmet.plugin.power.modules.hik.service.HikCommunityInfoService; +import com.epmet.plugin.power.modules.utils.HkDeviceUtil; +import com.fasterxml.jackson.databind.ObjectMapper; +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.*; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Service +public class HikCommunityInfoServiceImpl extends BaseServiceImpl implements HikCommunityInfoService { + + @Autowired + private HikCommunityInfoRedis hikCommunityInfoRedis; + + @Autowired + private HkDeviceUtil hkDeviceUtil; + + @Autowired + private LoginUserUtil loginUserUtil; + + // 参数 + private Integer pageNo = 1; + private Integer pageSize = 10; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, HikCommunityInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, HikCommunityInfoDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + String communityName = (String)params.get("communityName"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.like(StringUtils.isNotBlank(communityName), "COMMUNITY_NAME", communityName); + + return wrapper; + } + + @Override + public HikCommunityInfoDTO get(String id) { + HikCommunityInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, HikCommunityInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(HikCommunityInfoDTO dto) { + HikCommunityInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikCommunityInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(HikCommunityInfoDTO dto) { + HikCommunityInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikCommunityInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result getCommunityList() { + // 请求路径 + String url = "https://api2.hik-cloud.com/api/v1/estate/system/communities/actions/list"; + + // token + String token =hkDeviceUtil.getAccessToken(); +// token = "Bearer ".concat(token); + + Map headerMap = new HashMap<>(4); + headerMap.put("Authorization",token); + + Map paramsMap = new HashMap<>(4); + paramsMap.put("pageNo", pageNo); + paramsMap.put("pageSize", pageSize); + + JSONArray jsonArray = getJSONArrayListGET(url,false,paramsMap,headerMap,"请求社区列表信息失败"); + + List entityList = new ArrayList(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObj = jsonArray.getJSONObject(i); + // 转成对象实体 + HikCommunityInfoEntity entity = JSONObject.toJavaObject(jsonObj ,HikCommunityInfoEntity.class); + entity.setCustomerId(loginUserUtil.getLoginUserCustomerId() == null ? "0001" : loginUserUtil.getLoginUserCustomerId()); + entityList.add(entity); + } + insertBatch(entityList); + + if(jsonArray != null && jsonArray.size() == 10){ + pageNo++; + getCommunityList(); + } + + return new Result(); + } + + /** + * sendGet请求 + * @param url + * @param isHttps + * @param paramsMap + * @param headerMap + * @param msg + * @return + */ + public JSONArray getJSONArrayListGET(String url,Boolean isHttps,Map paramsMap,Map headerMap,String msg){ + // 请求接口 + String data = HttpClientManager.getInstance().sendGet(url,false,paramsMap, headerMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg); + } + JSONObject toResult = JSON.parseObject(data); + + JSONObject dataList = JSON.parseObject(toResult.get("data").toString()); + + JSONArray rows = JSONArray.parseArray(dataList.get("rows").toString()); + + return rows; + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikDeviceInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikDeviceInfoServiceImpl.java new file mode 100644 index 0000000..5933489 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikDeviceInfoServiceImpl.java @@ -0,0 +1,170 @@ +package com.epmet.plugin.power.modules.hik.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +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.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.dto.hik.HikCommunityInfoDTO; +import com.epmet.plugin.power.modules.hik.dao.HikCommunityInfoDao; +import com.epmet.plugin.power.modules.hik.dao.HikDeviceInfoDao; +import com.epmet.plugin.power.dto.hik.HikDeviceInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikCommunityInfoEntity; +import com.epmet.plugin.power.modules.hik.entity.HikDeviceInfoEntity; +import com.epmet.plugin.power.modules.hik.redis.HikDeviceInfoRedis; +import com.epmet.plugin.power.modules.hik.service.HikDeviceInfoService; +import com.epmet.plugin.power.modules.utils.HkDeviceUtil; +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.*; + +/** + * 海康设备信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Service +public class HikDeviceInfoServiceImpl extends BaseServiceImpl implements HikDeviceInfoService { + + @Autowired + private HikDeviceInfoRedis hikDeviceInfoRedis; + + @Autowired + private HkDeviceUtil hkDeviceUtil; + + @Autowired + private LoginUserUtil loginUserUtil; + + @Autowired + private HikCommunityInfoDao hikCommunityInfoDao; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, HikDeviceInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, HikDeviceInfoDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + String communityId = (String)params.get("communityId"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(StringUtils.isNotBlank(communityId), "COMMUNITY_ID", communityId); + + return wrapper; + } + + @Override + public HikDeviceInfoDTO get(String id) { + HikDeviceInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, HikDeviceInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(HikDeviceInfoDTO dto) { + HikDeviceInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikDeviceInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(HikDeviceInfoDTO dto) { + HikDeviceInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikDeviceInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + public Result getDeviceList() { + // 请求路径 + String url = "https://api2.hik-cloud.com/api/v1/estate/devices/actions/listByCommunityId"; + + // token + String token =hkDeviceUtil.getAccessToken(); +// token = "Bearer ".concat(token); + + Map headerMap = new HashMap<>(4); + headerMap.put("Authorization",token); + + // 获取社区列表 + List communityList = hikCommunityInfoDao.getCommunityInfoAll(); + + for(HikCommunityInfoDTO hikCommunityInfoDTO : communityList){ + // 参数 + Integer pageNo = 1; + Integer pageSize = 1000; + Map paramsMap = new HashMap<>(4); + paramsMap.put("pageNo", pageNo); + paramsMap.put("pageSize", pageSize); + paramsMap.put("communityId",hikCommunityInfoDTO.getCommunityId()); + JSONArray jsonArray = getJSONArrayListPOST(url,JSON.toJSONString(paramsMap),headerMap,"请求设备列表信息失败"); + + List entityList = new ArrayList(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonObj = jsonArray.getJSONObject(i); + // 转成对象实体 + HikDeviceInfoEntity entity = JSONObject.toJavaObject(jsonObj ,HikDeviceInfoEntity.class); + entity.setCustomerId(loginUserUtil.getLoginUserCustomerId() == null ? "0001" : loginUserUtil.getLoginUserCustomerId()); + entityList.add(entity); + } + insertBatch(entityList); + } + + return new Result(); + } + + /** + * sendGet请求 + * @param url + * @param jsonStrParam + * @param headerMap + * @param msg + * @return + */ + public JSONArray getJSONArrayListPOST(String url,String jsonStrParam,Map headerMap,String msg){ + // 请求接口 + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url,jsonStrParam, headerMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), msg); + } + JSONObject toResult = JSON.parseObject(data); + + JSONObject dataList = JSON.parseObject(toResult.get("data").toString()); + + JSONArray rows = JSONArray.parseArray(dataList.get("rows").toString()); + + return rows; + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikErrorInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikErrorInfoServiceImpl.java new file mode 100644 index 0000000..1a6e31a --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/hik/service/impl/HikErrorInfoServiceImpl.java @@ -0,0 +1,95 @@ +package com.epmet.plugin.power.modules.hik.service.impl; + +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.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.plugin.power.modules.hik.dao.HikErrorInfoDao; +import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; +import com.epmet.plugin.power.modules.hik.entity.HikErrorInfoEntity; +import com.epmet.plugin.power.modules.hik.redis.HikErrorInfoRedis; +import com.epmet.plugin.power.modules.hik.service.HikErrorInfoService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 海康设备推送失败信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-23 + */ +@Service +public class HikErrorInfoServiceImpl extends BaseServiceImpl implements HikErrorInfoService { + + @Autowired + private HikErrorInfoRedis hikErrorInfoRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, HikErrorInfoDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, HikErrorInfoDTO.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 HikErrorInfoDTO get(String id) { + HikErrorInfoEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, HikErrorInfoDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(HikErrorInfoDTO dto) { + HikErrorInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikErrorInfoEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(HikErrorInfoDTO dto) { + HikErrorInfoEntity entity = ConvertUtils.sourceToTarget(dto, HikErrorInfoEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void deletePhysical(Map params) { + if (!params.isEmpty()) { + baseDao.deletePhysical(params); + } + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java index a7f68f2..5e71999 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentBlacklistController.java @@ -70,6 +70,7 @@ public class RentBlacklistController { return new Result(); } + @NoRepeatSubmit @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { List list = rentBlacklistService.list(params); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractFileController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractFileController.java index 7ea49af..69de084 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractFileController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractFileController.java @@ -63,7 +63,7 @@ public class RentContractFileController { return new Result(); } - @PostMapping("delete") + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); @@ -71,11 +71,4 @@ public class RentContractFileController { return new Result(); } - @GetMapping("export") - public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { - List list = rentContractFileService.list(params); - ExcelUtils.exportExcelToTarget(response, null, list, RentContractFileExcel.class); - } - - } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java index fcbfb40..f559bdb 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentContractInfoController.java @@ -50,7 +50,17 @@ public class RentContractInfoController { public Result save(@RequestBody RentContractInfoDTO dto) { //效验数据 ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); - return rentContractInfoService.save(dto); + rentContractInfoService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("savePc") + public Result savePc(@RequestBody RentContractInfoDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + rentContractInfoService.savePc(dto); + return new Result(); } @NoRepeatSubmit @@ -62,6 +72,23 @@ public class RentContractInfoController { return new Result(); } + @NoRepeatSubmit + @PostMapping("send") + public Result send(@RequestBody RentContractInfoDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + rentContractInfoService.send(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("resend/{id}") + public Result resend(@PathVariable("id") String id) { + //效验数据 + rentContractInfoService.resend(id); + return new Result(); + } + @NoRepeatSubmit @PostMapping("update") public Result update(@RequestBody RentContractInfoDTO dto) { @@ -71,6 +98,15 @@ public class RentContractInfoController { return new Result(); } + @NoRepeatSubmit + @PostMapping("updatePc") + public Result updatePc(@RequestBody RentContractInfoDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + rentContractInfoService.updatePc(dto); + return new Result(); + } + @DeleteMapping("delete") public Result delete(@RequestBody String[] ids) { //效验数据 @@ -79,6 +115,7 @@ public class RentContractInfoController { return new Result(); } + @NoRepeatSubmit @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { List list = rentContractInfoService.list(params); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java new file mode 100644 index 0000000..b4a4f1d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentHouseController.java @@ -0,0 +1,89 @@ +package com.epmet.plugin.power.modules.rent.controller; + +import com.alibaba.nacos.client.naming.utils.CollectionUtils; +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.plugin.power.dto.rent.RentHouseDTO; +import com.epmet.plugin.power.modules.rent.excel.RentHouseExcel; +import com.epmet.plugin.power.modules.rent.service.RentHouseService; +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; + + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@RestController +@RequestMapping("rentHouse") +public class RentHouseController { + + @Autowired + private RentHouseService rentHouseService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = rentHouseService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + RentHouseDTO data = rentHouseService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody RentHouseDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + rentHouseService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody RentHouseDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + rentHouseService.update(dto); + return new Result(); + } + + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + rentHouseService.delete(ids); + return new Result(); + } + + @NoRepeatSubmit + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = rentHouseService.list(params); + if(CollectionUtils.isEmpty(list)){ + RentHouseDTO dto = new RentHouseDTO(); + dto.setId(""); + list.add(dto); + } + ExcelUtils.exportExcelToTarget(response, null, list, RentHouseExcel.class); + } + + + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentTenantInfoController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentTenantInfoController.java index 7fdd761..4601409 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentTenantInfoController.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/controller/RentTenantInfoController.java @@ -7,8 +7,8 @@ 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.UpdateGroup; import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; import com.epmet.plugin.power.modules.rent.excel.RentTenantInfoExcel; import com.epmet.plugin.power.modules.rent.service.RentTenantInfoService; @@ -39,6 +39,12 @@ public class RentTenantInfoController { return new Result>().ok(page); } + @RequestMapping("landlord/page") + public Result> page4Landlord(@RequestParam Map params) { + PageData page = rentTenantInfoService.page4Landlord(params); + return new Result>().ok(page); + } + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) public Result get(@PathVariable("id") String id) { RentTenantInfoDTO data = rentTenantInfoService.get(id); @@ -53,6 +59,14 @@ public class RentTenantInfoController { return rentTenantInfoService.save(dto); } + @NoRepeatSubmit + @PostMapping("landlord/review") + public Result review(@RequestBody RentTenantInfoDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + return rentTenantInfoService.review(dto); + } + @NoRepeatSubmit @PostMapping("update") public Result update(@RequestBody RentTenantInfoDTO dto) { @@ -62,7 +76,7 @@ public class RentTenantInfoController { return new Result(); } - @PostMapping("delete") + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) public Result delete(@RequestBody String[] ids) { //效验数据 AssertUtils.isArrayEmpty(ids, "id"); @@ -70,11 +84,11 @@ public class RentTenantInfoController { return new Result(); } + @NoRepeatSubmit @GetMapping("export") public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { List list = rentTenantInfoService.list(params); ExcelUtils.exportExcelToTarget(response, null, list, RentTenantInfoExcel.class); } - } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java new file mode 100644 index 0000000..2975d72 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentHouseDao.java @@ -0,0 +1,16 @@ +package com.epmet.plugin.power.modules.rent.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Mapper +public interface RentHouseDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentTenantInfoDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentTenantInfoDao.java index 29cc2c7..443b2b7 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentTenantInfoDao.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/dao/RentTenantInfoDao.java @@ -1,9 +1,11 @@ package com.epmet.plugin.power.modules.rent.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; import com.epmet.plugin.power.modules.rent.entity.RentTenantInfoEntity; import org.apache.ibatis.annotations.Mapper; +import java.util.List; import java.util.Map; /** @@ -25,4 +27,14 @@ public interface RentTenantInfoDao extends BaseDao { */ void deletePhysical(Map params); + /** + * 查询房东列表 + * + * @param params + * @return java.util.List + * @author zhy + * @date 2022/5/5 13:57 + */ + List getLandlordList(Map params); + } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentBlacklistEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentBlacklistEntity.java index a9bb81e..9f851ae 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentBlacklistEntity.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentBlacklistEntity.java @@ -26,6 +26,11 @@ public class RentBlacklistEntity extends BaseEpmetEntity { */ private String userId; + /** + * epmet网格ID + */ + private String gridId; + /** * 姓名 */ diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractFileEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractFileEntity.java index d423815..1315055 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractFileEntity.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractFileEntity.java @@ -31,9 +31,9 @@ public class RentContractFileEntity extends BaseEpmetEntity { */ private String fileUrl; - /** - * 文件类型 0:图片,1 文件(合同) - */ + /** + * 文件类型 0:图片(人脸/头像),1 文件(合同),2 身份证照片,3 中介资料 + */ private String fileType; /** diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractInfoEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractInfoEntity.java index 11b0433..2230ff3 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractInfoEntity.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentContractInfoEntity.java @@ -106,6 +106,16 @@ public class RentContractInfoEntity extends BaseEpmetEntity { */ private String lessorMobile; + /** + * 出租人与户主关系 + */ + private String lessorRelation; + + /** + * 出租人现居住地址 + */ + private String lessorLiveAddress; + /** * 承租人姓名 */ @@ -121,6 +131,16 @@ public class RentContractInfoEntity extends BaseEpmetEntity { */ private String lesseeMobile; + /** + * 承租人单位 + */ + private String lesseeUnit; + + /** + * 承租人户籍地地址 + */ + private String lesseeHouseAddress; + /** * 签署日期 */ @@ -151,4 +171,9 @@ public class RentContractInfoEntity extends BaseEpmetEntity { */ private String customerId; + /** + * 是否是PC录入(0:否,1:是) + */ + private String isPcInput; + } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java new file mode 100644 index 0000000..9a465d3 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentHouseEntity.java @@ -0,0 +1,160 @@ +package com.epmet.plugin.power.modules.rent.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_rent_house") +public class RentHouseEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 小区id + */ + private String neighborHoodId; + + /** + * 片区id,neighbor_hood_part.id,可为空。 + */ + private String partId; + + /** + * 所属楼栋id + */ + private String buildingId; + + /** + * 所属单元id + */ + private String buildingUnitId; + + /** + * 房屋名字后台插入时生成 + */ + private String houseName; + + /** + * 门牌号 + */ + private String doorName; + + /** + * 房屋类型,1楼房,2平房,3别墅 + */ + private String houseType; + + /** + * 存储字典value + */ + private String purpose; + + /** + * 1:出租 0:自住 2:闲置 + */ + private Integer rentFlag; + + /** + * 房主姓名 + */ + private String ownerName; + + /** + * 房主电话 + */ + private String ownerPhone; + + /** + * 房主身份证号 + */ + private String ownerIdCard; + + /** + * 排序 + */ + private BigDecimal sort; + + /** + * 社区ID + */ + private String communityId; + + /** + * 社区 + */ + private String communityName; + + /** + * 网格ID + */ + private String gridId; + + /** + * 网格 + */ + private String gridName; + + /** + * 房屋小区ID + */ + private String villageId; + + /** + * 房屋小区 + */ + private String villageName; + + /** + * 楼号ID + */ + private String buildId; + + /** + * 楼号 + */ + private String buildName; + + /** + * 单元ID + */ + private String unitId; + + /** + * 单元 + */ + private String unitName; + + /** + * 房屋ID + */ + private String homeId; + + /** + * 房屋 + */ + private String homeName; + + /** + * 购房日期 + */ + private String purchaseDate; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentTenantInfoEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentTenantInfoEntity.java index 5aec950..f235ed5 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentTenantInfoEntity.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/entity/RentTenantInfoEntity.java @@ -54,15 +54,51 @@ public class RentTenantInfoEntity extends BaseEpmetEntity { */ private String type; + /** + * 审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用) + */ + private String state; + + /** + * 审核-原因 + */ + private String reason; + /** * 客户ID */ private String customerId; + /** + * 政治面貌 + */ + private String politicalStatus; + + /** + * 是否服兵役【是:1 否:0】 + */ + private String isMilitary; + + /** + * 国籍 + */ + private String nation; + + /** + * 工作单位 + */ + private String unit; + /** * 头像列表 */ @TableField(exist = false) private List imgList; + /** + * 身份证照片列表 + */ + @TableField(exist = false) + private List idCardImgList; + } diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java new file mode 100644 index 0000000..bea060e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/excel/RentHouseExcel.java @@ -0,0 +1,45 @@ +package com.epmet.plugin.power.modules.rent.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Data +public class RentHouseExcel { + + @Excel(name = "所属小区") + private String villageName; + + @Excel(name = "所属楼栋") + private String buildName; + + @Excel(name = "单元号") + private String unitName; + + @Excel(name = "门牌号") + private String homeName; + + @Excel(name = "类型", replace = {"楼房_1", "平房_2", "别墅_3"}) + private String houseType; + + @Excel(name = "用途", replace = {"住宅_1", "商业_2", "办公_3", "工业_4", "仓储_5", "商住混用_6", "其他_7"}) + private String purpose; + + @Excel(name = "房屋状态", replace = {"出租_1", "闲置_2", "自住_0"}) + private Integer rentFlag; + + @Excel(name = "房主姓名") + private String ownerName; + + @Excel(name = "房主电话") + private String ownerPhone; + + @Excel(name = "房主身份证") + private String ownerIdCard; + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java new file mode 100644 index 0000000..4165a7e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/redis/RentHouseRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.rent.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Component +public class RentHouseRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractFileService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractFileService.java index bb0b789..612e149 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractFileService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractFileService.java @@ -85,4 +85,15 @@ public interface RentContractFileService extends BaseService params); + + /** + * 查出对应资料 + * + * @param referenceId + * @param fileType + * @return java.util.List + * @author zhy + * @date 2022/5/17 20:31 + */ + List listByRefAndType(String referenceId, String fileType); } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java index 5a552ea..c776310 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentContractInfoService.java @@ -55,7 +55,17 @@ public interface RentContractInfoService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-05-11 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-05-11 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return RentHouseDTO + * @author generator + * @date 2022-05-11 + */ + RentHouseDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-11 + */ + void save(RentHouseDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-05-11 + */ + void update(RentHouseDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-05-11 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentTenantInfoService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentTenantInfoService.java index bbe0401..1b3fa25 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentTenantInfoService.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/RentTenantInfoService.java @@ -27,6 +27,16 @@ public interface RentTenantInfoService extends BaseService */ PageData page(Map params); + /** + * 房东分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-04-22 + */ + PageData page4Landlord(Map params); + /** * 默认查询 * @@ -48,7 +58,7 @@ public interface RentTenantInfoService extends BaseService RentTenantInfoDTO get(String id); /** - * 默认保存 + * 默认保存-房东信息 * * @param dto * @return void @@ -57,6 +67,16 @@ public interface RentTenantInfoService extends BaseService */ Result save(RentTenantInfoDTO dto); + /** + * 审核 + * + * @param dto + * @return void + * @author generator + * @date 2022-04-22 + */ + Result review(RentTenantInfoDTO dto); + /** * 默认更新 * @@ -86,4 +106,5 @@ public interface RentTenantInfoService extends BaseService * @date 2022/4/24 14:08 */ void deletePhysical(Map params); + } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java index 8a2c413..bca0d53 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentBlacklistServiceImpl.java @@ -43,10 +43,11 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl page(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) @@ -56,6 +57,7 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl list(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, RentBlacklistDTO.class); @@ -68,6 +70,7 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -76,6 +79,7 @@ public class RentBlacklistServiceImpl extends BaseServiceImpl params = new HashMap<>(4); params.put("idCard", dto.getIdCard()); if (!list(params).isEmpty()) { diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractFileServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractFileServiceImpl.java index e362927..dffa8a0 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractFileServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractFileServiceImpl.java @@ -17,6 +17,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Arrays; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -96,4 +97,11 @@ public class RentContractFileServiceImpl extends BaseServiceImpl listByRefAndType(String referenceId, String fileType) { + Map params = new HashMap<>(4); + params.put("referenceId", referenceId); + params.put("fileType", fileType); + return list(params); + } } \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java index 6db1756..b8f74a7 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentContractInfoServiceImpl.java @@ -13,14 +13,24 @@ import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.IdCardNoValidatorUtils; import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.IcHouseDTO; import com.epmet.dto.IcResiUserAttachmentDTO; import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.form.IcHouseAddFormDTO; import com.epmet.dto.form.RentTenantFormDTO; import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.plugin.power.dto.hik.HikCommunityInfoDTO; +import com.epmet.plugin.power.dto.hik.HikDeviceInfoDTO; +import com.epmet.plugin.power.dto.hik.HikErrorInfoDTO; +import com.epmet.plugin.power.dto.hik.form.HikAuthorityFormDTO; +import com.epmet.plugin.power.dto.hik.form.HikPersonFormDTO; import com.epmet.plugin.power.dto.rent.RentContractFileDTO; import com.epmet.plugin.power.dto.rent.RentContractInfoDTO; import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; +import com.epmet.plugin.power.modules.hik.service.HikCommunityInfoService; +import com.epmet.plugin.power.modules.hik.service.HikDeviceInfoService; +import com.epmet.plugin.power.modules.hik.service.HikErrorInfoService; import com.epmet.plugin.power.modules.rent.dao.RentContractInfoDao; import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity; import com.epmet.plugin.power.modules.rent.entity.RentContractInfoEntity; @@ -29,6 +39,7 @@ import com.epmet.plugin.power.modules.rent.redis.RentContractInfoRedis; import com.epmet.plugin.power.modules.rent.service.RentContractFileService; import com.epmet.plugin.power.modules.rent.service.RentContractInfoService; import com.epmet.plugin.power.modules.rent.service.RentTenantInfoService; +import com.epmet.plugin.power.modules.utils.HkDeviceUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -50,7 +61,10 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl page(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); + if (StringUtils.isNotBlank((String) params.get("dataFlag"))) { + params.put("createdBy", loginUserUtil.getLoginUserId()); + } IPage page = getPage(params); List list = baseDao.getContractInfoList(params); return new PageData<>(list, page.getTotal()); - } @Override public List list(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, RentContractInfoDTO.class); @@ -93,10 +120,14 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); @@ -112,8 +143,12 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl params = new HashMap<>(4); params.put("contractId", id); - - // 取出租客信息 List tenantList = rentTenantInfoService.list(params); tenantList.forEach(item -> { // 租客信息补充照片信息 - params.put("referenceId", item.getId()); - params.put("fileType", NumConstant.ZERO_STR); - List imgList = rentContractFileService.list(params); - item.setImgList(imgList); + item.setImgList(rentContractFileService.listByRefAndType(item.getId(), NumConstant.ZERO_STR)); + // 租客信息补充身份证照片信息 + item.setIdCardImgList(rentContractFileService.listByRefAndType(item.getId(), NumConstant.TWO_STR)); }); dto.setTenantList(tenantList); dto.setTenantNum(tenantList.size()); - params.put("referenceId", dto.getId()); - params.put("fileType", NumConstant.ONE_STR); // 取出合同文件信息 - List fileList = rentContractFileService.list(params); - dto.setFileList(fileList); + dto.setFileList(rentContractFileService.listByRefAndType(dto.getId(), NumConstant.ONE_STR)); + dto.setAgencyImgList(rentContractFileService.listByRefAndType(dto.getId(), NumConstant.THREE_STR)); return dto; } @Override @Transactional(rollbackFor = Exception.class) - public Result save(RentContractInfoDTO dto) { + public void save(RentContractInfoDTO dto) { RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class); entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); insert(entity); - return updateTenantAndFile(entity.getId(), dto); + // 处理租客信息和合同信息 + updateTenantAndFile(entity.getId(), dto); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void savePc(RentContractInfoDTO dto) { + // PC 端新增,默认审核通过(0:待审核;1:通过;2:不通过) + dto.setState("1"); + // 是否是 PC 录入(0:否,1:是) + dto.setIsPcInput("1"); + + RentContractInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentContractInfoEntity.class); + entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + + insert(entity); + // 处理租客信息和合同信息 + updateTenantAndFile(entity.getId(), dto); + + // PC新增,默认审核通过,需要更新基础库头像信息以及居民信息,最后更新房屋的状态 + if (NumConstant.ONE_STR.equals(entity.getState())) { + // 获取基本信息 + RentContractInfoDTO contractDto = get(entity.getId()); + + // 获取租客信息 + Map tenantParams = new HashMap<>(4); + tenantParams.put("contractId", contractDto.getId()); + List tenantList = rentTenantInfoService.list(tenantParams); + + tenantList.forEach(tenant -> { + RentTenantFormDTO formDTO = new RentTenantFormDTO(); + List images = new ArrayList<>(); + formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + formDTO.setIdCard(tenant.getIdCard()); + formDTO.setType(NumConstant.ONE_STR); + + List imgList = rentContractFileService.listByRefAndType(tenant.getId(), NumConstant.ZERO_STR); + + imgList.forEach(img -> { + // 更新基础库的人员头像 + IcResiUserAttachmentDTO image = new IcResiUserAttachmentDTO(); + image.setAttachmentUrl(img.getFileUrl()); + image.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + images.add(image); + }); + formDTO.setImages(images); + + // 初始化居民信息 + IcResiUserDTO user = new IcResiUserDTO(); + user.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + user.setGridId(contractDto.getGridId()); + user.setVillageId(contractDto.getVillageId()); + user.setBuildId(contractDto.getBuildId()); + user.setUnitId(contractDto.getUnitId()); + user.setHomeId(contractDto.getHomeId()); + user.setName(tenant.getName()); + user.setIdCard(tenant.getIdCard()); + user.setMobile(tenant.getMobile()); + user.setGender(IdCardNoValidatorUtils.getGender(tenant.getIdCard())); + + user.setAgencyId(contractDto.getCommunityId()); + Result agencyInfo = govOrgOpenFeignClient.getAgencyById(contractDto.getCommunityId()); + user.setPids(agencyInfo.getData().getPids()); + + formDTO.setUser(user); + + epmetUserOpenFeignClient.updateImage(formDTO); + + }); + + // 更新房屋的状态为租赁 + Result houseInfo = govOrgOpenFeignClient.get(dto.getHomeId()); + IcHouseAddFormDTO formDTO = ConvertUtils.sourceToTarget(houseInfo.getData(), IcHouseAddFormDTO.class); + formDTO.setRentFlag(NumConstant.ONE); + formDTO.setHouseId(dto.getHomeId()); + govOrgOpenFeignClient.houseUpdate(formDTO); + } + } @Override @@ -162,7 +270,7 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl imgParams = new HashMap<>(4); - imgParams.put("referenceId", tenant.getId()); - imgParams.put("fileType", NumConstant.ZERO_STR); - List imgList = rentContractFileService.list(imgParams); + List imgList = rentContractFileService.listByRefAndType(tenant.getId(), NumConstant.ZERO_STR); imgList.forEach(img -> { // 更新基础库的人员头像 @@ -215,9 +320,77 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl houseInfo = govOrgOpenFeignClient.get(dto.getHomeId()); + IcHouseAddFormDTO formDTO = ConvertUtils.sourceToTarget(houseInfo.getData(), IcHouseAddFormDTO.class); + formDTO.setRentFlag(NumConstant.ONE); + formDTO.setHouseId(dto.getHomeId()); + govOrgOpenFeignClient.houseUpdate(formDTO); } } + @Override + @Transactional(rollbackFor = Exception.class) + public void send(RentContractInfoDTO info) { + RentContractInfoDTO dto = get(info.getId()); + dto.getTenantList().forEach(item -> { + try { + Map delParams = new HashMap<>(); + delParams.put("idCard", item.getIdCard()); + hikErrorInfoService.deletePhysical(delParams); + + HikPersonFormDTO person = new HikPersonFormDTO(); + person.setFaceUrl(item.getImgList().get(0).getFileUrl()); + person.setMobile(item.getMobile()); + person.setCredentialType(NumConstant.ONE); + person.setCredentialNumber(item.getIdCard()); + person.setPersonName(item.getName()); + person.setGender(NumConstant.ONE_NEG); + String personId = hkDeviceUtil.sendPerson(person); + + if (StringUtils.isNotBlank(personId)) { + HikAuthorityFormDTO authority = new HikAuthorityFormDTO(); + authority.setPersonType(NumConstant.ONE); + authority.setPersonId(personId); + + Map communityParams = new HashMap<>(4); + communityParams.put("communityName", dto.getVillageName()); + List communityList = hikCommunityInfoService.list(communityParams); + + communityList.forEach(community -> { + authority.setCommunityId(community.getCommunityId()); + + Map deviceParams = new HashMap<>(4); + deviceParams.put("communityId", community.getCommunityId()); + List deviceList = hikDeviceInfoService.list(deviceParams); + + deviceList.forEach(device -> { + authority.setDeviceId(device.getDeviceId()); + + hkDeviceUtil.authorityIssued(authority); + }); + }); + } + } catch (EpmetException e) { + HikErrorInfoDTO error = new HikErrorInfoDTO(); + error.setIdCard(item.getIdCard()); + error.setErrorInfo(e.getMessage()); + error.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + error.setReferenceId(dto.getId()); + hikErrorInfoService.save(error); + } + }); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void resend(String id) { + HikErrorInfoDTO errorDto = hikErrorInfoService.get(id); + RentContractInfoDTO dto = get(errorDto.getReferenceId()); + send(dto); + } + @Override @Transactional(rollbackFor = Exception.class) public void update(RentContractInfoDTO dto) { @@ -226,6 +399,14 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl params = new HashMap<>(8); params.put("contractId", contractId); params.put("referenceId", contractId); @@ -242,12 +423,12 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl tenantList = ConvertUtils.sourceToTarget(dto.getTenantList(), RentTenantInfoEntity.class); long idCardNum = tenantList.stream().map(RentTenantInfoEntity::getIdCard).collect(Collectors.toList()).stream().distinct().count(); if (tenantList.size() != idCardNum) { - return new Result().error("租客身份证重复"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客身份证重复"); } tenantList.forEach(tenant -> { @@ -256,13 +437,17 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl { if (null == tenant.getImgList() || tenant.getImgList().isEmpty()) { throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "租客照片不能为空"); @@ -275,11 +460,23 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl idCardImgList = ConvertUtils.sourceToTarget(tenant.getIdCardImgList(), RentContractFileEntity.class); + idCardImgList.forEach(img -> { + img.setReferenceId(tenant.getId()); + img.setFileType(NumConstant.TWO_STR); + img.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + }); + rentContractFileService.insertBatch(idCardImgList); + } }); } + // 附件处理 if (null == dto.getFileList() || dto.getFileList().isEmpty()) { - return new Result().error("合同附件不能为空"); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "合同附件不能为空"); } else { List fileList = ConvertUtils.sourceToTarget(dto.getFileList(), RentContractFileEntity.class); fileList.forEach(item -> { @@ -289,7 +486,17 @@ public class RentContractInfoServiceImpl extends BaseServiceImpl 0) { + List fileList = ConvertUtils.sourceToTarget(dto.getAgencyImgList(), RentContractFileEntity.class); + fileList.forEach(item -> { + item.setReferenceId(contractId); + item.setFileType(NumConstant.THREE_STR); + item.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + }); + rentContractFileService.insertBatch(fileList); + } } -} \ No newline at end of file +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java new file mode 100644 index 0000000..c806972 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentHouseServiceImpl.java @@ -0,0 +1,129 @@ +package com.epmet.plugin.power.modules.rent.service.impl; + +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.FieldConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.security.user.LoginUserUtil; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.dto.form.IcHouseAddFormDTO; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.plugin.power.dto.rent.RentHouseDTO; +import com.epmet.plugin.power.modules.rent.dao.RentHouseDao; +import com.epmet.plugin.power.modules.rent.entity.RentHouseEntity; +import com.epmet.plugin.power.modules.rent.redis.RentHouseRedis; +import com.epmet.plugin.power.modules.rent.service.RentHouseService; +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.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 房屋信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-11 + */ +@Service +public class RentHouseServiceImpl extends BaseServiceImpl implements RentHouseService { + + @Autowired + private RentHouseRedis rentHouseRedis; + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Autowired + private LoginUserUtil loginUserUtil; + + @Override + public PageData page(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, RentHouseDTO.class); + } + + @Override + public List list(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, RentHouseDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + String gridId = (String) params.get("gridId"); + String villageId = (String) params.get("villageId"); + String buildId = (String) params.get("buildId"); + String unitId = (String) params.get("unitId"); + String homeId = (String) params.get("homeId"); + String ownerName = (String) params.get("ownerName"); + String ownerPhone = (String) params.get("ownerPhone"); + String ownerIdCard = (String) params.get("ownerIdCard"); + String rentFlag = (String) params.get("rentFlag"); + String startTime = (String) params.get("startTime"); + String endTime = (String) params.get("endTime"); + String customerId = (String) params.get("customerId"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(StringUtils.isNotBlank(gridId), "GRID_ID", gridId); + wrapper.eq(StringUtils.isNotBlank(villageId), "VILLAGE_ID", villageId); + wrapper.eq(StringUtils.isNotBlank(buildId), "BUILD_ID", buildId); + wrapper.eq(StringUtils.isNotBlank(unitId), "UNIT_ID", unitId); + wrapper.eq(StringUtils.isNotBlank(homeId), "HOME_ID", homeId); + wrapper.eq(StringUtils.isNotBlank(ownerName), "OWNER_NAME", ownerName); + wrapper.eq(StringUtils.isNotBlank(ownerPhone), "OWNER_PHONE", ownerPhone); + wrapper.eq(StringUtils.isNotBlank(ownerIdCard), "OWNER_ID_CARD", ownerIdCard); + wrapper.eq(StringUtils.isNotBlank(rentFlag), "RENT_FLAG", rentFlag); + wrapper.ge(StringUtils.isNotBlank(startTime), "PURCHASE_DATE", startTime); + wrapper.le(StringUtils.isNotBlank(endTime), "PURCHASE_DATE", endTime); + wrapper.eq(StringUtils.isNotBlank(customerId), "CUSTOMER_ID", customerId); + + return wrapper; + } + + @Override + public RentHouseDTO get(String id) { + RentHouseEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, RentHouseDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(RentHouseDTO dto) { + RentHouseEntity entity = ConvertUtils.sourceToTarget(dto, RentHouseEntity.class); + insert(entity); + + // 更新房屋的租赁状态 + if (dto.getNeedUpdate()) { + IcHouseAddFormDTO formDTO = ConvertUtils.sourceToTarget(dto, IcHouseAddFormDTO.class); + formDTO.setHouseId(dto.getHomeId()); + govOrgOpenFeignClient.houseUpdate(formDTO); + } + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(RentHouseDTO dto) { + RentHouseEntity entity = ConvertUtils.sourceToTarget(dto, RentHouseEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java index 80eb329..1dfbd9e 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/rent/service/impl/RentTenantInfoServiceImpl.java @@ -12,6 +12,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.IcResiUserAttachmentDTO; import com.epmet.dto.form.RentTenantFormDTO; import com.epmet.feign.EpmetUserOpenFeignClient; +import com.epmet.plugin.power.dto.rent.RentContractFileDTO; import com.epmet.plugin.power.dto.rent.RentTenantInfoDTO; import com.epmet.plugin.power.modules.rent.dao.RentTenantInfoDao; import com.epmet.plugin.power.modules.rent.entity.RentContractFileEntity; @@ -39,7 +40,7 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl page(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); IPage page = baseDao.selectPage( getPage(params, FieldConstant.CREATED_TIME, false), getWrapper(params) @@ -56,8 +58,17 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl page4Landlord(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); + IPage page = getPage(params); + List list = baseDao.getLandlordList(params); + return new PageData<>(list, page.getTotal()); + } + @Override public List list(Map params) { + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); List entityList = baseDao.selectList(getWrapper(params)); return ConvertUtils.sourceToTarget(entityList, RentTenantInfoDTO.class); @@ -68,20 +79,39 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl wrapper = new QueryWrapper<>(); wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); wrapper.eq(StringUtils.isNotBlank(contractId), "CONTRACT_ID", contractId); wrapper.eq(StringUtils.isNotBlank(idCard), "ID_CARD", idCard); wrapper.eq(StringUtils.isNotBlank(type), "TYPE", type); + wrapper.eq(StringUtils.isNotBlank(state), "STATE", state); + wrapper.eq(StringUtils.isNotBlank(customerId), "CUSTOMER_ID", customerId); return wrapper; } @Override public RentTenantInfoDTO get(String id) { + RentTenantInfoDTO dto; RentTenantInfoEntity entity = baseDao.selectById(id); - return ConvertUtils.sourceToTarget(entity, RentTenantInfoDTO.class); + dto = ConvertUtils.sourceToTarget(entity, RentTenantInfoDTO.class); + // 补充照片信息 + Map params = new HashMap<>(4); + params.put("referenceId", id); + params.put("fileType", NumConstant.ZERO_STR); + List imgList = rentContractFileService.list(params); + dto.setImgList(imgList); + // 补充身份证照片信息 + params = new HashMap<>(4); + params.put("referenceId", id); + params.put("fileType", NumConstant.TWO_STR); + List idCardImgList = rentContractFileService.list(params); + dto.setIdCardImgList(idCardImgList); + + return dto; } @Override @@ -89,17 +119,22 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl params = new HashMap<>(4); params.put("idCard", dto.getIdCard()); + params.put("state", NumConstant.ONE_STR); + params.put("customerId", loginUserUtil.getLoginUserCustomerId()); if (!list(params).isEmpty()) { - return new Result().error("用户已存在"); + return new Result().error("提交失败,用户已通过审核"); } - List images = new ArrayList<>(); +// List images = new ArrayList<>(); // 处理头像 if (null == dto.getImgList() || dto.getImgList().isEmpty()) { return new Result().error("照片不能为空"); + } else if (null == dto.getIdCardImgList() || dto.getIdCardImgList().isEmpty()) { + return new Result().error("身份证照片不能为空"); } else { RentTenantInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentTenantInfoEntity.class); entity.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + entity.setState(NumConstant.ZERO_STR); insert(entity); List imgList = ConvertUtils.sourceToTarget(dto.getImgList(), RentContractFileEntity.class); @@ -108,16 +143,65 @@ public class RentTenantInfoServiceImpl extends BaseServiceImpl idCardImgList = ConvertUtils.sourceToTarget(dto.getIdCardImgList(), RentContractFileEntity.class); + idCardImgList.forEach(img -> { + img.setReferenceId(entity.getId()); + img.setFileType(NumConstant.TWO_STR); + img.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + }); + rentContractFileService.insertBatch(idCardImgList); + +// // 如果是房东信息立马去更新照片 +// if (NumConstant.ZERO_STR.equals(dto.getType())) { +// RentTenantFormDTO formDTO = new RentTenantFormDTO(); +// formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); +// formDTO.setIdCard(dto.getIdCard()); +// formDTO.setImages(images); +// formDTO.setType(dto.getType()); +// epmetUserOpenFeignClient.updateImage(formDTO); +// } + } + return new Result(); + } + + + @Override + @Transactional(rollbackFor = Exception.class) + public Result review(RentTenantInfoDTO dto) { + Map params = new HashMap<>(4); + params.put("idCard", dto.getIdCard()); + params.put("state", NumConstant.ONE_STR); + if (!list(params).isEmpty()) { + return new Result().error("用户已通过审核"); + } + + List images = new ArrayList<>(); + // 处理头像 + if (null == dto.getImgList() || dto.getImgList().isEmpty()) { + return new Result().error("照片不能为空"); + } else { + RentTenantInfoEntity entity = ConvertUtils.sourceToTarget(dto, RentTenantInfoEntity.class); + updateById(entity); + + // 如果是房东信息通过了审核,立马去更新照片 + if (NumConstant.ZERO_STR.equals(dto.getType()) && NumConstant.ONE_STR.equals(dto.getState())) { + List imgList = ConvertUtils.sourceToTarget(dto.getImgList(), RentContractFileEntity.class); + imgList.forEach(img -> { + // 更新基础库的人员头像 + IcResiUserAttachmentDTO image = new IcResiUserAttachmentDTO(); + image.setAttachmentUrl(img.getFileUrl()); + image.setCustomerId(loginUserUtil.getLoginUserCustomerId()); + images.add(image); + }); + RentTenantFormDTO formDTO = new RentTenantFormDTO(); formDTO.setCustomerId(loginUserUtil.getLoginUserCustomerId()); formDTO.setIdCard(dto.getIdCard()); diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/utils/.gitkeep b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/utils/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/utils/HkDeviceUtil.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/utils/HkDeviceUtil.java new file mode 100644 index 0000000..fd9689b --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/utils/HkDeviceUtil.java @@ -0,0 +1,148 @@ +package com.epmet.plugin.power.modules.utils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.commons.redis.RedisKeys; +import com.epmet.plugin.power.config.HikCloudProperties; +import com.epmet.plugin.power.dto.hik.form.HikAuthorityFormDTO; +import com.epmet.plugin.power.dto.hik.form.HikPersonFormDTO; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.HashMap; +import java.util.Map; + +/** + * 海康设备下放命令 + * + * @author zhy + * @date 2022/5/20 9:36 + */ +@Component +public class HkDeviceUtil { + private static Logger logger = LoggerFactory.getLogger(HkDeviceUtil.class); + + @Autowired + private HikCloudProperties hikCloudProperties; + + @Autowired + private RedisUtils redisUtils; + + private final String GET_ACCESS_TOKEN = "/oauth/token"; + private final String GET_DEVICES = "/api/v1/estate/devices"; + private final String SEND_PERSON = "/api/v1/estate/system/person"; + private final String ISSUE_AUTHORITY = "/api/v1/estate/entranceGuard/permissions/actions/authorityIssued"; + + private final String GRANT_TYPE = "client_credentials"; + + /** + * 获取accessToken + * + * @param + * @return void + * @author zhy + * @date 2022/5/20 16:40 + */ + public String getAccessToken() { + String key = RedisKeys.getHikTokenKey(); + Object obj = redisUtils.get(key); + if (null != obj) { + return (String) obj; + } + + String url = hikCloudProperties.getUrl().concat(GET_ACCESS_TOKEN); + Map paramsMap = new HashMap<>(8); + paramsMap.put("client_id", hikCloudProperties.getClient()); + paramsMap.put("client_secret", hikCloudProperties.getSecret()); + paramsMap.put("grant_type", GRANT_TYPE); +// paramsMap.put("scope", "app"); + + String data = HttpClientManager.getInstance().sendPost(url, paramsMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "AccessToken获取失败"); + } + + JSONObject toResult = JSON.parseObject(data); + if (!toResult.containsKey("access_token")) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "AccessToken获取失败"); + } + String accessToken = "Bearer ".concat(toResult.get("access_token").toString()); + + redisUtils.set(key, accessToken, RedisUtils.HOUR_ONE_EXPIRE); + return accessToken; + } + + /** + * 下发人员 + * + * @param dto + * @return java.lang.String 人员ID + * @author zhy + * @date 2022/5/23 10:08 + */ + public String sendPerson(HikPersonFormDTO dto) { + String url = hikCloudProperties.getUrl().concat(SEND_PERSON); + + Map paramsMap = new HashMap<>(4); + paramsMap.put("Authorization", getAccessToken()); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员信息下发失败"); + } + JSONObject toResult = JSON.parseObject(data); + Result result = ConvertUtils.mapToEntity(toResult, Result.class); + if (null != toResult.get("code")) { + result.setCode(((Integer) toResult.get("code")).intValue()); + } + if (NumConstant.TWO_HUNDRED != result.getCode()) { + logger.info(result.getMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员信息下发失败"); + } + Object registerResult = result.getData(); + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + return jsonObject.getString("personId"); + } + + /** + * 下发人员权限 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public String authorityIssued(HikAuthorityFormDTO dto) { + String url = hikCloudProperties.getUrl().concat(ISSUE_AUTHORITY); + + Map paramsMap = new HashMap<>(4); + paramsMap.put("Authorization", getAccessToken()); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员权限下发失败"); + } + JSONObject toResult = JSON.parseObject(data); + Result result = ConvertUtils.mapToEntity(toResult, Result.class); + if (null != toResult.get("code")) { + result.setCode(((Integer) toResult.get("code")).intValue()); + } + if (NumConstant.TWO_HUNDRED != result.getCode()) { + logger.info(result.getMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员权限下发失败"); + } + return "success"; + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java new file mode 100644 index 0000000..000175a --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/controller/VisitVisitorController.java @@ -0,0 +1,111 @@ +package com.epmet.plugin.power.modules.visit.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +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.plugin.power.dto.visit.VisitVisitorDTO; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitorLogoutFormDTO; +import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; +import com.epmet.plugin.power.modules.visit.excel.VisitVisitorExcel; +import com.epmet.plugin.power.modules.visit.service.VisitVisitorService; +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; + + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@RestController +@RequestMapping("visitVisitor") +public class VisitVisitorController { + + @Autowired + private VisitVisitorService visitVisitorService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params) { + PageData page = visitVisitorService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}", method = {RequestMethod.POST, RequestMethod.GET}) + public Result get(@PathVariable("id") String id) { + VisitVisitorDTO data = visitVisitorService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody VisitVisitorDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + visitVisitorService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody VisitVisitorDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + visitVisitorService.update(dto); + return new Result(); + } + + @RequestMapping(value = "delete", method = {RequestMethod.POST, RequestMethod.DELETE}) + public Result delete(@RequestBody String[] ids) { + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + visitVisitorService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = visitVisitorService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, VisitVisitorExcel.class); + } + + @NoRepeatSubmit + @PostMapping("visit") + public Result visit(@RequestBody VisitVisitorFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + visitVisitorService.visit(dto); + visitVisitorService.doorAuthority(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("logout") + public Result logout(@RequestBody VisitorLogoutFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("chart/traffic") + public Result> getTraffic(@RequestBody VisitVisitorChartFormDTO dto) { + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + return new Result>().ok(visitVisitorService.getTraffic(dto)); + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java new file mode 100644 index 0000000..11c10b9 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/dao/VisitVisitorDao.java @@ -0,0 +1,29 @@ +package com.epmet.plugin.power.modules.visit.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; +import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; +import com.epmet.plugin.power.modules.visit.entity.VisitVisitorEntity; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Mapper +public interface VisitVisitorDao extends BaseDao { + + /** + * 人流量 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + List getTraffic(VisitVisitorChartFormDTO dto); +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/entity/VisitVisitorEntity.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/entity/VisitVisitorEntity.java new file mode 100644 index 0000000..0c31c8d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/entity/VisitVisitorEntity.java @@ -0,0 +1,134 @@ +package com.epmet.plugin.power.modules.visit.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("pli_visit_visitor") +public class VisitVisitorEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 姓名 + */ + private String name; + + /** + * 身份证 + */ + private String idCard; + + /** + * 性别 + */ + private String gender; + + /** + * 手机号 + */ + private String mobile; + + /** + * 人员类型 0:访客 1:租客 + */ + private String type; + + /** + * 审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用) + */ + private String state; + + /** + * 审核原因 + */ + private String reason; + + /** + * 客户ID + */ + private String customerId; + + /** + * 来访事由 + */ + private String visitReason; + + /** + * 头像 + */ + private String faceImg; + + /** + * 小区 + */ + private String residential; + + /** + * 楼栋 + */ + private String building; + + /** + * 单元 + */ + private String unit; + + /** + * 房屋 + */ + private String room; + + /** + * 组织id + */ + private String agencyId; + + /** + * 上级组织id + */ + private String parentAgencyId; + + /** + * 组织的所有上级组织id + */ + private String agencyPids; + + /** + * 网格id + */ + private String gridId; + + /** + * 小区ID + */ + private String neighborhoodId; + + /** + * 楼栋ID + */ + private String buildingId; + + /** + * 单元ID + */ + private String unitId; + + /** + * 房屋ID + */ + private String houseId; + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/excel/VisitVisitorExcel.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/excel/VisitVisitorExcel.java new file mode 100644 index 0000000..5812052 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/excel/VisitVisitorExcel.java @@ -0,0 +1,81 @@ +package com.epmet.plugin.power.modules.visit.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Data +public class VisitVisitorExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "姓名") + private String name; + + @Excel(name = "身份证") + private String idCard; + + @Excel(name = "性别") + private String gender; + + @Excel(name = "手机号") + private String mobile; + + @Excel(name = "人员类型 0:访客 1:租客") + private String type; + + @Excel(name = "审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用)") + private String state; + + @Excel(name = "审核原因") + private String reason; + + @Excel(name = "删除标记 0:未删除,1:已删除") + private String delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "来访事由") + private String visitReason; + + @Excel(name = "头像") + private String faceImg; + + @Excel(name = "小区") + private String residential; + + @Excel(name = "楼栋") + private String building; + + @Excel(name = "单元") + private String unit; + + @Excel(name = "房屋") + private String room; + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/redis/VisitVisitorRedis.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/redis/VisitVisitorRedis.java new file mode 100644 index 0000000..0472c16 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/redis/VisitVisitorRedis.java @@ -0,0 +1,30 @@ +package com.epmet.plugin.power.modules.visit.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Component +public class VisitVisitorRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java new file mode 100644 index 0000000..5451f38 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/VisitVisitorService.java @@ -0,0 +1,113 @@ +package com.epmet.plugin.power.modules.visit.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.plugin.power.dto.visit.VisitVisitorDTO; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorFormDTO; +import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; +import com.epmet.plugin.power.modules.visit.entity.VisitVisitorEntity; + +import java.util.List; +import java.util.Map; + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +public interface VisitVisitorService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-07-26 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-07-26 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return VisitVisitorDTO + * @author generator + * @date 2022-07-26 + */ + VisitVisitorDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + void save(VisitVisitorDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + void update(VisitVisitorDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-07-26 + */ + void delete(String[] ids); + + /** + * 访客来访 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + void visit(VisitVisitorFormDTO dto); + + /** + * 临时授权 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + void doorAuthority(VisitVisitorFormDTO dto); + + /** + * 人流量 + * + * @param dto + * @return void + * @author generator + * @date 2022-07-26 + */ + List getTraffic(VisitVisitorChartFormDTO dto); + + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java new file mode 100644 index 0000000..c769496 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/service/impl/VisitVisitorServiceImpl.java @@ -0,0 +1,184 @@ +package com.epmet.plugin.power.modules.visit.service.impl; + +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.FieldConstant; +import com.epmet.commons.tools.constant.NumConstant; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.IcNeighborHoodDTO; +import com.epmet.feign.GovOrgOpenFeignClient; +import com.epmet.plugin.power.dto.visit.VisitVisitorDTO; +import com.epmet.plugin.power.dto.visit.form.DhPersonFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorChartFormDTO; +import com.epmet.plugin.power.dto.visit.form.VisitVisitorFormDTO; +import com.epmet.plugin.power.dto.visit.result.VisitVisitorChartResultDTO; +import com.epmet.plugin.power.modules.visit.dao.VisitVisitorDao; +import com.epmet.plugin.power.modules.visit.entity.VisitVisitorEntity; +import com.epmet.plugin.power.modules.visit.redis.VisitVisitorRedis; +import com.epmet.plugin.power.modules.visit.service.VisitVisitorService; +import com.epmet.plugin.power.modules.visit.utils.DhDeviceUtil; +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.time.LocalDate; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 租客表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-07-26 + */ +@Service +public class VisitVisitorServiceImpl extends BaseServiceImpl implements VisitVisitorService { + + @Autowired + private VisitVisitorRedis visitVisitorRedis; + + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + + @Autowired + private DhDeviceUtil dhDeviceUtil; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, VisitVisitorDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, VisitVisitorDTO.class); + } + + private QueryWrapper getWrapper(Map params) { + String id = (String) params.get(FieldConstant.ID_HUMP); + String idCard = (String) params.get("idCard"); + String name = (String) params.get("name"); + String mobile = (String) params.get("mobile"); + String neighborhoodId = (String) params.get("neighborhoodId"); + String buildingId = (String) params.get("buildingId"); + String unitId = (String) params.get("unitId"); + String houseId = (String) params.get("houseId"); + String startTime = (String) params.get("startTime"); + String endTime = (String) params.get("endTime"); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + wrapper.eq(StringUtils.isNotBlank(idCard), "ID_CARD", idCard); + wrapper.eq(StringUtils.isNotBlank(name), "NAME", name); + wrapper.eq(StringUtils.isNotBlank(mobile), "MOBILE", mobile); + wrapper.eq(StringUtils.isNotBlank(neighborhoodId), "NEIGHBORHOOD_ID", neighborhoodId); + wrapper.eq(StringUtils.isNotBlank(buildingId), "BUILDING_ID", buildingId); + wrapper.eq(StringUtils.isNotBlank(unitId), "UNIT_ID", unitId); + wrapper.eq(StringUtils.isNotBlank(houseId), "HOUSE_ID", houseId); + wrapper.gt(StringUtils.isNotBlank(startTime), "CREATED_TIME", startTime); + wrapper.lt(StringUtils.isNotBlank(endTime), "CREATED_TIME", endTime); + + return wrapper; + } + + @Override + public VisitVisitorDTO get(String id) { + VisitVisitorEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, VisitVisitorDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(VisitVisitorDTO dto) { + VisitVisitorEntity entity = ConvertUtils.sourceToTarget(dto, VisitVisitorEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(VisitVisitorDTO dto) { + VisitVisitorEntity entity = ConvertUtils.sourceToTarget(dto, VisitVisitorEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void visit(VisitVisitorFormDTO dto) { + VisitVisitorEntity entity = ConvertUtils.sourceToTarget(dto, VisitVisitorEntity.class); + Result result = govOrgOpenFeignClient.getIcNeighbordhoodById(dto.getNeighborhoodId()); + if (result.success()) { + entity.setResidential(result.getData().getNeighborHoodName()); + entity.setGridId(result.getData().getGridId()); + entity.setAgencyId(result.getData().getAgencyId()); + entity.setParentAgencyId(result.getData().getParentAgencyId()); + entity.setAgencyPids(result.getData().getAgencyPids()); + } + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void doorAuthority(VisitVisitorFormDTO dto) { + sendAuth(dto); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public List getTraffic(VisitVisitorChartFormDTO dto) { + if (StringUtils.isBlank(dto.getDate())) { + dto.setDate(LocalDate.now().toString()); + } + return baseDao.getTraffic(dto); + } + + /** + * 设备下发 + * + * @param dto + * @return void + * @author zhy + * @date 2022/7/28 9:13 + */ + private void sendAuth(VisitVisitorFormDTO dto) { + DhPersonFormDTO formDTO = new DhPersonFormDTO(); + formDTO.setPaperType("身份证"); + formDTO.setPaperNumber(dto.getIdCard()); + formDTO.setName(dto.getName()); + formDTO.setCode(dto.getIdCard().substring(dto.getIdCard().length() - 10)); + formDTO.setSex(NumConstant.ZERO_STR.equals(dto.getGender()) ? "女" : "男"); + formDTO.setBirthday(dto.getIdCard().substring(6, 10) + "-" + dto.getIdCard().substring(10, 12) + "-" + dto.getIdCard().substring(12, 14)); + formDTO.setPhone(dto.getMobile()); + formDTO.setStatus("在职"); + dhDeviceUtil.addPersonAuth(formDTO, dto.getFaceImg()); + } + + /** + * 删除权限 + * + * @param idCard + * @return void + * @author zhy + * @date 2022/7/28 9:13 + */ + private void delAuth(String idCard) { + dhDeviceUtil.dataHandle(idCard.substring(idCard.length() - 10)); + } + +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/Base64Util.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/Base64Util.java new file mode 100644 index 0000000..6a3cd94 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/Base64Util.java @@ -0,0 +1,768 @@ +package com.epmet.plugin.power.modules.visit.utils; + + +import java.math.BigInteger; + +/** + * Provides Base64 encoding and decoding as defined by RFC 2045. + * + *

+ * This class implements section 6.8. Base64 Content-Transfer-Encoding from RFC 2045 Multipurpose + * Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies by Freed and Borenstein. + *

+ *

+ * The class can be parameterized in the following manner with various constructors: + *

+ * + *

+ * The URL-safe parameter is only applied to encode operations. Decoding seamlessly handles both modes. + *

+ *

+ * Since this class operates directly on byte streams, and not character streams, it is hard-coded to only + * encode/decode character encodings which are compatible with the lower 127 ASCII chart (ISO-8859-1, Windows-1252, + * UTF-8, etc). + *

+ *

+ * This class is thread-safe. + *

+ * + * @see RFC 2045 + * @since 1.0 + * @version $Id: Base64.java 1635986 2014-11-01 16:27:52Z tn $ + */ +public class Base64Util extends BaseNCodec { + + /** + * BASE32 characters are 6 bits in length. + * They are formed by taking a block of 3 octets to form a 24-bit string, + * which is converted into 4 BASE64 characters. + */ + private static final int BITS_PER_ENCODED_BYTE = 6; + private static final int BYTES_PER_UNENCODED_BLOCK = 3; + private static final int BYTES_PER_ENCODED_BLOCK = 4; + + /** + * Chunk separator per RFC 2045 section 2.1. + * + *

+ * N.B. The next major release may break compatibility and make this field private. + *

+ * + * @see RFC 2045 section 2.1 + */ + static final byte[] CHUNK_SEPARATOR = {'\r', '\n'}; + + /** + * This array is a lookup table that translates 6-bit positive integer index values into their "Base64 Alphabet" + * equivalents as specified in Table 1 of RFC 2045. + * + * Thanks to "commons" project in ws.apache.org for this code. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + */ + private static final byte[] STANDARD_ENCODE_TABLE = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', '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', '+', '/' + }; + + /** + * This is a copy of the STANDARD_ENCODE_TABLE above, but with + and / + * changed to - and _ to make the encoded Base64 results more URL-SAFE. + * This table is only used when the Base64's mode is set to URL-SAFE. + */ + private static final byte[] URL_SAFE_ENCODE_TABLE = { + 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', + 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', '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', '-', '_' + }; + + /** + * This array is a lookup table that translates Unicode characters drawn from the "Base64 Alphabet" (as specified + * in Table 1 of RFC 2045) into their 6-bit positive integer equivalents. Characters that are not in the Base64 + * alphabet but fall within the bounds of the array are translated to -1. + * + * Note: '+' and '-' both decode to 62. '/' and '_' both decode to 63. This means decoder seamlessly handles both + * URL_SAFE and STANDARD base64. (The encoder, on the other hand, needs to know ahead of time what to emit). + * + * Thanks to "commons" project in ws.apache.org for this code. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + */ + private static final byte[] DECODE_TABLE = { + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 62, -1, 63, 52, 53, 54, + 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, + 24, 25, -1, -1, -1, -1, 63, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 + }; + + /** + * Base64 uses 6-bit fields. + */ + /** Mask used to extract 6 bits, used when encoding */ + private static final int MASK_6BITS = 0x3f; + + // The static final fields above are used for the original static byte[] methods on Base64. + // The private member fields below are used with the new streaming approach, which requires + // some state be preserved between calls of encode() and decode(). + + /** + * Encode table to use: either STANDARD or URL_SAFE. Note: the DECODE_TABLE above remains static because it is able + * to decode both STANDARD and URL_SAFE streams, but the encodeTable must be a member variable so we can switch + * between the two modes. + */ + private final byte[] encodeTable; + + // Only one decode table currently; keep for consistency with Base32 code + private final byte[] decodeTable = DECODE_TABLE; + + /** + * Line separator for encoding. Not used when decoding. Only used if lineLength > 0. + */ + private final byte[] lineSeparator; + + /** + * Convenience variable to help us determine when our buffer is going to run out of room and needs resizing. + * decodeSize = 3 + lineSeparator.length; + */ + private final int decodeSize; + + /** + * Convenience variable to help us determine when our buffer is going to run out of room and needs resizing. + * encodeSize = 4 + lineSeparator.length; + */ + private final int encodeSize; + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length is 0 (no chunking), and the encoding table is STANDARD_ENCODE_TABLE. + *

+ * + *

+ * When decoding all variants are supported. + *

+ */ + public Base64Util() { + this(0); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in the given URL-safe mode. + *

+ * When encoding the line length is 76, the line separator is CRLF, and the encoding table is STANDARD_ENCODE_TABLE. + *

+ * + *

+ * When decoding all variants are supported. + *

+ * + * @param urlSafe + * if true, URL-safe encoding is used. In most cases this should be set to + * false. + * @since 1.4 + */ + public Base64Util(final boolean urlSafe) { + this(MIME_CHUNK_SIZE, CHUNK_SEPARATOR, urlSafe); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length is given in the constructor, the line separator is CRLF, and the encoding table is + * STANDARD_ENCODE_TABLE. + *

+ *

+ * Line lengths that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data. + *

+ *

+ * When decoding all variants are supported. + *

+ * + * @param lineLength + * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of + * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when + * decoding. + * @since 1.4 + */ + public Base64Util(final int lineLength) { + this(lineLength, CHUNK_SEPARATOR); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length and line separator are given in the constructor, and the encoding table is + * STANDARD_ENCODE_TABLE. + *

+ *

+ * Line lengths that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data. + *

+ *

+ * When decoding all variants are supported. + *

+ * + * @param lineLength + * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of + * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when + * decoding. + * @param lineSeparator + * Each line of encoded data will end with this sequence of bytes. + * @throws IllegalArgumentException + * Thrown when the provided lineSeparator included some base64 characters. + * @since 1.4 + */ + public Base64Util(final int lineLength, final byte[] lineSeparator) { + this(lineLength, lineSeparator, false); + } + + /** + * Creates a Base64 codec used for decoding (all modes) and encoding in URL-unsafe mode. + *

+ * When encoding the line length and line separator are given in the constructor, and the encoding table is + * STANDARD_ENCODE_TABLE. + *

+ *

+ * Line lengths that aren't multiples of 4 will still essentially end up being multiples of 4 in the encoded data. + *

+ *

+ * When decoding all variants are supported. + *

+ * + * @param lineLength + * Each line of encoded data will be at most of the given length (rounded down to nearest multiple of + * 4). If lineLength <= 0, then the output will not be divided into lines (chunks). Ignored when + * decoding. + * @param lineSeparator + * Each line of encoded data will end with this sequence of bytes. + * @param urlSafe + * Instead of emitting '+' and '/' we emit '-' and '_' respectively. urlSafe is only applied to encode + * operations. Decoding seamlessly handles both modes. + * Note: no padding is added when using the URL-safe alphabet. + * @throws IllegalArgumentException + * The provided lineSeparator included some base64 characters. That's not going to work! + * @since 1.4 + */ + public Base64Util(final int lineLength, final byte[] lineSeparator, final boolean urlSafe) { + super(BYTES_PER_UNENCODED_BLOCK, BYTES_PER_ENCODED_BLOCK, + lineLength, + lineSeparator == null ? 0 : lineSeparator.length); + // TODO could be simplified if there is no requirement to reject invalid line sep when length <=0 + // @see test case Base64Test.testConstructors() + if (lineSeparator != null) { + if (containsAlphabetOrPad(lineSeparator)) { + final String sep = newStringUtf8(lineSeparator); + throw new IllegalArgumentException("lineSeparator must not contain base64 characters: [" + sep + "]"); + } + if (lineLength > 0){ // null line-sep forces no chunking rather than throwing IAE + this.encodeSize = BYTES_PER_ENCODED_BLOCK + lineSeparator.length; + this.lineSeparator = new byte[lineSeparator.length]; + System.arraycopy(lineSeparator, 0, this.lineSeparator, 0, lineSeparator.length); + } else { + this.encodeSize = BYTES_PER_ENCODED_BLOCK; + this.lineSeparator = null; + } + } else { + this.encodeSize = BYTES_PER_ENCODED_BLOCK; + this.lineSeparator = null; + } + this.decodeSize = this.encodeSize - 1; + this.encodeTable = urlSafe ? URL_SAFE_ENCODE_TABLE : STANDARD_ENCODE_TABLE; + } + + /** + * Returns our current encode mode. True if we're URL-SAFE, false otherwise. + * + * @return true if we're in URL-SAFE mode, false otherwise. + * @since 1.4 + */ + public boolean isUrlSafe() { + return this.encodeTable == URL_SAFE_ENCODE_TABLE; + } + + /** + *

+ * Encodes all of the provided data, starting at inPos, for inAvail bytes. Must be called at least twice: once with + * the data to encode, and once with inAvail set to "-1" to alert encoder that EOF has been reached, to flush last + * remaining bytes (if not multiple of 3). + *

+ *

Note: no padding is added when encoding using the URL-safe alphabet.

+ *

+ * Thanks to "commons" project in ws.apache.org for the bitwise operations, and general approach. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + *

+ * + * @param in + * byte[] array of binary data to base64 encode. + * @param inPos + * Position to start reading data from. + * @param inAvail + * Amount of bytes available from input for encoding. + * @param context + * the context to be used + */ + @Override + void encode(final byte[] in, int inPos, final int inAvail, final Context context) { + if (context.eof) { + return; + } + // inAvail < 0 is how we're informed of EOF in the underlying data we're + // encoding. + if (inAvail < 0) { + context.eof = true; + if (0 == context.modulus && lineLength == 0) { + return; // no leftovers to process and not using chunking + } + final byte[] buffer = ensureBufferSize(encodeSize, context); + final int savedPos = context.pos; + switch (context.modulus) { // 0-2 + case 0 : // nothing to do here + break; + case 1 : // 8 bits = 6 + 2 + // top 6 bits: + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 2) & MASK_6BITS]; + // remaining 2: + buffer[context.pos++] = encodeTable[(context.ibitWorkArea << 4) & MASK_6BITS]; + // URL-SAFE skips the padding to further reduce size. + if (encodeTable == STANDARD_ENCODE_TABLE) { + buffer[context.pos++] = pad; + buffer[context.pos++] = pad; + } + break; + + case 2 : // 16 bits = 6 + 6 + 4 + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 10) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 4) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea << 2) & MASK_6BITS]; + // URL-SAFE skips the padding to further reduce size. + if (encodeTable == STANDARD_ENCODE_TABLE) { + buffer[context.pos++] = pad; + } + break; + default: + throw new IllegalStateException("Impossible modulus "+context.modulus); + } + context.currentLinePos += context.pos - savedPos; // keep track of current line position + // if currentPos == 0 we are at the start of a line, so don't add CRLF + if (lineLength > 0 && context.currentLinePos > 0) { + System.arraycopy(lineSeparator, 0, buffer, context.pos, lineSeparator.length); + context.pos += lineSeparator.length; + } + } else { + for (int i = 0; i < inAvail; i++) { + final byte[] buffer = ensureBufferSize(encodeSize, context); + context.modulus = (context.modulus+1) % BYTES_PER_UNENCODED_BLOCK; + int b = in[inPos++]; + if (b < 0) { + b += 256; + } + context.ibitWorkArea = (context.ibitWorkArea << 8) + b; // BITS_PER_BYTE + if (0 == context.modulus) { // 3 bytes = 24 bits = 4 * 6 bits to extract + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 18) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 12) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[(context.ibitWorkArea >> 6) & MASK_6BITS]; + buffer[context.pos++] = encodeTable[context.ibitWorkArea & MASK_6BITS]; + context.currentLinePos += BYTES_PER_ENCODED_BLOCK; + if (lineLength > 0 && lineLength <= context.currentLinePos) { + System.arraycopy(lineSeparator, 0, buffer, context.pos, lineSeparator.length); + context.pos += lineSeparator.length; + context.currentLinePos = 0; + } + } + } + } + } + + /** + *

+ * Decodes all of the provided data, starting at inPos, for inAvail bytes. Should be called at least twice: once + * with the data to decode, and once with inAvail set to "-1" to alert decoder that EOF has been reached. The "-1" + * call is not necessary when decoding, but it doesn't hurt, either. + *

+ *

+ * Ignores all non-base64 characters. This is how chunked (e.g. 76 character) data is handled, since CR and LF are + * silently ignored, but has implications for other bytes, too. This method subscribes to the garbage-in, + * garbage-out philosophy: it will not check the provided data for validity. + *

+ *

+ * Thanks to "commons" project in ws.apache.org for the bitwise operations, and general approach. + * http://svn.apache.org/repos/asf/webservices/commons/trunk/modules/util/ + *

+ * + * @param in + * byte[] array of ascii data to base64 decode. + * @param inPos + * Position to start reading data from. + * @param inAvail + * Amount of bytes available from input for encoding. + * @param context + * the context to be used + */ + @Override + void decode(final byte[] in, int inPos, final int inAvail, final Context context) { + if (context.eof) { + return; + } + if (inAvail < 0) { + context.eof = true; + } + for (int i = 0; i < inAvail; i++) { + final byte[] buffer = ensureBufferSize(decodeSize, context); + final byte b = in[inPos++]; + if (b == pad) { + // We're done. + context.eof = true; + break; + } else { + if (b >= 0 && b < DECODE_TABLE.length) { + final int result = DECODE_TABLE[b]; + if (result >= 0) { + context.modulus = (context.modulus+1) % BYTES_PER_ENCODED_BLOCK; + context.ibitWorkArea = (context.ibitWorkArea << BITS_PER_ENCODED_BYTE) + result; + if (context.modulus == 0) { + buffer[context.pos++] = (byte) ((context.ibitWorkArea >> 16) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.ibitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) (context.ibitWorkArea & MASK_8BITS); + } + } + } + } + } + + // Two forms of EOF as far as base64 decoder is concerned: actual + // EOF (-1) and first time '=' character is encountered in stream. + // This approach makes the '=' padding characters completely optional. + if (context.eof && context.modulus != 0) { + final byte[] buffer = ensureBufferSize(decodeSize, context); + + // We have some spare bits remaining + // Output all whole multiples of 8 bits and ignore the rest + switch (context.modulus) { +// case 0 : // impossible, as excluded above + case 1 : // 6 bits - ignore entirely + // TODO not currently tested; perhaps it is impossible? + break; + case 2 : // 12 bits = 8 + 4 + context.ibitWorkArea = context.ibitWorkArea >> 4; // dump the extra 4 bits + buffer[context.pos++] = (byte) ((context.ibitWorkArea) & MASK_8BITS); + break; + case 3 : // 18 bits = 8 + 8 + 2 + context.ibitWorkArea = context.ibitWorkArea >> 2; // dump 2 bits + buffer[context.pos++] = (byte) ((context.ibitWorkArea >> 8) & MASK_8BITS); + buffer[context.pos++] = (byte) ((context.ibitWorkArea) & MASK_8BITS); + break; + default: + throw new IllegalStateException("Impossible modulus "+context.modulus); + } + } + } + + /** + * Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the + * method treats whitespace as valid. + * + * @param arrayOctet + * byte array to test + * @return true if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; + * false, otherwise + * @deprecated 1.5 Use {@link #isBase64(byte[])}, will be removed in 2.0. + */ + @Deprecated + public static boolean isArrayByteBase64(final byte[] arrayOctet) { + return isBase64(arrayOctet); + } + + /** + * Returns whether or not the octet is in the base 64 alphabet. + * + * @param octet + * The value to test + * @return true if the value is defined in the the base 64 alphabet, false otherwise. + * @since 1.4 + */ + public static boolean isBase64(final byte octet) { + return octet == PAD_DEFAULT || (octet >= 0 && octet < DECODE_TABLE.length && DECODE_TABLE[octet] != -1); + } + + /** + * Tests a given String to see if it contains only valid characters within the Base64 alphabet. Currently the + * method treats whitespace as valid. + * + * @param base64 + * String to test + * @return true if all characters in the String are valid characters in the Base64 alphabet or if + * the String is empty; false, otherwise + * @since 1.5 + */ + public static boolean isBase64(final String base64) { + return isBase64(getBytesUtf8(base64)); + } + + /** + * Tests a given byte array to see if it contains only valid characters within the Base64 alphabet. Currently the + * method treats whitespace as valid. + * + * @param arrayOctet + * byte array to test + * @return true if all bytes are valid characters in the Base64 alphabet or if the byte array is empty; + * false, otherwise + * @since 1.5 + */ + public static boolean isBase64(final byte[] arrayOctet) { + for (int i = 0; i < arrayOctet.length; i++) { + if (!isBase64(arrayOctet[i]) && !isWhiteSpace(arrayOctet[i])) { + return false; + } + } + return true; + } + + /** + * Encodes binary data using the base64 algorithm but does not chunk the output. + * + * @param binaryData + * binary data to encode + * @return byte[] containing Base64 characters in their UTF-8 representation. + */ + public static byte[] encodeBase64(final byte[] binaryData) { + return encodeBase64(binaryData, false); + } + + /** + * Encodes binary data using the base64 algorithm but does not chunk the output. + * + * NOTE: We changed the behaviour of this method from multi-line chunking (commons-codec-1.4) to + * single-line non-chunking (commons-codec-1.5). + * + * @param binaryData + * binary data to encode + * @return String containing Base64 characters. + * @since 1.4 (NOTE: 1.4 chunked the output, whereas 1.5 does not). + */ + public static String encodeBase64String(final byte[] binaryData) { + return newStringUtf8(encodeBase64(binaryData, false)); + } + + /** + * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The + * url-safe variation emits - and _ instead of + and / characters. + * Note: no padding is added. + * @param binaryData + * binary data to encode + * @return byte[] containing Base64 characters in their UTF-8 representation. + * @since 1.4 + */ + public static byte[] encodeBase64URLSafe(final byte[] binaryData) { + return encodeBase64(binaryData, false, true); + } + + /** + * Encodes binary data using a URL-safe variation of the base64 algorithm but does not chunk the output. The + * url-safe variation emits - and _ instead of + and / characters. + * Note: no padding is added. + * @param binaryData + * binary data to encode + * @return String containing Base64 characters + * @since 1.4 + */ + public static String encodeBase64URLSafeString(final byte[] binaryData) { + return newStringUtf8(encodeBase64(binaryData, false, true)); + } + + /** + * Encodes binary data using the base64 algorithm and chunks the encoded output into 76 character blocks + * + * @param binaryData + * binary data to encode + * @return Base64 characters chunked in 76 character blocks + */ + public static byte[] encodeBase64Chunked(final byte[] binaryData) { + return encodeBase64(binaryData, true); + } + + /** + * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. + * + * @param binaryData + * Array containing binary data to encode. + * @param isChunked + * if true this encoder will chunk the base64 output into 76 character blocks + * @return Base64-encoded data. + * @throws IllegalArgumentException + * Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} + */ + public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked) { + return encodeBase64(binaryData, isChunked, false); + } + + /** + * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. + * + * @param binaryData + * Array containing binary data to encode. + * @param isChunked + * if true this encoder will chunk the base64 output into 76 character blocks + * @param urlSafe + * if true this encoder will emit - and _ instead of the usual + and / characters. + * Note: no padding is added when encoding using the URL-safe alphabet. + * @return Base64-encoded data. + * @throws IllegalArgumentException + * Thrown when the input array needs an output array bigger than {@link Integer#MAX_VALUE} + * @since 1.4 + */ + public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, final boolean urlSafe) { + return encodeBase64(binaryData, isChunked, urlSafe, Integer.MAX_VALUE); + } + + /** + * Encodes binary data using the base64 algorithm, optionally chunking the output into 76 character blocks. + * + * @param binaryData + * Array containing binary data to encode. + * @param isChunked + * if true this encoder will chunk the base64 output into 76 character blocks + * @param urlSafe + * if true this encoder will emit - and _ instead of the usual + and / characters. + * Note: no padding is added when encoding using the URL-safe alphabet. + * @param maxResultSize + * The maximum result size to accept. + * @return Base64-encoded data. + * @throws IllegalArgumentException + * Thrown when the input array needs an output array bigger than maxResultSize + * @since 1.4 + */ + public static byte[] encodeBase64(final byte[] binaryData, final boolean isChunked, + final boolean urlSafe, final int maxResultSize) { + if (binaryData == null || binaryData.length == 0) { + return binaryData; + } + + // Create this so can use the super-class method + // Also ensures that the same roundings are performed by the ctor and the code + final Base64Util b64 = isChunked ? new Base64Util(urlSafe) : new Base64Util(0, CHUNK_SEPARATOR, urlSafe); + final long len = b64.getEncodedLength(binaryData); + if (len > maxResultSize) { + throw new IllegalArgumentException("Input array too big, the output array would be bigger (" + + len + + ") than the specified maximum size of " + + maxResultSize); + } + + return b64.encode(binaryData); + } + + /** + * Decodes a Base64 String into octets. + *

+ * Note: this method seamlessly handles data encoded in URL-safe or normal mode. + *

+ * + * @param base64String + * String containing Base64 data + * @return Array containing decoded data. + * @since 1.4 + */ + public static byte[] decodeBase64(final String base64String) { + return new Base64Util().decode(base64String); + } + + /** + * Decodes Base64 data into octets. + *

+ * Note: this method seamlessly handles data encoded in URL-safe or normal mode. + *

+ * + * @param base64Data + * Byte array containing Base64 data + * @return Array containing decoded data. + */ + public static byte[] decodeBase64(final byte[] base64Data) { + return new Base64Util().decode(base64Data); + } + + // Implementation of the Encoder Interface + + // Implementation of integer encoding used for crypto + /** + * Decodes a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. + * + * @param pArray + * a byte array containing base64 character data + * @return A BigInteger + * @since 1.4 + */ + public static BigInteger decodeInteger(final byte[] pArray) { + return new BigInteger(1, decodeBase64(pArray)); + } + + /** + * Encodes to a byte64-encoded integer according to crypto standards such as W3C's XML-Signature. + * + * @param bigInt + * a BigInteger + * @return A byte array containing base64 character data + * @throws NullPointerException + * if null is passed in + * @since 1.4 + */ + public static byte[] encodeInteger(final BigInteger bigInt) { + if (bigInt == null) { + throw new NullPointerException("encodeInteger called with null parameter"); + } + return encodeBase64(toIntegerBytes(bigInt), false); + } + + /** + * Returns a byte-array representation of a BigInteger without sign bit. + * + * @param bigInt + * BigInteger to be converted + * @return a byte array representation of the BigInteger parameter + */ + static byte[] toIntegerBytes(final BigInteger bigInt) { + int bitlen = bigInt.bitLength(); + // round bitlen + bitlen = ((bitlen + 7) >> 3) << 3; + final byte[] bigBytes = bigInt.toByteArray(); + + if (((bigInt.bitLength() % 8) != 0) && (((bigInt.bitLength() / 8) + 1) == (bitlen / 8))) { + return bigBytes; + } + // set up params for copying everything but sign bit + int startSrc = 0; + int len = bigBytes.length; + + // if bigInt is exactly byte-aligned, just skip signbit in copy + if ((bigInt.bitLength() % 8) == 0) { + startSrc = 1; + len--; + } + final int startDst = bitlen / 8 - len; // to pad w/ nulls as per spec + final byte[] resizedBytes = new byte[bitlen / 8]; + System.arraycopy(bigBytes, startSrc, resizedBytes, startDst, len); + return resizedBytes; + } + + /** + * Returns whether or not the octet is in the Base64 alphabet. + * + * @param octet + * The value to test + * @return true if the value is defined in the the Base64 alphabet false otherwise. + */ + @Override + protected boolean isInAlphabet(final byte octet) { + return octet >= 0 && octet < decodeTable.length && decodeTable[octet] != -1; + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/BaseNCodec.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/BaseNCodec.java new file mode 100644 index 0000000..2ab2ea6 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/BaseNCodec.java @@ -0,0 +1,521 @@ +package com.epmet.plugin.power.modules.visit.utils; + + +import java.nio.charset.Charset; +import java.util.Arrays; + +/** + * Abstract superclass for Base-N encoders and decoders. + * + *

+ * This class is thread-safe. + *

+ * + * @version $Id: BaseNCodec.java 1634404 2014-10-26 23:06:10Z ggregory $ + */ +public abstract class BaseNCodec { + + /** + * Holds thread context so classes can be thread-safe. + * + * This class is not itself thread-safe; each thread must allocate its own copy. + * + * @since 1.7 + */ + static class Context { + + /** + * Place holder for the bytes we're dealing with for our based logic. + * Bitwise operations store and extract the encoding or decoding from this variable. + */ + int ibitWorkArea; + + /** + * Place holder for the bytes we're dealing with for our based logic. + * Bitwise operations store and extract the encoding or decoding from this variable. + */ + long lbitWorkArea; + + /** + * Buffer for streaming. + */ + byte[] buffer; + + /** + * Position where next character should be written in the buffer. + */ + int pos; + + /** + * Position where next character should be read from the buffer. + */ + int readPos; + + /** + * Boolean flag to indicate the EOF has been reached. Once EOF has been reached, this object becomes useless, + * and must be thrown away. + */ + boolean eof; + + /** + * Variable tracks how many characters have been written to the current line. Only used when encoding. We use + * it to make sure each encoded line never goes beyond lineLength (if lineLength > 0). + */ + int currentLinePos; + + /** + * Writes to the buffer only occur after every 3/5 reads when encoding, and every 4/8 reads when decoding. This + * variable helps track that. + */ + int modulus; + + Context() { + } + + /** + * Returns a String useful for debugging (especially within a debugger.) + * + * @return a String useful for debugging. + */ + @SuppressWarnings("boxing") // OK to ignore boxing here + public String toString() { + return String.format("%s[buffer=%s, currentLinePos=%s, eof=%s, ibitWorkArea=%s, lbitWorkArea=%s, " + + "modulus=%s, pos=%s, readPos=%s]", this.getClass().getSimpleName(), Arrays.toString(buffer), + currentLinePos, eof, ibitWorkArea, lbitWorkArea, modulus, pos, readPos); + } + } + + /** + * EOF + * + * @since 1.7 + */ + static final int EOF = -1; + + /** + * MIME chunk size per RFC 2045 section 6.8. + * + *

+ * The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any + * equal signs. + *

+ * + * @see RFC 2045 section 6.8 + */ + public static final int MIME_CHUNK_SIZE = 76; + + /** + * PEM chunk size per RFC 1421 section 4.3.2.4. + * + *

+ * The {@value} character limit does not count the trailing CRLF, but counts all other characters, including any + * equal signs. + *

+ * + * @see RFC 1421 section 4.3.2.4 + */ + public static final int PEM_CHUNK_SIZE = 64; + + private static final int DEFAULT_BUFFER_RESIZE_FACTOR = 2; + + /** + * Defines the default buffer size - currently {@value} + * - must be large enough for at least one encoded block+separator + */ + private static final int DEFAULT_BUFFER_SIZE = 8192; + + /** Mask used to extract 8 bits, used in decoding bytes */ + protected static final int MASK_8BITS = 0xff; + + /** + * Byte used to pad output. + */ + protected static final byte PAD_DEFAULT = '='; // Allow static access to default + + /** + * @deprecated Use {@link #pad}. Will be removed in 2.0. + */ + @Deprecated + protected final byte PAD = PAD_DEFAULT; // instance variable just in case it needs to vary later + + protected final byte pad; // instance variable just in case it needs to vary later + + /** Number of bytes in each full block of unencoded data, e.g. 4 for Base64 and 5 for Base32 */ + private final int unencodedBlockSize; + + /** Number of bytes in each full block of encoded data, e.g. 3 for Base64 and 8 for Base32 */ + private final int encodedBlockSize; + + /** + * Chunksize for encoding. Not used when decoding. + * A value of zero or less implies no chunking of the encoded data. + * Rounded down to nearest multiple of encodedBlockSize. + */ + protected final int lineLength; + + /** + * Size of chunk separator. Not used unless {@link #lineLength} > 0. + */ + private final int chunkSeparatorLength; + + /** + * Note lineLength is rounded down to the nearest multiple of {@link #encodedBlockSize} + * If chunkSeparatorLength is zero, then chunking is disabled. + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length lineLength + * @param chunkSeparatorLength the chunk separator length, if relevant + */ + protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize, + final int lineLength, final int chunkSeparatorLength) { + this(unencodedBlockSize, encodedBlockSize, lineLength, chunkSeparatorLength, PAD_DEFAULT); + } + + /** + * Note lineLength is rounded down to the nearest multiple of {@link #encodedBlockSize} + * If chunkSeparatorLength is zero, then chunking is disabled. + * @param unencodedBlockSize the size of an unencoded block (e.g. Base64 = 3) + * @param encodedBlockSize the size of an encoded block (e.g. Base64 = 4) + * @param lineLength if > 0, use chunking with a length lineLength + * @param chunkSeparatorLength the chunk separator length, if relevant + * @param pad byte used as padding byte. + */ + protected BaseNCodec(final int unencodedBlockSize, final int encodedBlockSize, + final int lineLength, final int chunkSeparatorLength, final byte pad) { + this.unencodedBlockSize = unencodedBlockSize; + this.encodedBlockSize = encodedBlockSize; + final boolean useChunking = lineLength > 0 && chunkSeparatorLength > 0; + this.lineLength = useChunking ? (lineLength / encodedBlockSize) * encodedBlockSize : 0; + this.chunkSeparatorLength = chunkSeparatorLength; + + this.pad = pad; + } + + /** + * Returns true if this object has buffered data for reading. + * + * @param context the context to be used + * @return true if there is data still available for reading. + */ + boolean hasData(final Context context) { // package protected for access from I/O streams + return context.buffer != null; + } + + /** + * Returns the amount of buffered data available for reading. + * + * @param context the context to be used + * @return The amount of buffered data available for reading. + */ + int available(final Context context) { // package protected for access from I/O streams + return context.buffer != null ? context.pos - context.readPos : 0; + } + + /** + * Get the default buffer size. Can be overridden. + * + * @return {@link #DEFAULT_BUFFER_SIZE} + */ + protected int getDefaultBufferSize() { + return DEFAULT_BUFFER_SIZE; + } + + /** + * Increases our buffer by the {@link #DEFAULT_BUFFER_RESIZE_FACTOR}. + * @param context the context to be used + */ + private byte[] resizeBuffer(final Context context) { + if (context.buffer == null) { + context.buffer = new byte[getDefaultBufferSize()]; + context.pos = 0; + context.readPos = 0; + } else { + final byte[] b = new byte[context.buffer.length * DEFAULT_BUFFER_RESIZE_FACTOR]; + System.arraycopy(context.buffer, 0, b, 0, context.buffer.length); + context.buffer = b; + } + return context.buffer; + } + + /** + * Ensure that the buffer has room for size bytes + * + * @param size minimum spare space required + * @param context the context to be used + * @return the buffer + */ + protected byte[] ensureBufferSize(final int size, final Context context){ + if ((context.buffer == null) || (context.buffer.length < context.pos + size)){ + return resizeBuffer(context); + } + return context.buffer; + } + + /** + * Extracts buffered data into the provided byte[] array, starting at position bPos, up to a maximum of bAvail + * bytes. Returns how many bytes were actually extracted. + *

+ * Package protected for access from I/O streams. + * + * @param b + * byte[] array to extract the buffered data into. + * @param bPos + * position in byte[] array to start extraction at. + * @param bAvail + * amount of bytes we're allowed to extract. We may extract fewer (if fewer are available). + * @param context + * the context to be used + * @return The number of bytes successfully extracted into the provided byte[] array. + */ + int readResults(final byte[] b, final int bPos, final int bAvail, final Context context) { + if (context.buffer != null) { + final int len = Math.min(available(context), bAvail); + System.arraycopy(context.buffer, context.readPos, b, bPos, len); + context.readPos += len; + if (context.readPos >= context.pos) { + context.buffer = null; // so hasData() will return false, and this method can return -1 + } + return len; + } + return context.eof ? EOF : 0; + } + + /** + * Checks if a byte value is whitespace or not. + * Whitespace is taken to mean: space, tab, CR, LF + * @param byteToCheck + * the byte to check + * @return true if byte is whitespace, false otherwise + */ + protected static boolean isWhiteSpace(final byte byteToCheck) { + switch (byteToCheck) { + case ' ' : + case '\n' : + case '\r' : + case '\t' : + return true; + default : + return false; + } + } + + /** + * Encodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of + * the Encoder interface, and will throw an EncoderException if the supplied object is not of type byte[]. + * + * @param obj + * Object to encode + * @return An object (of type byte[]) containing the Base-N encoded data which corresponds to the byte[] supplied. + * @throws Exception + * if the parameter supplied is not of type byte[] + */ + public Object encode(final Object obj) throws Exception { + if (!(obj instanceof byte[])) { + throw new Exception("Parameter supplied to Base-N encode is not a byte[]"); + } + return encode((byte[]) obj); + } + + /** + * Encodes a byte[] containing binary data, into a String containing characters in the Base-N alphabet. + * Uses UTF8 encoding. + * + * @param pArray + * a byte array containing binary data + * @return A String containing only Base-N character data + */ + public String encodeToString(final byte[] pArray) { + return newStringUtf8(encode(pArray)); + } + + /** + * Encodes a byte[] containing binary data, into a String containing characters in the appropriate alphabet. + * Uses UTF8 encoding. + * + * @param pArray a byte array containing binary data + * @return String containing only character data in the appropriate alphabet. + */ + public String encodeAsString(final byte[] pArray){ + return newStringUtf8(encode(pArray)); + } + + /** + * Decodes an Object using the Base-N algorithm. This method is provided in order to satisfy the requirements of + * the Decoder interface, and will throw a DecoderException if the supplied object is not of type byte[] or String. + * + * @param obj + * Object to decode + * @return An object (of type byte[]) containing the binary data which corresponds to the byte[] or String + * supplied. + * @throws Exception + * if the parameter supplied is not of type byte[] + */ + public Object decode(final Object obj) throws Exception { + if (obj instanceof byte[]) { + return decode((byte[]) obj); + } else if (obj instanceof String) { + return decode((String) obj); + } else { + throw new Exception("Parameter supplied to Base-N decode is not a byte[] or a String"); + } + } + + /** + * Decodes a String containing characters in the Base-N alphabet. + * + * @param pArray + * A String containing Base-N character data + * @return a byte array containing binary data + */ + public byte[] decode(final String pArray) { + return decode(getBytesUtf8(pArray)); + } + + /** + * Decodes a byte[] containing characters in the Base-N alphabet. + * + * @param pArray + * A byte array containing Base-N character data + * @return a byte array containing binary data + */ + public byte[] decode(final byte[] pArray) { + if (pArray == null || pArray.length == 0) { + return pArray; + } + final Context context = new Context(); + decode(pArray, 0, pArray.length, context); + decode(pArray, 0, EOF, context); // Notify decoder of EOF. + final byte[] result = new byte[context.pos]; + readResults(result, 0, result.length, context); + return result; + } + + /** + * Encodes a byte[] containing binary data, into a byte[] containing characters in the alphabet. + * + * @param pArray + * a byte array containing binary data + * @return A byte array containing only the basen alphabetic character data + */ + public byte[] encode(final byte[] pArray) { + if (pArray == null || pArray.length == 0) { + return pArray; + } + final Context context = new Context(); + encode(pArray, 0, pArray.length, context); + encode(pArray, 0, EOF, context); // Notify encoder of EOF. + final byte[] buf = new byte[context.pos - context.readPos]; + readResults(buf, 0, buf.length, context); + return buf; + } + + // package protected for access from I/O streams + abstract void encode(byte[] pArray, int i, int length, Context context); + + // package protected for access from I/O streams + abstract void decode(byte[] pArray, int i, int length, Context context); + + /** + * Returns whether or not the octet is in the current alphabet. + * Does not allow whitespace or pad. + * + * @param value The value to test + * + * @return true if the value is defined in the current alphabet, false otherwise. + */ + protected abstract boolean isInAlphabet(byte value); + + /** + * Tests a given byte array to see if it contains only valid characters within the alphabet. + * The method optionally treats whitespace and pad as valid. + * + * @param arrayOctet byte array to test + * @param allowWSPad if true, then whitespace and PAD are also allowed + * + * @return true if all bytes are valid characters in the alphabet or if the byte array is empty; + * false, otherwise + */ + public boolean isInAlphabet(final byte[] arrayOctet, final boolean allowWSPad) { + for (int i = 0; i < arrayOctet.length; i++) { + if (!isInAlphabet(arrayOctet[i]) && + (!allowWSPad || (arrayOctet[i] != pad) && !isWhiteSpace(arrayOctet[i]))) { + return false; + } + } + return true; + } + + /** + * Tests a given String to see if it contains only valid characters within the alphabet. + * The method treats whitespace and PAD as valid. + * + * @param basen String to test + * @return true if all characters in the String are valid characters in the alphabet or if + * the String is empty; false, otherwise + * @see #isInAlphabet(byte[], boolean) + */ + public boolean isInAlphabet(final String basen) { + return isInAlphabet(getBytesUtf8(basen), true); + } + + /** + * Tests a given byte array to see if it contains any characters within the alphabet or PAD. + * + * Intended for use in checking line-ending arrays + * + * @param arrayOctet + * byte array to test + * @return true if any byte is a valid character in the alphabet or PAD; false otherwise + */ + protected boolean containsAlphabetOrPad(final byte[] arrayOctet) { + if (arrayOctet == null) { + return false; + } + for (final byte element : arrayOctet) { + if (pad == element || isInAlphabet(element)) { + return true; + } + } + return false; + } + + /** + * Calculates the amount of space needed to encode the supplied array. + * + * @param pArray byte[] array which will later be encoded + * + * @return amount of space needed to encoded the supplied array. + * Returns a long since a max-len array will require > Integer.MAX_VALUE + */ + public long getEncodedLength(final byte[] pArray) { + // Calculate non-chunked size - rounded up to allow for padding + // cast to long is needed to avoid possibility of overflow + long len = ((pArray.length + unencodedBlockSize-1) / unencodedBlockSize) * (long) encodedBlockSize; + if (lineLength > 0) { // We're using chunking + // Round up to nearest multiple + len += ((len + lineLength-1) / lineLength) * chunkSeparatorLength; + } + return len; + } + + public static Charset UTF8 = Charset.forName("UTF-8"); + + public static String newStringUtf8(byte[] bytes) { + return newString(bytes, UTF8); + } + + private static String newString(final byte[] bytes, final Charset charset) { + return bytes == null ? null : new String(bytes, charset); + } + + public static byte[] getBytesUtf8(final String string) { + return getBytes(string, UTF8); + } + + private static byte[] getBytes(final String string, final Charset charset) { + if (string == null) { + return null; + } + return string.getBytes(charset); + } +} \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/DhDeviceUtil.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/DhDeviceUtil.java new file mode 100644 index 0000000..519cecf --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/DhDeviceUtil.java @@ -0,0 +1,777 @@ +package com.epmet.plugin.power.modules.visit.utils; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.EpmetException; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.commons.tools.redis.RedisUtils; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.plugin.commons.redis.RedisKeys; +import com.epmet.plugin.power.config.DhCloudProperties; +import com.epmet.plugin.power.dto.visit.DhTokenDTO; +import com.epmet.plugin.power.dto.visit.form.*; +import com.epmet.plugin.power.dto.visit.result.DhChannelResultDTO; +import net.coobird.thumbnailator.Thumbnails; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.imageio.ImageIO; +import javax.xml.bind.DatatypeConverter; +import java.awt.image.BufferedImage; +import java.io.*; +import java.math.BigDecimal; +import java.net.URL; +import java.time.LocalDate; +import java.util.*; + +/** + * 海康设备下放命令 + * + * @author zhy + * @date 2022/5/20 9:36 + */ +@Component +public class DhDeviceUtil { + private static Logger logger = LoggerFactory.getLogger(DhDeviceUtil.class); + + @Autowired + private DhCloudProperties dhCloudProperties; + + @Autowired + private RedisUtils redisUtils; + + private final String GET_PUBLIC_KEY = "/WPMS/getPublicKey"; + private final String GET_LOGIN_PASS = "/WPMS/login"; + private final String GET_DEPARTMENT = "/CardSolution/card/department"; + private final String GET_PERSON_IDENTITY = "/CardSolution/card/person/personidentity"; + private final String GET_DOOR_PLAN = "/CardSolution/card/accessControl/timeQuantum/1/page"; + private final String GET_DOOR_CHANNEL = "/CardSolution/card/accessControl/channel/bycondition/combined"; + private final String ADD_PERSON = "/CardSolution/card/person"; + private final String LIST_PERSON = "/CardSolution/card/person/bycondition/combined"; + private final String DEL_PERSON = "/CardSolution/card/person/delete"; + private final String ADD_PERSON_IMG = "/CardSolution/common/saveMobileBase64ImageToByte"; + private final String ADD_AUTH = "/CardSolution/card/accessControl/doorAuthority/update"; + private final String LIST_CARD = "/CardSolution/card/card/bycondition/combined"; + private final String DEL_CARD = "/CardSolution/card/card/returnByNumber/"; + private final String OPEN_CARD = "/CardSolution/card/card/open/batch"; + + /** + * 获取publicKey + * + * @param + * @return void + * @author zhy + * @date 2022/5/20 16:40 + */ + public String getPublicKey() { + String key = RedisKeys.getDhPublicKey(); + Object obj = redisUtils.get(key); + if (null != obj) { + return (String) obj; + } + + String url = dhCloudProperties.getUrl().concat(GET_PUBLIC_KEY); + Map paramsMap = new HashMap<>(4); + + DhPublicKeyFormDTO dto = new DhPublicKeyFormDTO(); + dto.setLoginName(dhCloudProperties.getLoginName()); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "publicKey获取失败"); + } + + JSONObject toResult = JSON.parseObject(data); + if (!toResult.containsKey("publicKey")) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "publicKey获取失败"); + } + String publicKey = toResult.get("publicKey").toString(); + + redisUtils.set(key, publicKey, RedisUtils.MINUTE_THIRTY_EXPIRE); + return publicKey; + } + + /** + * 获取loginPass + * + * @param + * @return void + * @author zhy + * @date 2022/5/20 16:40 + */ + public DhTokenDTO getLoginPass(String publicKey) { + String key = RedisKeys.getDhToken(); + Object obj = redisUtils.get(key); + if (null != obj) { + return (DhTokenDTO) obj; + } + + String url = dhCloudProperties.getUrl().concat(GET_LOGIN_PASS); + Map paramsMap = new HashMap<>(4); + + DhLoginPassFormDTO dto = new DhLoginPassFormDTO(); + dto.setLoginName(dhCloudProperties.getLoginName()); + String pwd; + try { + pwd = RSAUtils.getPwdByRsa(publicKey, dhCloudProperties.getLoginPass()); + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "loginPass加密失败"); + } + dto.setLoginPass(pwd); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "loginPass获取失败"); + } + + JSONObject toResult = JSON.parseObject(data); + if (!toResult.containsKey("token")) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "loginPass获取失败"); + } + DhTokenDTO token = new DhTokenDTO(); + token.setId(toResult.get("id").toString()); + token.setLoginName(toResult.get("loginName").toString()); + token.setPublicKey(toResult.get("publicKey").toString()); + token.setToken(toResult.get("token").toString()); + redisUtils.set(key, token, RedisUtils.MINUTE_THIRTY_EXPIRE); + return token; + } + + /** + * 新增部门 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + public Long getDept() { + String url = dhCloudProperties.getUrl().concat(GET_DEPARTMENT); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); +// DhDeptFormDTO dto = new DhDeptFormDTO(); +// dto.setName("访客部门"); +// dto.setParentId(1L); + + String data = HttpClientManager.getInstance().sendGet(url, paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询部门列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + for (int i = 0; i < jsonArray.size(); i++) { + if ("临时人员".equals(jsonArray.getJSONObject(i).get("name").toString())) { + return Long.parseLong(jsonArray.getJSONObject(i).get("id").toString()); + } + } + + return null; + } + + /** + * 人员预处理 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + public void personHandle(String code) { + String url = dhCloudProperties.getUrl().concat(LIST_PERSON); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhPersonPageFormDTO dto = new DhPersonPageFormDTO(); + dto.setPageNum(1); + dto.setPageSize(100); + dto.setCode(code); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询人员列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询人员列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + List ids = new ArrayList<>(); + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + for (int i = 0; i < jsonArray.size(); i++) { + ids.add(Integer.parseInt(jsonArray.getJSONObject(i).get("id").toString())); + } + if (!ids.isEmpty()) { + DhPersonDelFormDTO del = new DhPersonDelFormDTO(); + del.setPersonIds(ids); + delPerson(del); + } + + } + + /** + * 卡片预处理 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + public void cardHandle(String code) { + String url = dhCloudProperties.getUrl().concat(LIST_CARD); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhCardPageFormDTO dto = new DhCardPageFormDTO(); + dto.setPageNum(1); + dto.setPageSize(100); + dto.setPersonCode(code); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询卡片列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询卡片列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + for (int i = 0; i < jsonArray.size(); i++) { + delCard(jsonArray.getJSONObject(i).get("cardNumber").toString()); + } + } + + /** + * 删除人员 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + public void delPerson(DhPersonDelFormDTO dto) { + String url = dhCloudProperties.getUrl().concat(DEL_PERSON); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "删除人员失败"); + } + } + + /** + * 退卡 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 10:08 + */ + public void delCard(String cardNum) { + String url = dhCloudProperties.getUrl().concat(DEL_CARD); + url = url + cardNum; + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, StringUtils.EMPTY, paramsMap).getData(); + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "删除卡片失败"); + } + } + + /** + * 获取身份 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public String getIdentity() { + String url = dhCloudProperties.getUrl().concat(GET_PERSON_IDENTITY); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); +// DhIdentityFormDTO dto = new DhIdentityFormDTO(); +// dto.setName("访客"); +// dto.setSubsidyAmount(0D); +// dto.setIsCashRecharge(1); +// dto.setIsMachineRecharge(1); + + String data = HttpClientManager.getInstance().sendGet(url, paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + JSONArray jsonArray = JSON.parseArray(registerResult.toString()); + for (int i = 0; i < jsonArray.size(); i++) { + if ("默认身份".equals(jsonArray.getJSONObject(i).get("name").toString())) { + return jsonArray.getJSONObject(i).get("id").toString(); + } + } + + return ""; + } + + /** + * 获取开门计划 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public Long getPlan() { + String url = dhCloudProperties.getUrl().concat(GET_DOOR_PLAN); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhPlanPageFormDTO dto = new DhPlanPageFormDTO(); + dto.setPageNum(1); + dto.setPageSize(100); + dto.setSingleCondition("默认"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询开门计划失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + + if (jsonArray.size() > 0) { + return Long.parseLong(jsonArray.getJSONObject(0).get("id").toString()); + } + + return null; + } + + /** + * 查询通道 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public List getChannel() { + String url = dhCloudProperties.getUrl().concat(GET_DOOR_CHANNEL); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Map paramsMap = new HashMap<>(4); + DhChannelPageFormDTO dto = new DhChannelPageFormDTO(); + dto.setPageSize(100); + dto.setPageNum(1); + dto.setDeviceGenre("0"); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询通道列表失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + + JSONObject jsonObject = JSON.parseObject(registerResult.toString()); + + JSONArray jsonArray = JSON.parseArray(jsonObject.get("pageData").toString()); + + List list = new ArrayList<>(); + for (int i = 0; i < jsonArray.size(); i++) { + JSONObject jsonItem = jsonArray.getJSONObject(i); + DhChannelResultDTO channel = new DhChannelResultDTO(); + channel.setPrivilegeType("1"); + channel.setResouceCode(jsonItem.get("channelCode").toString()); + list.add(channel); + } + + return list; + } + + /** + * 新增人员 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public Long addPerson(DhPersonFormDTO dto) { + // 数据预处理 + dataHandle(dto.getCode()); + + String url = dhCloudProperties.getUrl().concat(ADD_PERSON); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + Long deptId = getDept(); + if (null == deptId) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "查询临时人员部门失败"); + } + String identity = getIdentity(); + if (StringUtils.isBlank(identity)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取身份失败"); + } + dto.setDeptId(deptId); + dto.setPersonIdentityId(identity); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(dto), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "新增人员失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "新增人员失败!" + result.getErrMsg()); + } + Object registerResult = result.getData(); + if (null != registerResult) { + return Long.parseLong(registerResult.toString()); + } + return null; + } + + /** + * 下发人员头像 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public String addPersonImg(DhPersonFormDTO dto, String imgUrl) { + DhPersonImgFormDTO imgFormDTO = new DhPersonImgFormDTO(); + String url = dhCloudProperties.getUrl().concat(ADD_PERSON_IMG); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + imgFormDTO.setPersonCode(dto.getCode()); + imgFormDTO.setBase64file(getBase64ByUrl(imgUrl)); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(imgFormDTO), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员头像失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员头像失败!" + result.getErrMsg()); + } else { + return "success"; + } + } + + /** + * 人员开卡 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public String addPersonCard(DhPersonFormDTO dto) { + Long personId = addPerson(dto); + if (personId == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "添加人员信息失败"); + } + DhPersonCardListFormDTO cardListFormDTO = new DhPersonCardListFormDTO(); + List cardList = new ArrayList<>(); + DhPersonCardFormDTO cardFormDTO = new DhPersonCardFormDTO(); + String url = dhCloudProperties.getUrl().concat(OPEN_CARD); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + cardFormDTO.setPersonId(personId); + cardFormDTO.setPersonName(dto.getName()); + cardFormDTO.setCardNumber(generateNiceString(8)); + cardFormDTO.setCardType("0"); + cardFormDTO.setCategory("0"); + cardFormDTO.setCardStatus("ACTIVE"); + cardFormDTO.setStartDate(LocalDate.now().toString()); + cardFormDTO.setEndDate(LocalDate.now().plusDays(1L).toString()); + String pwd; + try { + pwd = RSAUtils.getPwdByRsa(getPublicKey(), "123456"); + } catch (Exception e) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "密码加密失败"); + } + cardFormDTO.setCardPassword(pwd); + cardFormDTO.setSubSystems("1"); + cardList.add(cardFormDTO); + cardListFormDTO.setObjectList(cardList); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(cardListFormDTO), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员开卡失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "人员开卡失败!" + result.getErrMsg()); + } else { + return cardFormDTO.getCardNumber(); + } + } + + /** + * 下发人员权限 + * + * @param dto + * @return java.lang.String + * @author zhy + * @date 2022/5/23 11:04 + */ + public String addPersonAuth(DhPersonFormDTO dto, String imgUrl) { + String personCard = addPersonCard(dto); + if (StringUtils.isBlank(personCard)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "开卡失败"); + } else if (StringUtils.isNotBlank(imgUrl)) { + addPersonImg(dto, imgUrl); + } + + List channel = getChannel(); + if (channel.isEmpty()) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取通道失败"); + } + + Long plan = getPlan(); + if (plan == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取开门计划失败"); + } + + DhAuthFormDTO authFormDTO = new DhAuthFormDTO(); + String url = dhCloudProperties.getUrl().concat(ADD_AUTH); + String urlParam = getDhUrlParams(); + url = url + urlParam; + + authFormDTO.setCardNumber(personCard); + authFormDTO.setTimeQuantumId(plan.toString()); + authFormDTO.setCardPrivilegeDetails(channel); + + Map paramsMap = new HashMap<>(4); + + String data = HttpClientManager.getInstance().sendPostByJSONAndHeader(url, JSON.toJSONString(authFormDTO), paramsMap).getData(); + + if (null == data) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员权限失败"); + } + JSONObject toResult = JSON.parseObject(data); + DhResult result = ConvertUtils.mapToEntity(toResult, DhResult.class); + if (null != toResult.get("success")) { + result.setCode(200); + } + if (!result.getSuccess()) { + logger.info(result.getErrMsg()); + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "下发人员权限失败!" + result.getErrMsg()); + } else { + return "success"; + } + } + + /** + * 拼接url固定参数 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/7/28 16:09 + */ + private String getDhUrlParams() { + DhTokenDTO token = getLoginPass(getPublicKey()); + return "?userId=" + token.getId() + "&username=" + token.getLoginName() + "&token=" + token.getToken(); + } + + private String getBase64ByUrl(String imgUrl) { + String ossDomain; + byte[] fileBytes; + try { + URL url = new URL(imgUrl); + DataInputStream dataInputStream = new DataInputStream(url.openStream()); + byte[] originBytes = toByteArray(dataInputStream); + + fileBytes = compressPicCycle(originBytes, 100L, 0.1); + } catch (IOException e) { + logger.error("图片上传异常", e); + throw new RenException("图片上传异常"); + } + return DatatypeConverter.printBase64Binary(fileBytes); + } + + /** + * @param bytes 原图片字节数组 + * @param desFileSize 指定图片大小,单位 kb + * @param accuracy 精度,递归压缩的比率,建议小于0.9 + * @return + */ + private byte[] compressPicCycle(byte[] bytes, long desFileSize, double accuracy) throws IOException { + // 获取目标图片 + long fileSize = bytes.length; + System.out.println("=====fileSize======== " + fileSize); + // 判断图片大小是否小于指定图片大小 + if (fileSize <= desFileSize * 1024) { + return bytes; + } + //计算宽高 + BufferedImage bim = ImageIO.read(new ByteArrayInputStream(bytes)); + int imgWidth = bim.getWidth(); + System.out.println(imgWidth + "====imgWidth====="); + int imgHeight = bim.getHeight(); + int desWidth = new BigDecimal(imgWidth).multiply(new BigDecimal(accuracy)).intValue(); + System.out.println(desWidth + "====desWidth====="); + int desHeight = new BigDecimal(imgHeight).multiply(new BigDecimal(accuracy)).intValue(); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); //字节输出流(写入到内存) + Thumbnails.of(new ByteArrayInputStream(bytes)).size(desWidth, desHeight).outputQuality(accuracy).toOutputStream(baos); + //如果不满足要求,递归直至满足要求 + return compressPicCycle(baos.toByteArray(), desFileSize, accuracy); + } + + /** + * inputstream输入流转换成byte[]字节数组 + * + * @param input + * @return byte[] + * @author yinzuomei + * @date 2020/2/27 16:09 + */ + private byte[] toByteArray(InputStream input) throws IOException { + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buffer = new byte[1024 * 4]; + int n = 0; + while (-1 != (n = input.read(buffer))) { + output.write(buffer, 0, n); + } + return output.toByteArray(); + } + + /** + * 随机生成16进制字符串 + * + * @param len + * @return java.lang.String + * @author zhy + * @date 2022/7/29 9:47 + */ + private String generateNiceString(int len) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < len; i++) { + sb.append(Integer.toHexString(new Random().nextInt(16))); + } + return sb.toString().toUpperCase(); + } + + /** + * 退卡,然后删除人员 + * + * @param code + * @return void + * @author zhy + * @date 2022/8/3 10:48 + */ + public void dataHandle(String code) { + // 先退卡 + cardHandle(code); + // 再删人员 + personHandle(code); + } + +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/DhResult.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/DhResult.java new file mode 100644 index 0000000..86a8748 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/DhResult.java @@ -0,0 +1,142 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + * + * https://www.renren.io + * + * 版权所有,侵权必究! + */ + +package com.epmet.plugin.power.modules.visit.utils; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ErrorCode; +import com.epmet.commons.tools.utils.MessageUtils; +import com.epmet.commons.tools.utils.Result; +import org.apache.commons.lang3.StringUtils; + +import java.io.Serializable; + +/** + * 响应数据 + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +public class DhResult implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 编码:0表示成功,其他值表示失败 + */ + private Integer code = 0; + /** + * 消息内容 + */ + private String errMsg = "success"; + + /** + * 内部信息 + */ + private Boolean success = true; + + /** + * 响应数据 + */ + private T data; + + public DhResult ok(T data) { + this.setData(data); + return this; + } + + public boolean success(){ + return code == 0; + } + + /** + * 返回 + * "code": 8000, + * "msg": "服务器开小差了...", + */ + public DhResult error() { + this.code = EpmetErrorCode.SERVER_ERROR.getCode(); + this.errMsg = EpmetErrorCode.getMsg(code); + if (StringUtils.isBlank(this.errMsg)) { + this.errMsg = MessageUtils.getMessage(this.code); + } + return this; + } + + /** + * 根据错误编码查询msg返回 + */ + public DhResult error(int code) { + this.code = code; + this.errMsg = EpmetErrorCode.getMsg(code); + if (StringUtils.isBlank(this.errMsg)) { + this.errMsg = MessageUtils.getMessage(this.code); + } + return this; + } + + /** + * 传入错误编码+msg返回 + */ + public DhResult error(int code, String msg) { + this.code = code; + this.errMsg = msg; + return this; + } + + /** + * + * @param msg + * @return 此方法废弃,统一使用 + * logger.error(XXXX); + * throw new RenException(XXXX); + * XXXX定义常量里 + */ + @Deprecated + public DhResult error(String msg) { + this.code = ErrorCode.INTERNAL_SERVER_ERROR; + this.errMsg = msg; + return this; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getErrMsg() { + return errMsg; + } + + public void setErrMsg(String errMsg) { + this.errMsg = errMsg; + } + + public T getData() { + return data; + } + + public void setData(T data) { + this.data = data; + } + + public Boolean getSuccess() { + return success; + } + + public void setSuccess(Boolean success) { + this.success = success; + } + + @Override + public String toString() { + return JSON.toJSONString(this); + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/RSAUtils.java b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/RSAUtils.java new file mode 100644 index 0000000..866b401 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/java/com/epmet/plugin/power/modules/visit/utils/RSAUtils.java @@ -0,0 +1,325 @@ +package com.epmet.plugin.power.modules.visit.utils; + +import java.security.Key; +import java.security.KeyFactory; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.SecureRandom; +import java.security.Security; +import java.security.Signature; +import java.security.interfaces.RSAPrivateKey; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; +import java.util.HashMap; +import java.util.Map; + +import javax.crypto.Cipher; + +import cn.hutool.core.codec.Base64; +import org.bouncycastle.jce.provider.BouncyCastleProvider; + +/** + * + *

Title:RSAUtils

+ *

Description:RSA工具类

+ *

Company:浙江大华技术股份有限公司

+ * @author 32174 + * @date 2018年12月18日 + */ +public class RSAUtils{ + public static final String KEY_ALGORITHM = "RSA"; + public static final String SIGNATURE_ALGORITHM = "MD5withRSA"; + public static final String PADDING="RSA/None/PKCS1Padding"; + + private static final String PUBLIC_KEY = "RSAPublicKey"; + private static final String PRIVATE_KEY = "RSAPrivateKey"; + + private static final int KEY_SIZE = 1024; // 秘钥长度1024,最长加密117字节明文 + + static{ + Security.addProvider(new BouncyCastleProvider()); + } + /** + * 用私钥对信息生成数字签名 + * + * @param data + * 加密数据 + * @param privateKey + * 私钥 + * + * @return + * @throws Exception + */ + public static String sign(byte[] data, String privateKey) throws Exception { + // 解密由base64编码的私钥 + byte[] keyBytes = decryptBASE64(privateKey); + + // 构造PKCS8EncodedKeySpec对象 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + + // KEY_ALGORITHM 指定的加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + + // 取私钥匙对象 + PrivateKey priKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 用私钥对信息生成数字签名 + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initSign(priKey); + signature.update(data); + + return encryptBASE64(signature.sign()); + } + + /** + * BASE64加密 + * + * @param key + * @return + * @throws Exception + */ + public static String encryptBASE64(byte[] key) throws Exception { + return Base64Util.encodeBase64String(key); + } + + /** + * BASE64解密 + * + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptBASE64(String key) throws Exception { + return Base64Util.decodeBase64(key.getBytes()); + } + + /** + * 校验数字签名 + * + * @param data + * 加密数据 + * @param publicKey + * 公钥 + * @param sign + * 数字签名 + * + * @return 校验成功返回true 失败返回false + * @throws Exception + * + */ + public static boolean verify(byte[] data, String publicKey, String sign) + throws Exception { + + // 解密由base64编码的公钥 + byte[] keyBytes = decryptBASE64(publicKey); + + // 构造X509EncodedKeySpec对象 + X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes); + + // KEY_ALGORITHM 指定的加密算法 + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + + // 取公钥匙对象 + PublicKey pubKey = keyFactory.generatePublic(keySpec); + + Signature signature = Signature.getInstance(SIGNATURE_ALGORITHM); + signature.initVerify(pubKey); + signature.update(data); + + // 验证签名是否正常 + return signature.verify(decryptBASE64(sign)); + } + + /** + * 解密
+ * 用私钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptByPrivateKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得私钥 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 对数据解密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.DECRYPT_MODE, privateKey); + + return cipher.doFinal(data); + } + + /** + * 解密
+ * 用公钥解密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] decryptByPublicKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得公钥 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicKey = keyFactory.generatePublic(x509KeySpec); + + // 对数据解密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.DECRYPT_MODE, publicKey); + + return cipher.doFinal(data); + } + + /** + * 加密
+ * 用公钥加密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] encryptByPublicKey(byte[] data, String key) + throws Exception { + // 对公钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得公钥 + X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key publicKey = keyFactory.generatePublic(x509KeySpec); + + // 对数据加密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.ENCRYPT_MODE, publicKey); + + return cipher.doFinal(data); + } + + /** + * 加密
+ * 用私钥加密 + * + * @param data + * @param key + * @return + * @throws Exception + */ + public static byte[] encryptByPrivateKey(byte[] data, String key) + throws Exception { + // 对密钥解密 + byte[] keyBytes = decryptBASE64(key); + + // 取得私钥 + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM); + Key privateKey = keyFactory.generatePrivate(pkcs8KeySpec); + + // 对数据加密 + Cipher cipher = Cipher.getInstance(PADDING , BouncyCastleProvider.PROVIDER_NAME); + cipher.init(Cipher.ENCRYPT_MODE, privateKey); + + return cipher.doFinal(data); + } + + /** + * 取得私钥(BASE64编码) + * + * @param keyMap + * @return + * @throws Exception + */ + public static String getPrivateKey(Map keyMap) + throws Exception { + Key key = (Key) keyMap.get(PRIVATE_KEY); + + return encryptBASE64(key.getEncoded()); + } + + /** + * 取得公钥(BASE64编码) + * + * @param keyMap + * @return + * @throws Exception + */ + public static String getPublicKey(Map keyMap) + throws Exception { + Key key = (Key) keyMap.get(PUBLIC_KEY); + + return encryptBASE64(key.getEncoded()); + } + + /** + * 判断字符串是否被公钥加密 + * @param text + * @param privateKey + * @return + */ + public static boolean isTextEncryptByPublicKey(String text , String privateKey){ + boolean bol = true; + try{ + byte[] encryBytes = RSAUtils.decryptBASE64(text); + RSAUtils.decryptByPrivateKey(encryBytes, privateKey); + }catch(Exception e){ + bol = false; + } + return bol; + } + + /** + * 初始化密钥 + * + * @return + * @throws Exception + */ + public static Map initKey() throws Exception { + KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM , BouncyCastleProvider.PROVIDER_NAME); + keyPairGen.initialize(KEY_SIZE , new SecureRandom()); + + KeyPair keyPair = keyPairGen.generateKeyPair(); + + // 公钥 + RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic(); + + // 私钥 + RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate(); + + Map keyMap = new HashMap(2); + + keyMap.put(PUBLIC_KEY, publicKey); + keyMap.put(PRIVATE_KEY, privateKey); + return keyMap; + } + + /** + * 密码加密 + * + * @param + * @return java.lang.String + * @author zhy + * @date 2022/7/29 10:46 + */ + public static String getPwdByRsa(String publicKey, String str) throws Exception { + byte[] decoded = Base64.decode(publicKey); + RSAPublicKey pubKey =(RSAPublicKey)KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(decoded));// RSA加密 + Cipher cipher = Cipher.getInstance("RSA"); + cipher.init(Cipher.ENCRYPT_MODE, pubKey); + return Base64.encode(cipher.doFinal(str.getBytes("UTF-8"))); + } +} diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/bootstrap.yml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/bootstrap.yml index 66aedcd..e20a81a 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/bootstrap.yml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/bootstrap.yml @@ -127,6 +127,17 @@ dingTalk: webHook: @dingTalk.robot.webHook@ secret: @dingTalk.robot.secret@ +hik: + cloud: + url: @hik.cloud.url@ + client: @hik.cloud.client@ + secret: @hik.cloud.secret@ +dh: + cloud: + url: @dh.cloud.url@ + loginName: @dh.cloud.loginName@ + loginPass: @dh.cloud.loginPass@ + # 停机选项 shutdown: graceful: diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.10__pli_rent_update.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.10__pli_rent_update.sql new file mode 100644 index 0000000..68c19fe --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.10__pli_rent_update.sql @@ -0,0 +1,3 @@ +ALTER TABLE epmet_pli_power.pli_rent_tenant_info ADD UNIT varchar(255) NULL; +ALTER TABLE epmet_pli_power.pli_rent_contract_info ADD LESSEE_UNIT varchar(255) NULL COMMENT '承租人工作单位'; +ALTER TABLE epmet_pli_power.pli_rent_contract_info CHANGE LESSEE_UNIT LESSEE_UNIT varchar(255) NULL COMMENT '承租人工作单位' AFTER LESSEE_MOBILE; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.11__pli_rent_contract_info_add_address.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.11__pli_rent_contract_info_add_address.sql new file mode 100644 index 0000000..8c52b47 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.11__pli_rent_contract_info_add_address.sql @@ -0,0 +1,2 @@ +ALTER TABLE pli_rent_contract_info ADD COLUMN LESSOR_LIVE_ADDRESS varchar(255) COMMENT '出租人现居住地'; +ALTER TABLE pli_rent_contract_info ADD COLUMN LESSEE_HOUSE_ADDRESS varchar(255) COMMENT '承租人户籍地地址'; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.12__pli_visit.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.12__pli_visit.sql new file mode 100644 index 0000000..bd21899 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.12__pli_visit.sql @@ -0,0 +1,65 @@ +/* + Navicat Premium Data Transfer + + Source Server : epmet_cloud_dev_pli + Source Server Type : MySQL + Source Server Version : 50726 + Source Host : 192.168.1.140:3306 + Source Schema : epmet_pli_power + + Target Server Type : MySQL + Target Server Version : 50726 + File Encoding : 65001 + + Date: 28/07/2022 10:52:15 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_chart_hour +-- ---------------------------- +DROP TABLE IF EXISTS `pli_chart_hour`; +CREATE TABLE `pli_chart_hour` ( + `hour` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '图表日期链表' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Table structure for pli_visit_visitor +-- ---------------------------- +DROP TABLE IF EXISTS `pli_visit_visitor`; +CREATE TABLE `pli_visit_visitor` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '姓名', + `ID_CARD` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '身份证', + `GENDER` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '性别 0:女 1:男', + `MOBILE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '手机号', + `TYPE` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '人员类型 0:访客 1:租客', + `STATE` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用)', + `REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核原因', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `VISIT_REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来访事由', + `FACE_IMG` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '头像', + `RESIDENTIAL` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '小区', + `BUILDING` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '楼栋', + `UNIT` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单元', + `ROOM` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房屋', + `AGENCY_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组织id', + `PARENT_AGENCY_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '上级组织id', + `AGENCY_PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '组织的所有上级组织id', + `GRID_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网格id', + `NEIGHBORHOOD_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '小区id', + `BUILDING_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属楼栋id', + `UNIT_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属单元id', + `HOUSE_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所属房屋id', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租客表' ROW_FORMAT = Dynamic; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.13__pli_rent_contract_info_add_isPcInput.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.13__pli_rent_contract_info_add_isPcInput.sql new file mode 100644 index 0000000..e048f35 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.13__pli_rent_contract_info_add_isPcInput.sql @@ -0,0 +1 @@ +ALTER TABLE pli_rent_contract_info ADD COLUMN IS_PC_INPUT varchar(1) COMMENT '是否来源于PC端录入(0:否;1:是)'; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.4__pli_rent.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.4__pli_rent.sql new file mode 100644 index 0000000..29ae249 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.4__pli_rent.sql @@ -0,0 +1,135 @@ +/* + Navicat Premium Data Transfer + + Source Server : epmet_test_user + Source Server Type : MySQL + Source Server Version : 50732 + Source Host : 118.190.150.119:13306 + Source Schema : epmet_pli_power + + Target Server Type : MySQL + Target Server Version : 50732 + File Encoding : 65001 + + Date: 13/05/2022 10:53:09 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_rent_tenant_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_rent_tenant_info`; +CREATE TABLE `pli_rent_tenant_info` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `CONTRACT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '合同ID', + `NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名', + `ID_CARD` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证', + `MOBILE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', + `YFZGX` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '与房主关系', + `TYPE` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '人员类型 0:房东 1:租客', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `STATE` char(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '审核状态 0:未审核 1:审核通过 2:审核不通过(房东使用)', + `REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核原因', + PRIMARY KEY (`ID`) USING BTREE, + INDEX `idx_cid`(`CONTRACT_ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '租客表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Table structure for pli_rent_contract_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_rent_contract_info`; +CREATE TABLE `pli_rent_contract_info` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `COMMUNITY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '社区ID', + `COMMUNITY_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '社区', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '网格ID', + `GRID_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '网格', + `VILLAGE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房屋小区ID', + `VILLAGE_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房屋小区', + `BUILD_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '楼号ID', + `BUILD_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '楼号', + `UNIT_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单元ID', + `UNIT_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '单元', + `HOME_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房屋ID', + `HOME_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房屋', + `OWNER_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '房主姓名', + `STATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '状态:0未审核,1审核通过,2审核不通过', + `LESSOR_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出租人姓名', + `LESSOR_ID_CARD` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出租人身份证', + `LESSOR_MOBILE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '出租人手机', + `LESSEE_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '承租人姓名', + `LESSEE_ID_CARD` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '承租人身份证', + `LESSEE_MOBILE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '承租人手机', + `SIGN_DATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '签署日期', + `REVIEW_DATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核日期', + `START_DATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '合同开始日期', + `END_DATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '合同结束日期', + `REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '审核-原因', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + PRIMARY KEY (`ID`) USING BTREE, + INDEX `epdc_master_topic_USER_ID_IDX`(`HOME_NAME`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '合同表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Table structure for pli_rent_contract_file +-- ---------------------------- +DROP TABLE IF EXISTS `pli_rent_contract_file`; +CREATE TABLE `pli_rent_contract_file` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'ID', + `REFERENCE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '引用ID', + `FILE_URL` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '文件地址', + `FILE_TYPE` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '文件类型 0:图片,1 文件(合同)', + `DEL_FLAG` int(11) NOT NULL COMMENT '删除标识 0:未删除,1:删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + PRIMARY KEY (`ID`) USING BTREE, + INDEX `idx_rid`(`REFERENCE_ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '附件表' ROW_FORMAT = DYNAMIC; + +-- ---------------------------- +-- Table structure for pli_rent_blacklist +-- ---------------------------- +DROP TABLE IF EXISTS `pli_rent_blacklist`; +CREATE TABLE `pli_rent_blacklist` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `USER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'epmet用户主键', + `NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '姓名', + `ID_CARD` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '身份证', + `MOBILE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', + `GENDER` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '性别 0女 1男', + `TYPE` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型 0 租客 1 房东', + `JOIN_DATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '加入时间', + `JOIN_REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '加入原因', + `REMOVE_DATE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移除时间', + `REMOVE_REASON` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '移除原因', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `GRID_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'epmet网格ID', + PRIMARY KEY (`ID`) USING BTREE, + INDEX `epdc_master_topic_USER_ID_IDX`(`USER_ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '黑名单表' ROW_FORMAT = DYNAMIC; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.5__pli_rent_house.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.5__pli_rent_house.sql new file mode 100644 index 0000000..eb90622 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.5__pli_rent_house.sql @@ -0,0 +1,63 @@ +/* + Navicat Premium Data Transfer + + Source Server : epmet_test_user + Source Server Type : MySQL + Source Server Version : 50732 + Source Host : 118.190.150.119:13306 + Source Schema : epmet_pli_power + + Target Server Type : MySQL + Target Server Version : 50732 + File Encoding : 65001 + + Date: 13/05/2022 10:53:09 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_rent_tenant_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_rent_house`; + +CREATE TABLE `pli_rent_house` ( + `ID` varchar(64) NOT NULL COMMENT '', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT 'ͻid', + `NEIGHBOR_HOOD_ID` varchar(64) DEFAULT NULL COMMENT 'Сid', + `PART_ID` varchar(64) DEFAULT NULL COMMENT 'Ƭidneighbor_hood_part.id,Ϊա', + `BUILDING_ID` varchar(64) DEFAULT NULL COMMENT '¥id', + `BUILDING_UNIT_ID` varchar(64) DEFAULT NULL COMMENT 'Ԫid', + `HOUSE_NAME` varchar(64) DEFAULT NULL COMMENT 'ֺ̨ʱ', + `DOOR_NAME` varchar(64) DEFAULT NULL COMMENT 'ƺ', + `HOUSE_TYPE` varchar(32) DEFAULT NULL COMMENT 'ͣ1¥2ƽ3', + `PURPOSE` varchar(32) DEFAULT NULL COMMENT '洢ֵvalue', + `RENT_FLAG` tinyint(1) DEFAULT NULL COMMENT '1 0ס 2', + `OWNER_NAME` varchar(32) DEFAULT '' COMMENT '', + `OWNER_PHONE` varchar(32) DEFAULT '' COMMENT '绰', + `OWNER_ID_CARD` varchar(32) DEFAULT '' COMMENT '֤', + `SORT` decimal(6,2) DEFAULT '0.00' COMMENT '', + `DEL_FLAG` varchar(1) NOT NULL DEFAULT '0' COMMENT 'ɾʶ 0δɾ1ɾ', + `REVISION` int(11) NOT NULL DEFAULT '0' 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 'ʱ', + `COMMUNITY_ID` varchar(32) NOT NULL COMMENT 'ID', + `COMMUNITY_NAME` varchar(32) DEFAULT NULL COMMENT '', + `GRID_ID` varchar(32) NOT NULL COMMENT 'ID', + `GRID_NAME` varchar(32) DEFAULT NULL COMMENT '', + `VILLAGE_ID` varchar(32) DEFAULT NULL COMMENT 'СID', + `VILLAGE_NAME` varchar(32) DEFAULT NULL COMMENT 'С', + `BUILD_ID` varchar(32) DEFAULT NULL COMMENT '¥ID', + `BUILD_NAME` varchar(32) DEFAULT NULL COMMENT '¥', + `UNIT_ID` varchar(32) DEFAULT NULL COMMENT 'ԪID', + `UNIT_NAME` varchar(32) DEFAULT NULL COMMENT 'Ԫ', + `HOME_ID` varchar(32) DEFAULT NULL COMMENT 'ID', + `HOME_NAME` varchar(32) DEFAULT NULL COMMENT '', + `PURCHASE_DATE` varchar(32) DEFAULT NULL COMMENT '', + PRIMARY KEY (`ID`) USING BTREE, + KEY `idx_building_id` (`BUILDING_ID`) USING BTREE COMMENT '¥id', + KEY `idx_hood_id` (`NEIGHBOR_HOOD_ID`) USING BTREE COMMENT 'Сid' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Ϣ'; \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.6__pli_rent_house.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.6__pli_rent_house.sql new file mode 100644 index 0000000..3b3798c --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.6__pli_rent_house.sql @@ -0,0 +1,25 @@ +/* + Navicat Premium Data Transfer + + Source Server : epmet_test_user + Source Server Type : MySQL + Source Server Version : 50732 + Source Host : 118.190.150.119:13306 + Source Schema : epmet_pli_power + + Target Server Type : MySQL + Target Server Version : 50732 + File Encoding : 65001 + + Date: 13/05/2022 10:53:09 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_rent_tenant_info +-- ---------------------------- + + +ALTER TABLE pli_rent_house MODIFY COLUMN COMMUNITY_ID VARCHAR(32) DEFAULT NULL ; \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.7__pli_rent_contract_update.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.7__pli_rent_contract_update.sql new file mode 100644 index 0000000..7e439d5 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.7__pli_rent_contract_update.sql @@ -0,0 +1,2 @@ +ALTER TABLE epmet_pli_power.pli_rent_contract_info ADD LESSOR_RELATION varchar(32) NULL COMMENT '出租人与户主关系'; +ALTER TABLE epmet_pli_power.pli_rent_contract_info CHANGE LESSOR_RELATION LESSOR_RELATION varchar(32) NULL COMMENT '出租人与户主关系' AFTER LESSOR_MOBILE; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.8__pli_rent_tenant_info_update.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.8__pli_rent_tenant_info_update.sql new file mode 100644 index 0000000..541e6d7 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.8__pli_rent_tenant_info_update.sql @@ -0,0 +1,3 @@ +ALTER TABLE epmet_pli_power.pli_rent_tenant_info ADD POLITICAL_STATUS varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '政治面貌'; +ALTER TABLE epmet_pli_power.pli_rent_tenant_info ADD IS_MILITARY varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '是否服兵役【是:1 否:0】'; +ALTER TABLE epmet_pli_power.pli_rent_tenant_info ADD NATION varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '国籍'; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.9__pli_hik.sql b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.9__pli_hik.sql new file mode 100644 index 0000000..7f35f7e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/db/migration/V0.0.9__pli_hik.sql @@ -0,0 +1,207 @@ +/* + Navicat Premium Data Transfer + + Source Server : epmet_test + Source Server Type : MySQL + Source Server Version : 50732 + Source Host : rm-bp1l2b53j508j1176xo.mysql.rds.aliyuncs.com:3306 + Source Schema : epmet_pli_power + + Target Server Type : MySQL + Target Server Version : 50732 + File Encoding : 65001 + + Date: 26/05/2022 11:06:34 +*/ + +SET NAMES utf8mb4; +SET FOREIGN_KEY_CHECKS = 0; + +-- ---------------------------- +-- Table structure for pli_hik_user_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_hik_user_info`; +CREATE TABLE `pli_hik_user_info` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `COMMUNITY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '社区ID', + `DEVICE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备ID', + `DEVICE_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称', + `DEVICE_MODEL` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备型号', + `DEVICE_SERIAL` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备序列号', + `DEVICE_STATUS` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备状态,0:离线,1:在线', + `DEVICE_PATH` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备路径', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '海康设备信息' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pli_hik_user_info +-- ---------------------------- +INSERT INTO `pli_hik_user_info` VALUES ('1', '0', 0, '1', '2022-04-24 16:37:02', '1518475117776248834', '2022-05-05 16:05:40', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519130902068830209', '0', 0, '1519129607526060033', '2022-04-27 09:46:46', '1519129607526060033', '2022-04-27 09:46:46', '775bf1a4331d2451eb0faf44294914a9', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519137954380570626', '0', 0, '1519129607526060033', '2022-04-27 10:14:47', '1519129607526060033', '2022-04-27 10:14:47', '775bf1a4331d2451eb0faf44294914a9', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519255397025304578', '0', 0, 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-04-27 18:01:28', 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-04-27 18:01:28', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519255921506242562', '0', 0, 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-04-27 18:03:33', 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-04-27 18:03:33', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519259445602406401', '0', 0, 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-04-27 18:17:33', 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-05-05 15:55:51', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519261145046306818', '0', 0, 'bd5797b6ccc67d0da5c7afc81683a88b', '2022-04-27 18:24:18', '1518475117776248834', '2022-05-05 15:55:46', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519870856960946177', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:05', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:05', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519870856969334786', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:05', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:05', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519870856973529090', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:05', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:05', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519870892964851714', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:13', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:13', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519870892973240321', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:13', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:13', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519870892977434626', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:13', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 10:47:13', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519952110813069313', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 16:09:57', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 16:09:57', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519952110825652225', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 16:09:57', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 16:09:57', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1519952110829846529', '0', 0, '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 16:09:57', '31d97bba11edd092731c4bcdd0cfd885', '2022-04-29 16:09:57', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522818520787673089', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:00:03', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:00:03', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522818520787673090', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:00:03', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:00:03', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522818520854781954', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:00:03', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:00:03', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522831908135481346', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:53:14', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:53:14', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522831908135481347', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:53:14', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:53:14', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522831908135481348', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:53:14', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:53:14', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522833276204199937', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:58:41', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:58:41', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522833276204199938', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:58:41', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:58:41', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522833276204199939', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:58:41', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 14:58:41', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522839236871004162', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 15:22:22', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 15:22:22', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522839236871004163', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 15:22:22', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 15:22:22', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1522839236871004164', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 15:22:22', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-07 15:22:22', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1523941125874941954', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-10 16:20:53', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-10 16:20:53', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1523941125891719170', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-10 16:20:53', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-10 16:20:53', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1523941125900107777', '0', 0, '5c257e9ed03c48fa0add951d482d35fe', '2022-05-10 16:20:53', '5c257e9ed03c48fa0add951d482d35fe', '2022-05-10 16:20:53', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1526858235601604610', '0', 0, '1519589686647726082', '2022-05-18 17:32:26', '1519589686647726082', '2022-05-18 17:32:26', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1526861851389448194', '0', 0, '1519589686647726082', '2022-05-18 17:46:48', '1519589686647726082', '2022-05-18 17:46:48', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1526861851397836802', '0', 0, '1519589686647726082', '2022-05-18 17:46:48', '1519589686647726082', '2022-05-18 17:46:48', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527098588476854273', '0', 0, '1519589686647726082', '2022-05-19 09:27:30', '1519589686647726082', '2022-05-19 09:27:30', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527098588535574529', '0', 0, '1519589686647726082', '2022-05-19 09:27:30', '1519589686647726082', '2022-05-19 09:27:30', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527098588543963137', '0', 0, '1519589686647726082', '2022-05-19 09:27:30', '1519589686647726082', '2022-05-19 09:27:30', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527103454301507586', '0', 0, '1519589686647726082', '2022-05-19 09:46:50', '1519589686647726082', '2022-05-19 09:46:50', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527103454309896193', '0', 0, '1519589686647726082', '2022-05-19 09:46:50', '1519589686647726082', '2022-05-19 09:46:50', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527103454309896194', '0', 0, '1519589686647726082', '2022-05-19 09:46:50', '1519589686647726082', '2022-05-19 09:46:50', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527107590946410497', '0', 0, '1519589686647726082', '2022-05-19 10:03:17', '1519589686647726082', '2022-05-19 10:03:17', '45687aa479955f9d06204d415238f7cc', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527172217686175746', '0', 0, '1519589686647726082', '2022-05-19 14:20:05', '1519589686647726082', '2022-05-19 14:20:05', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527172217744896002', '0', 0, '1519589686647726082', '2022-05-19 14:20:05', '1519589686647726082', '2022-05-19 14:20:05', '45687aa479955f9d06204d415238f7cc', '群众', '否', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527173017498005505', '0', 0, '1519589686647726082', '2022-05-19 14:23:16', '1519589686647726082', '2022-05-19 14:23:16', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527175894891212802', '0', 0, '1519589686647726082', '2022-05-19 14:34:42', '1519589686647726082', '2022-05-19 14:34:42', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527177360733351938', '0', 0, '1519589686647726082', '2022-05-19 14:40:31', '1519589686647726082', '2022-05-19 14:40:31', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527483669210968066', '0', 0, '1519589686647726082', '2022-05-20 10:57:41', '1519589686647726082', '2022-05-20 10:57:41', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527485515858161666', '0', 0, '1519589686647726082', '2022-05-20 11:05:01', '1519589686647726082', '2022-05-20 11:05:01', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('1527485965554659330', '0', 0, '1519589686647726082', '2022-05-20 11:06:48', '1519589686647726082', '2022-05-20 11:06:48', '45687aa479955f9d06204d415238f7cc', '党员', '是', '中国', NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('2', '0', 0, '1', '2022-04-24 16:37:02', '1', '2022-04-24 16:37:06', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO `pli_hik_user_info` VALUES ('3', '0', 0, '1', '2022-04-24 16:37:02', '1', '2022-04-24 16:37:06', '', NULL, NULL, NULL, NULL, NULL, NULL, NULL); + +-- ---------------------------- +-- Table structure for pli_hik_error_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_hik_error_info`; +CREATE TABLE `pli_hik_error_info` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `ID_CARD` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '身份证号', + `ERROR_TYPE` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误类型 0:token,1:人员,2权限', + `ERROR_INFO` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '错误详情', + `REFERENCE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '引用ID', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '海康设备推送失败信息' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pli_hik_error_info +-- ---------------------------- + +-- ---------------------------- +-- Table structure for pli_hik_device_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_hik_device_info`; +CREATE TABLE `pli_hik_device_info` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `COMMUNITY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '社区ID', + `DEVICE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备ID', + `DEVICE_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备名称', + `DEVICE_MODEL` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备型号', + `DEVICE_SERIAL` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备序列号', + `DEVICE_STATUS` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备状态,0:离线,1:在线', + `DEVICE_PATH` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备路径', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '海康设备信息' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pli_hik_device_info +-- ---------------------------- +INSERT INTO `pli_hik_device_info` VALUES ('1528615649503821826', '0', 0, 'APP_USER', '2022-05-23 13:55:46', 'APP_USER', '2022-05-23 13:55:46', '0001', '98b6060a7b8e408dbc3278a5b4fcfe2b', 'edbc991eb97445e698f709f3710a6fd4', '华二小区南门入口', 'DS-K1T671TM', 'F30961045', '1', '98b6060a7b8e408dbc3278a5b4fcfe2b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615649503821827', '0', 0, 'APP_USER', '2022-05-23 13:55:46', 'APP_USER', '2022-05-23 13:55:46', '0001', '98b6060a7b8e408dbc3278a5b4fcfe2b', '7a6f9f4b80184661a979534fc09ed6c7', '华二小区南门出口', 'DS-K1T671TM', 'F30961014', '1', '98b6060a7b8e408dbc3278a5b4fcfe2b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693724368898', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', '6ede5b5c18614274a778b789751e9600', '华三西区西门出口', 'DS-K1T671TM', 'F30961113', '1', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693724368899', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', '52d8049b99054beb82034836c0438a65', '华三西区西门入口', 'DS-K1T671TM', 'F30961001', '1', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693724368900', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', '352f21733f8442bcb5129ad924374df5', '华三西区东门出口', 'DS-K1T671TM', 'F30961136', '1', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693724368901', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', 'af7277c249bf488295a281ffd032f821', '华三西区东门入口', 'DS-K1T671TM', 'F30960996', '1', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693724368902', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', '99d463a32a3c47168e1ae9e607f9a431', '华三东区西门出口', 'DS-K1T671TM', 'F30961071', '0', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693724368903', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', 'fe025123bd6040fa972b94300936563d', '华三东区西门入口', 'DS-K1T671TM', 'F30960993', '0', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693787283458', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', 'c1656946183247e297988bc42c9f048c', '华三东区东门出口', 'DS-K1T671TM', 'F30961059', '0', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615693787283459', '0', 0, 'APP_USER', '2022-05-23 13:55:56', 'APP_USER', '2022-05-23 13:55:56', '0001', 'eff54b400c814a64906159f961aa9146', '2221e0f2737d4dcf9622c6277e2cf59a', '华三东区东门入口', 'DS-K1T671TM', 'F30961092', '0', 'eff54b400c814a64906159f961aa9146'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615695485976577', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', '9da3bab48a9d4b919172f91f73bed754', '924311c1327b4a24b242a2130de6bbbe', '青福楼入口', 'DS-K1T671TM', 'F30969104', '1', '9da3bab48a9d4b919172f91f73bed754'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615696467443713', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', 'b6a3f4d2012441b1ac419b6afafbf913', '285f5fba0a3940b2bddcb09fdffd2292', 'F区入口', 'DS-K1T671TM', 'F30969051', '1', 'b6a3f4d2012441b1ac419b6afafbf913'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615697377607682', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', '9f80094d599145868e3e61dbea5b4412', '8df91ee9cd3c483bb26e5bb4f5141d59', 'E区入口', 'DS-K1T671TM', 'F30969049', '1', '9f80094d599145868e3e61dbea5b4412'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615698346491905', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', 'ad0e2e103e1e4093a56f2707a681aa8b', '3178efe3ded2413d95fe002a3cf718be', '翠竹苑北门出口', 'DS-K1T671TM', 'F30961037', '1', 'ad0e2e103e1e4093a56f2707a681aa8b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615698409406466', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', 'ad0e2e103e1e4093a56f2707a681aa8b', 'a30b62d9e1614905a280f3e1e86ddddf', '翠竹苑北门入口', 'DS-K1T671TM', 'F30960956', '1', 'ad0e2e103e1e4093a56f2707a681aa8b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615698409406467', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', 'ad0e2e103e1e4093a56f2707a681aa8b', '22abf36c38894b6c9ba59787e1301c2a', '翠竹苑入口', 'DS-K1T671TM', 'F18089303', '1', 'ad0e2e103e1e4093a56f2707a681aa8b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615698409406468', '0', 0, 'APP_USER', '2022-05-23 13:55:57', 'APP_USER', '2022-05-23 13:55:57', '0001', 'ad0e2e103e1e4093a56f2707a681aa8b', 'eb4b2976e3cb48aaa8aa55d784baa77e', '翠竹苑出口', 'DS-K1T671TM', 'F18089140', '1', 'ad0e2e103e1e4093a56f2707a681aa8b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615699642531842', '0', 0, 'APP_USER', '2022-05-23 13:55:58', 'APP_USER', '2022-05-23 13:55:58', '0001', '94c3557623ae49708237224f7fb2238b', 'b2a7437e6cf14e0e91c21e4e3169b8cc', '玫瑰苑出口', 'DS-K1T671TM', 'F18089306', '1', '94c3557623ae49708237224f7fb2238b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615699642531843', '0', 0, 'APP_USER', '2022-05-23 13:55:58', 'APP_USER', '2022-05-23 13:55:58', '0001', '94c3557623ae49708237224f7fb2238b', 'ab04e9526f9d42adbc6cfaa31e42e634', '玫瑰苑入口', 'DS-K1T671TM', 'F18089215', '1', '94c3557623ae49708237224f7fb2238b'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615700695302146', '0', 0, 'APP_USER', '2022-05-23 13:55:58', 'APP_USER', '2022-05-23 13:55:58', '0001', '6c4109be29d34c0ebf4203459ba36e11', '299b26bbc81347bb84d85d92f9a0493f', '芙蓉苑南门入口', 'DS-K1T671TM', 'F30969058', '0', '6c4109be29d34c0ebf4203459ba36e11'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615700695302147', '0', 0, 'APP_USER', '2022-05-23 13:55:58', 'APP_USER', '2022-05-23 13:55:58', '0001', '6c4109be29d34c0ebf4203459ba36e11', 'd7a1cef53bd94fb2824540dac3b87276', '芙蓉苑南门出口', 'DS-K1T671TM', 'F18089300', '0', '6c4109be29d34c0ebf4203459ba36e11'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615700695302148', '0', 0, 'APP_USER', '2022-05-23 13:55:58', 'APP_USER', '2022-05-23 13:55:58', '0001', '6c4109be29d34c0ebf4203459ba36e11', '84c86dba7f2649a3be40d91d62fd9432', '芙蓉苑北门出口', 'DS-K1T671TM', 'F18089307', '1', '6c4109be29d34c0ebf4203459ba36e11'); +INSERT INTO `pli_hik_device_info` VALUES ('1528615700695302149', '0', 0, 'APP_USER', '2022-05-23 13:55:58', 'APP_USER', '2022-05-23 13:55:58', '0001', '6c4109be29d34c0ebf4203459ba36e11', 'a038ea3b85774e0bb8c5a472a330e296', '芙蓉苑北门入口', 'DS-K1T671TM', 'F18089312', '1', '6c4109be29d34c0ebf4203459ba36e11'); + +-- ---------------------------- +-- Table structure for pli_hik_community_info +-- ---------------------------- +DROP TABLE IF EXISTS `pli_hik_community_info`; +CREATE TABLE `pli_hik_community_info` ( + `ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '主键', + `DEL_FLAG` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '删除标记 0:未删除,1:已删除', + `REVISION` int(11) NULL DEFAULT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人', + `CREATED_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CUSTOMER_ID` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', + `COMMUNITY_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '社区ID', + `COMMUNITY_NAME` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '社区名称', + `PROVINCE_CODE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '省代号', + `CITY_CODE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '市代号', + `COUNTY_CODE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '区代号', + `LONGITUDE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '经度坐标值', + `LATITUDE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '维度坐标值', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '海康社区信息' ROW_FORMAT = Dynamic; + +-- ---------------------------- +-- Records of pli_hik_community_info +-- ---------------------------- +INSERT INTO `pli_hik_community_info` VALUES ('1528611740751986689', '0', 0, 'APP_USER', '2022-05-23 13:40:14', 'APP_USER', '2022-05-23 13:40:14', '0001', '98b6060a7b8e408dbc3278a5b4fcfe2b', '华城路二小区', '370000', '370200', '370214', '120.396', '36.307'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611740856844290', '0', 0, 'APP_USER', '2022-05-23 13:40:14', 'APP_USER', '2022-05-23 13:40:14', '0001', 'eff54b400c814a64906159f961aa9146', '华城路三小区', '370000', '370200', '370214', '120.388905', '36.304356'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611740856844291', '0', 0, 'APP_USER', '2022-05-23 13:40:14', 'APP_USER', '2022-05-23 13:40:14', '0001', '9da3bab48a9d4b919172f91f73bed754', '小寨子社区青福楼小区', '370000', '370200', '370214', '120.38749', '36.300049'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611740856844292', '0', 0, 'APP_USER', '2022-05-23 13:40:14', 'APP_USER', '2022-05-23 13:40:14', '0001', 'b6a3f4d2012441b1ac419b6afafbf913', '小寨子社区华城路1小区F区', '370000', '370200', '370214', '120.388541', '36.296505'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611740856844293', '0', 0, 'APP_USER', '2022-05-23 13:40:14', 'APP_USER', '2022-05-23 13:40:14', '0001', '9f80094d599145868e3e61dbea5b4412', '小寨子社区中城路120号E区', '370000', '370200', '370214', '120.389277', '36.292424'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611784972533762', '0', 0, 'APP_USER', '2022-05-23 13:40:24', 'APP_USER', '2022-05-23 13:40:24', '0001', 'ad0e2e103e1e4093a56f2707a681aa8b', '小寨子社区A区翠竹苑', '370000', '370200', '370214', '120.391351', '36.293698'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611784972533763', '0', 0, 'APP_USER', '2022-05-23 13:40:24', 'APP_USER', '2022-05-23 13:40:24', '0001', '94c3557623ae49708237224f7fb2238b', '小寨子社区D区玫瑰苑', '370000', '370200', '370214', '120.392055', '36.300876'); +INSERT INTO `pli_hik_community_info` VALUES ('1528611784972533764', '0', 0, 'APP_USER', '2022-05-23 13:40:24', 'APP_USER', '2022-05-23 13:40:24', '0001', '6c4109be29d34c0ebf4203459ba36e11', '小寨子社区C区芙蓉苑', '370000', '370200', '370214', '120.392576', '36.29958'); + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikCommunityInfoDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikCommunityInfoDao.xml new file mode 100644 index 0000000..978427b --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikCommunityInfoDao.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikDeviceInfoDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikDeviceInfoDao.xml new file mode 100644 index 0000000..ca5b5ee --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikDeviceInfoDao.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikErrorInfoDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikErrorInfoDao.xml new file mode 100644 index 0000000..43b53c7 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikErrorInfoDao.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + DELETE + FROM + pli_hik_error_info + + + AND ID_CARD = #{idCard} + + + + \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml index 33ce62f..9094c59 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisStructDao.xml @@ -35,47 +35,48 @@ - SELECT - count(*) + count(*) FROM - pli_power_axis_struct s + pli_power_axis_struct s WHERE - s.CUSTOMER_ID = #{customerId} - AND s.`NAME` = #{name} - - AND s.AGENCY_ID = #{agencyId} - - - AND s.AGENCY_ID = (SELECT t.agency_id FROM pli_power_axis_struct t WHERE t.ID = #{pid}) - - - - AND s.ID != #{id} - AND s.pid = #{pid} + s.CUSTOMER_ID = #{customerId} + AND s.`NAME` = #{name} + + AND s.AGENCY_ID = #{agencyId} + + + AND s.AGENCY_ID = (SELECT t.agency_id FROM pli_power_axis_struct t WHERE t.ID = #{pid}) + + + + AND s.ID != #{id} + AND s.pid = #{pid} - SELECT - count(*) + count(*) FROM - pli_power_axis_struct + pli_power_axis_struct WHERE - AGENCY_ID = #{agencyId} and CUSTOMER_ID = #{customerId} and CATEGORY_CODE = #{categoryCode} - AND id != #{id} + AGENCY_ID = #{agencyId} and CUSTOMER_ID = #{customerId} and CATEGORY_CODE = #{categoryCode} + AND id != #{id} - SELECT - count( DISTINCT HOUSE_ID ) + count(*) FROM - pli_power_kernel_household + pli_power_service_station h + LEFT JOIN pli_power_axis_struct s ON h.STRUCT_REFERENCE_ID = s.ID + AND s.DEL_FLAG = '0' WHERE - del_flag = '0' - - - - - \ No newline at end of file + + + diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml index d0005b3..fa32864 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerAxisTagDao.xml @@ -29,7 +29,12 @@ + + - \ No newline at end of file + diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml index 39fa97e..ae3fce4 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/poweraxis/PowerKernelHouseholdDao.xml @@ -128,7 +128,8 @@ GROUP BY h.HOUSE_ID ORDER BY - s.SORT + s.SORT,h.CREATED_TIME + LIMIT #{limit} @@ -172,5 +173,4 @@ h.CREATED_TIME - \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentContractInfoDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentContractInfoDao.xml index 820b9bb..b4884fe 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentContractInfoDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentContractInfoDao.xml @@ -18,6 +18,7 @@ + @@ -35,14 +36,59 @@ - \ No newline at end of file + diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml new file mode 100644 index 0000000..af389c5 --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentHouseDao.xml @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentTenantInfoDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentTenantInfoDao.xml index 08f588a..1e9611e 100644 --- a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentTenantInfoDao.xml +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/rent/RentTenantInfoDao.xml @@ -11,6 +11,7 @@ + @@ -32,4 +33,44 @@ + + \ No newline at end of file diff --git a/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml new file mode 100644 index 0000000..5ac136d --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/visit/VisitVisitorDao.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file