gaodd 5 meses atrás
pai
commit
f379b3bdc8

+ 19 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/equipmentOnlineRateAssessment/modular/monitorNvr/controller/MonitorNvrController.java

@@ -16,6 +16,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
16 16
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
17 17
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
18 18
 import com.github.xiaoymin.knife4j.annotations.ApiSupport;
19
+import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.utils.ParameterUtil;
19 20
 import io.swagger.annotations.Api;
20 21
 import io.swagger.annotations.ApiOperation;
21 22
 import org.springframework.validation.annotation.Validated;
@@ -36,6 +37,9 @@ import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.service.Monitor
36 37
 import javax.annotation.Resource;
37 38
 import javax.validation.Valid;
38 39
 import javax.validation.constraints.NotEmpty;
40
+import java.util.HashMap;
41
+import java.util.List;
42
+import java.util.Map;
39 43
 
40 44
 /**
41 45
  * 硬盘录像机表控制器
@@ -128,4 +132,19 @@ public class MonitorNvrController {
128 132
     public CommonResult<MonitorNvr> detail(@Valid MonitorNvrIdParam monitorNvrIdParam) {
129 133
         return CommonResult.data(monitorNvrService.detail(monitorNvrIdParam));
130 134
     }
135
+
136
+    /**
137
+     * shine
138
+     * @param orgId
139
+     * @return
140
+     */
141
+    @ApiOperationSupport(order = 6)
142
+    @ApiOperation("*查找要录像的NVR信息")
143
+    @GetMapping("/camera/getNVRVideo")
144
+    public CommonResult<List<Map<String,Object>>> getNVRVideo(Integer orgId) {
145
+        Map<String,Object> map = new HashMap<>();
146
+        map.put("orgId",orgId.toString());
147
+        List<Map<String,Object>> list = monitorNvrService.selectByNVRDates(map);
148
+        return CommonResult.data(ParameterUtil.slashCapitals(list));
149
+    }
131 150
 }

+ 5 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/equipmentOnlineRateAssessment/modular/monitorNvr/mapper/MonitorNvrMapper.java

@@ -22,6 +22,9 @@ import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.param.MonitorNv
22 22
 import org.apache.ibatis.annotations.Mapper;
23 23
 import org.apache.ibatis.annotations.Param;
24 24
 
25
+import java.util.List;
26
+import java.util.Map;
27
+
25 28
 /**
26 29
  * 硬盘录像机表Mapper接口
27 30
  *
@@ -34,4 +37,6 @@ public interface MonitorNvrMapper extends BaseMapper<MonitorNvr> {
34 37
     Page<CameraAndNvrVO> findNvr( Page<CameraAndNvrVO> page ,@Param("name") String name);
35 38
 
36 39
     Integer selectAllNum(String orgId);
40
+
41
+    List<Map<String, Object>> selectByNVRDates(Map<String, Object> map);
37 42
 }

+ 25 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/equipmentOnlineRateAssessment/modular/monitorNvr/mapper/mapping/MonitorNvrMapper.xml

@@ -21,4 +21,29 @@
21 21
             </if>
22 22
         </where>
23 23
     </select>
24
+
25
+    <select id="selectByNVRDates" resultType="java.util.HashMap" parameterType="java.util.Map" >
26
+        SELECT
27
+        camera.id camera_id,
28
+        camera.alias,
29
+        camera.factory,
30
+        camera.live,
31
+        camera.ip camera_ip,
32
+        camera.username camera_name,
33
+        camera.password camera_password,
34
+        camera.port camera_port,
35
+        camera.type camera_type,
36
+        nvr.ip nvr_ip,
37
+        nvr.username nvr_name,
38
+        nvr. PASSWORD nvr_password,
39
+        nvr. PORT nvr_port,
40
+        nvr.factory nvr_factory,
41
+        camera.channel_number,
42
+        camera.org_id
43
+        FROM
44
+        depot_qh.monitor_camera camera
45
+        LEFT JOIN depot_qh.monitor_nvr nvr ON nvr.id = camera.nvr_id
46
+        WHERE camera.isremove = '1' AND nvr.delete_mark = '1' AND camera.org_id = #{orgId,jdbcType=VARCHAR} AND nvr.org_id = #{orgId,jdbcType=VARCHAR}
47
+        group by camera.id
48
+    </select>
24 49
 </mapper>

+ 3 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/equipmentOnlineRateAssessment/modular/monitorNvr/service/MonitorNvrService.java

@@ -21,6 +21,7 @@ import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.param.MonitorNv
21 21
 import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.param.MonitorNvrPageParam;
22 22
 
23 23
 import java.util.List;
24
+import java.util.Map;
24 25
 
25 26
 /**
26 27
  * 硬盘录像机表Service接口
@@ -77,4 +78,6 @@ public interface MonitorNvrService extends IService<MonitorNvr> {
77 78
      * @date  2024/06/21 10:10
78 79
      **/
79 80
     MonitorNvr queryEntity(Integer id);
81
+
82
+    List<Map<String, Object>> selectByNVRDates(Map<String, Object> map);
80 83
 }

+ 9 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/equipmentOnlineRateAssessment/modular/monitorNvr/service/impl/MonitorNvrServiceImpl.java

@@ -32,7 +32,9 @@ import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.param.MonitorNv
32 32
 import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.param.MonitorNvrPageParam;
33 33
 import com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.service.MonitorNvrService;
34 34
 
35
+import javax.annotation.Resource;
35 36
 import java.util.List;
37
+import java.util.Map;
36 38
 
37 39
 /**
38 40
  * 硬盘录像机表Service接口实现类
@@ -43,6 +45,8 @@ import java.util.List;
43 45
 @Service
44 46
 public class MonitorNvrServiceImpl extends ServiceImpl<MonitorNvrMapper, MonitorNvr> implements MonitorNvrService {
45 47
 
48
+    @Resource
49
+    private MonitorNvrMapper monitorNvrMapper;
46 50
     @Override
47 51
     public Page<MonitorNvr> page(MonitorNvrPageParam monitorNvrPageParam) {
48 52
         QueryWrapper<MonitorNvr> queryWrapper = new QueryWrapper<>();
@@ -91,4 +95,9 @@ public class MonitorNvrServiceImpl extends ServiceImpl<MonitorNvrMapper, Monitor
91 95
         }
92 96
         return monitorNvr;
93 97
     }
98
+
99
+    @Override
100
+    public List<Map<String, Object>> selectByNVRDates(Map<String, Object> map) {
101
+        return monitorNvrMapper.selectByNVRDates(map);
102
+    }
94 103
 }

+ 270 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/equipmentOnlineRateAssessment/modular/monitorNvr/utils/ParameterUtil.java

@@ -0,0 +1,270 @@
1
+package com.unis.equipmentOnlineRateAssessment.modular.monitorNvr.utils;
2
+
3
+
4
+import java.io.BufferedInputStream;
5
+import java.io.InputStream;
6
+import java.text.ParseException;
7
+import java.text.SimpleDateFormat;
8
+import java.util.*;
9
+
10
+public class ParameterUtil {
11
+
12
+    public static String getSysDateTime(){
13
+        String temp_str="";
14
+        Date dt = new Date();
15
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
16
+        temp_str=sdf.format(dt);
17
+        System.out.println("获取当前时间"+temp_str);
18
+        return temp_str;
19
+    }
20
+    
21
+    public static String getDateYMDHMS(Date date) {
22
+    	String str = "";
23
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
24
+        str=sdf.format(date);
25
+        System.out.println("获取当前时间"+str);
26
+        return str;
27
+    }
28
+    
29
+    public static String getSysDate(){
30
+        String temp_str="";
31
+        Date dt = new Date();
32
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
33
+        temp_str=sdf.format(dt);
34
+        return temp_str;
35
+    }
36
+
37
+    public static Date string2datetime(String dateTime){
38
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
39
+        Date date = null;
40
+        try {
41
+            date = dateFormat.parse(dateTime);
42
+        } catch (ParseException e) {
43
+            e.printStackTrace();
44
+        }
45
+        return date;
46
+    }
47
+    public static Date string2date(String dateTime){
48
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
49
+        Date date = null;
50
+        try {
51
+            date = dateFormat.parse(dateTime);
52
+        } catch (ParseException e) {
53
+            e.printStackTrace();
54
+        }
55
+        return date;
56
+    }
57
+
58
+    public static String date2string(Date date){
59
+        SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
60
+        String str=sdf.format(date);
61
+        return str;
62
+    }
63
+
64
+    /**
65
+     * 获取指定时间的时间戳
66
+     * @param datatime
67
+     * @return
68
+     */
69
+    public static String getTimeStamp(String datatime){
70
+        long timeStamp = 0;
71
+        SimpleDateFormat format =  new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
72
+        try {
73
+            Date date = format.parse(datatime);
74
+            timeStamp = date.getTime();
75
+        } catch (ParseException e) {
76
+            e.printStackTrace();
77
+        }
78
+        return String.valueOf(timeStamp);
79
+    }
80
+
81
+    /*
82
+     * 将时间戳转换为时间
83
+     */
84
+    public static String stampToDate(String s){
85
+        String res;
86
+        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
87
+        long lt = new Long(s);
88
+        Date date = new Date(lt);
89
+        res = simpleDateFormat.format(date);
90
+        return res;
91
+    }
92
+
93
+    public static void main(String[] args) {
94
+        System.out.println(stampToDate("1504689208643"));
95
+        System.out.println(getTimeStamp(getSysDateTime()));
96
+    }
97
+    public static String getBHS(String BHS){
98
+        String[] str = BHS.split(",");
99
+        StringBuffer sb = new StringBuffer();
100
+        for(int i=0;i<str.length;i++){
101
+            sb.append("'").append(str[i]).append("'").append(",");
102
+        }
103
+        String s=sb.toString();
104
+        String t=s.substring(0,s.length()-1);
105
+        return t;
106
+    }
107
+
108
+    //判断字段值是为空 不为空返回ture
109
+    public static boolean isnotnull(Object name){
110
+        return (null!=name&&!"".equals(name) && !"null".equals(name) && "null" != name);
111
+    }
112
+    
113
+    //判断字段值是为空,为空返回ture
114
+    public static boolean isnull(Object name){
115
+        return (null==name || "".equals(name) || "null".equals(name) || "null" == name);
116
+    }
117
+
118
+    //判断字段值是相等  相等返回ture
119
+    public static boolean isequal(Object name,Object value){
120
+        if(name==value||name.equals(value)){
121
+            return true;
122
+        }
123
+        return false;
124
+    }
125
+
126
+    /**
127
+     * 判断list和str数组是否全等
128
+     * @param list
129
+     * @param str
130
+     * @return
131
+     */
132
+    public static boolean isAllequal(List<String> list,String[] str){
133
+        boolean isbz = true;
134
+        for(int z=0;z<str.length;z++){
135
+            if(!isequal(list.get(z),str[z])){
136
+                isbz = false;
137
+                break;
138
+            }
139
+        }
140
+        return !isbz || !(str.length == list.size());
141
+    }
142
+
143
+    //判断字段值是否在某个集合里  在返回ture
144
+    public static boolean isallequal(Object name,String[] value){
145
+        for(int i=0;i<value.length;i++){
146
+            if(name==value[i]||name.equals(value[i])){
147
+                return true;
148
+            }
149
+        }
150
+        return false;
151
+    }
152
+
153
+    /**
154
+     * 从properties得到路径
155
+     * @param filePath
156
+     * @return
157
+     */
158
+    public static Properties readProperties(String filePath) {
159
+        Properties props = new Properties();
160
+        try {
161
+            InputStream in = new BufferedInputStream(ParameterUtil.class.getResourceAsStream(filePath));
162
+            props.load(in);
163
+        } catch (Exception e) {
164
+            e.printStackTrace();
165
+        }
166
+        return props;
167
+    }
168
+    
169
+    /**
170
+     * 获取6位随机码
171
+     * @param num 随机数位数
172
+     * @return String 返回随机数
173
+     */
174
+    public static String randomCode(int num) {
175
+        StringBuilder str = new StringBuilder();
176
+        Random random = new Random();
177
+        for (int i = 0; i < num; i++) {
178
+            str.append(random.nextInt(10));
179
+        }
180
+        return str.toString();
181
+    }
182
+
183
+
184
+    //修改一个list
185
+    public static List<Map<String, Object>> slashCapitals(List<Map<String, Object>> list){
186
+        List<Map<String, Object>> listData = new ArrayList<Map<String,Object>>();
187
+        if(isnull(list)){
188
+            return listData;
189
+        }
190
+        Map<String,Object> data = new HashMap<String, Object>();
191
+        //循环list修改map
192
+        for (Map<String,Object> hcData : list) {
193
+            //循环修改一条数据
194
+            data = slashCapitals(hcData);
195
+            listData.add(data);
196
+        }
197
+        return listData;
198
+    }
199
+
200
+    //修改一条map数据
201
+    public static Map<String, Object> slashCapitals(Map<String, Object> map){
202
+        Map<String,Object> data = new HashMap<String, Object>();
203
+        if(isnull(map)){
204
+            return data;
205
+        }
206
+        //循环修改一条数据
207
+        for (Map.Entry<String,Object> entry: map.entrySet()) {
208
+            //字符串缓冲区
209
+            StringBuffer sbf = new StringBuffer();
210
+            //获取map的key值
211
+            String strs = slashCapital(entry.getKey());
212
+            // 转换成字符数组
213
+            char[] ch = strs.toCharArray();
214
+            // 首字母换小写
215
+            ch[0] = (char) (ch[0] + 32);
216
+            sbf.append(ch);
217
+            //添加key和value进入新的返回map
218
+            data.put(sbf.toString(),entry.getValue());
219
+        }
220
+        return data;
221
+    }
222
+
223
+    /** 方法说明 :带 _ 后第一个字母 转换成大写
224
+     * @return :String
225
+     * @author :HFanss
226
+     **/
227
+    public static String slashCapital(String str){
228
+        //字符串缓冲区
229
+        StringBuffer sbf = new StringBuffer();
230
+        //如果字符串包含下划线
231
+        if (str.contains("_")){
232
+            //按下划线来切割字符串为数组
233
+            String[] split = str.split("_");
234
+            //循环数组操作其中的字符串
235
+            for (int i = 0, index = split.length; i<index; i++) {
236
+                //递归调用方法
237
+                String upperTable = slashCapital(split[i]);
238
+                //添加到字符串缓冲区
239
+                sbf.append(upperTable);
240
+            }
241
+        }else{// 字符串不包含下划线
242
+            // 转换成字符数组
243
+            char[] ch = str.toCharArray();
244
+            // 判断首字母是否是字母
245
+            if (ch[0] >= 'a' && ch[0] <= 'z'){
246
+                // 利用ASCII码实现大写
247
+                ch[0] = (char) (ch[0] - 32);
248
+            }
249
+            // 添加进字符串缓存区
250
+            sbf.append(ch);
251
+        }
252
+        // 返回
253
+        return sbf.toString();
254
+    }
255
+
256
+    public static String dellOneDay(String time) {
257
+        String add = null;
258
+        try {
259
+            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
260
+            java.util.Date timeNow = df.parse(time);
261
+            Calendar begin=Calendar.getInstance();
262
+            begin.setTime(timeNow);
263
+            begin.add(Calendar.DAY_OF_MONTH,-1);
264
+            add = df.format(begin.getTime());
265
+        } catch (Exception e) {
266
+            e.printStackTrace();
267
+        }
268
+        return add;
269
+    }
270
+}