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/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-server/pom.xml b/epmet-plugins-module/pli-power-base/pli-power-base-server/pom.xml index af1b196..adfd171 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 @@ -164,6 +164,11 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 @@ -193,7 +198,7 @@ false - 192.168.43.104 + 192.168.43.186 false @@ -214,6 +219,11 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 @@ -268,6 +278,11 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 @@ -317,6 +332,11 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 @@ -369,6 +389,11 @@ 60 epmet-user callerRunsPolicy + + + https://api2.hik-cloud.com + 90688b09bb9d40088f7be404ccb347c7 + 7b1940707a4240be9c794c5a967a30c9 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/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..88c0b5f --- /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,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.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); + } + + + +} 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..fa5ef45 --- /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,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.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); + } + + + +} 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..356270d --- /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,16 @@ +package com.epmet.plugin.power.modules.hik.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.plugin.power.modules.hik.entity.HikCommunityInfoEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 海康社区信息 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-05-20 + */ +@Mapper +public interface HikCommunityInfoDao 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/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/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/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/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/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..6128386 --- /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,78 @@ +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.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); +} \ 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/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..c87d107 --- /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,78 @@ +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.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); +} \ 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..7fc5202 --- /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,87 @@ +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.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 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-20 + */ +@Service +public class HikCommunityInfoServiceImpl extends BaseServiceImpl implements HikCommunityInfoService { + + @Autowired + private HikCommunityInfoRedis hikCommunityInfoRedis; + + @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); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + 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)); + } + +} \ 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/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..07f8896 --- /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,87 @@ +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.HikDeviceInfoDao; +import com.epmet.plugin.power.dto.hik.HikDeviceInfoDTO; +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 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-20 + */ +@Service +public class HikDeviceInfoServiceImpl extends BaseServiceImpl implements HikDeviceInfoService { + + @Autowired + private HikDeviceInfoRedis hikDeviceInfoRedis; + + @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); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + 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)); + } + +} \ 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/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 e28ac56..6a90baa 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 @@ -12,6 +12,7 @@ import com.epmet.commons.tools.validator.group.DefaultGroup; 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; +import com.epmet.plugin.power.modules.utils.HkDeviceUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -33,6 +34,9 @@ public class RentTenantInfoController { @Autowired private RentTenantInfoService rentTenantInfoService; + @Autowired + private HkDeviceUtil hkDeviceUtil; + @RequestMapping("page") public Result> page(@RequestParam Map params) { PageData page = rentTenantInfoService.page(params); @@ -91,5 +95,10 @@ public class RentTenantInfoController { ExcelUtils.exportExcelToTarget(response, null, list, RentTenantInfoExcel.class); } + @GetMapping("test") + public Result test(@RequestParam Map params, HttpServletResponse response) throws Exception { + return new Result().ok(hkDeviceUtil.getAccessToken()); + } + } 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 8d548d4..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 @@ -106,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/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..6e47b45 --- /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,86 @@ +package com.epmet.plugin.power.modules.utils; + +import com.alibaba.fastjson.JSON; +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.utils.ConvertUtils; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import com.epmet.plugin.power.config.HikCloudProperties; +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; + + private final String GET_ACCESS_TOKEN = "/oauth/token"; + private final String GET_DEVICES = "/api/v1/estate/devices"; + + private final String GRANT_TYPE = "client_credentials"; + + /** + * 获取accessToken + * + * @param + * @return void + * @author zhy + * @date 2022/5/20 16:40 + */ + public String getAccessToken() { + 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获取失败"); + } + return toResult.get("access_token").toString(); + } +// +// public String getDevices() { +// String url = hikCloudProperties.getUrl().concat(GET_DEVICES); +// Map paramsMap = new HashMap<>(8); +// paramsMap.put("deviceId", hikCloudProperties.getClient()); +// +// +// String data = HttpClientManager.getInstance().sendGet(ThirdApiConstant.THIRD_PAUSER_SAVEUSER, JSON.toJSONString(dto)).getData(); +// 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 (!result.success()) { +// throw new RenException(PublicUserLoginConstant.SAVE_USER_EXCEPTION); +// } +// Object RegisterResult = result.getData(); +// JSONObject jsonObject = JSON.parseObject(RegisterResult.toString()); +// SaveUserResultDTO resultDTO = ConvertUtils.mapToEntity(jsonObject, SaveUserResultDTO.class); +// +// } +} 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..f93c0cf 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,12 @@ dingTalk: webHook: @dingTalk.robot.webHook@ secret: @dingTalk.robot.secret@ +hik: + cloud: + url: @hik.cloud.url@ + client: @hik.cloud.client@ + secret: @hik.cloud.secret@ + # 停机选项 shutdown: graceful: 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..942410e --- /dev/null +++ b/epmet-plugins-module/pli-power-base/pli-power-base-server/src/main/resources/mapper/hik/HikCommunityInfoDao.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/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