瀏覽代碼

官网调整排序,agbox调整动态配置、修复时间上传后时分秒无效BUG

hanzhengyi 1 年之前
父節點
當前提交
d48394c2e5

+ 10 - 5
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/controller/api/patrolAgboxControllerApi.java

@@ -3,6 +3,7 @@ package com.usky.agbox.controller.api;
 import com.alibaba.fastjson.JSONObject;
 import com.usky.agbox.RemotePatrolAgBoxService;
 import com.usky.agbox.service.job.patrolAgbox;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -12,28 +13,32 @@ import org.springframework.web.bind.annotation.RestController;
  */
 @RestController
 public class patrolAgboxControllerApi implements RemotePatrolAgBoxService {
+
+    @Autowired
+    private patrolAgbox agBox;
+
     @Override
     public JSONObject getEventCode() {
-        return patrolAgbox.getEventCode();
+        return agBox.getEventCode();
     }
 
     @Override
     public JSONObject getDeviceList() {
-        return patrolAgbox.getDeviceList();
+        return agBox.getDeviceList();
     }
 
     @Override
     public JSONObject updateHeart(@RequestBody String requestBody){
-        return patrolAgbox.updateHeart(requestBody);
+        return agBox.updateHeart(requestBody);
     }
 
     @Override
     public JSONObject addEvent(@RequestBody String requestBody){
-        return patrolAgbox.addEvent(requestBody);
+        return agBox.addEvent(requestBody);
     }
 
     @Override
     public JSONObject getEvent(@RequestBody String requestBody){
-        return patrolAgbox.getEvent(requestBody);
+        return agBox.getEvent(requestBody);
     }
 }

+ 10 - 5
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/controller/web/patrolAgboxController.java

@@ -4,6 +4,7 @@ package com.usky.agbox.controller.web;
 import com.alibaba.fastjson.JSONObject;
 import com.usky.agbox.service.job.patrolAgbox;
 import com.usky.common.core.bean.ApiResult;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -16,13 +17,17 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping("/patrolAgbox")
 public class patrolAgboxController {
+
+    @Autowired
+    private patrolAgbox agBox;
+
     /**
      * 获取事件编码信息
      * @return
      */
     @PostMapping("/getEventCode")
     public ApiResult<JSONObject> getEventCode(){
-        return ApiResult.success(patrolAgbox.getEventCode());
+        return ApiResult.success(agBox.getEventCode());
     }
 
     /**
@@ -31,7 +36,7 @@ public class patrolAgboxController {
      */
     @PostMapping("/getDeviceList")
     public ApiResult<JSONObject> getDeviceList(){
-        return ApiResult.success(patrolAgbox.getDeviceList());
+        return ApiResult.success(agBox.getDeviceList());
     }
 
     /**
@@ -40,7 +45,7 @@ public class patrolAgboxController {
      */
     @PostMapping("/addEvent")
     public ApiResult<JSONObject> addEvent(@RequestBody String requestBody){
-        return ApiResult.success(patrolAgbox.addEvent(requestBody));
+        return ApiResult.success(agBox.addEvent(requestBody));
     }
 
     /**
@@ -49,7 +54,7 @@ public class patrolAgboxController {
      */
     @PostMapping("/updateHeart")
     public ApiResult<JSONObject> updateHeart(@RequestBody String requestBody){
-        return ApiResult.success(patrolAgbox.updateHeart(requestBody));
+        return ApiResult.success(agBox.updateHeart(requestBody));
     }
 
     /**
@@ -58,6 +63,6 @@ public class patrolAgboxController {
      */
     @PostMapping("/getEvent")
     public ApiResult<JSONObject> getEvent(@RequestBody String requestBody){
-        return ApiResult.success(patrolAgbox.getEvent(requestBody));
+        return ApiResult.success(agBox.getEvent(requestBody));
     }
 }

+ 12 - 8
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/job/patrolAgbox.java

@@ -2,19 +2,23 @@ package com.usky.agbox.service.job;
 
 import com.alibaba.fastjson.JSONObject;
 import com.usky.agbox.service.util.HttpClientUtils;
-
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
 import java.util.HashMap;
 
+@Component
 public class patrolAgbox {
 
-    private static String KEY = "44c2710b-f7ff-4487-a556-bfae08232a09";
-    private static String URL = "http://172.16.120.245/agbox/device/patrol";
+    @Value("${agBox.key}")
+    private String KEY;
+    @Value("${agBox.url}")
+    private String URL;
 
     /**
      * 获取事件编码信息
      * @return
      */
-    public static JSONObject getEventCode() {
+    public JSONObject getEventCode() {
         HashMap map = new HashMap();
         map.put("key", KEY);
         map.put("json", "{\"jsonrpc\":\"2.0\",\"method\":\"getPatrolEventCode\"}");
@@ -27,7 +31,7 @@ public class patrolAgbox {
      * 获取设备列表信息
      * @return
      */
-    public static JSONObject getDeviceList() {
+    public JSONObject getDeviceList() {
         HashMap map = new HashMap();
         map.put("key", KEY);
         map.put("json", "{\"jsonrpc\":\"2.0\",\"method\":\"getDeviceList\"}");
@@ -40,7 +44,7 @@ public class patrolAgbox {
      * 添加事件信息
      * @return
      */
-    public static JSONObject addEvent(String requestBody) {
+    public JSONObject addEvent(String requestBody) {
         JSONObject eventVO = JSONObject.parseObject(requestBody);
         HashMap map = new HashMap();
         map.put("key", KEY);
@@ -56,7 +60,7 @@ public class patrolAgbox {
      * 更新心跳信息
      * @return
      */
-    public static JSONObject updateHeart(String requestBody) {
+    public JSONObject updateHeart(String requestBody) {
         JSONObject eventVO = JSONObject.parseObject(requestBody);
         HashMap map = new HashMap();
         map.put("key", KEY);
@@ -71,7 +75,7 @@ public class patrolAgbox {
      * 获取事件信息
      * @return
      */
-    public static JSONObject getEvent(String requestBody) {
+    public JSONObject getEvent(String requestBody) {
         JSONObject eventVO = JSONObject.parseObject(requestBody);
         HashMap map = new HashMap();
         map.put("key", KEY);

+ 5 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAttendanceServiceImpl.java

@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
 import com.usky.system.RemoteDeptService;
 
 import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -132,7 +133,10 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         patrolInspectionPersonnelService.updateSignStatus(patrolInspectionAttendance.getSignInType());
         JSONObject jsonObj = new JSONObject();
         jsonObj.put("deviceId", patrolInspectionAttendance.getDeviceCode());
-        jsonObj.put("triggerTime", LocalDateTime.now());
+        LocalDateTime now = LocalDateTime.now();
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        String formattedTime = now.format(formatter);
+        jsonObj.put("triggerTime", formattedTime);
         Integer eventCode = 17;
         if(patrolInspectionAttendance.getSignInType().equals(0)){
             eventCode=1;

+ 1 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/service/impl/BaseAppInfoServiceImpl.java

@@ -57,7 +57,6 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
     public void add(BaseAppInfo baseAppInfo){
         JSONObject jsonObj = new JSONObject();
         jsonObj.put("deviceId", baseAppInfo.getDeviceId());
-        JSONObject a = remotePatrolAgboxService.updateHeart(jsonObj.toJSONString());
 //        baseAppInfo.setNetworkService(a.toJSONString());
         HttpServletRequest request = getHttpServletRequest();
         String accessIp = getIpAddress(request);
@@ -66,5 +65,6 @@ public class BaseAppInfoServiceImpl extends AbstractCrudService<BaseAppInfoMappe
         baseAppInfo.setCreateTime(LocalDateTime.now());
         baseAppInfo.setTenantId(SecurityUtils.getTenantId());
         this.save(baseAppInfo);
+        JSONObject a = remotePatrolAgboxService.updateHeart(jsonObj.toJSONString());
     }
 }

+ 1 - 1
service-website/service-website-biz/src/main/java/com/usky/website/service/impl/SiteCategoryServiceImpl.java

@@ -38,7 +38,7 @@ public class SiteCategoryServiceImpl extends AbstractCrudService<SiteCategoryMap
         LambdaQueryWrapper<SiteCategory> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(SiteCategory::getStatus, 1)
                 .like(StringUtils.isNotBlank(categoryName),SiteCategory::getCategoryName,categoryName)
-                .orderByAsc(SiteCategory::getSortindex);
+                .orderByDesc(SiteCategory::getCreatedate);
         List<SiteCategory> list = this.list(queryWrapper);
         //取得所有parentId为0的数据,也就是一级目录
         //用于封装数据,取得他的孩子(也就是下级目录)的数据