From e88d34fd4cbe3a0cc57ecfdc1710d66bc88e26b5 Mon Sep 17 00:00:00 2001 From: zhubaomin <zhubaomin> Date: 星期二, 10 六月 2025 14:07:53 +0800 Subject: [PATCH] Merge branch 'master' of http://8.140.179.55:20000/r/pipIrr-SV --- pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoQo.java | 18 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenData.java | 18 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenResponse.java | 19 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppCtrl.java | 48 + pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenQuartzJob.java | 25 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voVi/VoCamera.java | 59 + pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java | 1 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViYsAppMapper.java | 31 + pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraSv.java | 84 ++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoSv.java | 44 + pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViYsAppMapper.xml | 101 +++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskSupport.java | 12 pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.properties | 1 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VoVideo.java | 20 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java | 3 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java | 10 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraQo.java | 22 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java | 2 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViCamera.java | 94 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/CameraTypeEnum.java | 24 pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml | 18 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCardSv.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoCtrl.java | 120 +++ pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAppClient.java | 135 ++++ pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttPubMsgSdV1.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraTypesConfig.java | 27 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppListener.java | 120 +++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViCameraMapper.java | 64 ++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/TypesVo.java | 14 pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java | 4 pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java | 8 pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd15/CdCtrl.java | 1 pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraCtrl.java | 239 +++++++ pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraDto.java | 83 ++ pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViYsApp.java | 60 + pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml | 2 pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java | 2 pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java | 2 pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttSubMsgSdV1.java | 2 pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViCameraMapper.xml | 235 +++++++ pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppSv.java | 47 + 49 files changed, 1,819 insertions(+), 15 deletions(-) diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttPubMsgSdV1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttPubMsgSdV1.java index c93c7ee..9817c1b 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttPubMsgSdV1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttPubMsgSdV1.java @@ -2,6 +2,7 @@ import com.dy.common.mw.protocol4Mqtt.MqttPubMsg; import lombok.Data; +import lombok.EqualsAndHashCode; /** * @Author: liurunyu @@ -9,6 +10,7 @@ * @Description 涓嬪彂鐨勫彂甯冩秷鎭紙鍗充笅琛屽懡浠わ級 */ @Data +@EqualsAndHashCode(callSuper=false) public class MqttPubMsgSdV1 extends MqttPubMsg { public Integer address ;//瀵勫瓨鍣ㄥ湴鍧� diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttSubMsgSdV1.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttSubMsgSdV1.java index 03d1e8d..e26ff6d 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttSubMsgSdV1.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/protocol4Mqtt/pSdV1/MqttSubMsgSdV1.java @@ -4,6 +4,7 @@ import com.dy.common.mw.protocol4Mqtt.MqttSubMsg; import com.dy.common.util.Callback; import lombok.Data; +import lombok.EqualsAndHashCode; /** * @Author: liurunyu @@ -11,6 +12,7 @@ * @Description 鏀跺埌鐨勮闃呮秷鎭� */ @Data +@EqualsAndHashCode(callSuper=false) public class MqttSubMsgSdV1 extends MqttSubMsg { public Integer address ;//瀵勫瓨鍣ㄥ湴鍧� public String value ;//瀵勫瓨鍣ㄥ�� diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskSupport.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskSupport.java index 0fc205e..7b135ad 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskSupport.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/schedulerTask/SchedulerTaskSupport.java @@ -19,6 +19,17 @@ SchedulerTaskSupport.threadPoolPriority = threadPoolPriority; } } + + /** + * 鍒犻櫎宸ヤ綔浠诲姟 + * @param jobName + * @param jobGroupName + * @throws SchedulerException + */ + public static void deleteJob(String jobName, String jobGroupName) throws SchedulerException{ + Scheduler sched = SchedulerTaskFactory.getSingleScheduler() ; + sched.deleteJob(new JobKey(jobName, jobGroupName)); + } /** * 娣诲姞姣廥绉掗挓閲嶅宸ヤ綔涓�娆$殑宸ヤ綔浠诲姟锛� @@ -61,7 +72,6 @@ .withIntervalInSeconds(intervalInSeconds) .withRepeatCount(repeatCount)) .build(); - sched.scheduleJob(job, trigger); sched.start(); diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java index 41344a3..0f9e27e 100644 --- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java +++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/webUtil/QueryResultVo.java @@ -53,6 +53,16 @@ @JSONField(serialize = false) public Integer queryCount ; + public void copyTo(QueryResultVo to){ + to.pageSize = this.pageSize ; + to.itemTotal = this.itemTotal ; + to.pageCurr = this.pageCurr ; + to.pageTotal = this.pageTotal ; + to.obj = this.obj ; + to.queryStart = this.queryStart ; + to.queryCount = this.queryCount ; + } + public void calculateAndSet(Long itemTotal, Map<String, Object> params) { this.itemTotal = itemTotal ; diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViCameraMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViCameraMapper.java new file mode 100644 index 0000000..05843d2 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViCameraMapper.java @@ -0,0 +1,64 @@ +package com.dy.pipIrrGlobal.daoVi; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoVi.ViCamera; +import com.dy.pipIrrGlobal.voVi.VoCamera; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; +import java.util.Map; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:15 + * @Description + */ +@Mapper +public interface ViCameraMapper extends BaseMapper<ViCamera> { + int deleteByPrimaryKey(Long id); + + /** + * 閫昏緫鍒犻櫎 + * @param id primaryKey + * @return update count + */ + int deleteLogicById(Long id); + + + int insert(ViCamera record); + + int insertSelective(ViCamera record); + + ViCamera selectByPrimaryKey(Long id); + /** + * 鏌ヨ鎬绘暟 + * @param params 鏌ヨ鏉′欢 + * @return 鎬绘暟 + */ + Long selectTotal(Map<?, ?> params) ; + + /** + * 鍒嗛〉鏌ヨ涓�浜� + * @param params 鏌ヨ鏉′欢 + * @return 瀹炰綋闆嗗悎 + */ + List<VoCamera> selectSome(Map<?, ?> params) ; + /** + * 鏌ヨ鎬绘暟 + * @param params 鏌ヨ鏉′欢 + * @return 鎬绘暟 + */ + Long selectTotal4Monitor(Map<?, ?> params) ; + + /** + * 鍒嗛〉鏌ヨ涓�浜� + * @param params 鏌ヨ鏉′欢 + * @return 瀹炰綋闆嗗悎 + */ + List<VoCamera> selectSome4Monitor(Map<?, ?> params) ; + +// Update the record in the ViCamera table based on the primary key, but only update the fields that are not null + int updateByPrimaryKeySelective(ViCamera record); + + int updateByPrimaryKey(ViCamera record); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViYsAppMapper.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViYsAppMapper.java new file mode 100644 index 0000000..d257f4f --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/daoVi/ViYsAppMapper.java @@ -0,0 +1,31 @@ +package com.dy.pipIrrGlobal.daoVi; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.dy.pipIrrGlobal.pojoVi.ViYsApp; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 10:44 + * @Description + */ +@Mapper +public interface ViYsAppMapper extends BaseMapper<ViYsApp> { + int deleteByPrimaryKey(Long id); + + int deleteAll(); + + int insert(ViYsApp record); + + int insertSelective(ViYsApp record); + + ViYsApp selectByPrimaryKey(Long id); + + List<ViYsApp> selectAll(); + + int updateByPrimaryKeySelective(ViYsApp record); + + int updateByPrimaryKey(ViYsApp record); +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViCamera.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViCamera.java new file mode 100644 index 0000000..d57fcca --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViCamera.java @@ -0,0 +1,94 @@ +package com.dy.pipIrrGlobal.pojoVi; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:15 + * @Description + */ + +/** + * 钀ょ煶鎽勫儚鏈猴紙瑙嗛绔欙級 + */ +@TableName(value="vi_camera", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "瑙嗛鐩戞帶鎽勫儚鏈�") +public class ViCamera implements BaseEntity { + + public static final long serialVersionUID = 202506071604001L; + + /** + * 涓婚敭 + */ + @Schema(description = "涓婚敭", requiredMode = Schema.RequiredMode.REQUIRED) + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + public Long id; + + /** + * 绫诲瀷锛�1钀ょ煶锛� + */ + @Schema(description = "鎽勫儚鏈虹被鍨�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Byte type; + + /** + * 鎽勫儚鏈哄簭鍒楀彿 + */ + @Schema(description = "鎽勫儚鏈哄簭鍒楀彿", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String devNo; + + /** + * 瑙嗛绔欏悕绉� + */ + @Schema(description = "瑙嗛绔欏悕绉�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String name; + + /** + * 缁忓害 + */ + @Schema(description = "瑙嗛绔欑粡搴�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Double lng; + + /** + * 绾害 + */ + @Schema(description = "瑙嗛绔欑含搴�", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Double lat; + + /** + * 鏄惁澶у睆灞曠ず锛�1鏄紝0鎴杗ull鍚︼級 + */ + @Schema(description = "鏄惁澶у睍闆嗕腑鏄剧ず", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Byte onScreen; + + /** + * 澶у睆灞曠ず鎺掑簭锛堝ぇ浜庣瓑浜�1锛屾暟瀛楄秺灏忔帓搴忚秺鍓嶏級 + */ + @Schema(description = "澶у睆灞曠ず鎺掑簭", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Integer onSort; + + /** + * 澶囨敞 + */ + @Schema(description = "澶囨敞淇℃伅", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String remark; + + /** + * 鏄惁鍒犻櫎锛�1鏄紝0鍚︼級 + */ + @Schema(description = "鏄惁鍒犻櫎", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Byte deleted; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViYsApp.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViYsApp.java new file mode 100644 index 0000000..91bc3c5 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/pojoVi/ViYsApp.java @@ -0,0 +1,60 @@ +package com.dy.pipIrrGlobal.pojoVi; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.dy.common.po.BaseEntity; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.util.Date; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 10:44 + * @Description + */ + +/** + * 钀ょ煶浜戝簲鐢ˋpp鐩稿叧 + */ +@TableName(value="vi_ys_app", autoResultMap = true) +@Data +@Builder +@ToString +@NoArgsConstructor +@AllArgsConstructor +@Schema(name = "钀ょ煶浜戝簲鐢ˋpp") +public class ViYsApp implements BaseEntity { + + public static final long serialVersionUID = 202506071603001L; + + /** + * 涓婚敭 + */ + @Schema(description = "涓婚敭", requiredMode = Schema.RequiredMode.REQUIRED) + @JSONField(serializeUsing= ObjectWriterImplToString.class) + @TableId(type = IdType.INPUT) + public Long id; + + /** + * 钀ょ煶浜戠殑AccessToken + */ + @Schema(description = "钀ょ煶浜戝紑鏀惧钩鍙板簲鐢ˋccessToken", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public String accessToken; + + /** + * AccessToken杩囨湡鏃堕棿 + */ + @Schema(description = "AccessToken杩囨湡鏃堕棿锛堟绉掞級", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Long expireTime; + + /** + * AccessToken杩囨湡鏃堕棿 + */ + @Schema(description = "AccessToken杩囨湡鏃堕棿锛堝勾鏈堟棩鏃跺垎绉掞級", requiredMode = Schema.RequiredMode.NOT_REQUIRED) + public Date expireDt; + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/CameraTypeEnum.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/CameraTypeEnum.java new file mode 100644 index 0000000..fa62c8a --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/CameraTypeEnum.java @@ -0,0 +1,24 @@ +package com.dy.pipIrrGlobal.util; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 11:31 + * @Description + */ +public enum CameraTypeEnum { + YINGSHI((byte)1, "钀ょ煶"); + + private Byte type ; //1钀ょ煶 2娴峰悍 + private String name ;//钀ょ煶 娴峰悍 + + CameraTypeEnum(Byte type, String name){ + this.type = type ; + this.name = name ; + } + public Byte getType() { + return this.type ; + } + public String getName() { + return this.name ; + } +} diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java index 233e6f8..dacdd4b 100644 --- a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/util/OrgListenerSupport.java @@ -15,14 +15,14 @@ public abstract class OrgListenerSupport { /** - * 瀹炲鍖� + * 鍒濆鍖� */ @SuppressWarnings("unused ") protected void init(ResourceLoader resourceLoader) { this.doInit(resourceLoader); } /** - * 瀹炲鍖� + * 鍒濆鍖� */ @SuppressWarnings("unused ") protected void doInit(ResourceLoader resourceLoader) { @@ -61,7 +61,7 @@ // 寰楀埌 //////////////////////////////// /** - * 瀹炲鍖� + * 鍒濆鍖� */ @SuppressWarnings("unused ") protected List<Org.OrgVo> get(ResourceLoader resourceLoader) { @@ -69,7 +69,7 @@ } /** - * 瀹炲鍖� + * 鍒濆鍖� */ @SuppressWarnings("unused ") protected List<Org.OrgVo> doGet(ResourceLoader resourceLoader) { diff --git a/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voVi/VoCamera.java b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voVi/VoCamera.java new file mode 100644 index 0000000..4b45eb9 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/java/com/dy/pipIrrGlobal/voVi/VoCamera.java @@ -0,0 +1,59 @@ +package com.dy.pipIrrGlobal.voVi; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:12 + * @Description + */ +@Data +public class VoCamera { + private static final long serialVersionUID = 202506090918001L; + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long id; + + /** + * 绫诲瀷锛�1钀ょ煶锛� + */ + public Byte type; + + /** + * 鎽勫儚鏈哄簭鍒楀彿 + */ + public String devNo; + + /** + * 瑙嗛绔欏悕绉� + */ + public String name; + + /** + * 缁忓害 + */ + public Double lng; + + /** + * 绾害 + */ + public Double lat; + + /** + * 鏄惁澶у睆灞曠ず锛�1鏄紝0鎴杗ull鍚︼級 + */ + public Byte onScreen; + + /** + * 澶у睆灞曠ず鎺掑簭锛堝ぇ浜庣瓑浜�1锛屾暟瀛楄秺灏忔帓搴忚秺鍓嶏級 + */ + public Integer onSort; + + /** + * 澶囨敞 + */ + public String remark; + +} diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml index e37b6d4..cd1e11e 100644 --- a/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml +++ b/pipIrr-platform/pipIrr-global/src/main/resources/application-global.yml @@ -472,6 +472,24 @@ at-all: true mobile: 18602657034 +#瑙嗛鐩戞帶鐩稿叧 +video: + #钀ょ煶浜戝紑鏀惧钩鍙� + ys: + accessTokenExpireDay: 7 #AccessToken杩囨湡鏃堕棿锛屽崟浣嶅ぉ + appKey: 93987fd687444c23b427181a108f5253 + secret: d73a08e4fb3c3d9d0b696630eea8bd4e + requestAccessTokenUrl: https://open.ys7.com/api/lapp/token/get + requestVideoCommonUrl: https://open.ys7.com/console/jssdk/pc.html + requestVideoCameraPreUrl: ezopen://open.ys7.com/ + requestVideoCameraTailUrl: /1.live&themeId= + types: + - 1,钀ょ煶 #1:钀ょ煶 + #- 2,娴峰悍 #2:娴峰悍 + #- 3,澶у崕 #3:澶у崕 + #- 4,澶╁湴浼熶笟 #4:澶╁湴浼熶笟 + screen: + count: 4 #榛樿鏄剧ず4涓棰� #闃�鎺у櫒鍙傛暟 rtu: signalIntensity: diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViCameraMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViCameraMapper.xml new file mode 100644 index 0000000..7c22788 --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViCameraMapper.xml @@ -0,0 +1,235 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoVi.ViCameraMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoVi.ViCamera"> + <!--@mbg.generated--> + <!--@Table vi_camera--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="type" jdbcType="TINYINT" property="type" /> + <result column="dev_no" jdbcType="VARCHAR" property="devNo" /> + <result column="name" jdbcType="VARCHAR" property="name" /> + <result column="lng" jdbcType="DOUBLE" property="lng" /> + <result column="lat" jdbcType="DOUBLE" property="lat" /> + <result column="on_screen" jdbcType="TINYINT" property="onScreen" /> + <result column="on_sort" jdbcType="INTEGER" property="onSort" /> + <result column="remark" jdbcType="VARCHAR" property="remark" /> + <result column="deleted" jdbcType="TINYINT" property="deleted" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, `type`, dev_no, `name`, lng, lat, on_screen, on_sort, remark, deleted + </sql> + <sql id="part_Column_List"> + <!--@mbg.generated--> + id, `type`, dev_no, `name`, lng, lat, on_screen, on_sort, remark + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from vi_camera + where id = #{id,jdbcType=BIGINT} + </select> + + <select id="selectTotal" parameterType="java.util.Map" resultType="java.lang.Long"> + select + count(*) + from vi_camera tb + where tb.deleted != 1 + <trim prefix="and" suffixOverrides="and"> + <if test="name != null and name != ''"> + tb.`name` like concat('%', #{name}, '%') and + </if> + </trim> + </select> + <select id="selectSome" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voVi.VoCamera"> + <!--@mbg.generated--> + select + <include refid="part_Column_List" > + <property name="alias" value="tb"/> + </include> + from vi_camera tb + where tb.deleted != 1 + <trim prefix="and" suffixOverrides="and"> + <if test="name != null"> + tb.`name` like concat('%', #{name}, '%') and + </if> + </trim> + order by tb.on_sort ASC, tb.id DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + + <select id="selectTotal4Monitor" parameterType="java.util.Map" resultType="java.lang.Long"> + select + count(*) + from vi_camera tb + where tb.deleted != 1 and tb.on_screen = 1 + <trim prefix="and" suffixOverrides="and"> + <if test="name != null and name != ''"> + tb.`name` like concat('%', #{name}, '%') and + </if> + </trim> + </select> + <select id="selectSome4Monitor" parameterType="java.util.Map" resultType="com.dy.pipIrrGlobal.voVi.VoCamera"> + <!--@mbg.generated--> + select + <include refid="part_Column_List" > + <property name="alias" value="tb"/> + </include> + from vi_camera tb + where tb.deleted != 1 and tb.on_screen = 1 + <trim prefix="and" suffixOverrides="and"> + <if test="name != null"> + tb.`name` like concat('%', #{name}, '%') and + </if> + </trim> + order by tb.on_sort ASC, tb.id DESC + <trim prefix="limit " > + <if test="start != null and count != null"> + #{start,javaType=Integer,jdbcType=INTEGER}, #{count,javaType=Integer,jdbcType=INTEGER} + </if> + </trim> + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from vi_camera + where id = #{id,jdbcType=BIGINT} + </delete> + <delete id="deleteLogicById" parameterType="java.lang.Long"> + <!--@mbg.generated--> + update vi_camera set deleted = 1 + where id = #{id,jdbcType=BIGINT} + </delete> + + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoVi.ViCamera"> + <!--@mbg.generated--> + insert into vi_camera (id, `type`, dev_no, + `name`, lng, lat, on_screen, + on_sort, remark, deleted + ) + values (#{id,jdbcType=BIGINT}, #{type,jdbcType=TINYINT}, #{devNo,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{lng,jdbcType=DOUBLE}, #{lat,jdbcType=DOUBLE}, #{onScreen,jdbcType=TINYINT}, + #{onSort,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR}, #{deleted,jdbcType=TINYINT} + ) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoVi.ViCamera"> + <!--@mbg.generated--> + insert into vi_camera + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="type != null"> + `type`, + </if> + <if test="devNo != null"> + dev_no, + </if> + <if test="name != null"> + `name`, + </if> + <if test="lng != null"> + lng, + </if> + <if test="lat != null"> + lat, + </if> + <if test="onScreen != null"> + on_screen, + </if> + <if test="onSort != null"> + on_sort, + </if> + <if test="remark != null"> + remark, + </if> + <if test="deleted != null"> + deleted, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="type != null"> + #{type,jdbcType=TINYINT}, + </if> + <if test="devNo != null"> + #{devNo,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + #{name,jdbcType=VARCHAR}, + </if> + <if test="lng != null"> + #{lng,jdbcType=DOUBLE}, + </if> + <if test="lat != null"> + #{lat,jdbcType=DOUBLE}, + </if> + <if test="onScreen != null"> + #{onScreen,jdbcType=TINYINT}, + </if> + <if test="onSort != null"> + #{onSort,jdbcType=INTEGER}, + </if> + <if test="remark != null"> + #{remark,jdbcType=VARCHAR}, + </if> + <if test="deleted != null"> + #{deleted,jdbcType=TINYINT}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoVi.ViCamera"> + <!--@mbg.generated--> + update vi_camera + <set> + <if test="type != null"> + `type` = #{type,jdbcType=TINYINT}, + </if> + <if test="devNo != null"> + dev_no = #{devNo,jdbcType=VARCHAR}, + </if> + <if test="name != null"> + `name` = #{name,jdbcType=VARCHAR}, + </if> + <if test="lng != null"> + lng = #{lng,jdbcType=DOUBLE}, + </if> + <if test="lat != null"> + lat = #{lat,jdbcType=DOUBLE}, + </if> + <if test="onScreen != null"> + on_screen = #{onScreen,jdbcType=TINYINT}, + </if> + <if test="onSort != null"> + on_sort = #{onSort,jdbcType=INTEGER}, + </if> + <if test="remark != null"> + remark = #{remark,jdbcType=VARCHAR}, + </if> + <if test="deleted != null"> + deleted = #{deleted,jdbcType=TINYINT}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoVi.ViCamera"> + <!--@mbg.generated--> + update vi_camera + set `type` = #{type,jdbcType=TINYINT}, + dev_no = #{devNo,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + lng = #{lng,jdbcType=DOUBLE}, + lat = #{lat,jdbcType=DOUBLE}, + on_screen = #{onScreen,jdbcType=TINYINT}, + on_sort = #{onSort,jdbcType=INTEGER}, + remark = #{remark,jdbcType=VARCHAR}, + deleted = #{deleted,jdbcType=TINYINT} + where id = #{id,jdbcType=BIGINT} + </update> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViYsAppMapper.xml b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViYsAppMapper.xml new file mode 100644 index 0000000..84e711a --- /dev/null +++ b/pipIrr-platform/pipIrr-global/src/main/resources/mapper/ViYsAppMapper.xml @@ -0,0 +1,101 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.dy.pipIrrGlobal.daoVi.ViYsAppMapper"> + <resultMap id="BaseResultMap" type="com.dy.pipIrrGlobal.pojoVi.ViYsApp"> + <!--@mbg.generated--> + <!--@Table vi_ys_app--> + <id column="id" jdbcType="BIGINT" property="id" /> + <result column="access_token" jdbcType="VARCHAR" property="accessToken" /> + <result column="expire_time" jdbcType="BIGINT" property="expireTime" /> + <result column="expire_dt" jdbcType="TIMESTAMP" property="expireDt" /> + </resultMap> + <sql id="Base_Column_List"> + <!--@mbg.generated--> + id, access_token, expire_time, expire_dt + </sql> + <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from vi_ys_app + where id = #{id,jdbcType=BIGINT} + </select> + <select id="selectAll" resultMap="BaseResultMap"> + <!--@mbg.generated--> + select + <include refid="Base_Column_List" /> + from vi_ys_app + </select> + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> + <!--@mbg.generated--> + delete from vi_ys_app + where id = #{id,jdbcType=BIGINT} + </delete> + <delete id="deleteAll" > + <!--@mbg.generated--> + delete from vi_ys_app + </delete> + <insert id="insert" parameterType="com.dy.pipIrrGlobal.pojoVi.ViYsApp"> + <!--@mbg.generated--> + insert into vi_ys_app (id, access_token, expire_time, + expire_dt) + values (#{id,jdbcType=BIGINT}, #{accessToken,jdbcType=VARCHAR}, #{expireTime,jdbcType=BIGINT}, + #{expireDt,jdbcType=TIMESTAMP}) + </insert> + <insert id="insertSelective" parameterType="com.dy.pipIrrGlobal.pojoVi.ViYsApp"> + <!--@mbg.generated--> + insert into vi_ys_app + <trim prefix="(" suffix=")" suffixOverrides=","> + <if test="id != null"> + id, + </if> + <if test="accessToken != null"> + access_token, + </if> + <if test="expireTime != null"> + expire_time, + </if> + <if test="expireDt != null"> + expire_dt, + </if> + </trim> + <trim prefix="values (" suffix=")" suffixOverrides=","> + <if test="id != null"> + #{id,jdbcType=BIGINT}, + </if> + <if test="accessToken != null"> + #{accessToken,jdbcType=VARCHAR}, + </if> + <if test="expireTime != null"> + #{expireTime,jdbcType=BIGINT}, + </if> + <if test="expireDt != null"> + #{expireDt,jdbcType=TIMESTAMP}, + </if> + </trim> + </insert> + <update id="updateByPrimaryKeySelective" parameterType="com.dy.pipIrrGlobal.pojoVi.ViYsApp"> + <!--@mbg.generated--> + update vi_ys_app + <set> + <if test="accessToken != null"> + access_token = #{accessToken,jdbcType=VARCHAR}, + </if> + <if test="expireTime != null"> + expire_time = #{expireTime,jdbcType=BIGINT}, + </if> + <if test="expireDt != null"> + expire_dt = #{expireDt,jdbcType=TIMESTAMP}, + </if> + </set> + where id = #{id,jdbcType=BIGINT} + </update> + <update id="updateByPrimaryKey" parameterType="com.dy.pipIrrGlobal.pojoVi.ViYsApp"> + <!--@mbg.generated--> + update vi_ys_app + set access_token = #{accessToken,jdbcType=VARCHAR}, + expire_time = #{expireTime,jdbcType=BIGINT}, + expire_dt = #{expireDt,jdbcType=TIMESTAMP} + where id = #{id,jdbcType=BIGINT} + </update> +</mapper> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml index 67e19f9..26623b5 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/RtuDataDealTree.xml @@ -94,7 +94,7 @@ </task> <!-- Mqtt娑堟伅涓棿浠惰闃呯殑娑堟伅 --> <task id="TkMqttData" name="鎺ユ敹Mqtt娑堟伅" enable="true" class="com.dy.rtuMw.server.rtuData.TkMqttData"> - <task id="TkFindPSdV1" name="璇嗗埆灞变笢V1鏁版嵁" enable="true" class="com.dy.rtuMw.server.rtuData.pSdV1.TkFindPSdV1"> + <task id="TkFindPSdV1" name="璇嗗埆灞变笢V1鏁版嵁" enable="true" class="com.dy.rtuMw.server.rtuData.pSdV1.TkFindPSdV1"></task> </task> </task> </project> \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.properties b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.properties index ec1f674..08e4d72 100644 --- a/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.properties +++ b/pipIrr-platform/pipIrr-mw/pipIrr-mw-rtu/src/main/resources/config.properties @@ -42,6 +42,7 @@ # 鐢樺窞锛� mqtt.enable=false # 鍑夊窞锛� mqtt.enable=false # 閲戝窛锛� mqtt.enable=true +# mq/sd1/338220031439/weather mqtt.enable=true mqtt.topicAndQos=ym/sd1/10000/control/m1,1;ym/sd1/10000/control/m2,1;ym/sd1/control/m4,1;ym/sd1/10000/control/m80,1 diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java index 6a4d699..365f3ec 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-base/src/main/java/com/dy/pipIrrBase/util/InitListener.java @@ -120,7 +120,7 @@ @Override public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { try { - //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource鍒濆鍖栧畬鎴� Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); @@ -130,7 +130,7 @@ } /** - * 瀹炲鍖� + * 鍒濆鍖� */ @SuppressWarnings("unused ") private void init(ApplicationReadyEvent event){ diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java index ae28607..e7becdf 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-file/src/main/java/com/dy/pipIrrWebFile/fm/DyFmListener.java @@ -23,7 +23,7 @@ @Override public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { try { - //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource鍒濆鍖栧畬鎴� Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java index a2737ee..d01a0b1 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/PipIrrProjectApplication.java @@ -25,7 +25,7 @@ }) } ) -@MapperScan({"com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi"}) +@MapperScan({"com.dy.pipIrrGlobal.daoPr", "com.dy.pipIrrGlobal.daoBa","com.dy.pipIrrGlobal.daoFi","com.dy.pipIrrGlobal.daoVi"}) public class PipIrrProjectApplication { public static void main(String[] args) { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraCtrl.java new file mode 100644 index 0000000..6dfe16e --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraCtrl.java @@ -0,0 +1,239 @@ +package com.dy.pipIrrProject.video; + +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.pojoVi.ViCamera; +import com.dy.pipIrrGlobal.voVi.VoCamera; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.validation.Valid; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.MediaType; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:01 + * @Description + */ +@Slf4j +@Tag(name = "瑙嗛绔欑鐞�", description = "瑙嗛绔欑鐞�") +@RestController +@RequestMapping(path = "camera") +@RequiredArgsConstructor +public class CameraCtrl { + private CameraSv sv; + + @Autowired + private void setSv(CameraSv sv){ + this.sv = sv ; + } + + /** + * 瀹㈡埛绔姹傚緱鍒版墍鏈夋憚鍍忔満绫诲瀷 + * @return 鎵�鏈夋憚鍍忔満绫诲瀷 + */ + @Operation(summary = "鑾峰緱鍏ㄩ儴鎽勫儚鏈虹被鍨�", description = "杩斿洖鍏ㄩ儴鎽勫儚鏈虹被鍨�") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖鍏ㄩ儴鎽勫儚鏈虹被鍨嬫暟鎹紙BaseResponse.content:TypesVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = TypesVo.class))} + ) + }) + @GetMapping(path = "types") + @SsoAop() + public BaseResponse<QueryResultVo<List<TypesVo>>> types() { + try { + List<TypesVo> list = new ArrayList<>() ; + if(CameraTypesConfig.types != null && CameraTypesConfig.types.size() > 0){ + for (String type : CameraTypesConfig.types) { + String[] typeGrp = type.split(","); + if(typeGrp.length == 2){ + TypesVo vo = new TypesVo() ; + vo.type = Integer.parseInt(typeGrp[0].trim()) ; + vo.name = typeGrp[1].trim() ; + list.add(vo) ; + } + } + } + QueryResultVo<List<TypesVo>> res = new QueryResultVo() ; + res.obj = list ; + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鏌ヨ鍙栨按鍙e紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()); + } + } + + + /** + * 瀹㈡埛绔姹傚緱鍒颁竴浜涙憚鍍忔満鏁版嵁 + * @return 鎵�鏈夋憚鍍忔満鏁版嵁 + */ + @Operation(summary = "鑾峰緱涓�椤垫憚鍍忔満鏁版嵁", description = "杩斿洖涓�椤垫憚鍍忔満鏁版嵁鏁版嵁") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤垫憚鍍忔満鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoCamera.class))} + ) + }) + @GetMapping(path = "some") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoCamera>>> some(CameraQo vo){ + try { + QueryResultVo<List<VoCamera>> res = this.sv.some(vo) ; + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鏌ヨ鎽勫儚鏈哄紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } + + /** + * 寰楀埌涓�涓憚鍍忔満鏁版嵁 + * @return 涓�涓憚鍍忔満鏁版嵁 + */ + @Operation(summary = "涓�涓憚鍍忔満", description = "寰楀埌涓�涓憚鍍忔満鏁版嵁") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�涓憚鍍忔満鏁版嵁锛圔aseResponse.content:{}锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = ViCamera.class))} + ) + }) + @GetMapping(path = "one") + @SsoAop() + public BaseResponse<ViCamera> one(Long id){ + return BaseResponseUtils.buildSuccess(this.sv.selectById(id)); + } + + /** + * 淇濆瓨鎽勫儚鏈� + * @param dto 淇濆瓨鎽勫儚鏈篺orm琛ㄥ崟瀵硅薄 + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "淇濆瓨鎽勫儚鏈�", description = "鎻愪氦鎽勫儚鏈烘暟鎹紙form琛ㄥ崟锛夛紝杩涜淇濆瓨") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @PostMapping(path = "save", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<Boolean> save(@RequestBody @Valid CameraDto dto, BindingResult bindingResult){ + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + ViCamera po = dto.toNewPo() ; + po.deleted = 0 ; + int count; + try { + count = this.sv.save(po); + } catch (Exception e) { + log.error("淇濆瓨鎽勫儚鏈哄紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + /** + * 缂栬緫淇敼鎽勫儚鏈� + * @param dto 淇濆瓨鎽勫儚鏈篺orm琛ㄥ崟瀵硅薄 + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "缂栬緫淇敼鎽勫儚鏈�", description = "鎻愪氦鎽勫儚鏈烘暟鎹紙form琛ㄥ崟锛夛紝杩涜淇敼") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @PostMapping(path = "update", consumes = MediaType.APPLICATION_JSON_VALUE) + @SsoAop() + public BaseResponse<Boolean> update(@RequestBody @Valid CameraDto dto, BindingResult bindingResult){ + if(bindingResult != null && bindingResult.hasErrors()){ + return BaseResponseUtils.buildFail(Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage()); + } + ViCamera po = dto.toPo() ; + if(po.id == null){ + return BaseResponseUtils.buildFail("鏃犳暟鎹疄浣揑D") ; + } + int count; + try { + count = this.sv.update(po); + } catch (Exception e) { + log.error("淇濆瓨鎽勫儚鏈哄紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + + /** + * 鍒犻櫎鎽勫儚鏈� + * @param id 鎽勫儚鏈篒D + * @return 鏄惁鎴愬姛 + */ + @Operation(summary = "鍒犻櫎鎽勫儚鏈�", description = "鎻愪氦鎽勫儚鏈篒D锛岃繘琛岄�昏緫鍒犻櫎") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "鎿嶄綔缁撴灉锛歵rue锛氭垚鍔燂紝false锛氬け璐ワ紙BaseResponse.content锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = Boolean.class))} + ) + }) + @GetMapping(path = "delete") + @SsoAop() + public BaseResponse<Boolean> delete(Long id){ + if(id == null){ + return BaseResponseUtils.buildFail("id涓嶈兘涓虹┖") ; + } + int count; + try { + count = this.sv.delete(id); + } catch (Exception e) { + log.error("淇濆瓨鎽勫儚鏈哄紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + if(count <= 0){ + return BaseResponseUtils.buildFail("鏁版嵁搴撳瓨鍌ㄥけ璐�") ; + }else{ + return BaseResponseUtils.buildSuccess(true) ; + } + } + + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraDto.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraDto.java new file mode 100644 index 0000000..6c40ee5 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraDto.java @@ -0,0 +1,83 @@ +package com.dy.pipIrrProject.video; + +import com.dy.pipIrrGlobal.pojoVi.ViCamera; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotEmpty; +import jakarta.validation.constraints.NotNull; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 10:18 + * @Description + */ +@Data +@Schema(name = "鎽勫儚鏈猴紙瑙嗛绔欙級") +public class CameraDto { + public static final long serialVersionUID = 202506091020001L; + /** + * 涓婚敭 + */ + public String id; + + /** + * 绫诲瀷锛�1钀ょ煶锛� + */ + @NotNull(message = "鎽勫儚鏈虹被鍨嬩笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null + public Byte type; + + /** + * 鎽勫儚鏈哄簭鍒楀彿 + */ + @NotEmpty(message = "鎽勫儚鏈虹被鍨嬩笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null + public String devNo; + + /** + * 瑙嗛绔欏悕绉� + */ + @NotEmpty(message = "瑙嗛绔欏悕绉颁笉鑳戒负绌�") //涓嶈兘涓虹┖涔熶笉鑳戒负null + public String name; + + /** + * 缁忓害 + */ + public Double lng; + + /** + * 绾害 + */ + public Double lat; + + /** + * 鏄惁澶у睆灞曠ず锛�1鏄紝0鎴杗ull鍚︼級 + */ + public Byte onScreen; + + /** + * 澶у睆灞曠ず鎺掑簭锛堝ぇ浜庣瓑浜�1锛屾暟瀛楄秺灏忔帓搴忚秺鍓嶏級 + */ + public Integer onSort; + + /** + * 澶囨敞 + */ + public String remark; + + public ViCamera toNewPo(){ + ViCamera po = new ViCamera(); + po.type = this.type; + po.devNo = this.devNo; + po.name = this.name; + po.lng = this.lng; + po.lat = this.lat; + po.onScreen = this.onScreen; + po.onSort = this.onSort; + po.remark = this.remark; + return po; + } + public ViCamera toPo(){ + ViCamera po = this.toNewPo(); + po.id = Long.parseLong(this.id) ; + return po; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraQo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraQo.java new file mode 100644 index 0000000..ff2e9b7 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraQo.java @@ -0,0 +1,22 @@ +package com.dy.pipIrrProject.video; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:03 + * @Description + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@NoArgsConstructor +@AllArgsConstructor +@Builder +@Schema(name = "瑙嗛鐩戞帶鏌ヨ鏉′欢") +public class CameraQo extends QueryConditionVo { + @Schema(description = "鍚嶇О锛堝湴鍧�锛�") + public String name; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraSv.java new file mode 100644 index 0000000..56d50bc --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraSv.java @@ -0,0 +1,84 @@ +package com.dy.pipIrrProject.video; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoVi.ViCameraMapper; +import com.dy.pipIrrGlobal.pojoVi.ViCamera; +import com.dy.pipIrrGlobal.voVi.VoCamera; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Map; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:01 + * @Description + */ +@Slf4j +@Service +public class CameraSv { + + @Autowired + private ViCameraMapper dao; + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇瀹炰綋璁板綍 + * @param queryQo 鏌ヨ鏉′欢鍊煎璞� + * @return 瀹炰綋璁板綍鍒楄〃 + */ + public QueryResultVo<List<VoCamera>> some(CameraQo queryQo) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryQo); + Long itemTotal = dao.selectTotal(params); + + QueryResultVo<List<VoCamera>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = queryQo.pageSize; + rsVo.pageCurr = queryQo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = dao.selectSome(params); + return rsVo; + } + + + /** + * 寰楀埌涓�涓疄浣� + * @param id 瀹炰綋ID + * @return 瀹炰綋 + */ + public ViCamera selectById(Long id){ + return this.dao.selectById(id) ; + } + /** + * 淇濆瓨锛堟坊鍔狅級瑙嗛鐩戞帶鐐� + * @param po + * @return + */ + @Transactional + Integer save(ViCamera po) { + return dao.insert(po); + } + + /** + * 淇敼瀹炰綋 + * @param po 瀹炰綋 + * @return 鏁伴噺 + */ + @Transactional + public int update(ViCamera po) { + return this.dao.updateByPrimaryKeySelective(po); + } + + /** + * 淇濆瓨淇敼瀹炰綋 + * @param id 瀹炰綋ID + * @return 褰卞搷璁板綍鏁伴噺 + */ + @Transactional + public int delete(Long id){ + return this.dao.deleteLogicById(id) ; + } + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraTypesConfig.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraTypesConfig.java new file mode 100644 index 0000000..e88e1ab --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/CameraTypesConfig.java @@ -0,0 +1,27 @@ +package com.dy.pipIrrProject.video; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 14:21 + * @Description + */ +@Configuration +@ConfigurationProperties(prefix = "video") +public class CameraTypesConfig { + + public static List<String> types; + + public List<String> getTypes(){ + return types; + } + + public void setTypes(List<String> types){ + CameraTypesConfig.types = types ; + } + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/TypesVo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/TypesVo.java new file mode 100644 index 0000000..cad2010 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-project/src/main/java/com/dy/pipIrrProject/video/TypesVo.java @@ -0,0 +1,14 @@ +package com.dy.pipIrrProject.video; + +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:37 + * @Description + */ +@Data +public class TypesVo { + public Integer type ; + public String name ; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java index 3992ced..9ff5fe0 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/PipIrrRemoteApplication.java @@ -30,7 +30,8 @@ "com.dy.pipIrrGlobal.daoFi", "com.dy.pipIrrGlobal.daoAllRound", "com.dy.pipIrrGlobal.daoLargeScreen", - "com.dy.pipIrrGlobal.daoIr" + "com.dy.pipIrrGlobal.daoIr", + "com.dy.pipIrrGlobal.daoVi" }) public class PipIrrRemoteApplication { diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd15/CdCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd15/CdCtrl.java index ff2aee6..81663a2 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd15/CdCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/monitor/p202404V201/cd15/CdCtrl.java @@ -9,6 +9,7 @@ import com.dy.common.util.NumUtil; import com.dy.common.webUtil.BaseResponse; import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrRemote.common.dto.DtoBase; import com.dy.pipIrrRemote.monitor.common.ComCtrl; import io.swagger.v3.oas.annotations.tags.Tag; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java index c7fcc00..4fcac51 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/msCenter/Register2MwMsCenterListener.java @@ -51,7 +51,7 @@ @Override public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { try { - //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource鍒濆鍖栧畬鎴� Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java index 4c4b193..9823cfe 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/valve/ValveCtrl.java @@ -19,6 +19,7 @@ import com.dy.pipIrrGlobal.command.ComSupport; import com.dy.pipIrrGlobal.command.dto.Param; import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.voRm.VoUnclosedParam; import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; import com.dy.pipIrrGlobal.voSe.VoVirtualCard; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoCtrl.java new file mode 100644 index 0000000..627f0b0 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoCtrl.java @@ -0,0 +1,120 @@ +package com.dy.pipIrrRemote.video; + +import com.dy.common.aop.SsoAop; +import com.dy.common.webUtil.BaseResponse; +import com.dy.common.webUtil.BaseResponseUtils; +import com.dy.common.webUtil.QueryResultVo; +import com.dy.common.webUtil.ResultCodeMsg; +import com.dy.pipIrrGlobal.pojoVi.ViYsApp; +import com.dy.pipIrrGlobal.util.CameraTypeEnum; +import com.dy.pipIrrGlobal.voVi.VoCamera; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.responses.ApiResponses; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 10:34 + * @Description + */ +@Slf4j +@Tag(name = "瑙嗛鐩戞帶", description = "瑙嗛鐩戞帶") +@RestController +@RequestMapping(path = "video") +@RequiredArgsConstructor +public class VideoCtrl { + private VideoSv sv; + private YsAppSv ysSv; + + @Value("${video.screen.count: 4}") + private Integer pageSize;//姣忛〉鏄剧ず鏉℃暟 + + @Value("${video.ys.requestVideoCommonUrl: https://open.ys7.com/console/jssdk/pc.html}") + private String requestVideoCommonUrl;// + @Value("${video.ys.requestVideoCameraPreUrl: ezopen://open.ys7.com/}") + private String requestVideoCameraPreUrl;// + @Value("${video.ys.requestVideoCameraTailUrl: /1.live&themeId=}") + private String requestVideoCameraTailUrl;// + + @Autowired + private void setSv(VideoSv sv, YsAppSv ysSv){ + this.sv = sv ; + this.ysSv = ysSv ; + } + + + /** + * 瀹㈡埛绔姹傚緱鍒颁竴浜涙憚鍍忔満鏁版嵁 + * @return 鎵�鏈夋憚鍍忔満鏁版嵁 + */ + @Operation(summary = "鑾峰緱涓�椤垫憚鍍忔満鏁版嵁", description = "杩斿洖涓�椤垫憚鍍忔満鏁版嵁鏁版嵁") + @ApiResponses(value = { + @ApiResponse( + responseCode = ResultCodeMsg.RsCode.SUCCESS_CODE, + description = "杩斿洖涓�椤垫憚鍍忔満鏁版嵁锛圔aseResponse.content:QueryResultVo[{}]锛�", + content = {@Content(mediaType = MediaType.APPLICATION_JSON_VALUE, + schema = @Schema(implementation = VoCamera.class))} + ) + }) + @GetMapping(path = "some") + @SsoAop() + public BaseResponse<QueryResultVo<List<VoVideo>>> some(VideoQo queryQo){ + try { + ViYsApp ysApp = this.ysSv.selectSingleton() ; + if(ysApp == null){ + //remote妯″潡鐨勮嚜鍔ㄤ换鍔″彲鑳芥竻绌轰簡锛屾墍浠ュ啀鏌ヨ涓�娆� + ysApp = this.ysSv.selectSingleton() ; + } + List<VoVideo> list = new ArrayList<>() ; + QueryResultVo<List<VoCamera>> resTmp = this.sv.some(queryQo, pageSize) ; + if(resTmp != null && resTmp.obj != null){ + for(VoCamera vo : resTmp.obj){ + VoVideo vvo = new VoVideo() ; + vvo.id = vo.id ; + vvo.name = vo.name ; + if(ysApp != null && vo.type != null && vo.type.byteValue() == CameraTypeEnum.YINGSHI.getType().byteValue()){ + //钀ょ煶 + StringBuilder sb = new StringBuilder(); + sb.append(requestVideoCommonUrl); + sb.append("?accessToken="); + sb.append(ysApp.accessToken); + sb.append("&url="); + sb.append(requestVideoCameraPreUrl); + sb.append(vo.devNo); + sb.append(requestVideoCameraTailUrl); + vvo.videoUrl4Simple = sb.toString() + "simple"; + vvo.videoUrl4Standard = sb.toString() + "standard" ; + vvo.videoUrl4Security = sb.toString() + "security" ; + }else{ + vvo.videoUrl4Simple = "" ; + vvo.videoUrl4Standard = "" ; + vvo.videoUrl4Security = "" ; + } + list.add(vvo) ; + } + } + QueryResultVo<List<VoVideo>> res = new QueryResultVo<>() ; + resTmp.copyTo(res); + res.obj = list ; + return BaseResponseUtils.buildSuccess(res); + } catch (Exception e) { + log.error("鏌ヨ鎽勫儚鏈哄紓甯�", e); + return BaseResponseUtils.buildException(e.getMessage()) ; + } + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoQo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoQo.java new file mode 100644 index 0000000..e2e01ff --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoQo.java @@ -0,0 +1,18 @@ +package com.dy.pipIrrRemote.video; + +import com.dy.common.webUtil.QueryConditionVo; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 9:03 + * @Description + */ +@Data +@EqualsAndHashCode(callSuper = false) +@ToString(callSuper = true) +@Builder +@Schema(name = "瑙嗛鐩戞帶鏌ヨ鏉′欢") +public class VideoQo extends QueryConditionVo { +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoSv.java new file mode 100644 index 0000000..58ab291 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VideoSv.java @@ -0,0 +1,44 @@ +package com.dy.pipIrrRemote.video; + +import com.dy.common.webUtil.QueryResultVo; +import com.dy.pipIrrGlobal.daoVi.ViCameraMapper; +import com.dy.pipIrrGlobal.voVi.VoCamera; +import lombok.extern.slf4j.Slf4j; +import org.apache.dubbo.common.utils.PojoUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 10:42 + * @Description + */ +@Slf4j +@Service +public class VideoSv { + + @Autowired + private ViCameraMapper dao; + + /** + * 鏍规嵁鎸囧畾鏉′欢鑾峰彇瀹炰綋璁板綍 + * @param queryQo 鏌ヨ鏉′欢鍊煎璞� + * @return 瀹炰綋璁板綍鍒楄〃 + */ + public QueryResultVo<List<VoCamera>> some(VideoQo queryQo, int pageSize) { + Map<String, Object> params = (Map<String, Object>) PojoUtils.generalize(queryQo); + Long itemTotal = dao.selectTotal4Monitor(params); + + QueryResultVo<List<VoCamera>> rsVo = new QueryResultVo<>(); + rsVo.pageSize = pageSize; + rsVo.pageCurr = queryQo.pageCurr; + rsVo.calculateAndSet(itemTotal, params); + rsVo.obj = dao.selectSome4Monitor((params)) ; + return rsVo; + } + + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VoVideo.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VoVideo.java new file mode 100644 index 0000000..714fc10 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/VoVideo.java @@ -0,0 +1,20 @@ +package com.dy.pipIrrRemote.video; + +import com.alibaba.fastjson2.annotation.JSONField; +import com.alibaba.fastjson2.writer.ObjectWriterImplToString; +import lombok.Data; + +/** + * @Author: liurunyu + * @Date: 2025/6/9 10:57 + * @Description + */ +@Data +public class VoVideo { + @JSONField(serializeUsing= ObjectWriterImplToString.class) + public Long id ; + public String name ; + public String videoUrl4Simple ; + public String videoUrl4Standard ; + public String videoUrl4Security ; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppCtrl.java new file mode 100644 index 0000000..baab85e --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppCtrl.java @@ -0,0 +1,48 @@ +package com.dy.pipIrrRemote.video; + +import com.dy.common.multiDataSource.DataSourceContext; +import com.dy.pipIrrGlobal.pojoVi.ViYsApp; +import com.dy.pipIrrGlobal.util.Org; +import com.dy.pipIrrGlobal.util.OrgListenerSupport; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.io.ResourceLoader; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 12:45 + * @Description 绫诲悕涓寘鍚獻nner锛岃〃绀哄唴閮ㄥ簲鐢ㄧ殑Controller + */ +@Slf4j +@RestController +public class YsAppCtrl extends OrgListenerSupport { + + @Autowired + protected ResourceLoader resourceLoader ; + + @Autowired + protected YsAppSv ysAppSv; + + public ViYsApp selectSingletonYsApp(){ + return ysAppSv.selectSingleton() ; + } + + public Long saveAccessTokenOfYs(String accessToken, Long expireTime){ + if(Org.OrgList == null || Org.OrgList.size() == 0){ + super.init(resourceLoader); + } + List<Org.OrgVo> orgList = Org.OrgList ; + if(orgList != null || orgList.size() > 0){ + for(Org.OrgVo vo : orgList){ + //閬嶅巻鎵�鏈塷rg锛屽緱鍒板悇鑷殑钀ょ煶搴旂敤AccessToken + DataSourceContext.set(vo.tag);//璁剧疆鏁版嵁婧� + ysAppSv.deleteAll(); + ysAppSv.save(accessToken, expireTime) ; + } + } + return null ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppListener.java new file mode 100644 index 0000000..e3f6165 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppListener.java @@ -0,0 +1,120 @@ +package com.dy.pipIrrRemote.video; + + +import com.dy.common.multiDataSource.DataSourceContext; +import com.dy.pipIrrGlobal.pojoVi.ViYsApp; +import com.dy.pipIrrGlobal.util.Org; +import com.dy.pipIrrGlobal.util.OrgListenerSupport; +import com.dy.pipIrrRemote.video.ys.YsAppClient; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.core.io.ResourceLoader; +import org.springframework.lang.NonNull; +import org.springframework.stereotype.Component; + +import java.util.*; + +/** + * @Author: liurunyu + * @Date: 2025/6/6 17:19 + * @Description 瑙嗛鐩戞帶 + * 鐩戝惉鍣紝瀹炵幇鍔熻兘锛氬惎鍔ㄦ棩缁熻瀹氭椂浠诲姟 + * 鏈洃鍚櫒涓嶈兘閲囩敤ServletContextListener鏂瑰紡锛屽洜涓篠ervlet涓婁笅鏂嘋ontext鍒涘缓鍚� + * Spring瀹瑰櫒骞舵病鏈夊垱寤哄畬锛岃�屾湰绫讳腑鐢ㄤ簡Spring瀹瑰櫒涓殑Bean锛屽嵆*Dao 銆� + * 鎵�浠ラ噰鐢ㄤ簡Spring浜嬩欢鐩戝惉鍣ㄦ潵瀹炵幇 + */ +@Slf4j +@Component +public class YsAppListener extends OrgListenerSupport implements ApplicationListener<ApplicationReadyEvent> { + + @Autowired + protected ResourceLoader resourceLoader ; + + @Autowired + protected YsAppCtrl ysAppCtrl; + + @Autowired + protected YsAppClient ysAppClient; + + /** + * SpringBoot瀹瑰櫒宸茬粡鍑嗗濂戒簡锛屾墽琛屼笅闈㈡柟娉� + * @param event 浜嬩欢 + */ + @Override + public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { + try { + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource鍒濆鍖栧畬鎴� + Thread.sleep(1000L); + } catch (InterruptedException e) { + e.printStackTrace(); + }finally { + try{ + super.init(resourceLoader); + this.atSysStart(event); + }catch (Exception e){ + log.error("娉ㄥ唽钀ょ煶浜戝畾鏃朵换鍔″嚭閿�", e); + } + } + } + /** + * 鍒濆鍖� + */ + private void atSysStart(ApplicationReadyEvent event) throws Exception{ + //鎵�鏈塐rg锛屽叡鐢ㄤ竴涓悿鐭冲簲鐢ㄧ殑AccessToken + boolean isNowGetNewAccessToken = false ;//褰撲笅鏄惁鑾峰緱AccessToken + List<Org.OrgVo> orgList = Org.OrgList ; + Map<String, ViYsApp> viYsAppMap = new HashMap<>() ; + if(orgList != null && orgList.size() >0){ + for(Org.OrgVo vo : orgList){ + //閬嶅巻鎵�鏈塷rg锛屽緱鍒板悇鑷殑钀ょ煶搴旂敤AccessToken + DataSourceContext.set(vo.tag);//璁剧疆鏁版嵁婧� + ViYsApp po = ysAppCtrl.selectSingletonYsApp() ; + if(po == null){ + isNowGetNewAccessToken = true ; + }else{ + viYsAppMap.put(vo.tag, po) ; + } + } + this.dealAtSysStart(viYsAppMap, isNowGetNewAccessToken); + } + } + private void dealAtSysStart(Map<String, ViYsApp> viYsAppMap, boolean isNowGetNewAccessToken){ + if(!isNowGetNewAccessToken){ + if(viYsAppMap != null && viYsAppMap.size() >0){ + long nowMustAtMillis = System.currentTimeMillis() ; + Collection<ViYsApp> col = viYsAppMap.values() ; + Iterator<ViYsApp> it = col.iterator() ; + ViYsApp po ; + while (it.hasNext()){ + po = it.next() ; + if(po.expireTime != null && nowMustAtMillis > po.expireTime){ + isNowGetNewAccessToken = true ; + } + } + }else{ + isNowGetNewAccessToken = true ; + } + } + if(isNowGetNewAccessToken){ + this.ysAppClient.getAccessToken(); + this.ysAppClient.reSetNextGetAccessToken(null) ; + }else{ + long nextGetTokenAtMillis = 0L ; + Collection<ViYsApp> col = viYsAppMap.values() ; + Iterator<ViYsApp> it = col.iterator() ; + ViYsApp po ; + while (it.hasNext()){ + po = it.next() ; + if(nextGetTokenAtMillis == 0 || nextGetTokenAtMillis > po.expireTime){ + nextGetTokenAtMillis = po.expireTime ; + } + } + if(nextGetTokenAtMillis > 0L){ + this.ysAppClient.reSetNextGetAccessToken(nextGetTokenAtMillis); + } + } + } + +} \ No newline at end of file diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppSv.java new file mode 100644 index 0000000..8040186 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/YsAppSv.java @@ -0,0 +1,47 @@ +package com.dy.pipIrrRemote.video; + +import com.dy.common.util.DateTime; +import com.dy.pipIrrGlobal.daoVi.ViYsAppMapper; +import com.dy.pipIrrGlobal.pojoVi.ViYsApp; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 9:14 + * @Description + */ +@Component +public class YsAppSv { + + @Autowired + protected ViYsAppMapper viYsAppDao ; + + + public ViYsApp selectSingleton(){ + List<ViYsApp> all = this.viYsAppDao.selectAll() ; + if(all == null || all.size() == 0){ + return null ; + }else{ + return all.get(0) ; + } + } + + @Transactional(rollbackFor = Exception.class) + public Long save(String accessToken, Long expireTime){ + ViYsApp po = new ViYsApp() ; + po.accessToken = accessToken ; + po.expireTime = expireTime ; + po.expireDt = DateTime.getDate(expireTime) ; + this.viYsAppDao.insert(po) ; + return po.id ; + } + + @Transactional(rollbackFor = Exception.class) + public void deleteAll(){ + viYsAppDao.deleteAll() ; + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenData.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenData.java new file mode 100644 index 0000000..54471a2 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenData.java @@ -0,0 +1,18 @@ +package com.dy.pipIrrRemote.video.ys; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 14:00 + * @Description + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class YsAccessTokenData { + public String accessToken ; + public Long expireTime ; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenQuartzJob.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenQuartzJob.java new file mode 100644 index 0000000..ab21d5f --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenQuartzJob.java @@ -0,0 +1,25 @@ +package com.dy.pipIrrRemote.video.ys; + +import com.dy.common.schedulerTask.TaskJob; +import com.dy.common.springUtil.SpringContextUtil; +import org.quartz.JobExecutionContext; +import org.quartz.JobExecutionException; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 15:39 + * @Description + */ +public class YsAccessTokenQuartzJob extends TaskJob { + /** + * Quartz瀹氭椂浠诲姟锛屽叾涓嶅湪Spring瀹瑰櫒涓� + * @param ctx + * @throws JobExecutionException + */ + @Override + public void execute(JobExecutionContext ctx) throws JobExecutionException { + YsAppClient ysCli = SpringContextUtil.getBean(YsAppClient.class); + ysCli.getAccessToken(); + ysCli.reSetNextGetAccessToken(null); + } +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenResponse.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenResponse.java new file mode 100644 index 0000000..9a4b8ed --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAccessTokenResponse.java @@ -0,0 +1,19 @@ +package com.dy.pipIrrRemote.video.ys; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 14:00 + * @Description + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class YsAccessTokenResponse { + public YsAccessTokenData data ; + public String code ; + public String msg ; +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAppClient.java b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAppClient.java new file mode 100644 index 0000000..f4bf603 --- /dev/null +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-remote/src/main/java/com/dy/pipIrrRemote/video/ys/YsAppClient.java @@ -0,0 +1,135 @@ +package com.dy.pipIrrRemote.video.ys; + +import com.dy.common.schedulerTask.SchedulerTaskSupport; +import com.dy.pipIrrRemote.video.YsAppCtrl; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.*; +import org.springframework.stereotype.Component; +import org.springframework.util.LinkedMultiValueMap; +import org.springframework.util.MultiValueMap; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.UriComponentsBuilder; + +/** + * @Author: liurunyu + * @Date: 2025/6/7 11:40 + * @Description + */ +@Slf4j +@Component +public class YsAppClient { + + private static final String JobName = "VideoYsJob" ; + private static final String JobGroupName = "VideoYsGroup" ; + private static final Integer ThreadPoolMaxCount = 1 ;//绾跨▼姹犵嚎绋嬫渶澶т釜鏁� + private static final Integer ThreadPoolPriority = 5 ;//绾跨▼浼樺厛绾� + private static final boolean quartzJobRunOneTimes = true ;//瀹氭椂浠诲姟鍙墽琛屼竴娆� + + @Value("${video.ys.accessTokenExpireDay: 7}") + protected Integer accessTokenExpireDay;//AccessToken杩囨湡鏃堕棿锛屽崟浣嶅ぉ + + @Value("${video.ys.appKey}") + protected String appKey; + + @Value("${video.ys.secret}") + protected String secret; + + @Value("${video.ys.requestAccessTokenUrl}") + protected String requestAccessTokenUrl; + + @Autowired + protected RestTemplate restTemplate ; + + @Autowired + protected YsAppCtrl ysVideoCtrl; + + private Long computeNetGetAccessTokenAt(){ + Long millis = (System.currentTimeMillis() + (accessTokenExpireDay * 24 * 60 * 60 * 1000) ) ; + // millis = 10000L ; + return millis ; + } + + /** + * 鑾峰緱AccessToken + */ + public void getAccessToken(){ + if((appKey != null && appKey.trim().length() > 0) + && (secret != null && secret.trim().length() > 0) + && (requestAccessTokenUrl != null && requestAccessTokenUrl.trim().length() > 0)){ + MultiValueMap<String, String> formData = new LinkedMultiValueMap<>(); + formData.add("appKey", appKey); + formData.add("appSecret", secret); + YsAccessTokenResponse response = this.postRequest2Ys(restTemplate, requestAccessTokenUrl, formData); + if(response != null){ + switch (response.code){ + case "200" :{ + this.dealSuccessOfRequestAccessTokenFromYs(response) ; + break ; + } + default: { + this.dealErrorOfRequestAccessTokenFromYs(response) ; + break ; + } + } + } + } + } + private void dealSuccessOfRequestAccessTokenFromYs(YsAccessTokenResponse response){ + if(response != null && response.data != null){ + ysVideoCtrl.saveAccessTokenOfYs(response.data.accessToken, response.data.expireTime); + } + } + + private void dealErrorOfRequestAccessTokenFromYs(YsAccessTokenResponse response){ + log.error("浠庤悿鐭冲紑鏀惧钩鍙拌幏寰桝ccessToken澶辫触锛岄敊璇爜锛歿}锛岄敊璇俊鎭細{}", response.code, response.msg); + } + /** + * 璁剧疆涓嬫鑾峰緱AccessToken + */ + public void reSetNextGetAccessToken(Long getAccessTokenAt){ + if(getAccessTokenAt == null || getAccessTokenAt.longValue() == 0){ + getAccessTokenAt = this.computeNetGetAccessTokenAt() ; + } + //姣鍙樻垚绉� + int futureSecond = (int)((getAccessTokenAt - System.currentTimeMillis()) / 1000) ; + try { + SchedulerTaskSupport.setThreadPoolPro(ThreadPoolMaxCount , ThreadPoolPriority); + //鍥犱负瑕侀噸澶嶅姞宸ヤ綔浠诲姟锛屾墍浠ュ厛鎶婁笂娆″姞鐨勫悓缁勫悓鍚嶄换鍔″垹闄� + SchedulerTaskSupport.deleteJob(JobName , JobGroupName) ; + // 鍙墽琛屼竴娆$殑浠诲姟 + SchedulerTaskSupport.addSecondlyJob(JobName , JobGroupName, YsAccessTokenQuartzJob.class, null, futureSecond, 1, 0) ; + } catch (Exception e) { + log.error("璁剧疆浠庤悿鐭冲紑鏀惧钩鍙板畾鏃惰幏寰桝ccessToken浠诲姟鏃跺彂鐢熷紓甯�", e); + } + } + /** + * 鍚戣悿鐭冲紑鏀惧钩鍙板彂閫丳ost璇锋眰 + * @param restTemplate SpringBoot鐨凴estTemplate + * @param toMwUrl web璇锋眰Url + * @param body 鏁版嵁 + * @return + */ + private YsAccessTokenResponse postRequest2Ys(RestTemplate restTemplate, String toMwUrl, Object body) { + String url = UriComponentsBuilder.fromUriString(toMwUrl) + .build() + .toUriString(); + HttpHeaders headers = new HttpHeaders(); + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + + HttpEntity<?> httpEntity = new HttpEntity<>(body, headers); + ResponseEntity<YsAccessTokenResponse> resEntity = null; + try { + // 閫氳繃Post鏂瑰紡璋冪敤鎺ュ彛 + resEntity = restTemplate.exchange(url, HttpMethod.POST, httpEntity, YsAccessTokenResponse.class); + } catch (Exception e) { + log.error("浠庤悿鐭冲紑鏀惧钩鍙板畾鏃惰幏寰桝ccessToken浠诲姟鎵ц鏃跺彂鐢熷紓甯�", e); + } + if(resEntity != null){ + return resEntity.getBody(); + } + return null ; + } + +} diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java index 7a24c20..3effafc 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-sso/src/main/java/com/dy/sso/util/SsoListener.java @@ -17,7 +17,7 @@ @Override public void onApplicationEvent(ApplicationReadyEvent event) { try { - //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource鍒濆鍖栧畬鎴� Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java index 473fc85..f798af0 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/card/IcCardSv.java @@ -2,6 +2,7 @@ import com.dy.common.webUtil.QueryResultVo; import com.dy.pipIrrGlobal.daoSe.SeCardOperateMapper; +import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.voSt.VoCardUsage; import com.dy.pipIrrGlobal.voSt.VoICCard; import com.dy.pipIrrStatistics.card.IcCardqo.CommonQO; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java index 50b2aa3..39fb322 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByClientSv.java @@ -1,5 +1,6 @@ package com.dy.pipIrrStatistics.statistics; +import com.dy.pipIrrGlobal.daoSe.SeRechargeHistoryMapper; import com.dy.pipIrrGlobal.daoSt.StRechargeClientDayMapper; import com.dy.pipIrrGlobal.daoSt.StRechargeClientMonthMapper; import com.dy.pipIrrGlobal.daoSt.StRechargeClientYearMapper; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java index f85215d..28ad3f3 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StChargeByIcSv.java @@ -1,5 +1,6 @@ package com.dy.pipIrrStatistics.statistics; +import com.dy.pipIrrGlobal.daoSe.SeRechargeHistoryMapper; import com.dy.pipIrrGlobal.daoSt.StRechargeIcDayMapper; import com.dy.pipIrrGlobal.daoSt.StRechargeIcMonthMapper; import com.dy.pipIrrGlobal.daoSt.StRechargeIcYearMapper; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java index febf5bb..8cd56c4 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsJob.java @@ -21,7 +21,7 @@ */ public class StatisticsJob extends TaskJob { - private static Logger log = LogManager.getLogger(Test.class.getName()) ; + private static Logger log = LogManager.getLogger(StatisticsJob.class.getName()) ; private String orgTag ; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java index b313e63..4461e3a 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-statistics/src/main/java/com/dy/pipIrrStatistics/statistics/StatisticsListener.java @@ -53,7 +53,7 @@ @Override public void onApplicationEvent(@NonNull ApplicationReadyEvent event) { try { - //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource瀹炲鍖栧畬鎴� + //绛�1绉掞紝绛夊緟com.alibaba.druid.pool.DruidDataSource鍒濆鍖栧畬鎴� Thread.sleep(1000L); } catch (InterruptedException e) { e.printStackTrace(); diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCardSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCardSv.java index 12ff508..043abf9 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCardSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/client/ClientCardSv.java @@ -1,5 +1,6 @@ package com.dy.pipIrrWechat.client; +import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.voWe.VoCards3; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java index b9b3d5e..c9d9717 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/CommandSv.java @@ -28,9 +28,11 @@ import com.dy.pipIrrGlobal.daoRm.RmCommandHistoryMapper; import com.dy.pipIrrGlobal.daoRm.RmIrrigateProfileMapper; import com.dy.pipIrrGlobal.daoRm.RmOpenCloseValveLastMapper; +import com.dy.pipIrrGlobal.daoSe.SeClientCardMapper; import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; import com.dy.pipIrrGlobal.pojoIr.IrIntakeOperate; import com.dy.pipIrrGlobal.pojoRm.RmCommandHistory; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile; import com.dy.pipIrrGlobal.voRm.VoRtuAndVc; import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; diff --git a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java index 3ea14fc..1f38ed5 100644 --- a/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java +++ b/pipIrr-platform/pipIrr-web/pipIrr-web-wechat/src/main/java/com/dy/pipIrrWechat/command/ValveCtrl.java @@ -16,6 +16,7 @@ import com.dy.pipIrrGlobal.command.ComSupport; import com.dy.pipIrrGlobal.command.dto.Param; import com.dy.pipIrrGlobal.daoSe.SeVirtualCardMapper; +import com.dy.pipIrrGlobal.pojoSe.SeClientCard; import com.dy.pipIrrGlobal.voRm.VoIrrigaterProfile; import com.dy.pipIrrGlobal.voRm.VoUnclosedValve; import com.dy.pipIrrGlobal.voSe.VoVirtualCard; -- Gitblit v1.8.0