From ba98786e94ed5f440931d1af167129980a592395 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 08:51:23 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E4=B8=80=E5=85=AC=E5=8F=B8=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=BA=BA=E5=91=98=E5=AE=9A=E4=BD=8D=E7=B3=BB=E7=BB=9F?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcloud/controller/dw/DwController.java | 54 +++++++++++++++++++ .../java/com/zcloud/service/dw/DwService.java | 12 +++++ .../com/zcloud/service/dw/dto/AlarmGet.java | 13 +++++ .../zcloud/service/dw/dto/AlarmManageDto.java | 12 +++++ .../com/zcloud/service/dw/dto/MapGet.java | 15 ++++++ .../com/zcloud/service/dw/dto/MapInfo.java | 14 +++++ .../zcloud/service/dw/dto/MapRequired.java | 39 ++++++++++++++ .../java/com/zcloud/service/dw/dto/Page.java | 10 ++++ .../com/zcloud/service/dw/dto/TraceGet.java | 10 ++++ .../zcloud/service/dw/impl/DwServiceImpl.java | 40 ++++++++++++++ src/main/java/com/zcloud/util/HttpUtil.java | 44 +++++++++++++++ 11 files changed, 263 insertions(+) create mode 100644 src/main/java/com/zcloud/controller/dw/DwController.java create mode 100644 src/main/java/com/zcloud/service/dw/DwService.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/AlarmGet.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/AlarmManageDto.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/MapGet.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/MapInfo.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/MapRequired.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/Page.java create mode 100644 src/main/java/com/zcloud/service/dw/dto/TraceGet.java create mode 100644 src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java create mode 100644 src/main/java/com/zcloud/util/HttpUtil.java diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java new file mode 100644 index 00000000..d8f4e3e2 --- /dev/null +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -0,0 +1,54 @@ +package com.zcloud.controller.dw; + +import com.alibaba.fastjson.JSONObject; +import com.zcloud.controller.base.BaseController; +import com.zcloud.entity.PageData; +import com.zcloud.service.dw.DwService; +import com.zcloud.service.dw.dto.*; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + +import javax.annotation.Resource; + +@Controller +@RequestMapping(value = "/dw") +public class DwController extends BaseController { + + @Resource + private DwService dwService; + + @RequestMapping(value = "getTrace") + public Object getTrace() throws Exception { + PageData pd = this.getPageData(); + TraceGet traceGet = JSONObject.parseObject(JSONObject.toJSONString(pd), TraceGet.class); + return dwService.getTrace(traceGet); + } + + @RequestMapping(value = "getMapList") + public Object getMapList() throws Exception { + PageData pd = this.getPageData(); + MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); + return dwService.getMapList(mapGet); + } + + @RequestMapping(value = "saveOrUpdateMap") + public Object saveOrUpdateMap() throws Exception { + PageData pd = this.getPageData(); + MapInfo mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapInfo.class); + return dwService.saveOrUpdateMap(mapGet); + } + + @RequestMapping(value = "getAlarmList") + public Object getAlarmList() throws Exception { + PageData pd = this.getPageData(); + AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); + return dwService.getAlarmList(mapGet); + } + + @RequestMapping(value = "manageAlarm") + public Object manageAlarm() throws Exception { + PageData pd = this.getPageData(); + AlarmManageDto mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmManageDto.class); + return dwService.manageAlarm(mapGet); + } +} diff --git a/src/main/java/com/zcloud/service/dw/DwService.java b/src/main/java/com/zcloud/service/dw/DwService.java new file mode 100644 index 00000000..74567380 --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/DwService.java @@ -0,0 +1,12 @@ +package com.zcloud.service.dw; + +import com.zcloud.service.dw.dto.*; + +public interface DwService { + + Object getMapList(MapGet param) throws Exception; + Object saveOrUpdateMap(MapInfo param) throws Exception; + Object getTrace(TraceGet param) throws Exception; + Object getAlarmList(AlarmGet param) throws Exception; + Object manageAlarm(AlarmManageDto param) throws Exception; +} diff --git a/src/main/java/com/zcloud/service/dw/dto/AlarmGet.java b/src/main/java/com/zcloud/service/dw/dto/AlarmGet.java new file mode 100644 index 00000000..a79155f2 --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/AlarmGet.java @@ -0,0 +1,13 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class AlarmGet { + + private String startTime; + private String endTime; + private String status; + private Page page; + +} diff --git a/src/main/java/com/zcloud/service/dw/dto/AlarmManageDto.java b/src/main/java/com/zcloud/service/dw/dto/AlarmManageDto.java new file mode 100644 index 00000000..bb2a718d --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/AlarmManageDto.java @@ -0,0 +1,12 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class AlarmManageDto { + private String status; + private String alarmId; + private String opinion; + private String operator; + private String operatorName; +} diff --git a/src/main/java/com/zcloud/service/dw/dto/MapGet.java b/src/main/java/com/zcloud/service/dw/dto/MapGet.java new file mode 100644 index 00000000..39c08c48 --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/MapGet.java @@ -0,0 +1,15 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class MapGet { + private String departmentId; + private String userId; + private String userCardId; + private String userPhone; + private String deviceId; + private String deviceName; + private String type; + private Page page; +} diff --git a/src/main/java/com/zcloud/service/dw/dto/MapInfo.java b/src/main/java/com/zcloud/service/dw/dto/MapInfo.java new file mode 100644 index 00000000..0697540a --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/MapInfo.java @@ -0,0 +1,14 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class MapInfo { + + private MapRequired required; + //其他系统备注 + private String idRemark; + //备注 + private String remark; + private String dwUserMapId; +} diff --git a/src/main/java/com/zcloud/service/dw/dto/MapRequired.java b/src/main/java/com/zcloud/service/dw/dto/MapRequired.java new file mode 100644 index 00000000..1f141dca --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/MapRequired.java @@ -0,0 +1,39 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class MapRequired { + //映射类型(0-人员,1-设备) + private String type; + //人员id + private String userId; + //人员姓名 + private String userName; + //身份证号 + private String userCardId; + //手机号 + private String userPhone; + //设备id + private String deviceId; + //设备名称 + private String deviceName; + //部门id + private String departmentId; + //部门名称 + private String departmentName; + //企业id名称 + private String corpId; + //企业名称 + private String corpName; + //其他系统id + private String id; + //数据创建人id + private String creatorId; + //数据创建人名称 + private String creatorName; + //数据更新时间 + private String operatorId; + //数据更新人id + private String operatorName; +} diff --git a/src/main/java/com/zcloud/service/dw/dto/Page.java b/src/main/java/com/zcloud/service/dw/dto/Page.java new file mode 100644 index 00000000..f10fcc0b --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/Page.java @@ -0,0 +1,10 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class Page { + private String page; + private String size; + private String current; +} diff --git a/src/main/java/com/zcloud/service/dw/dto/TraceGet.java b/src/main/java/com/zcloud/service/dw/dto/TraceGet.java new file mode 100644 index 00000000..e3215fb3 --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/TraceGet.java @@ -0,0 +1,10 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +@Data +public class TraceGet { + private String user_id; + private String startTime; + private String endTime; +} diff --git a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java new file mode 100644 index 00000000..d774d53d --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java @@ -0,0 +1,40 @@ +package com.zcloud.service.dw.impl; + +import com.zcloud.service.dw.DwService; +import com.zcloud.service.dw.dto.*; +import com.zcloud.util.HttpUtil; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +@Service +public class DwServiceImpl implements DwService { + + @Value("dw.url") + private String url; + + + @Override + public Object getMapList(MapGet param) throws Exception { + return HttpUtil.post(url + "dw/getMapList", param); + } + + @Override + public Object saveOrUpdateMap(MapInfo param) throws Exception { + return HttpUtil.post(url + "dw/saveOrUpdateMap", param); + } + + @Override + public Object getTrace(TraceGet param) throws Exception { + return HttpUtil.post(url + "dw/getTrace", param); + } + + @Override + public Object getAlarmList(AlarmGet param) throws Exception { + return HttpUtil.post(url + "dw/getAlarmList", param); + } + + @Override + public Object manageAlarm(AlarmManageDto param) throws Exception { + return HttpUtil.post(url + "dw/manageAlarm", param); + } +} diff --git a/src/main/java/com/zcloud/util/HttpUtil.java b/src/main/java/com/zcloud/util/HttpUtil.java new file mode 100644 index 00000000..96527907 --- /dev/null +++ b/src/main/java/com/zcloud/util/HttpUtil.java @@ -0,0 +1,44 @@ +package com.zcloud.util; + +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; +import org.apache.poi.ss.formula.functions.T; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.client.RestTemplate; + +import java.util.HashMap; +import java.util.Map; + +public class HttpUtil { + + private static final Logger LOGGER = LoggerFactory.getLogger(HttpUtil.class); + /** + * 返回成功状态码 + */ + private static final int SUCCESS_CODE = 200; + + public HashMap doPost(String url, HashMap info) { + RestTemplate restTemplate = new RestTemplate(); + String result = restTemplate.postForEntity(url, info, String.class).getBody(); + return JSONObject.parseObject(result, new TypeReference>() {}); + } + + public HashMap doPost(String url, Object info) { + RestTemplate restTemplate = new RestTemplate(); + String result = restTemplate.postForEntity(url, info, String.class).getBody(); + return JSONObject.parseObject(result, new TypeReference>() {}); + } + + public T doPost(String url, Object info, Class tClass) { + RestTemplate restTemplate = new RestTemplate(); + String result = restTemplate.postForEntity(url, info, String.class).getBody(); + return JSONObject.parseObject(result, tClass); + } + + public static Object post(String url, Object info) { + RestTemplate restTemplate = new RestTemplate(); + String result = restTemplate.postForEntity(url, info, String.class).getBody(); + return JSONObject.parseObject(result, Map.class); + } +} From 7136bb9a3708d5b526c40cc1616002890305854a Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 10:27:30 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=AE=9A=E4=BD=8D?= =?UTF-8?q?=E6=96=B0=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/controller/dw/DwController.java | 5 +++++ src/main/java/com/zcloud/service/dw/DwService.java | 1 + src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index d8f4e3e2..e0fe2f7d 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -51,4 +51,9 @@ public class DwController extends BaseController { AlarmManageDto mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmManageDto.class); return dwService.manageAlarm(mapGet); } + + @RequestMapping(value = "getDictionary") + public Object getDictionary() throws Exception { + return dwService.getDictionary(); + } } diff --git a/src/main/java/com/zcloud/service/dw/DwService.java b/src/main/java/com/zcloud/service/dw/DwService.java index 74567380..51a85d42 100644 --- a/src/main/java/com/zcloud/service/dw/DwService.java +++ b/src/main/java/com/zcloud/service/dw/DwService.java @@ -9,4 +9,5 @@ public interface DwService { Object getTrace(TraceGet param) throws Exception; Object getAlarmList(AlarmGet param) throws Exception; Object manageAlarm(AlarmManageDto param) throws Exception; + Object getDictionary() throws Exception; } diff --git a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java index d774d53d..9c10106a 100644 --- a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java +++ b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java @@ -37,4 +37,9 @@ public class DwServiceImpl implements DwService { public Object manageAlarm(AlarmManageDto param) throws Exception { return HttpUtil.post(url + "dw/manageAlarm", param); } + + @Override + public Object getDictionary() throws Exception { + return HttpUtil.post(url + "dw/getDictionary", ""); + } } From 92dabf2a7c428b435467921d26c32026495eb8b0 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 10:59:30 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zcloud/controller/dw/DwController.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index e0fe2f7d..a8428c27 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -25,9 +25,12 @@ public class DwController extends BaseController { } @RequestMapping(value = "getMapList") - public Object getMapList() throws Exception { + public Object getMapList(Page page) throws Exception { PageData pd = this.getPageData(); MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); + mapGet.getPage().setPage(page.getPage()); + mapGet.getPage().setCurrent(page.getCurrent()); + mapGet.getPage().setSize(page.getSize()); return dwService.getMapList(mapGet); } @@ -39,9 +42,12 @@ public class DwController extends BaseController { } @RequestMapping(value = "getAlarmList") - public Object getAlarmList() throws Exception { + public Object getAlarmList(Page page) throws Exception { PageData pd = this.getPageData(); AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); + mapGet.getPage().setPage(page.getPage()); + mapGet.getPage().setCurrent(page.getCurrent()); + mapGet.getPage().setSize(page.getSize()); return dwService.getAlarmList(mapGet); } From b1dd0eb5533f37fe5b8e3d8f883e81b57d782686 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 11:03:47 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java index 9c10106a..3f8589ae 100644 --- a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java +++ b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java @@ -9,7 +9,7 @@ import org.springframework.stereotype.Service; @Service public class DwServiceImpl implements DwService { - @Value("dw.url") + @Value("${dw.url}") private String url; @@ -40,6 +40,7 @@ public class DwServiceImpl implements DwService { @Override public Object getDictionary() throws Exception { + System.out.println(url + "dw/getDictionary"); return HttpUtil.post(url + "dw/getDictionary", ""); } } From c7abd55db79517ccb91c421b7a153781c8f1c2cc Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 12:33:30 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../zcloud/controller/dw/DwController.java | 24 ++++++++++++------- src/main/java/com/zcloud/util/HttpUtil.java | 6 +++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/pom.xml b/pom.xml index 31ef9d76..235ecb1e 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ javax.servlet javax.servlet-api - 3.1.0 + 4.0.1 provided diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index a8428c27..b520591d 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -3,15 +3,16 @@ package com.zcloud.controller.dw; import com.alibaba.fastjson.JSONObject; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.PageData; +import com.zcloud.entity.Page; import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.dto.*; -import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; -@Controller -@RequestMapping(value = "/dw") +@RestController +@RequestMapping(value = "/dingWei") public class DwController extends BaseController { @Resource @@ -28,9 +29,11 @@ public class DwController extends BaseController { public Object getMapList(Page page) throws Exception { PageData pd = this.getPageData(); MapGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapGet.class); - mapGet.getPage().setPage(page.getPage()); - mapGet.getPage().setCurrent(page.getCurrent()); - mapGet.getPage().setSize(page.getSize()); + if (mapGet.getPage() == null){ + mapGet.setPage(new com.zcloud.service.dw.dto.Page()); + } + mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); + mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getMapList(mapGet); } @@ -45,9 +48,11 @@ public class DwController extends BaseController { public Object getAlarmList(Page page) throws Exception { PageData pd = this.getPageData(); AlarmGet mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmGet.class); - mapGet.getPage().setPage(page.getPage()); - mapGet.getPage().setCurrent(page.getCurrent()); - mapGet.getPage().setSize(page.getSize()); + if (mapGet.getPage() == null){ + mapGet.setPage(new com.zcloud.service.dw.dto.Page()); + } + mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); + mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getAlarmList(mapGet); } @@ -62,4 +67,5 @@ public class DwController extends BaseController { public Object getDictionary() throws Exception { return dwService.getDictionary(); } + } diff --git a/src/main/java/com/zcloud/util/HttpUtil.java b/src/main/java/com/zcloud/util/HttpUtil.java index 96527907..2cac2b63 100644 --- a/src/main/java/com/zcloud/util/HttpUtil.java +++ b/src/main/java/com/zcloud/util/HttpUtil.java @@ -41,4 +41,10 @@ public class HttpUtil { String result = restTemplate.postForEntity(url, info, String.class).getBody(); return JSONObject.parseObject(result, Map.class); } + + public static Object post(String url) { + RestTemplate restTemplate = new RestTemplate(); + String result = restTemplate.getForObject(url, String.class); + return JSONObject.parseObject(result, Map.class); + } } From 9eecfecf44daa5df81c80866b83edbfc5792a3f7 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 14:44:17 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E6=9C=AA=E5=88=86=E9=A1=B5bug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zcloud/controller/dw/DwController.java | 2 +- .../zcloud/service/dw/impl/DwServiceImpl.java | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index b520591d..9dfb6123 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -40,7 +40,7 @@ public class DwController extends BaseController { @RequestMapping(value = "saveOrUpdateMap") public Object saveOrUpdateMap() throws Exception { PageData pd = this.getPageData(); - MapInfo mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), MapInfo.class); + MapInfo mapGet = JSONObject.parseObject(pd.getString("data"), MapInfo.class); return dwService.saveOrUpdateMap(mapGet); } diff --git a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java index 3f8589ae..287f843d 100644 --- a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java +++ b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java @@ -1,17 +1,25 @@ package com.zcloud.service.dw.impl; +import com.zcloud.entity.PageData; +import com.zcloud.service.bus.CorpInfoService; import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.dto.*; import com.zcloud.util.HttpUtil; +import com.zcloud.util.Jurisdiction; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import javax.annotation.Resource; + @Service public class DwServiceImpl implements DwService { @Value("${dw.url}") private String url; + @Resource + private CorpInfoService corpInfoService; + @Override public Object getMapList(MapGet param) throws Exception { @@ -20,6 +28,14 @@ public class DwServiceImpl implements DwService { @Override public Object saveOrUpdateMap(MapInfo param) throws Exception { + param.getRequired().setCreatorId(Jurisdiction.getUSER_ID()); + param.getRequired().setCreatorName(Jurisdiction.getName()); + param.getRequired().setOperatorId(Jurisdiction.getUSER_ID()); + param.getRequired().setOperatorName(Jurisdiction.getName()); + param.getRequired().setCorpId(Jurisdiction.getCORPINFO_ID()); + PageData condition = new PageData(); + condition.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); + param.getRequired().setCorpName(corpInfoService.findById(condition).getString("CORP_NAME")); return HttpUtil.post(url + "dw/saveOrUpdateMap", param); } From 057ac23f9f7961bd31721706548e670988c4ac53 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 15:16:59 +0800 Subject: [PATCH 07/13] =?UTF-8?q?=E6=98=A0=E5=B0=84=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/service/dw/dto/MapRequired.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/zcloud/service/dw/dto/MapRequired.java b/src/main/java/com/zcloud/service/dw/dto/MapRequired.java index 1f141dca..cb8332af 100644 --- a/src/main/java/com/zcloud/service/dw/dto/MapRequired.java +++ b/src/main/java/com/zcloud/service/dw/dto/MapRequired.java @@ -6,6 +6,8 @@ import lombok.Data; public class MapRequired { //映射类型(0-人员,1-设备) private String type; + // 设备名称 + private String typeName; //人员id private String userId; //人员姓名 From a24889aabfe386e52e8dbb33259d94e2de2b6858 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 16:12:38 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E6=98=A0=E5=B0=84=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zcloud/controller/dw/DwController.java | 11 +++++++++++ src/main/java/com/zcloud/service/dw/DwService.java | 2 ++ .../java/com/zcloud/service/dw/dto/DeleteDto.java | 14 ++++++++++++++ .../com/zcloud/service/dw/impl/DwServiceImpl.java | 6 +++++- 4 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/zcloud/service/dw/dto/DeleteDto.java diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index 9dfb6123..30ba3527 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -6,6 +6,7 @@ import com.zcloud.entity.PageData; import com.zcloud.entity.Page; import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.dto.*; +import com.zcloud.util.Jurisdiction; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -44,6 +45,16 @@ public class DwController extends BaseController { return dwService.saveOrUpdateMap(mapGet); } + @RequestMapping(value = "deleteMap") + public Object deleteMap() throws Exception { + PageData pd = this.getPageData(); + DeleteDto deleteDto = new DeleteDto(); + deleteDto.setId(pd.getString("id")); + deleteDto.setOperatorId(Jurisdiction.getUSER_ID()); + deleteDto.setOperatorName(Jurisdiction.getName()); + return dwService.deleteMap(deleteDto); + } + @RequestMapping(value = "getAlarmList") public Object getAlarmList(Page page) throws Exception { PageData pd = this.getPageData(); diff --git a/src/main/java/com/zcloud/service/dw/DwService.java b/src/main/java/com/zcloud/service/dw/DwService.java index 51a85d42..fde31036 100644 --- a/src/main/java/com/zcloud/service/dw/DwService.java +++ b/src/main/java/com/zcloud/service/dw/DwService.java @@ -10,4 +10,6 @@ public interface DwService { Object getAlarmList(AlarmGet param) throws Exception; Object manageAlarm(AlarmManageDto param) throws Exception; Object getDictionary() throws Exception; + + Object deleteMap(DeleteDto deleteDto); } diff --git a/src/main/java/com/zcloud/service/dw/dto/DeleteDto.java b/src/main/java/com/zcloud/service/dw/dto/DeleteDto.java new file mode 100644 index 00000000..97badd5f --- /dev/null +++ b/src/main/java/com/zcloud/service/dw/dto/DeleteDto.java @@ -0,0 +1,14 @@ +package com.zcloud.service.dw.dto; + +import lombok.Data; + +import java.util.List; + +@Data +public class DeleteDto { + + private String id; + private List ids; + private String operatorId; + private String operatorName; +} diff --git a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java index 287f843d..3b1ba7a3 100644 --- a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java +++ b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java @@ -56,7 +56,11 @@ public class DwServiceImpl implements DwService { @Override public Object getDictionary() throws Exception { - System.out.println(url + "dw/getDictionary"); return HttpUtil.post(url + "dw/getDictionary", ""); } + + @Override + public Object deleteMap(DeleteDto deleteDto) { + return HttpUtil.post(url + "dw/deleteMap", deleteDto); + } } From f7b28773d6fd2690b1e195c7fee1f64f39cdbf4b Mon Sep 17 00:00:00 2001 From: limingyu Date: Sat, 13 Apr 2024 16:15:29 +0800 Subject: [PATCH 09/13] =?UTF-8?q?1=E3=80=81=E6=8A=A5=E8=AD=A6=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E9=A1=B5=E9=9D=A2=E6=98=BE=E7=A4=BA=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=95=B0=E6=8D=AEbug=E4=BF=AE=E5=A4=8D=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E5=BF=BD=E7=95=A5=E5=92=8C=E7=A1=AE=E8=AE=A4=E6=97=B6=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/controller/dw/DwController.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index 9dfb6123..4327780d 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -51,7 +51,7 @@ public class DwController extends BaseController { if (mapGet.getPage() == null){ mapGet.setPage(new com.zcloud.service.dw.dto.Page()); } - mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); + mapGet.getPage().setCurrent(String.valueOf(page.getUrlCurrentPage())); mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getAlarmList(mapGet); } @@ -60,6 +60,7 @@ public class DwController extends BaseController { public Object manageAlarm() throws Exception { PageData pd = this.getPageData(); AlarmManageDto mapGet = JSONObject.parseObject(JSONObject.toJSONString(pd), AlarmManageDto.class); + mapGet.setAlarmId(pd.getString("DW_ALARM_ID")); return dwService.manageAlarm(mapGet); } From e84b612073edacf9e475cd3af4184525b8d66217 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 16:53:00 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=AE=8C=E5=96=84=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/service/dw/dto/MapGet.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/zcloud/service/dw/dto/MapGet.java b/src/main/java/com/zcloud/service/dw/dto/MapGet.java index 39c08c48..e0a8cae1 100644 --- a/src/main/java/com/zcloud/service/dw/dto/MapGet.java +++ b/src/main/java/com/zcloud/service/dw/dto/MapGet.java @@ -6,6 +6,7 @@ import lombok.Data; public class MapGet { private String departmentId; private String userId; + private String userName; private String userCardId; private String userPhone; private String deviceId; From ff4be346ffad81fc346719bec0656c5e235b2ba1 Mon Sep 17 00:00:00 2001 From: liujun Date: Sat, 13 Apr 2024 17:11:13 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E6=9F=A5=E8=AF=A2bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/zcloud/controller/dw/DwController.java | 1 + src/main/java/com/zcloud/service/dw/dto/MapGet.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/zcloud/controller/dw/DwController.java b/src/main/java/com/zcloud/controller/dw/DwController.java index 44fcde9f..d722fb43 100644 --- a/src/main/java/com/zcloud/controller/dw/DwController.java +++ b/src/main/java/com/zcloud/controller/dw/DwController.java @@ -33,6 +33,7 @@ public class DwController extends BaseController { if (mapGet.getPage() == null){ mapGet.setPage(new com.zcloud.service.dw.dto.Page()); } + mapGet.setCorpId(Jurisdiction.getCORPINFO_ID()); mapGet.getPage().setCurrent(String.valueOf(page.getCurrentPage())); mapGet.getPage().setSize(String.valueOf(page.getShowCount())); return dwService.getMapList(mapGet); diff --git a/src/main/java/com/zcloud/service/dw/dto/MapGet.java b/src/main/java/com/zcloud/service/dw/dto/MapGet.java index e0a8cae1..af7c1213 100644 --- a/src/main/java/com/zcloud/service/dw/dto/MapGet.java +++ b/src/main/java/com/zcloud/service/dw/dto/MapGet.java @@ -8,6 +8,7 @@ public class MapGet { private String userId; private String userName; private String userCardId; + private String corpId; private String userPhone; private String deviceId; private String deviceName; From 1da764000c6ba32ccd361fdad2a92e60897557aa Mon Sep 17 00:00:00 2001 From: liujun Date: Tue, 16 Apr 2024 17:22:44 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E4=B8=80=E5=85=AC=E5=8F=B8=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=AE=9A=E4=BD=8D=E5=9C=B0=E5=9B=BE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcloud/controller/map/MapController.java | 41 +++++++++++++++++-- .../java/com/zcloud/service/dw/DwService.java | 1 + .../com/zcloud/service/dw/dto/MapGet.java | 3 +- .../zcloud/service/dw/dto/MapRequired.java | 1 - .../com/zcloud/service/dw/dto/TraceGet.java | 1 + .../zcloud/service/dw/impl/DwServiceImpl.java | 4 ++ 6 files changed, 45 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/zcloud/controller/map/MapController.java b/src/main/java/com/zcloud/controller/map/MapController.java index 24459ab8..c6369ffd 100644 --- a/src/main/java/com/zcloud/controller/map/MapController.java +++ b/src/main/java/com/zcloud/controller/map/MapController.java @@ -4,6 +4,9 @@ import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.bus.CorpInfoService; +import com.zcloud.service.dw.DwService; +import com.zcloud.service.dw.dto.MapGet; +import com.zcloud.service.dw.dto.TraceGet; import com.zcloud.service.keyProjects.VideoManagerService; import com.zcloud.service.map.*; import com.zcloud.service.map.util.ReturnMap; @@ -24,6 +27,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.client.RestTemplate; +import javax.annotation.Resource; import java.util.*; /** @@ -73,6 +77,8 @@ public class MapController extends BaseController { @Autowired private WeatherUtil weatherUtil; + @Resource + private DwService dwService; @ResponseBody @RequestMapping("/getCorpInfo") @@ -864,12 +870,39 @@ public class MapController extends BaseController { public Object getPersonByCardNo() throws Exception { Map map = new HashMap(); PageData pd = this.getPageData(); - PageData value = usersService.getPersonByCardNo(pd); - map.put("result", "success"); - map.put("pd", value); - return map; + // TODO 判断是否是公司人员定位 + if (true){ + MapGet mapInfo = new MapGet(); + mapInfo.setId(pd.getString("CARDNO")); + return dwService.getMapInfo(mapInfo); + }else { + PageData value = usersService.getPersonByCardNo(pd); + map.put("result", "success"); + map.put("pd", value); + return map; + } } + @RequestMapping(value = "/getPersonTrace") + @ResponseBody + public Object getPersonTrace() throws Exception { + Map map = new HashMap(); + PageData pd = this.getPageData(); + // TODO 判断是否是公司人员定位 + if (true){ + TraceGet mapInfo = new TraceGet(); + mapInfo.setId(pd.getString("id")); + return dwService.getTrace(mapInfo); + }else { + PageData value = usersService.getPersonByCardNo(pd); + map.put("result", "success"); + map.put("pd", value); + return map; + } + } + + + /** * 获取摄像头播放路径(曹妃甸使用) * diff --git a/src/main/java/com/zcloud/service/dw/DwService.java b/src/main/java/com/zcloud/service/dw/DwService.java index fde31036..ca17590f 100644 --- a/src/main/java/com/zcloud/service/dw/DwService.java +++ b/src/main/java/com/zcloud/service/dw/DwService.java @@ -4,6 +4,7 @@ import com.zcloud.service.dw.dto.*; public interface DwService { + Object getMapInfo(MapGet param) throws Exception; Object getMapList(MapGet param) throws Exception; Object saveOrUpdateMap(MapInfo param) throws Exception; Object getTrace(TraceGet param) throws Exception; diff --git a/src/main/java/com/zcloud/service/dw/dto/MapGet.java b/src/main/java/com/zcloud/service/dw/dto/MapGet.java index af7c1213..3a5293fe 100644 --- a/src/main/java/com/zcloud/service/dw/dto/MapGet.java +++ b/src/main/java/com/zcloud/service/dw/dto/MapGet.java @@ -7,11 +7,12 @@ public class MapGet { private String departmentId; private String userId; private String userName; - private String userCardId; private String corpId; + private String userCardId; private String userPhone; private String deviceId; private String deviceName; private String type; + private String id; private Page page; } diff --git a/src/main/java/com/zcloud/service/dw/dto/MapRequired.java b/src/main/java/com/zcloud/service/dw/dto/MapRequired.java index cb8332af..7a9ed604 100644 --- a/src/main/java/com/zcloud/service/dw/dto/MapRequired.java +++ b/src/main/java/com/zcloud/service/dw/dto/MapRequired.java @@ -6,7 +6,6 @@ import lombok.Data; public class MapRequired { //映射类型(0-人员,1-设备) private String type; - // 设备名称 private String typeName; //人员id private String userId; diff --git a/src/main/java/com/zcloud/service/dw/dto/TraceGet.java b/src/main/java/com/zcloud/service/dw/dto/TraceGet.java index e3215fb3..acf50478 100644 --- a/src/main/java/com/zcloud/service/dw/dto/TraceGet.java +++ b/src/main/java/com/zcloud/service/dw/dto/TraceGet.java @@ -5,6 +5,7 @@ import lombok.Data; @Data public class TraceGet { private String user_id; + private String id; private String startTime; private String endTime; } diff --git a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java index 3b1ba7a3..edf9433c 100644 --- a/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java +++ b/src/main/java/com/zcloud/service/dw/impl/DwServiceImpl.java @@ -20,6 +20,10 @@ public class DwServiceImpl implements DwService { @Resource private CorpInfoService corpInfoService; + @Override + public Object getMapInfo(MapGet param) throws Exception { + return HttpUtil.post(url + "dw/getMapInfo", param); + } @Override public Object getMapList(MapGet param) throws Exception { From ca299d110d087e1bf5b8ce1476097bbf7784de93 Mon Sep 17 00:00:00 2001 From: liujun Date: Wed, 17 Apr 2024 08:57:44 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E4=B8=80=E5=85=AC=E5=8F=B8=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E5=AE=9A=E4=BD=8D=E5=9C=B0=E5=9B=BE=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=E5=AE=8C=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zcloud/controller/map/MapController.java | 28 +++++++++++++++---- src/main/java/com/zcloud/util/HttpUtil.java | 9 ++++-- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/zcloud/controller/map/MapController.java b/src/main/java/com/zcloud/controller/map/MapController.java index c6369ffd..ed9544f0 100644 --- a/src/main/java/com/zcloud/controller/map/MapController.java +++ b/src/main/java/com/zcloud/controller/map/MapController.java @@ -1,11 +1,14 @@ package com.zcloud.controller.map; +import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.TypeReference; import com.zcloud.controller.base.BaseController; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.service.bus.CorpInfoService; import com.zcloud.service.dw.DwService; import com.zcloud.service.dw.dto.MapGet; +import com.zcloud.service.dw.dto.MapInfo; import com.zcloud.service.dw.dto.TraceGet; import com.zcloud.service.keyProjects.VideoManagerService; import com.zcloud.service.map.*; @@ -871,11 +874,26 @@ public class MapController extends BaseController { Map map = new HashMap(); PageData pd = this.getPageData(); // TODO 判断是否是公司人员定位 - if (true){ - MapGet mapInfo = new MapGet(); - mapInfo.setId(pd.getString("CARDNO")); - return dwService.getMapInfo(mapInfo); - }else { + if (pd.get("corpId") != null && "035958e685cf4850bc40151c5e0617a6".equals(pd.getString("corpId"))) { + MapGet mapGet = new MapGet(); + mapGet.setId(pd.getString("CARDNO")); + Object message = dwService.getMapInfo(mapGet); + map = JSONObject.parseObject(JSONObject.toJSONString(message), new TypeReference>() { + }); + if (map.get("code") == null || 200 != Integer.parseInt(map.get("code").toString())) { + return map; + } else { + MapInfo info = JSONObject.parseObject(JSONObject.toJSONString(map.get("info")), MapInfo.class); + PageData condition = new PageData(); + condition.put("USER_ID", info.getRequired().getUserId()); + PageData userInfo = usersService.findById(condition); + HashMap otherInfo = new HashMap<>(); + otherInfo.put("postName", userInfo.getString("postName")); + otherInfo.put("personnelTypeName", userInfo.getString("personnelTypeName")); + map.put("otherInfo", otherInfo); + return map; + } + } else { PageData value = usersService.getPersonByCardNo(pd); map.put("result", "success"); map.put("pd", value); diff --git a/src/main/java/com/zcloud/util/HttpUtil.java b/src/main/java/com/zcloud/util/HttpUtil.java index 2cac2b63..ba804ad4 100644 --- a/src/main/java/com/zcloud/util/HttpUtil.java +++ b/src/main/java/com/zcloud/util/HttpUtil.java @@ -30,10 +30,15 @@ public class HttpUtil { return JSONObject.parseObject(result, new TypeReference>() {}); } - public T doPost(String url, Object info, Class tClass) { + public T doPost(String url, Object info, Class responseType) { RestTemplate restTemplate = new RestTemplate(); String result = restTemplate.postForEntity(url, info, String.class).getBody(); - return JSONObject.parseObject(result, tClass); + return JSONObject.parseObject(result, responseType); + } + + public static T post(String url, Object info, Class responseType) { + RestTemplate restTemplate = new RestTemplate(); + return restTemplate.postForEntity(url, info, responseType).getBody(); } public static Object post(String url, Object info) {