diff --git a/ruoyi-common/src/main/java/com/zc/common/constant/RedisStreamConstants.java b/ruoyi-common/src/main/java/com/zc/common/constant/RedisStreamConstants.java index 4c88de06..bb7b7946 100644 --- a/ruoyi-common/src/main/java/com/zc/common/constant/RedisStreamConstants.java +++ b/ruoyi-common/src/main/java/com/zc/common/constant/RedisStreamConstants.java @@ -10,7 +10,7 @@ public class RedisStreamConstants { */ public static class WebSocketDirectional { public final static String KEY = "websocket:directional"; - public final static String GROUP = "group1"; + public final static String GROUP = "group2"; public final static String CONSUMER = "consumer1"; } @@ -19,7 +19,7 @@ public class RedisStreamConstants { */ public static class WebSocketStreamBroadcast { public final static String KEY = "websocket:broadcast"; - public final static String GROUP = "group1"; + public final static String GROUP = "group2"; public final static String CONSUMER = "consumer1"; } /** @@ -27,7 +27,7 @@ public class RedisStreamConstants { */ public static class WebSocketStreamEvent { public final static String KEY = "websocket:event"; - public final static String GROUP = "group1"; + public final static String GROUP = "group2"; public final static String CONSUMER = "consumer1"; } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java index 6c635175..488f65ce 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysConfig.java @@ -71,7 +71,7 @@ public class SysConfig extends BaseEntity } @NotBlank(message = "参数键值不能为空") - @Size(min = 0, max = 500, message = "参数键值长度不能超过500个字符") + @Size(min = 0, max = 1000, message = "参数键值长度不能超过1000个字符") public String getConfigValue() { return configValue; diff --git a/zc-business/src/main/java/com/zc/business/constant/RedisKeyConstants.java b/zc-business/src/main/java/com/zc/business/constant/RedisKeyConstants.java index 96985260..573eb12b 100644 --- a/zc-business/src/main/java/com/zc/business/constant/RedisKeyConstants.java +++ b/zc-business/src/main/java/com/zc/business/constant/RedisKeyConstants.java @@ -11,6 +11,11 @@ public class RedisKeyConstants */ public static final String DC_DEVICES = "dc:devices"; + /** + * dc设备 + */ + public static final String DC_DEVICE_ID = "dc:deviceId"; + /** * 路段 */ diff --git a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java index c76957cb..6f25528c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java +++ b/zc-business/src/main/java/com/zc/business/controller/BroadcastController.java @@ -4,12 +4,15 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.system.service.ISysConfigService; import com.zc.common.core.httpclient.OkHttp; import com.zc.common.core.httpclient.exception.HttpException; import com.zc.common.core.httpclient.request.RequestParams; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import okhttp3.Response; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @@ -35,15 +38,17 @@ public class BroadcastController extends BaseController { private static int numberOfReconnections = 1; @Resource private RedisCache redisCache; - private static final String ID = "admin"; - - private static final String SECRET = "21232f297a57a5a743894a0e4a801fc3"; - - private static final String CALLBACKURL = "http://10.0.81.202/broadcast/logIn"; - - private final static String URL = HTTP + "10.0.81.106/api/REST-API/"; - - private final static String TOKENKEY = "tokenRoadTestBroadcastPlatform"; + @Autowired + private ISysConfigService configService; + //private static final String ID = "admin"; + // + //private static final String SECRET = "21232f297a57a5a743894a0e4a801fc3"; + // + //private static final String CALLBACKURL = "http://10.0.111.11/broadcast/logIn"; + // + //private final static String URL = HTTP + "10.0.81.106/api/REST-API/"; + // + //private final static String TOKENKEY = "tokenRoadTestBroadcastPlatform"; /** * 广播平台事件回调函数 @@ -68,10 +73,11 @@ public class BroadcastController extends BaseController { @ApiOperation("广播功能调用") @PostMapping(value = "/broadcastFunctionCall") public JSONObject nearCamListDistance(@RequestBody JSONObject params) throws HttpException, IOException { + JSONObject broadcast = JSONObject.parseObject(configService.selectConfigByKey("broadcast")); JSONObject jsonResult = null; OkHttp okHttp = new OkHttp(1); RequestParams requestParams = new RequestParams(params); - String tokenRoadTestBroadcastPlatform = redisCache.getCacheObject(TOKENKEY); + String tokenRoadTestBroadcastPlatform = redisCache.getCacheObject(broadcast.getString("TOKENKEY")); if (tokenRoadTestBroadcastPlatform == null) { tokenRoadTestBroadcastPlatform = getToken(); } @@ -79,7 +85,7 @@ public class BroadcastController extends BaseController { Response response // 请求响应 = okHttp .headers(new HashMap<>()) - .url(URL + params.getString("functionType") + ".do?accessToken=" + tokenRoadTestBroadcastPlatform) // 请求地址 + .url(broadcast.getString("URL") + params.getString("functionType") + ".do?accessToken=" + tokenRoadTestBroadcastPlatform) // 请求地址 .data(requestParams) // 请求参数 .post(); // 请求方法 if (response.body() != null) { @@ -101,12 +107,13 @@ public class BroadcastController extends BaseController { } public String getToken() throws HttpException, IOException { + JSONObject broadcast = JSONObject.parseObject(configService.selectConfigByKey("broadcast")); OkHttp okHttp = new OkHttp(); RequestParams requestParams = new RequestParams(); - requestParams.put("id", ID); - requestParams.put("secret", SECRET); - requestParams.put("callbackUrl", CALLBACKURL); + requestParams.put("id", broadcast.getString("ID")); + requestParams.put("secret", broadcast.getString("SECRET")); + requestParams.put("callbackUrl", broadcast.getString("CALLBACKURL")); Response response // 请求响应 = okHttp .headers(new HashMap<>()) @@ -115,7 +122,7 @@ public class BroadcastController extends BaseController { .post(); // 请求方法 if (response.body() != null) { String accessToken = JSONObject.parseObject(response.body().string()).getString("accessToken"); - redisCache.setCacheObject(TOKENKEY, accessToken, 5, TimeUnit.MINUTES); + redisCache.setCacheObject(broadcast.getString("TOKENKEY"), accessToken, 5, TimeUnit.MINUTES); return accessToken; } return null; diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 2afa2dc7..5a8381f6 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -119,6 +119,24 @@ public class DcDeviceController extends BaseController { return AjaxResult.success(dcDeviceService.getDevice(id)); } + /** + * 根据网段查询设备 + */ + @ApiOperation("根据网段查询设备") + @GetMapping("/networkSegment/{networkSegment}") + public AjaxResult getDeviceByNetworkSegment(@PathVariable String networkSegment) { + return AjaxResult.success(dcDeviceService.getDeviceByNetworkSegment(networkSegment)); + } + + /** + * 根据网段分组查询分组设备 + */ + @ApiOperation("根据网段分组查询分组设备") + @GetMapping("/networkSegment") + public AjaxResult getGroupingDeviceByNetworkSegment() { + return AjaxResult.success(dcDeviceService.getGroupingDeviceByNetworkSegment()); + } + /** * 新增 diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java index 7a2899a7..0428137a 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java @@ -9,14 +9,7 @@ import com.zc.business.service.IDcEventService; import com.zc.common.core.websocket.WebSocketService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -147,10 +140,10 @@ public class DcEventController extends BaseController @ApiOperation("删除事件信息") // @PreAuthorize("@ss.hasPermi('system:event:remove')") @Log(title = "事件信息", businessType = BusinessType.DELETE) - @DeleteMapping("/{eventType}/{ids}") - public AjaxResult remove(@PathVariable int eventType,@PathVariable String[] ids ) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable String[] ids ) { - return toAjax(dcEventService.deleteDcEventByIds(eventType,ids)); + return toAjax(dcEventService.deleteDcEventByIds(ids)); } @ApiOperation("事件数量统计") // @PreAuthorize("@ss.hasPermi('system:event:list')") @@ -197,7 +190,7 @@ public class DcEventController extends BaseController */ @ApiOperation("解除事件") @PostMapping("/completeEvent") - public AjaxResult completeEvent(String eventId){ + public AjaxResult completeEvent(@ApiParam(value="事件id", name="eventId", required=true) @RequestParam("eventId") String eventId){ return dcEventService.completeEvent(eventId); } @@ -211,7 +204,7 @@ public class DcEventController extends BaseController */ @ApiOperation("无需清障") @PostMapping("/skipClear") - public AjaxResult skipClear(String eventId){ + public AjaxResult skipClear(@ApiParam(value="事件id", name="eventId", required=true) @RequestParam ("eventId") String eventId){ return dcEventService.skipClear(eventId); } } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventImportantController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventImportantController.java index f1fb84bc..e010ebc7 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventImportantController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventImportantController.java @@ -2,6 +2,9 @@ package com.zc.business.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; @@ -27,6 +30,7 @@ import com.ruoyi.common.core.page.TableDataInfo; * @author ruoyi * @date 2024-04-11 */ +@Api(tags = "事件侧重要素") @RestController @RequestMapping("/business/eventImportant") public class DcEventImportantController extends BaseController @@ -37,6 +41,7 @@ public class DcEventImportantController extends BaseController /** * 查询事件侧重要素列表 */ + @ApiOperation("查询事件侧重要素列表") @GetMapping("/list") public TableDataInfo list(DcEventImportant dcEventImportant) { @@ -48,6 +53,7 @@ public class DcEventImportantController extends BaseController /** * 导出事件侧重要素列表 */ + @ApiOperation("导出事件侧重要素列表") @Log(title = "事件侧重要素", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcEventImportant dcEventImportant) @@ -58,17 +64,19 @@ public class DcEventImportantController extends BaseController } /** - * 获取事件侧重要素详细信息 + * 根据事件id查询侧重要素信息 */ - @GetMapping(value = "/{id}") - public AjaxResult getInfo(@PathVariable("id") String id) + @ApiOperation("根据事件id查询侧重要素信息") + @GetMapping(value = "/{eventId}") + public AjaxResult getInfo(@PathVariable("eventId") String eventId) { - return AjaxResult.success(dcEventImportantService.selectDcEventImportantByEventId(id)); + return AjaxResult.success(dcEventImportantService.selectDcEventImportantByEventId(eventId)); } /** * 新增事件侧重要素 */ + @ApiOperation("新增事件侧重要素") @Log(title = "事件侧重要素", businessType = BusinessType.INSERT) @PostMapping public AjaxResult add(@RequestBody DcEventImportant dcEventImportant) @@ -81,6 +89,7 @@ public class DcEventImportantController extends BaseController */ @Log(title = "事件侧重要素", businessType = BusinessType.UPDATE) @PutMapping + @ApiOperation("修改事件侧重要素") public AjaxResult edit(@RequestBody DcEventImportant dcEventImportant) { return toAjax(dcEventImportantService.updateDcEventImportant(dcEventImportant)); @@ -89,6 +98,7 @@ public class DcEventImportantController extends BaseController /** * 删除事件侧重要素 */ + @ApiOperation("删除事件侧重要素") @Log(title = "事件侧重要素", businessType = BusinessType.DELETE) @DeleteMapping("/{ids}") public AjaxResult remove(@PathVariable String[] ids) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcMYSQLJob.java b/zc-business/src/main/java/com/zc/business/controller/DcMYSQLJob.java index feb7be44..db03ddf4 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcMYSQLJob.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcMYSQLJob.java @@ -21,7 +21,7 @@ import java.util.Date; public class DcMYSQLJob { //private final Environment environment; - private static final String IP = "10.0.81.202"; + private static final String IP = "10.0.111.11"; private static final String PORT = "3306"; @@ -36,7 +36,7 @@ public class DcMYSQLJob { @Scheduled(cron = "0 0 22 * * ?") //@Scheduled(cron = "0 10 * * * ?") public void backupAthena() throws IOException { - String url = "jdbc:mysql://10.0.81.202:3306/athena?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"; + String url = "jdbc:mysql://10.0.111.11:3306/athena?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"; extracted(url, "athena"); } @@ -45,7 +45,7 @@ public class DcMYSQLJob { //@Scheduled(cron = "0 20 * * * ?") public void backupJiHeDC() throws IOException { // 数据库配置信息 - String url = "jdbc:mysql://10.0.81.202:3306/jihe-dc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"; + String url = "jdbc:mysql://10.0.111.11:3306/jihe-dc?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"; extracted(url, "jihe-dc"); } @@ -54,7 +54,7 @@ public class DcMYSQLJob { //@Scheduled(cron = "0 30 * * * ?") public void backupJiHeDCPro() throws IOException { // 数据库配置信息 - String url = "jdbc:mysql://10.0.81.202:3306/jihe-dc-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"; + String url = "jdbc:mysql://10.0.111.11:3306/jihe-dc-pro?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true"; extracted(url, "jihe-dc-pro"); } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java b/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java new file mode 100644 index 00000000..8a3160fe --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcPublishManageController.java @@ -0,0 +1,104 @@ +package com.zc.business.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcPublishManage; +import com.zc.business.service.IDcPublishManageService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 信息发布管理记录Controller + * + * @author ruoyi + * @date 2024-04-19 + */ +@RestController +@RequestMapping("/business/manage") +public class DcPublishManageController extends BaseController +{ + @Autowired + private IDcPublishManageService dcPublishManageService; + + /** + * 查询信息发布管理记录列表 + */ + @PreAuthorize("@ss.hasPermi('business:manage:list')") + @GetMapping("/list") + public TableDataInfo list(DcPublishManage dcPublishManage) + { + startPage(); + List list = dcPublishManageService.selectDcPublishManageList(dcPublishManage); + return getDataTable(list); + } + + /** + * 导出信息发布管理记录列表 + */ + @PreAuthorize("@ss.hasPermi('business:manage:export')") + @Log(title = "信息发布管理记录", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcPublishManage dcPublishManage) + { + List list = dcPublishManageService.selectDcPublishManageList(dcPublishManage); + ExcelUtil util = new ExcelUtil<>(DcPublishManage.class); + util.exportExcel(response, list, "信息发布管理记录数据"); + } + + /** + * 获取信息发布管理记录详细信息 + */ + @PreAuthorize("@ss.hasPermi('business:manage:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcPublishManageService.selectDcPublishManageById(id)); + } + + /** + * 新增信息发布管理记录 + */ + @PreAuthorize("@ss.hasPermi('business:manage:add')") + @Log(title = "信息发布管理记录", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcPublishManage dcPublishManage) + { + return toAjax(dcPublishManageService.insertDcPublishManage(dcPublishManage)); + } + + /** + * 修改信息发布管理记录 + */ + @PreAuthorize("@ss.hasPermi('business:manage:edit')") + @Log(title = "信息发布管理记录", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcPublishManage dcPublishManage) + { + return toAjax(dcPublishManageService.updateDcPublishManage(dcPublishManage)); + } + + /** + * 删除信息发布管理记录 + */ + @PreAuthorize("@ss.hasPermi('business:manage:remove')") + @Log(title = "信息发布管理记录", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(dcPublishManageService.deleteDcPublishManageByIds(ids)); + } +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java b/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java new file mode 100644 index 00000000..c7ccae60 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcPublishingChannelsController.java @@ -0,0 +1,117 @@ +package com.zc.business.controller; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcPublishingChannels; +import com.zc.business.service.IDcPublishingChannelsService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 发布渠道Controller + * + * @author ruoyi + * @date 2024-04-19 + */ +@RestController +@RequestMapping("/business/channels") +public class DcPublishingChannelsController extends BaseController +{ + @Autowired + private IDcPublishingChannelsService dcPublishingChannelsService; + + /** + * 查询发布渠道列表 + */ + @PreAuthorize("@ss.hasPermi('business:channels:list')") + @GetMapping("/list") + public TableDataInfo list(DcPublishingChannels dcPublishingChannels) + { + startPage(); + List list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels); + return getDataTable(list); + } + + /** + * 导出发布渠道列表 + */ + @PreAuthorize("@ss.hasPermi('business:channels:export')") + @Log(title = "发布渠道", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcPublishingChannels dcPublishingChannels) + { + List list = dcPublishingChannelsService.selectDcPublishingChannelsList(dcPublishingChannels); + ExcelUtil util = new ExcelUtil<>(DcPublishingChannels.class); + util.exportExcel(response, list, "发布渠道数据"); + } + + /** + * 获取发布渠道详细信息 + */ + @PreAuthorize("@ss.hasPermi('business:channels:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcPublishingChannelsService.selectDcPublishingChannelsById(id)); + } + + /** + * 新增发布渠道 + */ + @PreAuthorize("@ss.hasPermi('business:channels:add')") + @Log(title = "发布渠道", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcPublishingChannels dcPublishingChannels) + { + if (dcPublishingChannels.getDataCategory()==null){ + return AjaxResult.error("参数错误"); + } + List channelsList = dcPublishingChannelsService. + selectChannelsDataCategory(dcPublishingChannels.getDataCategory()); + if (channelsList!=null&&channelsList.size()>0){ + return AjaxResult.error("事件类型已存在"); + } + return toAjax(dcPublishingChannelsService.insertDcPublishingChannels(dcPublishingChannels)); + } + + /** + * 修改发布渠道 + */ + @PreAuthorize("@ss.hasPermi('business:channels:edit')") + @Log(title = "发布渠道", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcPublishingChannels dcPublishingChannels) + { + List channelsList = dcPublishingChannelsService. + selectChannelsDataCategory(dcPublishingChannels.getDataCategory()); + if (channelsList!=null&&channelsList.size()>0){ + return AjaxResult.error("事件类型已存在"); + } + return toAjax(dcPublishingChannelsService.updateDcPublishingChannels(dcPublishingChannels)); + } + + /** + * 删除发布渠道 + */ + @PreAuthorize("@ss.hasPermi('business:channels:remove')") + @Log(title = "发布渠道", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(dcPublishingChannelsService.deleteDcPublishingChannelsByIds(ids)); + } +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java b/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java new file mode 100644 index 00000000..71d5fd56 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcSwitchController.java @@ -0,0 +1,105 @@ +package com.zc.business.controller; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcSwitch; +import com.zc.business.service.DcSwitchService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.io.IOException; +import java.net.InetAddress; +import java.util.List; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; + +/** + * 交换机Controller + * + * @author wangjiabao + */ +@Api(tags = {"交换机"}) +@RestController +@RequestMapping("/business/switch") +public class DcSwitchController extends BaseController { + + @Resource + private DcSwitchService dcSwitchService; + + /** + * 查询交换机 + */ + @ApiOperation("查询交换机") + @GetMapping("/query") + public AjaxResult getSwitchList(DcSwitch dcSwitch) { + return AjaxResult.success(dcSwitchService.getSwitchList(dcSwitch)); + } + + /** + * 根据设备列表查询设备 + */ + @ApiOperation("根据设备列表查询设备") + @GetMapping("/deviceList/{deviceList}") + public AjaxResult getDeviceList(@PathVariable String deviceList) { + return AjaxResult.success(dcSwitchService.getDeviceList(deviceList)); + } + + /** + * 查询所有数据 + * + * @return + */ + @GetMapping("/list") + public AjaxResult getSwitchListAll() { + return AjaxResult.success(dcSwitchService.getSwitchListAll()); + } + + /** + * 定时更新交换机网络状态 + */ + @Scheduled(cron = "0 0/30 * * * ?") + public void updateNetWorkStatus() { + List switchList = dcSwitchService.getSwitchList(new DcSwitch()); + ExecutorService executor = Executors.newFixedThreadPool(100); + List collect = switchList.stream() + .filter(dcSwitch -> { + return dcSwitch.getAncestors().split(",").length > 1; + }).collect(Collectors.toList()); + CountDownLatch latch = new CountDownLatch(collect.size()); + collect.forEach(dcSwitch -> { + executor.execute(() -> { + try { + InetAddress inet = InetAddress.getByName(dcSwitch.getSwitchIp()); + if (inet.isReachable(5000)) { + // 成功 + dcSwitch.setNetWorkStatus(1); + } else { + // 失败 + dcSwitch.setNetWorkStatus(0); + } + } catch (IOException e) { + e.getMessage(); + } finally { + latch.countDown(); + } + }); + }); + try { + latch.await(); // 等待所有线程执行完毕 + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } finally { + executor.shutdown(); + } + // 批量修改 + dcSwitchService.updateBatchByNetWorkStatus(collect); + } +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcVoiceBroadcastController.java b/zc-business/src/main/java/com/zc/business/controller/DcVoiceBroadcastController.java new file mode 100644 index 00000000..75ad8f47 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcVoiceBroadcastController.java @@ -0,0 +1,138 @@ +package com.zc.business.controller; +import java.util.List; +import javax.servlet.http.HttpServletResponse; +import com.zc.business.domain.DcVoiceBroadcast; +import com.zc.business.service.IDcVoiceBroadcastService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; + +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 语音广播预发布Controller + * + * @author ruoyi + * @date 2024-04-19 + */ +@RestController +@RequestMapping("/system/broadcast") +@Api(tags = "语音广播预发布") +public class DcVoiceBroadcastController extends BaseController +{ + @Autowired + private IDcVoiceBroadcastService dcVoiceBroadcastService; + + /** + * 查询语音广播预发布列表 + */ + @ApiOperation("查询语音广播预发布列表") + @PreAuthorize("@ss.hasPermi('system:broadcast:list')") + @GetMapping("/list") + public TableDataInfo list(DcVoiceBroadcast dcVoiceBroadcast) + { + startPage(); + List list = dcVoiceBroadcastService.selectDcVoiceBroadcastList(dcVoiceBroadcast); + return getDataTable(list); + } + /** + * 查询语音广播预发布列表 + */ + @ApiOperation("无分页查询语音广播预发布列表") + @PreAuthorize("@ss.hasPermi('system:broadcast:listAll')") + @GetMapping("/listAll") + public TableDataInfo listAll(DcVoiceBroadcast dcVoiceBroadcast) + { + List list = dcVoiceBroadcastService.selectDcVoiceBroadcastList(dcVoiceBroadcast); + return getDataTable(list); + } + /** + * 根据模版类型查询查询语音广播预发布列表 + */ + @ApiOperation("根据模版类型查询查询语音广播预发布列表") + @PreAuthorize("@ss.hasPermi('system:broadcast:listId')") + @GetMapping("/listAll/{category}") + public TableDataInfo listByCategory(@PathVariable("category") String category) + { + List list = dcVoiceBroadcastService.selectDcVoiceBroadcastListByCategory(category); + return getDataTable(list); + } + + /** + * 导出语音广播预发布列表 + */ + @ApiOperation("导出语音广播预发布列表") + + @PreAuthorize("@ss.hasPermi('system:broadcast:export')") + @Log(title = "语音广播预发布", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcVoiceBroadcast dcVoiceBroadcast) + { + List list = dcVoiceBroadcastService.selectDcVoiceBroadcastList(dcVoiceBroadcast); + ExcelUtil util = new ExcelUtil<>(DcVoiceBroadcast.class); + util.exportExcel(response, list, "语音广播预发布数据"); + } + + /** + * 获取语音广播预发布详细信息 + */ + @ApiOperation("根据id获取语音广播预发布详细信息") + + @PreAuthorize("@ss.hasPermi('system:broadcast:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcVoiceBroadcastService.selectDcVoiceBroadcastById(id)); + } + + /** + * 新增语音广播预发布 + */ + @ApiOperation("新增语音广播预发布") + + @PreAuthorize("@ss.hasPermi('system:broadcast:add')") + @Log(title = "语音广播预发布", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcVoiceBroadcast dcVoiceBroadcast) + { + return toAjax(dcVoiceBroadcastService.insertDcVoiceBroadcast(dcVoiceBroadcast)); + } + + /** + * 修改语音广播预发布 + */ + @ApiOperation("修改语音广播预发布") + @PreAuthorize("@ss.hasPermi('system:broadcast:edit')") + @Log(title = "语音广播预发布", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcVoiceBroadcast dcVoiceBroadcast) + { + return toAjax(dcVoiceBroadcastService.updateDcVoiceBroadcast(dcVoiceBroadcast)); + } + + /** + * 删除语音广播预发布 + */ + @ApiOperation("删除语音广播预发布") + @PreAuthorize("@ss.hasPermi('system:broadcast:remove')") + @Log(title = "语音广播预发布", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(dcVoiceBroadcastService.deleteDcVoiceBroadcastByIds(ids)); + } +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java index aa45c5f4..1cb74c8c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcWarningController.java @@ -153,19 +153,25 @@ public class DcWarningController extends BaseController //指挥调度 @PostMapping("/commandAndDispatch") public AjaxResult commandAndDispatch(@RequestBody DcWarning dcWarning){ - if (StringUtils.isBlank(dcWarning.getStakeMark())){ + if (StringUtils.isBlank(dcWarning.getStakeMark())||StringUtils.isBlank(dcWarning.getId())){ return AjaxResult.error("参数错误"); } return (dcWarningService.commandAndDispatch(dcWarning)); } - //指挥调度记录新增 - @PostMapping("/insertDispatch") + //指挥调度记录修改 + @PostMapping("/updateDispatch") public AjaxResult insertDispatch(@RequestBody DcDispatch dcDispatch){ - return AjaxResult.success(dcWarningService.insertDispatch(dcDispatch)); + if (dcDispatch.getOrganizationId()==null){ + return AjaxResult.error("参数错误"); + } + return toAjax(dcWarningService.insertDispatch(dcDispatch)); } //指挥调度资源新增 - @PostMapping("/insertSource") - public AjaxResult insertDispatchSource(@RequestBody DcDispatchResource dcDispatchResource){ - return toAjax(dcWarningService.insertDispatchSource(dcDispatchResource)); + @PostMapping("/updateSource") + public AjaxResult insertDispatchSource(@RequestBody HashMap map){ + if (map==null||!map.containsKey("dispatchId")){ + return AjaxResult.error("参数错误"); + } + return toAjax(dcWarningService.insertDispatchSource(map)); } } diff --git a/zc-business/src/main/java/com/zc/business/controller/MsmController.java b/zc-business/src/main/java/com/zc/business/controller/MsmController.java index 10a3070d..a89d5c64 100644 --- a/zc-business/src/main/java/com/zc/business/controller/MsmController.java +++ b/zc-business/src/main/java/com/zc/business/controller/MsmController.java @@ -3,19 +3,16 @@ package com.zc.business.controller; import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; -import com.zc.business.domain.DcWarning; +import com.zc.business.domain.DcEventProcess; import com.zc.business.service.IMsmService; -import com.zc.business.utils.HttpUtil; +import com.zc.business.service.impl.DcEventProcessServiceImpl; import org.apache.commons.lang3.StringUtils; -import org.omg.CORBA.INTERNAL; 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; import org.springframework.web.bind.annotation.RestController; -import java.lang.reflect.Array; -import java.rmi.MarshalledObject; import java.util.ArrayList; import java.util.HashMap; @@ -28,6 +25,8 @@ import java.util.HashMap; public class MsmController extends BaseController { @Autowired private IMsmService msmService; + @Autowired + private DcEventProcessServiceImpl dcEventProcessService; /** * 短信推送业务,阿里云短信业务 @@ -46,15 +45,37 @@ public class MsmController extends BaseController { //调用微信推送 @PostMapping("/wenXinPush") public AjaxResult commandAndDispatch(@RequestBody HashMap map){ - return AjaxResult.success(msmService.wenXinSend("wx9ee0e3babfd8d2af","de2ecb80b30d63135918ba3ae6ffb711")); + return AjaxResult.success(msmService.wenXinSend("内容")); } //整合推送 @PostMapping("/pushAll") - public AjaxResult pushAll(@RequestBody HashMap map) + public AjaxResult pushAll(@RequestBody HashMap map){ + if (map == null || !map.containsKey("type")||StringUtils.isBlank(map.get("type").toString())) { + return AjaxResult.error("参数错误"); + } + if (map == null ||!map.containsKey("content")|| StringUtils.isBlank(map.get("content").toString())) { + return AjaxResult.error("内容为空"); + } + if (!map.containsKey("eventId")|| StringUtils.isBlank(map.get("eventId").toString())) { + return AjaxResult.error("事件id为空"); + } + return msmService.putAll(map); + } + //整合推送(弃用) + @PostMapping("/pushAllText") + public AjaxResult pushAllText(@RequestBody HashMap map) { - if (map == null || StringUtils.isBlank(map.get("type").toString())) { + if (map == null || !map.containsKey("type")||StringUtils.isBlank(map.get("type").toString())) { return AjaxResult.error("参数错误"); } + if (map == null ||!map.containsKey("content")|| StringUtils.isBlank(map.get("content").toString())) { + return AjaxResult.error("内容为空"); + } + if (!map.containsKey("eventId")|| StringUtils.isBlank(map.get("eventId").toString())) { + return AjaxResult.error("事件id为空"); + } + String eventId = map.get("eventId").toString();//事件id + String content = map.get("content").toString();//信息内容 ArrayList array = (ArrayList) map.get("type"); Boolean send = null; Integer data = null; @@ -70,32 +91,27 @@ public class MsmController extends BaseController { continue; } if ("2".equals(type)) { //微信 - JSONArray objects = msmService.wenXinSend("wx9ee0e3babfd8d2af", "de2ecb80b30d63135918ba3ae6ffb711"); + JSONArray objects = msmService.wenXinSend(content); data = (Integer) objects.get(0); continue; } } - if (send==null){ - message=null; - }else if (send){ + if (send==true){ message = "短信推送成功"; // 如果 send 为 true,则短信推送成功 } - if (data==null){ - weiXin=null; - }else if (data==0){ + if (data==0){ weiXin = "微信推送成功"; // 如果所有 dateValue 都为0,则微信推送成功 } - if (message!=null&&"短信推送成功".equals(message) &&weiXin!=null&&"微信推送成功".equals(weiXin)) { + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(eventId); + dcEventProcess.setSource(1); + dcEventProcess.setProcessType(2); + String context = "出行信息发布:" + content; + dcEventProcess.setContext(context); + dcEventProcessService.insertDcEventProcess(dcEventProcess); + if ("短信推送成功".equals(message) &&"微信推送成功".equals(weiXin)) { return AjaxResult.success(message +","+ weiXin); - } else if (message==null&&weiXin!=null&&"微信推送成功".equals(weiXin)){ - return AjaxResult.success(weiXin); - }else if (message!=null&&"短信推送成功".equals(message)&&weiXin==null){ - return AjaxResult.success(message); - }else if (message!=null&&"短信推送失败".equals(message)&&weiXin==null){ - return AjaxResult.error(message); - }else if (message==null&&"微信推送失败".equals(weiXin)){ - return AjaxResult.error(weiXin); - }else { + } else { return AjaxResult.error(message +","+ weiXin); } } diff --git a/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java b/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java index cd286852..69a29eda 100644 --- a/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/NonAutomaticWarningController.java @@ -7,6 +7,7 @@ import com.hikvision.artemis.sdk.ArtemisHttpUtil; import com.hikvision.artemis.sdk.config.ArtemisConfig; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.system.service.ISysConfigService; import com.zc.business.domain.DcWarning; import com.zc.business.domain.NonAutomaticWarning; import com.zc.business.service.IDcWarningService; @@ -14,6 +15,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.eclipse.paho.client.mqttv3.*; import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.*; @@ -37,16 +39,18 @@ import java.util.Objects; @RequestMapping("/nonAutomaticWarning") public class NonAutomaticWarningController extends BaseController { - private static final String APPKEY = "22825659"; - - private static final String APPSECRET = "7Qcq3fr1gaYws6QhyDqt"; - - private static final String URI = "/artemis/api/common/v1/event/getTopicInfo"; - - private static final String IP = "10.0.81.28"; + //private static final String APPKEY = "22825659"; + // + //private static final String APPSECRET = "7Qcq3fr1gaYws6QhyDqt"; + // + // private static final String URI = "/artemis/api/common/v1/event/getTopicInfo"; + // + //private static final String IP = "10.0.81.28"; @Resource private IDcWarningService dcWarningService; + @Autowired + private ISysConfigService configService; /* * 调用功能 @@ -134,7 +138,7 @@ public class NonAutomaticWarningController extends BaseController { String illegalTrafficEvent = data.getString("illegalTrafficEvent"); String directionName = data.getString("directionName"); String crossingName = data.getString("crossingName"); - String targetPicUrl = "https://10.0.81.202/fjyj" + data.getString("targetPicUrl"); + String targetPicUrl = "https://10.0.111.11/fjyj" + data.getString("targetPicUrl"); String laneNo = data.getString("laneNo"); ArrayList pictures = new ArrayList<>(); @@ -278,10 +282,11 @@ public class NonAutomaticWarningController extends BaseController { // @PostConstruct public AjaxResult eventSubscriptionPostConstruct() throws Exception { NonAutomaticWarning stringStringHashMap = new NonAutomaticWarning(); - stringStringHashMap.setAPPKEY(APPKEY); - stringStringHashMap.setAPPSECRET(APPSECRET); - stringStringHashMap.setURI(URI); - stringStringHashMap.setIP(IP); + JSONObject nonAutomaticWarning = JSONObject.parseObject(configService.selectConfigByKey("nonAutomaticWarning")); + stringStringHashMap.setAPPKEY(nonAutomaticWarning.getString("APPKEY")); + stringStringHashMap.setAPPSECRET(nonAutomaticWarning.getString("APPSECRET")); + stringStringHashMap.setURI(nonAutomaticWarning.getString("URI")); + stringStringHashMap.setIP(nonAutomaticWarning.getString("IP")); return getAjaxResult(stringStringHashMap); } } diff --git a/zc-business/src/main/java/com/zc/business/controller/VideoController.java b/zc-business/src/main/java/com/zc/business/controller/VideoController.java index 9365d7f6..3fb84c7c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/VideoController.java +++ b/zc-business/src/main/java/com/zc/business/controller/VideoController.java @@ -4,9 +4,11 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.ruoyi.common.constant.HttpStatus; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.system.service.ISysConfigService; import com.zc.business.constant.DeviceTypeConstants; import com.zc.business.domain.DcDevice; import com.zc.business.enums.CameraDirectionEnum; @@ -20,6 +22,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import okhttp3.Response; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; @@ -33,6 +36,7 @@ import java.util.concurrent.TimeUnit; import java.util.stream.Collectors; import static com.ruoyi.common.constant.Constants.HTTP; +import static com.ruoyi.common.constant.Constants.HTTPS; import static java.util.Comparator.comparing; @@ -68,6 +72,8 @@ public class VideoController extends BaseController { @Resource private IMiddleDatabaseService middleDatabaseService; + @Autowired + private ISysConfigService configService; // 组织机构id private final static String CAM_DEPT_ID = "1301730"; @@ -316,7 +322,7 @@ public class VideoController extends BaseController { Response response // 请求响应 = okHttp - .url(HTTP + "10.0.81.202:8081" + "/api/iot/device/query") // 请求地址 + .url(HTTP + "10.0.111.11:8081" + "/api/iot/device/query") // 请求地址 .get(); // 请求方法 return JSON.parseObject(response.body().string(), AjaxResult.class); } @@ -483,11 +489,26 @@ public class VideoController extends BaseController { if (response.body() != null) { jsonResult = JSONObject.parseObject(response.body().string()); - if (jsonResult.containsKey("code") && UNAUTHORIZED.equals(jsonResult.getInteger("code"))) { - getToken(); - okHttp.post(); - if (response.body() != null) { - jsonResult = JSONObject.parseObject(response.body().string()); + if (jsonResult.containsKey("code")) { + if (HttpStatus.SUCCESS == jsonResult.getInteger("code")) { + Map data = jsonResult.getJSONObject("data"); + String liveUrl = data.get("liveUrl").toString(); + liveUrl = configService.selectConfigByKey("dc.cameraUrl") + liveUrl.substring(7); + data.put("liveUrl",liveUrl); + jsonResult.put("data",data); + } else if (UNAUTHORIZED.equals(jsonResult.getInteger("code"))) { + getToken(); + okHttp.post(); + if (response.body() != null) { + jsonResult = JSONObject.parseObject(response.body().string()); + if (HttpStatus.SUCCESS == jsonResult.getInteger("code")) { + Map data = jsonResult.getJSONObject("data"); + String liveUrl = data.get("liveUrl").toString(); + liveUrl = configService.selectConfigByKey("cameraUrl") + liveUrl.substring(7); + data.put("liveUrl",liveUrl); + jsonResult.put("data",data); + } + } } } } diff --git a/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java b/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java index c6915458..c73819e3 100644 --- a/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java +++ b/zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java @@ -5,17 +5,19 @@ import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.system.service.ISysConfigService; import com.zc.business.domain.DcRegion; import com.zc.business.service.impl.DcRegionServiceImpl; import com.zc.common.core.httpclient.OkHttp; +import com.zc.common.core.httpclient.exception.HttpException; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import okhttp3.Response; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.io.IOException; import java.util.*; import java.util.concurrent.TimeUnit; @@ -30,29 +32,33 @@ import java.util.concurrent.TimeUnit; @RequestMapping("/weatherForecast") public class WeatherForecastController extends BaseController { - private static final String WEATHERFACTSURI = "https://devapi.qweather.com/v7/weather/now?location="; - private static final String WEATHERFACTS = "weatherFacts"; - private static final String WEATHERFACTSKEY = "f72f6415b3f04515be1cceb868b33a7e"; //谢朴峰 - private static final String METEOROLOGICALEARLYWARNINGURI = "https://devapi.qweather.com/v7/warning/now?location="; - private static final String METEOROLOGICALEARLYWARNING = "meteorologicalEarlyWarning"; - private static final String METEOROLOGICALEARLYWARNINGKEY = "8b5e521388154799a86e73444db76b1d"; // 高广超 - private static final String HOURLYWEATHERURI = "https://devapi.qweather.com/v7/weather/24h?location="; - private static final String HOURLYWEATHER = "hourlyWeather"; - private static final String HOURLYWEATHERKEY = "cfd87e0502684ac3a681eb19a712aec6"; // 孟凡峰 - private static final String KEY = "&key="; + //private static final String WEATHERFACTSURI = "https://devapi.qweather.com/v7/weather/now?location="; + //private static final String WEATHERFACTS = "weatherFacts"; + //private static final String WEATHERFACTSKEY = "f72f6415b3f04515be1cceb868b33a7e"; //谢朴峰 + //private static final String METEOROLOGICALEARLYWARNINGURI = "https://devapi.qweather.com/v7/warning/now?location="; + //private static final String METEOROLOGICALEARLYWARNING = "meteorologicalEarlyWarning"; + //private static final String METEOROLOGICALEARLYWARNINGKEY = "8b5e521388154799a86e73444db76b1d"; // 高广超 + //private static final String HOURLYWEATHERURI = "https://devapi.qweather.com/v7/weather/24h?location="; + //private static final String HOURLYWEATHER = "hourlyWeather"; + //private static final String HOURLYWEATHERKEY = "cfd87e0502684ac3a681eb19a712aec6"; // 孟凡峰 + //private static final String KEY = "&key="; @Resource private RedisCache redisCache; @Resource private DcRegionServiceImpl dcRegionService; + @Autowired + private ISysConfigService configService; + /* * 天气实况查询 * */ @ApiOperation("天气实况查询") @PostMapping(value = "/weatherFacts") public AjaxResult weatherFacts() { - return getAjaxResult(WEATHERFACTSURI, WEATHERFACTSKEY, WEATHERFACTS); + JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather")); + return getAjaxResult(weather.getString("WEATHERFACTSURI"), weather.getString("WEATHERFACTSKEY"), weather.getString("WEATHERFACTS")); } /* @@ -61,7 +67,8 @@ public class WeatherForecastController extends BaseController { @ApiOperation("气象预警查询") @PostMapping(value = "/meteorologicalEarlyWarning") public AjaxResult meteorologicalEarlyWarning() { - return getAjaxResult(METEOROLOGICALEARLYWARNINGURI, METEOROLOGICALEARLYWARNINGKEY, METEOROLOGICALEARLYWARNING); + JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather")); + return getAjaxResult(weather.getString("METEOROLOGICALEARLYWARNINGURI"), weather.getString("METEOROLOGICALEARLYWARNINGKEY"), weather.getString("METEOROLOGICALEARLYWARNING")); } /* @@ -70,8 +77,9 @@ public class WeatherForecastController extends BaseController { @ApiOperation("气象预警数量查询") @PostMapping(value = "/queryTheNumberOfMeteorologicalWarning") public AjaxResult queryTheNumberOfMeteorologicalWarning() { + JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather")); JSONObject jsonObject = new JSONObject(); - JSONObject cacheObject = redisCache.getCacheObject(METEOROLOGICALEARLYWARNING); + JSONObject cacheObject = redisCache.getCacheObject(weather.getString("METEOROLOGICALEARLYWARNING")); if (cacheObject != null) { jsonObject = cacheObject; @@ -88,7 +96,7 @@ public class WeatherForecastController extends BaseController { Response response // 请求响应 = okHttp .headers(new HashMap<>()) - .url(METEOROLOGICALEARLYWARNINGURI + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + KEY + METEOROLOGICALEARLYWARNINGKEY) // 请求地址 + .url(weather.getString("METEOROLOGICALEARLYWARNINGURI") + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + weather.getString("KEY") + weather.getString("METEOROLOGICALEARLYWARNINGKEY")) // 请求地址 .get(); // 请求方法 if (response.body() != null) { @@ -96,7 +104,7 @@ public class WeatherForecastController extends BaseController { JSONObject jsonResult = JSONObject.parseObject(response.body().string()); if (jsonResult.getInteger("code") == 200) { - jsonObject.put(METEOROLOGICALEARLYWARNING + dcRegion.getId(), extracted(jsonResult, "warning")); + jsonObject.put(weather.getString("METEOROLOGICALEARLYWARNING") + dcRegion.getId(), extracted(jsonResult, "warning")); } else { return AjaxResult.error(jsonResult.getInteger("code"), "请求失败"); @@ -107,7 +115,7 @@ public class WeatherForecastController extends BaseController { } } } - redisCache.setCacheObject(METEOROLOGICALEARLYWARNING, jsonObject, 13, TimeUnit.MINUTES); + redisCache.setCacheObject(weather.getString("METEOROLOGICALEARLYWARNING"), jsonObject, 13, TimeUnit.MINUTES); JSONArray meteorologicalEarlyWarning1 = jsonObject.getJSONArray("meteorologicalEarlyWarning1"); JSONArray meteorologicalEarlyWarning2 = jsonObject.getJSONArray("meteorologicalEarlyWarning2"); JSONArray meteorologicalEarlyWarning3 = jsonObject.getJSONArray("meteorologicalEarlyWarning3"); @@ -133,10 +141,12 @@ public class WeatherForecastController extends BaseController { @ApiOperation("逐小时天气查询") @PostMapping(value = "/hourlyWeather") public AjaxResult hourlyWeather() { - return getAjaxResult(HOURLYWEATHERURI, HOURLYWEATHERKEY, HOURLYWEATHER); + JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather")); + return getAjaxResult(weather.getString("HOURLYWEATHERURI"), weather.getString("HOURLYWEATHERKEY"), weather.getString("HOURLYWEATHER")); } private AjaxResult getAjaxResult(String uri, String accessKey, String redisKey) { + JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather")); JSONObject cacheObject = redisCache.getCacheObject(redisKey); @@ -159,7 +169,7 @@ public class WeatherForecastController extends BaseController { Response response // 请求响应 = okHttp .headers(new HashMap<>()) - .url(uri + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + KEY + accessKey) // 请求地址 + .url(uri + dcRegion.getLongitude() + "," + dcRegion.getLatitude() + weather.getString("KEY") + accessKey) // 请求地址 .get(); // 请求方法 if (response.body() != null) { @@ -167,15 +177,15 @@ public class WeatherForecastController extends BaseController { JSONObject jsonResult = JSONObject.parseObject(response.body().string()); if (jsonResult.getInteger("code") == 200) { - if (Objects.equals(redisKey, WEATHERFACTS)) { + if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) { jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "now")); - } else if (Objects.equals(redisKey, METEOROLOGICALEARLYWARNING)) { + } else if (Objects.equals(redisKey, weather.getString("METEOROLOGICALEARLYWARNING"))) { jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "warning")); - } else if (Objects.equals(redisKey, HOURLYWEATHER)) { + } else if (Objects.equals(redisKey, weather.getString("HOURLYWEATHER"))) { jsonObject.put(redisKey + dcRegion.getId(), extracted(jsonResult, "hourly")); } @@ -191,15 +201,15 @@ public class WeatherForecastController extends BaseController { } - if (Objects.equals(redisKey, WEATHERFACTS)) { + if (Objects.equals(redisKey, weather.getString("WEATHERFACTS"))) { redisCache.setCacheObject(redisKey, jsonObject, 13, TimeUnit.MINUTES); - } else if (Objects.equals(redisKey, METEOROLOGICALEARLYWARNING)) { + } else if (Objects.equals(redisKey, weather.getString("METEOROLOGICALEARLYWARNING"))) { redisCache.setCacheObject(redisKey, jsonObject, 13, TimeUnit.MINUTES); - } else if (Objects.equals(redisKey, HOURLYWEATHER)) { + } else if (Objects.equals(redisKey, weather.getString("HOURLYWEATHER"))) { redisCache.setCacheObject(redisKey, jsonObject, 13, TimeUnit.MINUTES); } @@ -236,4 +246,35 @@ public class WeatherForecastController extends BaseController { } return jsonObject; } + + /* + * 逐小时天气查询 + * */ + @ApiOperation("查询指定经纬度天气") + @GetMapping(value = "/queryTheSpecifiedLatitudeAndLongitudeWeather/{longitude}/{latitude}") + public AjaxResult queryTheSpecifiedLatitudeAndLongitudeWeather(@PathVariable String longitude, @PathVariable String latitude) throws HttpException, IOException { + + JSONObject weather = JSONObject.parseObject(configService.selectConfigByKey("weather")); + JSONObject jsonObject = new JSONObject(); + + OkHttp okHttp = new OkHttp(); + + Response response // 请求响应 + = okHttp + .headers(new HashMap<>()) + .url(weather.getString("WEATHERFACTSURI") + longitude + "," + latitude + weather.getString("KEY") + weather.getString("WEATHERFACTSKEY")) // 请求地址 + .get(); // 请求方法 + + if (response.body() != null) { + + JSONObject jsonResult = JSONObject.parseObject(response.body().string()); + if (jsonResult.getInteger("code") == 200) { + jsonObject.put("weatherInTheAreaWhereTheIncidentOccurred",jsonResult); + } else { + return AjaxResult.error(jsonResult.getInteger("code"), "请求失败"); + } + } + return AjaxResult.success(jsonObject); + } + } diff --git a/zc-business/src/main/java/com/zc/business/controller/WeiboAuthExample.java b/zc-business/src/main/java/com/zc/business/controller/WeiboAuthExample.java new file mode 100644 index 00000000..054b44a2 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/WeiboAuthExample.java @@ -0,0 +1,77 @@ +package com.zc.business.controller; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.util.Map; +import java.util.HashMap; +//微博获取token的工具类 +public class WeiboAuthExample { + private static final String APP_KEY = "1894516689"; + private static final String APP_SECRET = "4e89660243b70328fb74ae10f9ed98e5"; + private static final String REDIRECT_URI = "https://api.weibo.com/oauth2/default.html"; // 回调URL,需要URL编码 + private static final String AUTHORIZE_URL = "https://api.weibo.com/oauth2/authorize?client_id="+APP_KEY+"&redirect_uri="+REDIRECT_URI+"&response_type=code"; + + public static void main(String[] args) throws IOException { + // 1. 引导用户到微博授权页面 + System.out.println("Please visit the following URL to authorize your Weibo account:"); + System.out.println(AUTHORIZE_URL); + System.out.println("After authorization, you will be redirected to the callback URL with an Authorization Code."); + + // 在实际应用中,你应该设置一个HTTP服务器来处理回调,而不是从控制台读取输入。 + // 这里为了简化示例,我们直接从控制台读取Authorization Code。 + System.out.print("Enter the Authorization Code from the callback URL: "); + BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); + String code = reader.readLine(); + // 2. 使用Authorization Code请求Access Token + String accessTokenUrl = "https://api.weibo.com/oauth2/access_token"; + Map params = new HashMap<>(); + params.put("client_id", APP_KEY); + params.put("client_secret", APP_SECRET); + params.put("grant_type", "authorization_code"); + params.put("code", code); + params.put("redirect_uri", REDIRECT_URI); + + String accessTokenResponse = sendPostRequest(accessTokenUrl, params); + // 解析Access Token响应,实际应用中应该使用JSON库来解析 + System.out.println("Access Token Response: " + accessTokenResponse); + + } + + private static String sendPostRequest(String url, Map params) throws IOException { + URL obj = new URL(url); + HttpURLConnection con = (HttpURLConnection) obj.openConnection(); + con.setRequestMethod("POST"); + con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + con.setRequestProperty("Accept", "application/json"); + con.setDoOutput(true); + + StringBuilder postData = new StringBuilder(); + for (Map.Entry param : params.entrySet()) { + if (postData.length() != 0) postData.append('&'); + postData.append(URLEncoder.encode(param.getKey(), StandardCharsets.UTF_8.toString())); + postData.append('='); + postData.append(URLEncoder.encode(param.getValue(), StandardCharsets.UTF_8.toString())); + } + byte[] postDataBytes = postData.toString().getBytes(StandardCharsets.UTF_8); + + try (OutputStream os = con.getOutputStream()) { + os.write(postDataBytes); + } + int responseCode = con.getResponseCode(); + BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream())); + String inputLine; + StringBuffer response = new StringBuffer(); + + while ((inputLine = in.readLine()) != null) { + response.append(inputLine); + } + in.close(); + return response.toString(); + } +} \ No newline at end of file diff --git a/zc-business/src/main/java/com/zc/business/controller/WeiboAuthUtil.java b/zc-business/src/main/java/com/zc/business/controller/WeiboAuthUtil.java index d1d03258..584a37f7 100644 --- a/zc-business/src/main/java/com/zc/business/controller/WeiboAuthUtil.java +++ b/zc-business/src/main/java/com/zc/business/controller/WeiboAuthUtil.java @@ -1,95 +1,61 @@ package com.zc.business.controller; - -import com.alibaba.fastjson.JSONObject; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; -import org.apache.http.client.HttpClient; -import org.apache.http.client.methods.CloseableHttpResponse; -import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; import org.apache.http.util.EntityUtils; -import java.io.IOException; -import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.URL; -import java.net.URLEncoder; + +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.List; + /** * @author 王思祥 * @ClassName DcWarningPush 微博推送 */ public class WeiboAuthUtil { - //1.登录传入重定向的url,用户授权后返回授权的code,2.使用code取得认证权限token 3.调用接口参数 - //1.登录获取用户的回调code - private static final String APP_KEY = "你的App Key"; - private static final String AUTH_URL = "https://api.weibo.com/oauth2/authorize"; - private static final String APP_SECRET = "你的App Secret"; - private static final String REDIRECT_URI = "你的回调URL"; - //获取授权后的code - public String tokenCode(){ - String url="https://api.weibo.com/oauth2/authorize?client_id="+APP_KEY+"&redirect_uri="+AUTH_URL; - String token=null; + private static final String ACCESS_TOKEN = "2.00oesadIn1MNEC0296dd00f87jmhaC"; + private static final String WEIBO_API_URL = "https://api.weibo.com/2/statuses/update.json"; + + public static void main(String[] args) { try { - URL urlGet = new URL(url); //创建链接 - HttpURLConnection http = (HttpURLConnection) urlGet.openConnection(); - http.setRequestMethod("GET"); - http.setDoInput(true); //打开获取返回数据 - http.connect(); //发送链接 - InputStream is = http.getInputStream(); // - int size = is.available(); - byte[] jsonBytes = new byte[size]; - is.read(jsonBytes); - token = new String(jsonBytes, "UTF-8"); - System.err.println(token); - JSONObject jsonObject = JSONObject.parseObject(token); - is.close(); - return jsonObject.get("code").toString(); - }catch (Exception e){ + String text = "这是一条通过Java和微博API推送的消息!"; // 你要推送的微博内容 + postWeibo(text); + } catch (Exception e) { e.printStackTrace(); } - return ""; } - //获取toke - public String token(String code)throws IOException { - HttpClient httpClient = HttpClients.createDefault(); - String tokenUrl = REDIRECT_URI + "?client_id=" + APP_KEY - + "&client_secret=" + APP_SECRET - + "&grant_type=authorization_code" - + "&code=" + code - + "&redirect_uri=" + URLEncoder.encode(REDIRECT_URI, "UTF-8"); - HttpGet httpGet = new HttpGet(tokenUrl); - HttpResponse response = httpClient.execute(httpGet); + private static void postWeibo(String status) throws Exception { + CloseableHttpClient httpClient = HttpClients.createDefault(); + HttpPost httpPost = new HttpPost(WEIBO_API_URL); + + // 设置请求头,包含Content-Type + httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8"); + httpPost.setHeader("Authorization", "Bearer " + ACCESS_TOKEN); + + // 构造POST请求参数列表 + List params = new ArrayList<>(); + params.add(new BasicNameValuePair("access_token", ACCESS_TOKEN)); + params.add(new BasicNameValuePair("status", status)); + // 将参数列表转换为URL编码的字符串 + StringEntity paramsEntity = new StringEntity(EntityUtils.toString(new UrlEncodedFormEntity(params, StandardCharsets.UTF_8)), StandardCharsets.UTF_8); + // 设置请求体内容 + httpPost.setEntity(paramsEntity); + // 发送请求并获取响应 + HttpResponse response = httpClient.execute(httpPost); HttpEntity entity = response.getEntity(); if (entity != null) { - String responseBody = EntityUtils.toString(entity, "UTF-8"); - org.json.JSONObject jsonObject = new org.json.JSONObject(responseBody); - return jsonObject.optString("access_token"); + String responseString = EntityUtils.toString(entity, StandardCharsets.UTF_8); + System.out.println("Response: " + responseString); } - return null; + // 关闭HttpClient连接 + httpClient.close(); } - //执行调用推送api - public static void main(String[] args) throws Exception { - WeiboAuthUtil weiboAuthUtil = new WeiboAuthUtil(); - String code = weiboAuthUtil.tokenCode(); - String accessToken = weiboAuthUtil.token(code);//认证后的code放入,获取token - // 创建HttpClient实例 - try (CloseableHttpClient httpClient = HttpClients.createDefault()) { - // 构建请求URL,这里以获取用户信息为例 - String url = "https://api.weibo.com/2/users/show.json?access_token=" + accessToken + "&uid=用户UID"; - // 创建HttpGet请求 - HttpGet httpGet = new HttpGet(url); - // 执行请求并获取响应 - try (CloseableHttpResponse response = httpClient.execute(httpGet)) { - HttpEntity entity = response.getEntity(); - if (entity != null) { - // 读取响应内容 - String responseString = EntityUtils.toString(entity, "UTF-8"); - System.out.println(responseString); - } - } - } - } } \ No newline at end of file diff --git a/zc-business/src/main/java/com/zc/business/domain/DcDevice.java b/zc-business/src/main/java/com/zc/business/domain/DcDevice.java index ba999a9e..ed37f702 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcDevice.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcDevice.java @@ -46,6 +46,8 @@ public class DcDevice { private String deviceCode; @ApiModelProperty("设备类型") private String deviceType; + @ApiModelProperty("所属网段") + private String networkSegment; @ApiModelProperty("设备图片") private String deviceImg; @ApiModelProperty("安装日期") diff --git a/zc-business/src/main/java/com/zc/business/domain/DcDispatch.java b/zc-business/src/main/java/com/zc/business/domain/DcDispatch.java index 6a2e9ed8..6cf17542 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcDispatch.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcDispatch.java @@ -63,6 +63,16 @@ private String organizationName; /** $column.columnComment */ @Excel(name = "调度记录id", readConverterExp = "$column.readConverterExp()") private Long dispatchId; + //部门id + private Long deptId; + + public Long getDeptId() { + return deptId; + } + + public void setDeptId(Long deptId) { + this.deptId = deptId; + } public Integer getDispatchType() { return dispatchType; diff --git a/zc-business/src/main/java/com/zc/business/domain/DcDispatchResource.java b/zc-business/src/main/java/com/zc/business/domain/DcDispatchResource.java index 7f9f318d..90a79098 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcDispatchResource.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcDispatchResource.java @@ -30,7 +30,10 @@ public class DcDispatchResource extends BaseEntity @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") private Long dispatchId; - public void setId(Long id) + + + + public void setId(Long id) { this.id = id; } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java b/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java index be0ab666..649c2ea1 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventProcess.java @@ -40,6 +40,11 @@ public class DcEventProcess @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") private String operator; + /** $column.columnComment */ + @ApiModelProperty(value="操作人名称") + @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") + private String operatorName; + /** 1-pc端 2-手机端 */ @ApiModelProperty(value="来源") @@ -74,18 +79,18 @@ public class DcEventProcess @ApiModelProperty("内容类型") @Excel(name = "${type}", readConverterExp = "$column.readConverterExp()") private String type; - +/* @ApiModelProperty("上传文件") - private MultipartFile file; + private MultipartFile file;*/ - public MultipartFile getFile() { + /* public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { this.file = file; - } + }*/ public void setId(Long id) { @@ -123,7 +128,16 @@ public class DcEventProcess { return operator; } - public void setSource(Integer source) + + public String getOperatorName() { + return operatorName; + } + + public void setOperatorName(String operatorName) { + this.operatorName = operatorName; + } + + public void setSource(Integer source) { this.source = source; } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java b/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java new file mode 100644 index 00000000..89524611 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcPublishManage.java @@ -0,0 +1,405 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.omg.CORBA.INTERNAL; + +/** + * 信息发布管理记录对象 dc_publish_manage + * + * @author ruoyi + * @date 2024-04-19 + */ +public class DcPublishManage extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + + /** 事件编号 */ + @Excel(name = "事件编号") + private String eventId; + + /** 所属机构 */ + @Excel(name = "所属机构") + private Long deptId; + + /** 发布渠道ID */ + @Excel(name = "发布渠道ID") + private Long publishChannelsId; + + /** 标题 */ + @Excel(name = "标题") + private String title; + + /** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */ + @Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序") + private Integer publishChannels; + + /** 审核状态:0-待审核1-已审核2-未通过 */ + @Excel(name = "审核状态: 0-待审核 1-已审核 2-未通过") + private Integer isverify; + + /** 发布者 */ + @Excel(name = "发布者") + private String publisher; + + /** 审核者1 */ + @Excel(name = "审核者1") + private String auditor1; + + /** 审核者1 */ + @Excel(name = "审核者1") + private String auditor2; + + /** 审核时间1 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") + private Date auditTime1; + + /** 审核时间1 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @Excel(name = "审核时间1", width = 30, dateFormat = "yyyy-MM-dd") + private Date auditTime2; + + /** 审核者1意见 */ + @Excel(name = "审核者1意见") + private String auditComment1; + + /** 审核者2意见 */ + @Excel(name = "审核者2意见") + private String auditComment2; + + /** 发布时间 */ + @Excel(name = "发布时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date publishTime; + + /** 发布状态:1-成功2-失败3-草稿 */ + @Excel(name = "发布状态: 1-成功 2-失败 3-草稿") + private Integer publishStatus; + + /** 事件详情 */ + @Excel(name = "事件详情") + private String contentDetails; + + @Excel(name = "方向", readConverterExp = "1=菏泽方向,3=济南方向") + private String direction; + @Excel(name = "桩号") + private String stakeMark; + @Excel(name = "事件主类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件") + private String eventType; + @Excel(name = "事件子类", readConverterExp = "1-1=追尾,1-2=侧翻,1-3=撞护栏,1-4=自然,1-5=其他事故,2-1=车辆故障,3-1=主线封闭和限行,3-2=收费站封闭和限行,3-3=立交封闭和限行,3-4=服务区封闭和限行,4-1=道路拥堵,4-2=立交拥堵,4-3=收费站拥堵,4-4=服务区拥堵,5-1=行人,5-2=非机动车,5-3=摩托车,5-4=其他,6-1=烟雾,6-2=倒伏树木,6-3=撒落物,6-4=动物,6-5=其他,7-1=道路养护施工,7-2=收费站养护施工,7-3=服务区养护施工,7-4=枢纽立交匝道养护施工,7-5=地方道路养护施工,7-6=道路工程建设施工,7-7=收费站工程建设施工,7-8=服务区工程建设施工,7-9=枢纽立交匝道工程建设施工,7-10=地方道路工程建设施工,8-1=封闭、暂停营业,8-2=重要设施停用,8-3=服务区其他异常,9-1=摄像机,9-2=护栏,9-3=隔离栅") + private String eventSubclass; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date eventTime; + + /** 参数开始时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date startTime; + /** 参数结束时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date endTime; + //参数 + private String startStakeMarkValue; + //参数 + private String endStakeMarkValue; + //参数 + private Integer startStakeMark; + //参数 + private Integer endStakeMark; + //管制收费站 + private String facilityName; + //事件状态:0-待确认1-处理中2-已完成 + private Integer eventState; + + public Integer getEventState() { + return eventState; + } + + public void setEventState(Integer eventState) { + this.eventState = eventState; + } + + public String getFacilityName() { + return facilityName; + } + + public void setFacilityName(String facilityName) { + this.facilityName = facilityName; + } + + public String getStartStakeMarkValue() { + return startStakeMarkValue; + } + + public void setStartStakeMarkValue(String startStakeMarkValue) { + this.startStakeMarkValue = startStakeMarkValue; + } + + public String getEndStakeMarkValue() { + return endStakeMarkValue; + } + + public void setEndStakeMarkValue(String endStakeMarkValue) { + this.endStakeMarkValue = endStakeMarkValue; + } + + public Integer getStartStakeMark() { + return startStakeMark; + } + + public void setStartStakeMark(Integer startStakeMark) { + this.startStakeMark = startStakeMark; + } + + public Integer getEndStakeMark() { + return endStakeMark; + } + + public void setEndStakeMark(Integer endStakeMark) { + this.endStakeMark = endStakeMark; + } + + public String getDirection() { + return direction; + } + + public Date getEventTime() { + return eventTime; + } + + public void setEventTime(Date eventTime) { + this.eventTime = eventTime; + } + + public Date getStartTime() { + return startTime; + } + + public void setStartTime(Date startTime) { + this.startTime = startTime; + } + + public Date getEndTime() { + return endTime; + } + + public void setEndTime(Date endTime) { + this.endTime = endTime; + } + + public void setDirection(String direction) { + this.direction = direction; + } + + public String getStakeMark() { + return stakeMark; + } + + public void setStakeMark(String stakeMark) { + this.stakeMark = stakeMark; + } + + public String getEventType() { + return eventType; + } + + public void setEventType(String eventType) { + this.eventType = eventType; + } + + public String getEventSubclass() { + return eventSubclass; + } + + public void setEventSubclass(String eventSubclass) { + this.eventSubclass = eventSubclass; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setEventId(String eventId) + { + this.eventId = eventId; + } + + public String getEventId() + { + return eventId; + } + public void setDeptId(Long deptId) + { + this.deptId = deptId; + } + + public Long getDeptId() + { + return deptId; + } + public void setPublishChannelsId(Long publishChannelsId) + { + this.publishChannelsId = publishChannelsId; + } + + public Long getPublishChannelsId() + { + return publishChannelsId; + } + public void setTitle(String title) + { + this.title = title; + } + + public String getTitle() + { + return title; + } + public void setPublishChannels(Integer publishChannels) + { + this.publishChannels = publishChannels; + } + + public Integer getPublishChannels() + { + return publishChannels; + } + public void setIsverify(Integer isverify) + { + this.isverify = isverify; + } + + public Integer getIsverify() + { + return isverify; + } + public void setPublisher(String publisher) + { + this.publisher = publisher; + } + + public String getPublisher() + { + return publisher; + } + public void setAuditor1(String auditor1) + { + this.auditor1 = auditor1; + } + + public String getAuditor1() + { + return auditor1; + } + public void setAuditor2(String auditor2) + { + this.auditor2 = auditor2; + } + + public String getAuditor2() + { + return auditor2; + } + public void setAuditTime1(Date auditTime1) + { + this.auditTime1 = auditTime1; + } + + public Date getAuditTime1() + { + return auditTime1; + } + public void setAuditTime2(Date auditTime2) + { + this.auditTime2 = auditTime2; + } + + public Date getAuditTime2() + { + return auditTime2; + } + public void setAuditComment1(String auditComment1) + { + this.auditComment1 = auditComment1; + } + + public String getAuditComment1() + { + return auditComment1; + } + public void setAuditComment2(String auditComment2) + { + this.auditComment2 = auditComment2; + } + + public String getAuditComment2() + { + return auditComment2; + } + public void setPublishTime(Date publishTime) + { + this.publishTime = publishTime; + } + + public Date getPublishTime() + { + return publishTime; + } + public void setPublishStatus(Integer publishStatus) + { + this.publishStatus = publishStatus; + } + + public Integer getPublishStatus() + { + return publishStatus; + } + public void setContentDetails(String contentDetails) + { + this.contentDetails = contentDetails; + } + + public String getContentDetails() + { + return contentDetails; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("eventId", getEventId()) + .append("deptId", getDeptId()) + .append("publishChannelsId", getPublishChannelsId()) + .append("title", getTitle()) + .append("publishChannels", getPublishChannels()) + .append("isverify", getIsverify()) + .append("publisher", getPublisher()) + .append("auditor1", getAuditor1()) + .append("auditor2", getAuditor2()) + .append("auditTime1", getAuditTime1()) + .append("auditTime2", getAuditTime2()) + .append("auditComment1", getAuditComment1()) + .append("auditComment2", getAuditComment2()) + .append("publishTime", getPublishTime()) + .append("publishStatus", getPublishStatus()) + .append("contentDetails", getContentDetails()) + .append("remark", getRemark()) + .append("updateTime", getUpdateTime()) + .append("createTime", getCreateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java b/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java new file mode 100644 index 00000000..adb0a72f --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcPublishingChannels.java @@ -0,0 +1,125 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 发布渠道对象 dc_publishing_channels + * + * @author ruoyi + * @date 2024-04-19 + */ +public class DcPublishingChannels extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键 */ + private Long id; + /** 数据种类:和交通事件类型保持一致就可以 */ + @Excel(name = "数据种类",readConverterExp = "1=交通事故,2=车辆故障,3=交通管制,4=交通拥堵,5=非法上路,6=路障清除,7=施工建设,8=服务区异常,9=设施设备隐患,10=异常天气,11=其他事件") + private Integer dataCategory; + + /** 1-影响通行2-不影响通行 */ + @Excel(name = "影响级别",readConverterExp="1=影响通行,2=不影响通行") + private Integer infoLevel; + + /** 0-停用2-启用 */ + @Excel(name = "启用状态",readConverterExp="0=停用,2=启用") + private Integer enabled; + + /** 1-单人审核2-双人审核 */ + @Excel(name = "审核方式",readConverterExp="1=单人审核,2=双人审核") + private Integer auditMethod; + + /** 发布渠道:多选用逗号隔开1-手机短信2-微信公众号3-微博4-情报板5-服务网站6-微信小程序 */ + @Excel(name = "发布渠道",readConverterExp="1=手机短信,2=微信公众号,3=微博,4=情报板,5=服务网站,6=微信小程序") + private String publishChannels; + + /** 启用日期 */ + @Excel(name = "启用日期", readConverterExp = "$column.readConverterExp()") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date enableDate; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setDataCategory(Integer dataCategory) + { + this.dataCategory = dataCategory; + } + + public Integer getDataCategory() + { + return dataCategory; + } + public void setInfoLevel(Integer infoLevel) + { + this.infoLevel = infoLevel; + } + + public Integer getInfoLevel() + { + return infoLevel; + } + public void setEnabled(Integer enabled) + { + this.enabled = enabled; + } + + public Integer getEnabled() + { + return enabled; + } + public void setAuditMethod(Integer auditMethod) + { + this.auditMethod = auditMethod; + } + + public Integer getAuditMethod() + { + return auditMethod; + } + public void setPublishChannels(String publishChannels) + { + this.publishChannels = publishChannels; + } + + public String getPublishChannels() + { + return publishChannels; + } + public void setEnableDate(Date enableDate) + { + this.enableDate = enableDate; + } + + public Date getEnableDate() + { + return enableDate; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("dataCategory", getDataCategory()) + .append("infoLevel", getInfoLevel()) + .append("enabled", getEnabled()) + .append("auditMethod", getAuditMethod()) + .append("publishChannels", getPublishChannels()) + .append("enableDate", getEnableDate()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcSwitch.java b/zc-business/src/main/java/com/zc/business/domain/DcSwitch.java new file mode 100644 index 00000000..9fd63400 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcSwitch.java @@ -0,0 +1,122 @@ +package com.zc.business.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +/** + * 交换机对象 dc_switch + * + * @author wangjiabao + * @date 2024-04-19 + */ + +@ApiModel("交换机实体") +@Data +@AllArgsConstructor +@NoArgsConstructor +public class DcSwitch { + + /** + * 交换机编号 + */ + @Excel(name = "交换机编号") + @ApiModelProperty("交换机编号") + private Integer switchId; + + /** + * 父交换机编号 + */ + @Excel(name = "父交换机编号") + @ApiModelProperty("父交换机编号") + private Integer parentId; + + /** + * 祖级列表 + */ + @Excel(name = "祖级列表") + @ApiModelProperty("祖级列表") + private String ancestors; + + /** + * 交换机名称 + */ + @Excel(name = "交换机名称") + @ApiModelProperty("交换机名称") + private String switchName; + + /** + * 所在桩号 + */ + @Excel(name = "所在桩号") + @ApiModelProperty("所在桩号") + private String stakeMark; + + /** + * 设备列表 + */ + @Excel(name = "设备列表") + @ApiModelProperty("设备列表") + private String deviceList; + /** + * 交换机ip + */ + @Excel(name = "交换机ip") + @ApiModelProperty("交换机ip") + private String switchIp; + + /** + * 网路状态 + */ + @Excel(name = "网路状态") + @ApiModelProperty("网路状态") + private Integer netWorkStatus; + + /** + * 环网 + */ + @Excel(name = "环网") + @ApiModelProperty("环网") + private Integer ringNetWork; + + /** + * 使用状态 + */ + @Excel(name = "使用状态") + @ApiModelProperty("使用状态") + private Integer userState; + + /** + * 创建时间 + */ + @Excel(name = "创建时间") + @ApiModelProperty("创建时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date createTime; + + /** + * 更新时间 + */ + @Excel(name = "更新时间") + @ApiModelProperty("更新时间") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + private Date updateTime; + + private List children; + + + /** + * 故障数量 + */ + private int numberOfFaults; + private Map> dcDeviceList; + +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java b/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java new file mode 100644 index 00000000..51cfc018 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcVoiceBroadcast.java @@ -0,0 +1,72 @@ +package com.zc.business.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 语音广播预发布对象 dc_voice_broadcast + * + * @author ruoyi + * @date 2024-04-19 + */ +@ApiModel("语音广播预发布对象") +public class DcVoiceBroadcast extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + @ApiModelProperty("模板分组") + + /** 模板分组 */ + @Excel(name = "模板分组") + private String category; + + /** 内容 */ + @Excel(name = "内容") + private String content; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + public void setCategory(String category) + { + this.category = category; + } + + public String getCategory() + { + return category; + } + public void setContent(String content) + { + this.content = content; + } + + public String getContent() + { + return content; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("category", getCategory()) + .append("content", getContent()) + .append("remark", getRemark()) + .append("createTime", getCreateTime()) + .append("updateTime", getUpdateTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantMapper.java index 1aa5d2bf..ce2a2a8c 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEventImportantMapper.java @@ -14,10 +14,10 @@ public interface DcEventImportantMapper /** * 查询事件侧重要素 * - * @param id 事件侧重要素主键 + * @param eventId 事件id * @return 事件侧重要素 */ - public DcEventImportant selectDcEventImportantByEventId(String id); + public DcEventImportant selectDcEventImportantByEventId(String eventId); /** * 查询事件侧重要素列表 diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java index 40d81d8c..89f211a9 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java @@ -27,6 +27,8 @@ public interface DcEventMapper extends BaseMapper * @return 事件信息 */ public DcEvent selectDcEventById(String id); + //查询事件主类信息 + public DcEvent selectDcEventMainById(String id); /** * 查询事件信息列表 @@ -115,6 +117,8 @@ public interface DcEventMapper extends BaseMapper * @return boolean */ boolean completeEvent(@Param("eventId") String eventId); + + int selectClearInfo(String eventId); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java new file mode 100644 index 00000000..86eca8f0 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPublishManageMapper.java @@ -0,0 +1,69 @@ +package com.zc.business.mapper; + +import java.util.HashMap; +import java.util.List; +import com.zc.business.domain.DcPublishManage; +import org.apache.ibatis.annotations.Param; + +/** + * 信息发布管理记录Mapper接口 + * + * @author ruoyi + * @date 2024-04-19 + */ +public interface DcPublishManageMapper +{ + /** + * 查询信息发布管理记录 + * + * @param id 信息发布管理记录主键 + * @return 信息发布管理记录 + */ + public DcPublishManage selectDcPublishManageById(Long id); + + /** + * 查询信息发布管理记录列表 + * + * @param dcPublishManage 信息发布管理记录 + * @return 信息发布管理记录集合 + */ + List selectDcPublishManageList(DcPublishManage dcPublishManage); + + /** + * 新增信息发布管理记录 + * + * @param dcPublishManage 信息发布管理记录 + * @return 结果 + */ + int insertDcPublishManage(DcPublishManage dcPublishManage); + + /** + * 修改信息发布管理记录 + * + * @param dcPublishManage 信息发布管理记录 + * @return 结果 + */ + int updateDcPublishManage(DcPublishManage dcPublishManage); + + /** + * 删除信息发布管理记录 + * + * @param id 信息发布管理记录主键 + * @return 结果 + */ + int deleteDcPublishManageById(Long id); + + /** + * 批量删除信息发布管理记录 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcPublishManageByIds(Long[] ids); + //查询交通事件类型 + public Integer selectEventType(@Param("eventId")String eventId); + //获取发布渠道信息 + public DcPublishManage selectPublishManage(@Param("dataCategory")Integer dataCategory); + //查询信息发布列表 + public List> selectDcPublishManageListMap(DcPublishManage dcPublishManage); +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java new file mode 100644 index 00000000..d08e2fe4 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPublishingChannelsMapper.java @@ -0,0 +1,63 @@ +package com.zc.business.mapper; + +import java.util.List; +import com.zc.business.domain.DcPublishingChannels; + +/** + * 发布渠道Mapper接口 + * + * @author ruoyi + * @date 2024-04-19 + */ +public interface DcPublishingChannelsMapper +{ + /** + * 查询发布渠道 + * + * @param id 发布渠道主键 + * @return 发布渠道 + */ + public DcPublishingChannels selectDcPublishingChannelsById(Long id); + + /** + * 查询发布渠道列表 + * + * @param dcPublishingChannels 发布渠道 + * @return 发布渠道集合 + */ + List selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels); + + /** + * 新增发布渠道 + * + * @param dcPublishingChannels 发布渠道 + * @return 结果 + */ + int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels); + + /** + * 修改发布渠道 + * + * @param dcPublishingChannels 发布渠道 + * @return 结果 + */ + int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels); + + /** + * 删除发布渠道 + * + * @param id 发布渠道主键 + * @return 结果 + */ + int deleteDcPublishingChannelsById(Long id); + + /** + * 批量删除发布渠道 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcPublishingChannelsByIds(Long[] ids); + //查询数据类型是否已经存在 + public List selectChannelsDataCategory(Integer dataCategory); +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcSwitchMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcSwitchMapper.java new file mode 100644 index 00000000..7b59135e --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcSwitchMapper.java @@ -0,0 +1,19 @@ +package com.zc.business.mapper; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.zc.business.domain.DcSwitch; +import org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 交换机Mapper接口 + * + * @author wangjiabao + */ +@Mapper +public interface DcSwitchMapper extends BaseMapper { + List getSwitchList(DcSwitch dcSwitch); + + int updateBatchByNetWorkStatus(List list); +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcVoiceBroadcastMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcVoiceBroadcastMapper.java new file mode 100644 index 00000000..7785db4b --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcVoiceBroadcastMapper.java @@ -0,0 +1,64 @@ +package com.zc.business.mapper; + +import com.zc.business.domain.DcVoiceBroadcast; + +import java.util.List; + +/** + * 语音广播预发布Mapper接口 + * + * @author ruoyi + * @date 2024-04-19 + */ +public interface DcVoiceBroadcastMapper +{ + /** + * 查询语音广播预发布 + * + * @param id 语音广播预发布主键 + * @return 语音广播预发布 + */ + public DcVoiceBroadcast selectDcVoiceBroadcastById(Long id); + + /** + * 查询语音广播预发布列表 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 语音广播预发布集合 + */ + List selectDcVoiceBroadcastList(DcVoiceBroadcast dcVoiceBroadcast); + + /** + * 新增语音广播预发布 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 结果 + */ + int insertDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); + + /** + * 修改语音广播预发布 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 结果 + */ + int updateDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); + + /** + * 删除语音广播预发布 + * + * @param id 语音广播预发布主键 + * @return 结果 + */ + int deleteDcVoiceBroadcastById(Long id); + + /** + * 批量删除语音广播预发布 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcVoiceBroadcastByIds(Long[] ids); + + List selectDcVoiceBroadcastListByCategory(String category); +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index f1ddd947..2e6e4af2 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -108,4 +108,27 @@ public interface DcWarningMapper public Integer insertDispatchResource(DcDispatchResource dcDispatchResource); //新增调度记录信息 public Integer insertDcDispatch(DcDispatch dcDispatch); + //修改调度记录信息 + public Integer updateDcDispatch(DcDispatch dcDispatch); + //查询调度资源信息 + public HashMap selectDcDispatch(@Param("eventId") String eventId); + //查询记录信息 + public List> selectDispatchResource(@Param("dispatchId")Long dispatchId); + //查询查询值班的全部人员 + public List> selectShiftsEmployeesToday(); + public List> selectShiftsEmployees(); + //查询机构人员和调度关系 + public List> selectEmployeesDispatch(@Param("organizationId")Long organizationId,@Param("eventId") String eventId); + //查询机构车辆和调度关系 + public List> selectVehiclesDispatch(@Param("organizationId")Long organizationId,@Param("eventId") String eventId); + //取出运管中心 + public HashMap selectOrganization(); + //选中的人员信息 + public List> selectEmployeesChoice(@Param("dispatchId")Long dispatchId); + //选中的车辆信息 + public List> selectVehiclesChoice(@Param("dispatchId")Long dispatchId); + public Integer deleteDispatchResource(@Param("dispatchId")Long dispatchId); + + DcDispatch selectDcDispatchById(@Param("id") Long id); + } diff --git a/zc-business/src/main/java/com/zc/business/service/DcSwitchService.java b/zc-business/src/main/java/com/zc/business/service/DcSwitchService.java new file mode 100644 index 00000000..5fb43223 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/DcSwitchService.java @@ -0,0 +1,37 @@ +package com.zc.business.service; + +import com.zc.business.domain.DcDevice; +import com.zc.business.domain.DcSwitch; + +import java.util.List; + +/** + * 交换机Service接口 + * + * @author wangjiabao + * @date 2024-04-19 + */ +public interface DcSwitchService { + + /** + * 查询交换机 + */ + List getSwitchList(DcSwitch dcSwitch); + + /** + * 根据设备列表查询设备 + */ + List getDeviceList(String deviceList); + + /** + * 查询所有数据 + * @return + */ + List getSwitchListAll(); + + /** + * 批量修改网络状态 + * @return + */ + int updateBatchByNetWorkStatus(List list); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java index 26644f00..8e975dbc 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcDeviceService.java @@ -73,6 +73,19 @@ public interface IDcDeviceService extends IService { */ DcDevice getDevice(String id); + /** + * 根据网段查询设备 + * @param networkSegment + * @return + */ + List getDeviceByNetworkSegment(String networkSegment); + + /** + * 根据网段分组查询分组设备 + * @return + */ + Map> getGroupingDeviceByNetworkSegment(); + DcStakeMark exampleQueryTheAssociatedPileNumber(DcDevice dcDevice); Long statisticalAnomalyDevice(); diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventImportantService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventImportantService.java index b212e772..04a27946 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventImportantService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventImportantService.java @@ -14,10 +14,10 @@ public interface IDcEventImportantService /** * 查询事件侧重要素 * - * @param id 事件侧重要素主键 + * @param eventId 事件id * @return 事件侧重要素 */ - public DcEventImportant selectDcEventImportantByEventId(String id); + public DcEventImportant selectDcEventImportantByEventId(String eventId); /** * 查询事件侧重要素列表 diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java index c05eac4e..8bebab43 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java @@ -69,7 +69,7 @@ public interface IDcEventService * @param ids 需要删除的事件信息主键集合 * @return 结果 */ - public int deleteDcEventByIds(int eventType,String[] ids); + public int deleteDcEventByIds(String[] ids); /** * 删除事件信息信息 diff --git a/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java b/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java new file mode 100644 index 00000000..c7567d45 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcPublishManageService.java @@ -0,0 +1,61 @@ +package com.zc.business.service; + +import java.util.List; +import com.zc.business.domain.DcPublishManage; + +/** + * 信息发布管理记录Service接口 + * + * @author ruoyi + * @date 2024-04-19 + */ +public interface IDcPublishManageService +{ + /** + * 查询信息发布管理记录 + * + * @param id 信息发布管理记录主键 + * @return 信息发布管理记录 + */ + public DcPublishManage selectDcPublishManageById(Long id); + + /** + * 查询信息发布管理记录列表 + * + * @param dcPublishManage 信息发布管理记录 + * @return 信息发布管理记录集合 + */ + List selectDcPublishManageList(DcPublishManage dcPublishManage); + + /** + * 新增信息发布管理记录 + * + * @param dcPublishManage 信息发布管理记录 + * @return 结果 + */ + int insertDcPublishManage(DcPublishManage dcPublishManage); + + /** + * 修改信息发布管理记录 + * + * @param dcPublishManage 信息发布管理记录 + * @return 结果 + */ + int updateDcPublishManage(DcPublishManage dcPublishManage); + + /** + * 批量删除信息发布管理记录 + * + * @param ids 需要删除的信息发布管理记录主键集合 + * @return 结果 + */ + int deleteDcPublishManageByIds(Long[] ids); + + /** + * 删除信息发布管理记录信息 + * + * @param id 信息发布管理记录主键 + * @return 结果 + */ + int deleteDcPublishManageById(Long id); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java b/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java new file mode 100644 index 00000000..70d73cbd --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcPublishingChannelsService.java @@ -0,0 +1,63 @@ +package com.zc.business.service; + +import java.util.List; +import com.zc.business.domain.DcPublishingChannels; + +/** + * 发布渠道Service接口 + * + * @author ruoyi + * @date 2024-04-19 + */ +public interface IDcPublishingChannelsService +{ + /** + * 查询发布渠道 + * + * @param id 发布渠道主键 + * @return 发布渠道 + */ + public DcPublishingChannels selectDcPublishingChannelsById(Long id); + + /** + * 查询发布渠道列表 + * + * @param dcPublishingChannels 发布渠道 + * @return 发布渠道集合 + */ + List selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels); + + /** + * 新增发布渠道 + * + * @param dcPublishingChannels 发布渠道 + * @return 结果 + */ + int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels); + + /** + * 修改发布渠道 + * + * @param dcPublishingChannels 发布渠道 + * @return 结果 + */ + int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels); + + /** + * 批量删除发布渠道 + * + * @param ids 需要删除的发布渠道主键集合 + * @return 结果 + */ + int deleteDcPublishingChannelsByIds(Long[] ids); + + /** + * 删除发布渠道信息 + * + * @param id 发布渠道主键 + * @return 结果 + */ + int deleteDcPublishingChannelsById(Long id); + //查询数据类型是否已经存在 + public List selectChannelsDataCategory(Integer dataCategory); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcVoiceBroadcastService.java b/zc-business/src/main/java/com/zc/business/service/IDcVoiceBroadcastService.java new file mode 100644 index 00000000..2cdb249a --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcVoiceBroadcastService.java @@ -0,0 +1,64 @@ +package com.zc.business.service; + +import com.zc.business.domain.DcVoiceBroadcast; + +import java.util.List; + +/** + * 语音广播预发布Service接口 + * + * @author ruoyi + * @date 2024-04-19 + */ +public interface IDcVoiceBroadcastService +{ + /** + * 查询语音广播预发布 + * + * @param id 语音广播预发布主键 + * @return 语音广播预发布 + */ + public DcVoiceBroadcast selectDcVoiceBroadcastById(Long id); + + /** + * 查询语音广播预发布列表 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 语音广播预发布集合 + */ + List selectDcVoiceBroadcastList(DcVoiceBroadcast dcVoiceBroadcast); + + /** + * 新增语音广播预发布 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 结果 + */ + int insertDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); + + /** + * 修改语音广播预发布 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 结果 + */ + int updateDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast); + + /** + * 批量删除语音广播预发布 + * + * @param ids 需要删除的语音广播预发布主键集合 + * @return 结果 + */ + int deleteDcVoiceBroadcastByIds(Long[] ids); + + /** + * 删除语音广播预发布信息 + * + * @param id 语音广播预发布主键 + * @return 结果 + */ + int deleteDcVoiceBroadcastById(Long id); + + List selectDcVoiceBroadcastListByCategory(String category); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java index c406e471..93af5845 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcWarningService.java @@ -88,8 +88,8 @@ public interface IDcWarningService Integer updateEndSection(); //指挥调度 AjaxResult commandAndDispatch(DcWarning dcWarning); + //修改指挥调度资源记录 + public Integer insertDispatch(DcDispatch dcDispatch); //新增指挥调度资源记录 - public DcDispatch insertDispatch(DcDispatch dcDispatch); - //新增指挥调度资源记录 - public Integer insertDispatchSource(DcDispatchResource dcDispatchResource); + public Integer insertDispatchSource(HashMap map); } diff --git a/zc-business/src/main/java/com/zc/business/service/IMsmService.java b/zc-business/src/main/java/com/zc/business/service/IMsmService.java index 5dc10cdf..d6ecff09 100644 --- a/zc-business/src/main/java/com/zc/business/service/IMsmService.java +++ b/zc-business/src/main/java/com/zc/business/service/IMsmService.java @@ -2,6 +2,9 @@ package com.zc.business.service; import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.core.domain.AjaxResult; +import org.springframework.http.converter.xml.AbstractJaxb2HttpMessageConverter; + +import java.util.HashMap; public interface IMsmService { /** @@ -16,6 +19,8 @@ public interface IMsmService { * * @return */ - JSONArray wenXinSend(String appId, String appSecret); + JSONArray wenXinSend(String content); + //整合推送 + public AjaxResult putAll(HashMap map); } \ No newline at end of file diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java index c70a0fac..f659096d 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcDeviceServiceImpl.java @@ -26,6 +26,7 @@ import javax.annotation.Resource; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.util.stream.Collectors; /** * 设备Service业务层处理 @@ -67,13 +68,18 @@ public class DcDeviceServiceImpl extends ServiceImpl i // 清楚 redis 缓存数据 redisCache.deleteObject(RedisKeyConstants.DC_DEVICES); + redisCache.deleteObject(RedisKeyConstants.DC_DEVICE_ID); // 添加 redis 缓存数据 dcDevices.forEach(val -> { String iotDeviceId = val.getIotDeviceId(); + Long id = val.getId(); if (StringUtils.hasText(iotDeviceId)) { redisCache.setCacheMapValue(RedisKeyConstants.DC_DEVICES, val.getIotDeviceId(), val); } + if (StringUtils.hasText(id.toString())) { + redisCache.setCacheMapValue(RedisKeyConstants.DC_DEVICE_ID, val.getId(), val); + } }); } @@ -370,6 +376,28 @@ public class DcDeviceServiceImpl extends ServiceImpl i return device; } + /** + * 根据网段查询设备 + * @param networkSegment + * @return + */ + @Override + public List getDeviceByNetworkSegment(String networkSegment) { + DcDevice device = new DcDevice(); + device.setNetworkSegment(networkSegment); + return dcDeviceMapper.selectDcDeviceList(device); + } + + /** + * 根据网段分组查询分组设备 + */ + @Override + public Map> getGroupingDeviceByNetworkSegment() { + List deviceList = dcDeviceMapper.selectDcDeviceList(new DcDevice()); + return deviceList.stream() + .collect(Collectors.groupingBy(DcDevice::getNetworkSegment)); + } + @Override public DcStakeMark exampleQueryTheAssociatedPileNumber(DcDevice dcDevice) { DcStakeMark dcStakeMark = new DcStakeMark(); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java index f38ee2c4..6a61c259 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEmergencyPlansServiceImpl.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.uuid.IdUtils; import com.zc.business.constant.DeviceFunctionIdConstants; @@ -24,6 +25,7 @@ import com.zc.business.service.IDcDeviceService; import com.zc.business.service.IDcFacilityService; import com.zc.common.core.httpclient.exception.HttpException; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -58,6 +60,9 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { @Resource private ThreadPoolTaskExecutor threadPoolTaskExecutor; + @Autowired + private DcEventProcessServiceImpl dcEventProcessService; + /** * 查询事件预案 @@ -750,6 +755,14 @@ public class DcEmergencyPlansServiceImpl implements DcEmergencyPlansService { eventPlanAssocMapper.updateEventPlanAssoc(selectEventPlanAssoc); resultObject.put("eventPlanAssocId",selectEventPlanAssoc.getId()); } + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(id); + dcEventProcess.setSource(1); + dcEventProcess.setProcessType(3); + dcEventProcess.setProcessId(Long.valueOf(resultObject.get("eventPlanAssocId").toString())); + dcEventProcess.setContext("设备管控:"); + dcEventProcessService.insertDcEventProcess(dcEventProcess); + resultObject.put("deviceOperationResult",resultArray); return resultObject; } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java index 07fae61e..8ef3657b 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantFileServiceImpl.java @@ -64,8 +64,6 @@ public class DcEventImportantFileServiceImpl implements IDcEventImportantFileSer if (i > 0){ DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(dcEventImportantFile.getEventId()); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); dcEventProcess.setProcessType(4); dcEventProcess.setProcessId(dcEventImportantFile.getId()); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantServiceImpl.java index f828a8c2..0c951f7d 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventImportantServiceImpl.java @@ -22,13 +22,13 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService /** * 查询事件侧重要素 * - * @param id 事件侧重要素主键 + * @param eventId 事件id * @return 事件侧重要素 */ @Override - public DcEventImportant selectDcEventImportantByEventId(String id) + public DcEventImportant selectDcEventImportantByEventId(String eventId) { - return dcEventImportantMapper.selectDcEventImportantByEventId(id); + return dcEventImportantMapper.selectDcEventImportantByEventId(eventId); } /** @@ -64,7 +64,11 @@ public class DcEventImportantServiceImpl implements IDcEventImportantService @Override public int updateDcEventImportant(DcEventImportant dcEventImportant) { - return dcEventImportantMapper.updateDcEventImportant(dcEventImportant); + int i = dcEventImportantMapper.updateDcEventImportant(dcEventImportant); + if (i < 1){ + i = dcEventImportantMapper.insertDcEventImportant(dcEventImportant); + } + return i; } /** diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java index 4c91278c..a097984a 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventProcessServiceImpl.java @@ -1,10 +1,12 @@ package com.zc.business.service.impl; import java.io.IOException; +import java.util.Date; import java.util.List; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.exception.file.InvalidExtensionException; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.MimeTypeUtils; import com.zc.business.domain.DcEvent; @@ -62,7 +64,7 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService public int insertDcEventProcess(DcEventProcess dcEventProcess) { //如果有文件传入 - if(!dcEventProcess.getFile().isEmpty()){ + /*if(!dcEventProcess.getFile().isEmpty()){ try { String address = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), dcEventProcess.getFile(), MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); dcEventProcess.setContext(address); @@ -71,14 +73,17 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService } catch (IOException | InvalidExtensionException e){ e.printStackTrace(); } - } + }*/ //判断是否最后一个节点 - if (dcEventProcess.getProcessType() != null && dcEventProcess.getProcessType() == 1){ + /*if (dcEventProcess.getProcessType() != null && dcEventProcess.getProcessType() == 1){ int finalNode = dcEventProcessMapper.selectFinalNode(dcEventProcess.getEventId()); if (finalNode == dcEventProcess.getProcessId()){ dcEventService.updateDcEventState(dcEventProcess.getEventId(),2); } - } + }*/ + dcEventProcess.setOperationTime(new Date()); + dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); + dcEventProcess.setOperatorName(SecurityUtils.getLoginUser().getUser().getNickName()); return dcEventProcessMapper.insertDcEventProcess(dcEventProcess); } @@ -92,17 +97,9 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService public boolean batchInsertDcEventProcess(List dcEventProcessList) { dcEventProcessList.forEach(dcEventProcess -> { - //如果有文件传入 - if(!dcEventProcess.getFile().isEmpty()){ - try { - String address = FileUploadUtils.upload(RuoYiConfig.getUploadPath(), dcEventProcess.getFile(), MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); - dcEventProcess.setContext(address); - String type = address.split("\\.")[1]; - dcEventProcess.setType(type); - } catch (IOException | InvalidExtensionException e){ - e.printStackTrace(); - } - } + dcEventProcess.setOperationTime(new Date()); + dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); + dcEventProcess.setOperatorName(SecurityUtils.getLoginUser().getUser().getNickName()); }); return dcEventProcessMapper.batchInsertDcEventProcess(dcEventProcessList); @@ -117,6 +114,9 @@ public class DcEventProcessServiceImpl implements IDcEventProcessService @Override public int updateDcEventProcess(DcEventProcess dcEventProcess) { + dcEventProcess.setOperationTime(new Date()); + dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); + dcEventProcess.setOperatorName(SecurityUtils.getLoginUser().getUser().getNickName()); return dcEventProcessMapper.updateDcEventProcess(dcEventProcess); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index d1411627..4732167c 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -196,11 +196,12 @@ public class DcEventServiceImpl extends ServiceImpl impl } if (i7 > 0) { -if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == null){//非 事件处置 和收费站等多条数据添加 +//if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == null){//非 事件处置 和收费站等多条数据添加 +/*if (eventType !=3 &&dcEventId == null){//非 事件处置 和收费站等多条数据添加 //中间库 MdEvent mdEvent = new MdEvent(dcEvent); middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); -} +}*/ switch (eventType) { //交通事故 case 1: @@ -236,9 +237,6 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == dcEvent.getDcEventTrafficControl().setFacilityId(dcEvent.getDcEventTrafficControl().getFacilityIds()[0]);//取出数组字段赋值 设施id int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl());// }else { - //中间库 - MdEvent mdEvent = new MdEvent(dcEvent); - middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); extracted(dcEvent);//事件推送到 首页 dcEvent.getDcEventTrafficControl().setId(uuid); @@ -303,10 +301,6 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == dcEvent.setStakeMark(extracted(facilityId)); } dcEventMapper.insertDcEvent(dcEvent); - extracted(dcEvent); - //中间库 - MdEvent mdEvent = new MdEvent(dcEvent); - middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); int i6 = dcEventTrafficControlMapper.insertDcEventTrafficControl(dcEvent.getDcEventTrafficControl()); @@ -354,9 +348,6 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityIds()[i]); dcEvent.setStakeMark(extracted(facilityId)); } - //中间库 - MdEvent mdEvent = new MdEvent(dcEvent); - middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); dcEventMapper.insertDcEvent(dcEvent); extracted(dcEvent); @@ -439,7 +430,10 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == } } String content= direction+" " + dcEvent.getStakeMark()+" "+HAPPEN+EventSubclass+EVENT ; - WebSocketService.broadcast(SUBEVENT, content); //推送事件消息 0不是感知事件 + Map contentMap = new HashMap<>(); + contentMap.put("content",content); + contentMap.put("event",dcEvent); + WebSocketService.broadcast(SUBEVENT, contentMap); //推送事件消息 0不是感知事件 } //根据路网设施查询桩号 @@ -535,8 +529,6 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == //事件处置流程记录 DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(dcEvent.getId()); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(dcEvent.getEventType().intValue()); if (processConfigList != null && processConfigList.size() > 0){ @@ -647,8 +639,6 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == //事件处置流程记录 DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(dcEvent.getId()); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(dcEvent.getEventType().intValue()); if (processConfigList != null && processConfigList.size() > 0){ @@ -680,23 +670,17 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == @Override public int updateDcEvent(DcEvent dcEvent) { DcEvent oldEvent = selectEventSubclassById(dcEvent.getEventType().intValue(),dcEvent.getId()); - dcEvent.setUpdateTime(DateUtils.getNowDate()); int i7 = dcEventMapper.updateDcEvent(dcEvent); if (i7 > 0) { - String context = comparisonInfo(oldEvent,dcEvent); - //事件处置流程记录 DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(dcEvent.getId()); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); dcEventProcess.setContext(context); dcEventProcessService.insertDcEventProcess(dcEventProcess); - //中间库 MdEvent mdEvent = new MdEvent(dcEvent); middleDatabaseService.updateMiddleDatabaseEvent(mdEvent); @@ -765,59 +749,62 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == * @return 结果 */ @Override - public int deleteDcEventByIds(int eventType, String[] ids) { - int i7 = dcEventMapper.deleteDcEventByIds(ids); - if (i7 > 0) { - switch (eventType) { - //交通事故 - case 1: - int i1 = dcEventAccidentMapper.deleteDcEventAccidentByIds(ids); - break; - //车辆事故 - case 2: - int i5 = dcEventVehicleAccidentMapper.deleteDcEventVehicleAccidentByIds(ids); - break; - //交通管制 - case 3: - int i6 = dcEventTrafficControlMapper.deleteDcEventTrafficControlByIds(ids); - break; - //交通拥堵 - case 4: - int i4 = dcEventTrafficCongestionMapper.deleteDcEventTrafficCongestionByIds(ids); + public int deleteDcEventByIds(String[] ids) { + int i7=-1; + for (String id : ids) { + DcEvent dcEvent = dcEventMapper.selectDcEventMainById(id); + int eventType = Math.toIntExact(dcEvent.getEventType()); + i7 = dcEventMapper.deleteDcEventById(id); - break; - //非法上路 - case 5: - break; - //路障清除 - case 6: - break; - //施工建设 - case 7: - int i2 = dcEventConstructionMapper.deleteDcEventConstructionByIds(ids); - break; - //服务区异常 - case 8: - int i3 = dcEventServiceAreaMapper.deleteDcEventServiceAreaByIds(ids); - break; - //设施设备隐患 - case 9: - break; - //异常天气 - case 10: - int i = dcEventAbnormalWeatherMapper.deleteDcEventAbnormalWeatherByIds(ids); - break; - //其他事件 - case 11: - break; - // - default: - break; + switch (eventType) { + //交通事故 + case 1: + int i1 = dcEventAccidentMapper.deleteDcEventAccidentById(id); + break; + //车辆事故 + case 2: + int i5 = dcEventVehicleAccidentMapper.deleteDcEventVehicleAccidentById(id); + break; + //交通管制 + case 3: + int i6 = dcEventTrafficControlMapper.deleteDcEventTrafficControlById(id); + break; + //交通拥堵 + case 4: + int i4 = dcEventTrafficCongestionMapper.deleteDcEventTrafficCongestionById(id); + + break; + //非法上路 + case 5: + break; + //路障清除 + case 6: + break; + //施工建设 + case 7: + int i2 = dcEventConstructionMapper.deleteDcEventConstructionById(id); + break; + //服务区异常 + case 8: + int i3 = dcEventServiceAreaMapper.deleteDcEventServiceAreaById(id); + break; + //设施设备隐患 + case 9: + break; + //异常天气 + case 10: + int i = dcEventAbnormalWeatherMapper.deleteDcEventAbnormalWeatherById(id); + break; + //其他事件 + case 11: + break; + // + default: + break; + } } return i7; - } else { - return -1; - } + } /** @@ -976,11 +963,13 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == if (i > 0){ DcEvent dcEvent = dcEventMapper.selectDcEventById(id); + //中间库 + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); + //事件处置流程记录 DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(dcEvent.getId()); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); List processConfigList = dcProcessConfigMapper.selectDcProcessConfigByEventType(dcEvent.getEventType().intValue()); if (processConfigList != null && processConfigList.size() > 0){ @@ -1034,7 +1023,7 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == try { Date date = new Date(); date.setTime(Long.parseLong(result.getRight().toString())); - result.setRight(df.format(date));; + result.setRight(df.format(date)); } catch (Exception e){ e.printStackTrace(); } @@ -1395,17 +1384,27 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == */ @Override public AjaxResult completeEvent(String eventId){ + + DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); + if (dcEvent.getEventState() != null && dcEvent.getEventState().equals(2L)){ + return AjaxResult.error("事件已解除,无法进行操作!"); + } + boolean flag = dcEventMapper.completeEvent(eventId); if (flag){ - DcEvent dcEvent = dcEventMapper.selectDcEventById(eventId); - String datePoor = getDatePoor(dcEvent.getEndTime(),dcEvent.getStartTime()); + + //中间库 + MdEvent mdEvent = new MdEvent(); + mdEvent.setFusionId(eventId); + mdEvent.setEventStatus(2L); + middleDatabaseService.updateMiddleDatabaseEvent(mdEvent); + + String datePoor = getDatePoor(new Date(),dcEvent.getStartTime()); //事件处置流程记录 DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(eventId); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); dcEventProcess.setContext("事件解除,处置完毕,处置时长:" + datePoor); @@ -1426,11 +1425,14 @@ if (dcEvent.getDcEventTrafficControl().getFacilityIds().length<1 &&dcEventId == @Override public AjaxResult skipClear(String eventId){ + int i = dcEventMapper.selectClearInfo(eventId); + if (i > 0){ + return AjaxResult.error("已跳过清障,无法重复操作!"); + } + //事件处置流程记录 DcEventProcess dcEventProcess = new DcEventProcess(); dcEventProcess.setEventId(eventId); - dcEventProcess.setOperationTime(new Date()); - dcEventProcess.setOperator(SecurityUtils.getUserId().toString()); dcEventProcess.setSource(1); dcEventProcess.setProcessType(1); dcEventProcess.setProcessId(6L); diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java new file mode 100644 index 00000000..e562dee8 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishManageServiceImpl.java @@ -0,0 +1,107 @@ +package com.zc.business.service.impl; + +import com.ruoyi.common.utils.DateUtils; +import com.zc.business.domain.DcPublishManage; +import com.zc.business.mapper.DcPublishManageMapper; +import com.zc.business.service.IDcPublishManageService; +import com.zc.business.utils.StakeMarkUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 信息发布管理记录Service业务层处理 + * + * @author ruoyi + * @date 2024-04-19 + */ +@Service +public class DcPublishManageServiceImpl implements IDcPublishManageService +{ + @Autowired + private DcPublishManageMapper dcPublishManageMapper; + + /** + * 查询信息发布管理记录 + * + * @param id 信息发布管理记录主键 + * @return 信息发布管理记录 + */ + @Override + public DcPublishManage selectDcPublishManageById(Long id) + { + return dcPublishManageMapper.selectDcPublishManageById(id); + } + + /** + * 查询信息发布管理记录列表 + * + * @param dcPublishManage 信息发布管理记录 + * @return 信息发布管理记录 + */ + @Override + public List selectDcPublishManageList(DcPublishManage dcPublishManage) + { + StakeMarkUtils stakeMarkUtils = new StakeMarkUtils(); + if (StringUtils.isNotBlank(dcPublishManage.getStartStakeMarkValue())) { + Integer stakeMark = stakeMarkUtils.stakeMarkToInt(dcPublishManage.getStartStakeMarkValue()); + dcPublishManage.setStartStakeMark(stakeMark); + } + if (StringUtils.isNotBlank(dcPublishManage.getEndStakeMarkValue())) { + Integer endMark = stakeMarkUtils.stakeMarkToInt(dcPublishManage.getEndStakeMarkValue()); + dcPublishManage.setEndStakeMark(endMark); + } + return dcPublishManageMapper.selectDcPublishManageList(dcPublishManage); + } + + /** + * 新增信息发布管理记录 + * + * @param dcPublishManage 信息发布管理记录 + * @return 结果 + */ + @Override + public int insertDcPublishManage(DcPublishManage dcPublishManage) + { + dcPublishManage.setCreateTime(DateUtils.getNowDate()); + return dcPublishManageMapper.insertDcPublishManage(dcPublishManage); + } + + /** + * 修改信息发布管理记录 + * @param dcPublishManage 信息发布管理记录 + * @return 结果 + */ + @Override + public int updateDcPublishManage(DcPublishManage dcPublishManage) + { + dcPublishManage.setUpdateTime(DateUtils.getNowDate()); + return dcPublishManageMapper.updateDcPublishManage(dcPublishManage); + } + + /** + * 批量删除信息发布管理记录 + * + * @param ids 需要删除的信息发布管理记录主键 + * @return 结果 + */ + @Override + public int deleteDcPublishManageByIds(Long[] ids) + { + return dcPublishManageMapper.deleteDcPublishManageByIds(ids); + } + + /** + * 删除信息发布管理记录信息 + * + * @param id 信息发布管理记录主键 + * @return 结果 + */ + @Override + public int deleteDcPublishManageById(Long id) + { + return dcPublishManageMapper.deleteDcPublishManageById(id); + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java new file mode 100644 index 00000000..f9e8f5ab --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPublishingChannelsServiceImpl.java @@ -0,0 +1,101 @@ +package com.zc.business.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zc.business.mapper.DcPublishingChannelsMapper; +import com.zc.business.domain.DcPublishingChannels; +import com.zc.business.service.IDcPublishingChannelsService; + +/** + * 发布渠道Service业务层处理 + * + * @author ruoyi + * @date 2024-04-19 + */ +@Service +public class DcPublishingChannelsServiceImpl implements IDcPublishingChannelsService +{ + @Autowired + private DcPublishingChannelsMapper dcPublishingChannelsMapper; + + /** + * 查询发布渠道 + * + * @param id 发布渠道主键 + * @return 发布渠道 + */ + @Override + public DcPublishingChannels selectDcPublishingChannelsById(Long id) + { + return dcPublishingChannelsMapper.selectDcPublishingChannelsById(id); + } + + /** + * 查询发布渠道列表 + * + * @param dcPublishingChannels 发布渠道 + * @return 发布渠道 + */ + @Override + public List selectDcPublishingChannelsList(DcPublishingChannels dcPublishingChannels) + { + return dcPublishingChannelsMapper.selectDcPublishingChannelsList(dcPublishingChannels); + } + + /** + * 新增发布渠道 + * + * @param dcPublishingChannels 发布渠道 + * @return 结果 + */ + @Override + public int insertDcPublishingChannels(DcPublishingChannels dcPublishingChannels) + { + dcPublishingChannels.setCreateTime(DateUtils.getNowDate()); + return dcPublishingChannelsMapper.insertDcPublishingChannels(dcPublishingChannels); + } + + /** + * 修改发布渠道 + * + * @param dcPublishingChannels 发布渠道 + * @return 结果 + */ + @Override + public int updateDcPublishingChannels(DcPublishingChannels dcPublishingChannels) + { + dcPublishingChannels.setUpdateTime(DateUtils.getNowDate()); + return dcPublishingChannelsMapper.updateDcPublishingChannels(dcPublishingChannels); + } + + /** + * 批量删除发布渠道 + * + * @param ids 需要删除的发布渠道主键 + * @return 结果 + */ + @Override + public int deleteDcPublishingChannelsByIds(Long[] ids) + { + return dcPublishingChannelsMapper.deleteDcPublishingChannelsByIds(ids); + } + + /** + * 删除发布渠道信息 + * + * @param id 发布渠道主键 + * @return 结果 + */ + @Override + public int deleteDcPublishingChannelsById(Long id) + { + return dcPublishingChannelsMapper.deleteDcPublishingChannelsById(id); + } + //查询数据类型是否已经存在 + @Override + public List selectChannelsDataCategory(Integer dataCategory) { + return dcPublishingChannelsMapper.selectChannelsDataCategory(dataCategory); + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcSwitchServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcSwitchServiceImpl.java new file mode 100644 index 00000000..5d77cf24 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcSwitchServiceImpl.java @@ -0,0 +1,165 @@ +package com.zc.business.service.impl; + +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.StringUtils; +import com.zc.business.constant.RedisKeyConstants; +import com.zc.business.domain.DcDevice; +import com.zc.business.domain.DcSwitch; +import com.zc.business.mapper.DcSwitchMapper; +import com.zc.business.service.DcSwitchService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.*; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.stream.Collectors; + +/** + * 交换机Service实现类 + * + * @author wangjiabao + * @date 2024-04-19 + */ +@Service +public class DcSwitchServiceImpl extends ServiceImpl implements DcSwitchService { + + @Resource + private DcSwitchMapper dcSwitchMapper; + + @Resource + private RedisCache redisCache; + + /** + * 查询交换机 + */ + @Override + public List getSwitchList(DcSwitch dcSwitch) { + return getDeviceListBySwitch(dcSwitchMapper.getSwitchList(dcSwitch)); + } + + /** + * 根据设备列表查询设备 + */ + @Override + public List getDeviceList(String deviceList) { + if (StringUtils.isEmpty(deviceList)) { + return new ArrayList<>(); + } + List devices = Arrays.stream(deviceList.split(",")).collect(Collectors.toList()); + List dcDevices = new ArrayList<>(); + devices.forEach(device -> { + DcDevice cacheMapValue = redisCache.getCacheMapValue(RedisKeyConstants.DC_DEVICE_ID,device); + dcDevices.add(cacheMapValue); + }); + return dcDevices; + } + + /** + * 查询所有数据 + * + * @return + */ + @Override + public List getSwitchListAll() { + List deviceListBySwitch = dcSwitchMapper.getSwitchList(new DcSwitch()); + List dcSwitches = getDeviceListBySwitch(deviceListBySwitch); + List returnList = new ArrayList<>(); + List tempList = new ArrayList<>(); + for (DcSwitch switche : dcSwitches) { + tempList.add(switche.getSwitchId()); + } + for (DcSwitch switches : dcSwitches) { + // 如果是顶级节点, 遍历该父节点的所有子节点 + if (!tempList.contains(switches.getParentId())) { + recursionFn(dcSwitches, switches); + returnList.add(switches); + } + } + if (returnList.isEmpty()) { + returnList = dcSwitches; + } + return returnList; + } + + /** + * 处置交换机数据-获取设备数据 + * @param list + * @return + */ + public List getDeviceListBySwitch(List list) { + ExecutorService executor = Executors.newFixedThreadPool(100); + CountDownLatch latch = new CountDownLatch(list.size()); + list.forEach(dcSwitch -> { + executor.execute(() ->{ + try { + if (StringUtils.isNotEmpty(dcSwitch.getDeviceList())) { + // 说明是设备交换机 + List deviceList = getDeviceList(dcSwitch.getDeviceList()); + if (deviceList.size() > 0) { + Map> collect = deviceList.stream().collect(Collectors.groupingBy(DcDevice::getDeviceType)); + dcSwitch.setDcDeviceList(collect); + } + } + }catch (Exception e) { + e.printStackTrace(); + }finally { + latch.countDown(); + } + }); + }); + + try { + latch.await(); // 等待所有线程执行完毕 + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + } finally { + executor.shutdown(); + } + return list; + } + + /** + * 批量修改网络状态 + * @return + */ + @Override + public int updateBatchByNetWorkStatus(List list) { + return dcSwitchMapper.updateBatchByNetWorkStatus(list); + } + + private void recursionFn(List list, DcSwitch t) { + // 得到子节点列表 + List childList = getChildList(list, t); + t.setChildren(childList); + for (DcSwitch tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 得到子节点列表 + */ + private List getChildList(List list, DcSwitch t) { + List tlist = new ArrayList<>(); + Iterator it = list.iterator(); + while (it.hasNext()) { + DcSwitch n = (DcSwitch) it.next(); + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getSwitchId().longValue()) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 判断是否有子节点 + */ + private boolean hasChild(List list, DcSwitch t) { + return getChildList(list, t).size() > 0; + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcVoiceBroadcastServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcVoiceBroadcastServiceImpl.java new file mode 100644 index 00000000..8709e93e --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcVoiceBroadcastServiceImpl.java @@ -0,0 +1,102 @@ +package com.zc.business.service.impl; + +import java.util.List; +import com.ruoyi.common.utils.DateUtils; +import com.zc.business.domain.DcVoiceBroadcast; +import com.zc.business.mapper.DcVoiceBroadcastMapper; +import com.zc.business.service.IDcVoiceBroadcastService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + + +/** + * 语音广播预发布Service业务层处理 + * + * @author ruoyi + * @date 2024-04-19 + */ +@Service +public class DcVoiceBroadcastServiceImpl implements IDcVoiceBroadcastService +{ + @Autowired + private DcVoiceBroadcastMapper dcVoiceBroadcastMapper; + + /** + * 查询语音广播预发布 + * + * @param id 语音广播预发布主键 + * @return 语音广播预发布 + */ + @Override + public DcVoiceBroadcast selectDcVoiceBroadcastById(Long id) + { + return dcVoiceBroadcastMapper.selectDcVoiceBroadcastById(id); + } + + /** + * 查询语音广播预发布列表 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 语音广播预发布 + */ + @Override + public List selectDcVoiceBroadcastList(DcVoiceBroadcast dcVoiceBroadcast) + { + return dcVoiceBroadcastMapper.selectDcVoiceBroadcastList(dcVoiceBroadcast); + } + + /** + * 新增语音广播预发布 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 结果 + */ + @Override + public int insertDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast) + { + dcVoiceBroadcast.setCreateTime(DateUtils.getNowDate()); + return dcVoiceBroadcastMapper.insertDcVoiceBroadcast(dcVoiceBroadcast); + } + + /** + * 修改语音广播预发布 + * + * @param dcVoiceBroadcast 语音广播预发布 + * @return 结果 + */ + @Override + public int updateDcVoiceBroadcast(DcVoiceBroadcast dcVoiceBroadcast) + { + dcVoiceBroadcast.setUpdateTime(DateUtils.getNowDate()); + return dcVoiceBroadcastMapper.updateDcVoiceBroadcast(dcVoiceBroadcast); + } + + /** + * 批量删除语音广播预发布 + * + * @param ids 需要删除的语音广播预发布主键 + * @return 结果 + */ + @Override + public int deleteDcVoiceBroadcastByIds(Long[] ids) + { + return dcVoiceBroadcastMapper.deleteDcVoiceBroadcastByIds(ids); + } + + /** + * 删除语音广播预发布信息 + * + * @param id 语音广播预发布主键 + * @return 结果 + */ + @Override + public int deleteDcVoiceBroadcastById(Long id) + { + return dcVoiceBroadcastMapper.deleteDcVoiceBroadcastById(id); + } + + @Override + public List selectDcVoiceBroadcastListByCategory(String category) { + return dcVoiceBroadcastMapper.selectDcVoiceBroadcastListByCategory(category); + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java index d784f5a3..3c981218 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcWarningServiceImpl.java @@ -7,12 +7,7 @@ import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.uuid.IdUtils; -import com.zc.business.domain.DcDispatch; -import com.zc.business.domain.DcDispatchResource; -import com.zc.business.domain.DcEvent; -import com.zc.business.domain.DcWaringStrategy; -import com.zc.business.domain.DcWarning; -import com.zc.business.domain.DcWarningBatchConvert; +import com.zc.business.domain.*; import com.zc.business.enums.ValueConverter; import com.zc.business.enums.WarningSubclassEnum; import com.zc.business.mapper.DcEventMapper; @@ -29,6 +24,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.lang.reflect.Array; +import java.rmi.MarshalledObject; +import java.util.concurrent.ThreadLocalRandom; import javax.annotation.Resource; import java.util.ArrayList; import java.util.Comparator; @@ -53,6 +51,8 @@ public class DcWarningServiceImpl implements IDcWarningService private DcEventMapper dcEventMapper; @Autowired private IDcEventService dcEventService; + @Autowired + private DcEventProcessServiceImpl dcEventProcessService; @Resource private RedisCache redisCache; private final String HAPPEN = "发生"; @@ -204,7 +204,10 @@ public class DcWarningServiceImpl implements IDcWarningService } } String content= direction+" " + dcWarning.getStakeMark()+" "+HAPPEN+EventSubclass+EVENT ; - WebSocketService.broadcast(SUBEVENT, content); //推送事件消息 0不是感知事件 + Map contentMap = new HashMap<>(); + contentMap.put("content",content); + contentMap.put("event",dcWarning); + WebSocketService.broadcast(SUBEVENT, contentMap); //推送事件消息 0不是感知事件 } //优先级策略(还差优先级策略需要配置) @@ -503,18 +506,46 @@ public class DcWarningServiceImpl implements IDcWarningService } List> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> { return (Double) map.get("difference"); })).collect(Collectors.toList()); - HashMap map = sortedHashMaps.get(0); - Long id = (Long) map.get("id");//取出最近的机构id - if (id!=null){ - DcDispatch dcDispatch = new DcDispatch(); - dcDispatch.setEventId(dcWarning.getId()); - dcDispatch.setOrganizationId(id); - dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定记录 + HashMap hashMap = dcWarningMapper.selectDcDispatch(dcWarning.getId());//查询事件是否已经有转的调度记录 + if (!sortedHashMaps.isEmpty()&&hashMap==null) { + HashMap map = sortedHashMaps.get(0); + Long id = (Long) map.get("id");//取出最近的机构id + if (id != null) { + DcDispatch dcDispatch = new DcDispatch(); + DcDispatchResource dcDispatchResource = new DcDispatchResource(); + dcDispatch.setDeptId(SecurityUtils.getLoginUser().getDeptId()); + dcDispatch.setEventId(dcWarning.getId()); + dcWarningMapper.insertDcDispatch(dcDispatch);//事件绑定信息记录 + Long dispatchId = dcDispatch.getId();//信息记录id + List> employeesMap = dcWarningMapper.selectOrganizationEmployees(dispatchId);//人员map + if (employeesMap != null) { + // 生成一个随机索引,范围在0到列表长度减1之间 + int randomIndex = ThreadLocalRandom.current().nextInt(employeesMap.size()); + HashMap randomEmployee = employeesMap.get(randomIndex); + Long employeesId = (Long) randomEmployee.get("id");//随机人员id + dcDispatchResource.setResourceId(employeesId);//资源id + dcDispatchResource.setDispatchType(1);//资源类型 + dcDispatchResource.setDispatchId(dispatchId);//信息记录id + dcWarningMapper.insertDispatchResource(dcDispatchResource); + } + List> vehiclesMap = dcWarningMapper.selectVehicles(dispatchId);//车辆map + if (vehiclesMap != null) { + // 生成一个随机索引,范围在0到列表长度减1之间 + int randomIndex = ThreadLocalRandom.current().nextInt(vehiclesMap.size()); + HashMap randomEmployee = employeesMap.get(randomIndex); + Long vehiclesId = (Long) randomEmployee.get("id");//随机车辆id + dcDispatchResource.setResourceId(vehiclesId);//资源id + dcDispatchResource.setDispatchType(2);//资源类型 + dcDispatchResource.setDispatchId(dispatchId);//信息记录id + dcWarningMapper.insertDispatchResource(dcDispatchResource);//绑定车辆信息 + } + } } if (insertDcEvent==0){ return AjaxResult.error("操作失败"); } return AjaxResult.success("操作成功"); + } @Override @@ -616,6 +647,7 @@ public class DcWarningServiceImpl implements IDcWarningService //逻辑,调用全部的机构信息,计算传入的桩号与机构桩号的距离作为排序使用,使用机构的id调出车辆,人员,值班等信息 List> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称 ArrayList> hashMaps = new ArrayList<>(); + Map mapAll = new HashMap<>(); for (HashMap map:mapList){ if (StringUtils.isBlank(map.get("stakeMark").toString())){ continue; @@ -627,57 +659,92 @@ public class DcWarningServiceImpl implements IDcWarningService Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值 map.put("difference",difference/1000.0);//米转公里加入到map Long id = (Long) map.get("id");//机构的id,用户获取人员、值班、车辆等信息 - List> employeesMap = dcWarningMapper.selectOrganizationEmployees(id);//人员map - List> shiftsMap = dcWarningMapper.selectShifts(id);//值班map - List> vehiclesMap = dcWarningMapper.selectVehicles(id);//车辆map + List> employeesMap = dcWarningMapper.selectEmployeesDispatch(id,dcWarning.getId());//人员map + List> vehiclesMap = dcWarningMapper.selectVehiclesDispatch(id,dcWarning.getId());//车辆map map.put("employeesMap",employeesMap); - map.put("shiftsMap",shiftsMap); map.put("vehiclesMap",vehiclesMap); hashMaps.add(map); } - List> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> { return (Double) map.get("difference"); })).collect(Collectors.toList()); - return AjaxResult.success(sortedHashMaps); + mapAll.put("listData",sortedHashMaps); + HashMap map = dcWarningMapper.selectDcDispatch(dcWarning.getId());//获取机构id与资源id + if (map!=null){ + HashMap hashMap = new HashMap<>(); + Long id = (Long) map.get("id");//调度记录id + Object deptName =map.get("deptName");//部门名称 + List> shifts = dcWarningMapper.selectShiftsEmployees();//值班为空把全部的人员信息作为值班人员信息 + List> resource = dcWarningMapper.selectDispatchResource(id);//全部资源信息 + List> employeesChoice = dcWarningMapper.selectEmployeesChoice(id);//选中人员信息 + List> vehiclesChoice = dcWarningMapper.selectVehiclesChoice(id);//选中车辆信息 + hashMap.put("id",id);//调度记录id + hashMap.put("deptName",deptName); + hashMap.put("shifts",shifts); + hashMap.put("resource",resource); + mapAll.put("resource",hashMap); + mapAll.put("employeesChoice",employeesChoice); + mapAll.put("vehiclesChoice",vehiclesChoice); + } + return AjaxResult.success(mapAll); } @Override - public DcDispatch insertDispatch(DcDispatch dcDispatch) { - dcWarningMapper.insertDcDispatch(dcDispatch); - return dcDispatch; + public Integer insertDispatch(DcDispatch dcDispatch) { + if (dcDispatch.getId()==null){ //id为空说明新增 + return dcWarningMapper.insertDcDispatch(dcDispatch); + } + return dcWarningMapper.updateDcDispatch(dcDispatch); } @Override - public Integer insertDispatchSource(DcDispatchResource dcDispatchResource) { - return dcWarningMapper.insertDispatchResource(dcDispatchResource); + @Transactional(rollbackFor = Exception.class) + public Integer insertDispatchSource(HashMap map) { + DcDispatchResource dcDispatchResource = new DcDispatchResource(); + Integer pat = (Integer) map.get("dispatchId"); + long dispatchId = pat.longValue(); + dcWarningMapper.deleteDispatchResource(dispatchId);//删除全部属于该调度记录下的全部资源 + ArrayList> employeesArray = (ArrayList>) map.get("employees");//取出人员 + + String context = "路管人员"; + if (employeesArray!=null&&employeesArray.size()>0) { + for (Map array : employeesArray) { + dcDispatchResource.setDispatchType(1);//类型 + dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString()));//资源id + dcDispatchResource.setDispatchId(dispatchId);//关联调度记录 + Integer integer = dcWarningMapper.insertDispatchResource(dcDispatchResource); + context = context + array.get("name").toString() + "、"; + if (integer == 0) { + throw new RuntimeException("插入资源失败"); + } + } + context = context.substring(0,context.length() -1); + context += "参与事件救援"; + } + ArrayList> vehicleArray = (ArrayList>) map.get("vehicle");////取出车辆 + if (vehicleArray!=null&&vehicleArray.size()>0) { + context += ",救援车辆"; + for (Map array : vehicleArray) { + dcDispatchResource.setDispatchType(2); + dcDispatchResource.setResourceId(Long.valueOf(array.get("id").toString())); + dcDispatchResource.setDispatchId(dispatchId); + Integer integer = dcWarningMapper.insertDispatchResource(dcDispatchResource); + + context = context + array.get("vehiclePlate").toString() + "、"; + if (integer == 0) { + throw new RuntimeException("插入资源失败"); + } + } + context = context.substring(0,context.length() -1); + context += "参与事件救援"; + } + + DcDispatch dcDispatch = dcWarningMapper.selectDcDispatchById(dispatchId); + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(dcDispatch.getEventId()); + dcEventProcess.setSource(1); + dcEventProcess.setContext(context); + dcEventProcessService.insertDcEventProcess(dcEventProcess); + return 1; } - //依据桩号计算出记录最近的机构id - public AjaxResult stake(DcWarning dcWarning){ - String stakeMark = dcWarning.getStakeMark(); - ArrayList> hashMaps = new ArrayList<>(); - List> mapList = dcWarningMapper.selectRecentlySection();//全部机构的桩号和名称 - for (HashMap map:mapList){ - if (StringUtils.isBlank(map.get("stakeMark").toString())){ - continue; - } - Long id = (Long) map.get("id");//机构的id - String stakeMarkNew = map.get("stakeMark").toString();//机构桩号 - StakeMarkUtils stakeMarkUtils = new StakeMarkUtils(); - Integer itselfStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMarkNew);//机构本身的米数 - Integer afferentStakeMark = stakeMarkUtils.stakeMarkToInt(stakeMark);//传入的桩号米数 - Integer difference =Math.abs(afferentStakeMark-itselfStakeMark); //计算距离绝对值 - map.put("difference",difference/1000.0);//米转公里加入到map - map.put("id",id); - hashMaps.add(map); - } - List> sortedHashMaps = hashMaps.stream().sorted(Comparator.comparing(map -> { - return (Double) map.get("difference"); })).collect(Collectors.toList()); - if (!sortedHashMaps.isEmpty()){ - HashMap map = sortedHashMaps.get(0); - Long id = (Long) map.get("id"); - return AjaxResult.success(id); - } - return null; - } } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java index aa151b06..825e6c9b 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/MsmServiceImpl.java @@ -9,25 +9,28 @@ import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.aliyuncs.profile.DefaultProfile; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.redis.RedisCache; +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.spring.SpringUtils; +import com.zc.business.domain.DcEventProcess; +import com.zc.business.domain.DcPublishManage; +import com.zc.business.mapper.DcPublishManageMapper; import com.zc.business.service.IMsmService; import com.zc.business.utils.HttpUtil; import org.apache.commons.lang3.StringUtils; import org.json.JSONObject; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Resource; import java.io.InputStream; - import java.net.HttpURLConnection; import java.net.URL; +import java.util.ArrayList; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.Random; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -38,7 +41,16 @@ import java.util.concurrent.TimeUnit; @Service public class MsmServiceImpl implements IMsmService { private static final String WEIXINTUISONTOKEN = "weixintuisontoken";//redis策略缓存的key - + private static final String ALIYUNACCESSKEYID="LTAI5tENd3j1tP5t2fF4fxaX";//阿里短信accessKeyId + private static final String ALIYUNAECRET="i86Yenj13XRd2aeZMtybpKxsqI1VRU";//阿里云密钥 + private static final String ALIYUNTEMPLATE="SMS_154950909";//阿里云短信模板 + private static final String WEIXINAPPID="wx9ee0e3babfd8d2af";//微信公众号appid + private static final String WEIXINAPPSECRET="de2ecb80b30d63135918ba3ae6ffb711";//微信公众号APPSECRET + private static final String WEIXINTEMPLATE="D_yBiN7aDl2pw3bhSqU_Fbi0D8BHXL0qeBjhusWVO68";//微信公众号推送模板id + @Autowired + private DcEventProcessServiceImpl dcEventProcessService; + @Autowired + private DcPublishManageMapper dcPublishManageMapper; /** * 发送短信 * @@ -48,13 +60,13 @@ public class MsmServiceImpl implements IMsmService { public boolean send(String phone) { //地域节点、阿里云的id、秘钥 DefaultProfile profile = DefaultProfile.getProfile("cn-qingdao", - "LTAI5tENd3j1tP5t2fF4fxaX", "i86Yenj13XRd2aeZMtybpKxsqI1VRU"); + ALIYUNACCESSKEYID, ALIYUNAECRET); IAcsClient client = new DefaultAcsClient(profile); SendSmsRequest request = new SendSmsRequest(); request.setSysRegionId("cn-qingdao");//地域节点 request.putQueryParameter("PhoneNumbers", phone); //手机号,要填绑定测试的手机号码 request.putQueryParameter("SignName", "阿里云短信测试"); //阿里云签名名称 - request.putQueryParameter("TemplateCode", "SMS_154950909"); //阿里云模板code + request.putQueryParameter("TemplateCode", ALIYUNTEMPLATE); //阿里云模板code String code = String.format("%04d", new Random().nextInt(10000));//验证码 HashMap map = new HashMap<>(); map.put("code", code); //参数加入到map @@ -62,7 +74,7 @@ public class MsmServiceImpl implements IMsmService { request.putQueryParameter("TemplateParam", json); try { SendSmsResponse response = client.getAcsResponse(request); - if (response != null && response.getCode() != null && response.getCode().equals("OK")) { + if (response != null && response.getCode() != null && response.getCode().equalsIgnoreCase("OK")) { return true; } return false; @@ -80,11 +92,13 @@ public class MsmServiceImpl implements IMsmService { // } //微信推送 @Override - public JSONArray wenXinSend(String appId, String appSecret) { + public JSONArray wenXinSend(String content) { MsmServiceImpl msmService = new MsmServiceImpl(); - return msmService.sendTemp(appId, appSecret); + return msmService.sendTemp(WEIXINAPPID, WEIXINAPPSECRET,content); } + + //获取微信token public static com.alibaba.fastjson.JSONObject getAccessToken(String appId, String appSecret) { String url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appId + "&secret=" + appSecret; @@ -111,15 +125,16 @@ public class MsmServiceImpl implements IMsmService { } //执行微信推送 - public JSONArray sendTemp(String appId, String appSecret) { + public JSONArray sendTemp(String appId, String appSecret,String content) { JSONArray objects = new JSONArray(); ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(100); MsmServiceImpl msmService = new MsmServiceImpl(); RedisCache redisCache = SpringUtils.getBean(RedisCache.class); String accessToken = redisCache.getCacheObject(WEIXINTUISONTOKEN); if (StringUtils.isBlank(accessToken)) { - accessToken = msmService.getAccessToken(appId, appSecret).getString("access_token");//获取到了access_token - String expiresIn = msmService.getAccessToken(appId, appSecret).getString("expires_in");//token有效秒数 + com.alibaba.fastjson.JSONObject jsonObject = msmService.getAccessToken(appId, appSecret); + accessToken = jsonObject.getString("access_token");//获取到了access_token + String expiresIn = jsonObject.getString("expires_in");//token有效秒数 redisCache.setCacheObject(WEIXINTUISONTOKEN, accessToken, Integer.parseInt(expiresIn), TimeUnit.SECONDS);//把token存入到redis中,并设置过期时间(时间来自于微信接口返回) } JSONArray userListOpenid = msmService.getUserListOpenid(accessToken); @@ -129,12 +144,12 @@ public class MsmServiceImpl implements IMsmService { executor.execute(() -> { // 封装要发送的json Map map = new HashMap(); - map.put("template_id", "D_yBiN7aDl2pw3bhSqU_Fbi0D8BHXL0qeBjhusWVO68");//模板消息id + map.put("template_id", WEIXINTEMPLATE);//模板消息id map.put("touser", openid.toString());//这里的openid是全部关注公众号的openid // 封装data com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject(); com.alibaba.fastjson.JSONObject name = new com.alibaba.fastjson.JSONObject(); - name.put("value", "做一个身体和心灵都勇敢的人,趁着身体未老,心灵还透明。晚安!"); + name.put("value", content); data.put("name", name); com.alibaba.fastjson.JSONObject weather = new com.alibaba.fastjson.JSONObject(); weather.put("value", "阴天 19°c"); @@ -176,7 +191,6 @@ public class MsmServiceImpl implements IMsmService { //获取微信公众号全部关注人的openid public static JSONArray getUserListOpenid(String accessToken) { String url = "https://api.weixin.qq.com/cgi-bin/user/get?access_token=" + accessToken; - ; com.alibaba.fastjson.JSONObject jsonObj = null; try { URL urlGet = new URL(url); @@ -197,4 +211,71 @@ public class MsmServiceImpl implements IMsmService { com.alibaba.fastjson.JSONObject data = jsonObj.getJSONObject("data"); return data.getJSONArray("openid"); } + //整合推送 + @Override + @Transactional(rollbackFor = Exception.class) + public AjaxResult putAll(HashMap map) { + MsmServiceImpl msmService = new MsmServiceImpl(); + DcPublishManage dcPublishManage = new DcPublishManage(); + String eventId = map.get("eventId").toString();//事件id + String content = map.get("content").toString();//信息内容 + Integer eventType = dcPublishManageMapper.selectEventType(eventId);//事件类型 + DcPublishManage publishManage = dcPublishManageMapper.selectPublishManage(eventType);//渠道信息 + if (publishManage!=null){ + dcPublishManage.setPublishChannelsId(publishManage.getId());//渠道id + } + dcPublishManage.setEventId(eventId);//事件id + dcPublishManage.setPublisher(SecurityUtils.getUsername());//发布人 + dcPublishManage.setPublishTime(DateUtils.getNowDate());//发布时间 + dcPublishManage.setCreateTime(DateUtils.getNowDate());//创建时间 + dcPublishManage.setContentDetails(map.get("content").toString()); + ArrayList array = (ArrayList) map.get("type"); + Boolean send = null; + Integer data = null; + String weiXin = "微信推送失败"; // 初始化为成功状态 + String message = "短信推送失败"; // 初始化为失败状态 + for (String type : array) { + if ("1".equals(type)) { //短信 + if (map == null || StringUtils.isBlank(map.get("phone").toString())) { + return AjaxResult.error("手机号为空"); + } + String string = map.get("phone").toString(); + send = msmService.send(string); + if (send == true) { + message = "短信推送成功"; // 如果 send 为 true,则短信推送成功 + dcPublishManage.setPublishStatus(1);//发布成功 + }else { + dcPublishManage.setPublishStatus(2);//发布失败 + } + dcPublishManage.setPublishChannels(1);//发布渠道类型:短信 + dcPublishManageMapper.insertDcPublishManage(dcPublishManage);//加入推送记录 + continue; + } + if ("2".equals(type)) { //微信 + JSONArray objects = msmService.wenXinSend(content); + data = (Integer) objects.get(0); + if (data == 0) { + weiXin = "微信推送成功"; // 如果所有 dateValue 都为0,则微信推送成功 + dcPublishManage.setPublishStatus(1);//发布成功 + }else { + dcPublishManage.setPublishStatus(2);//发布失败 + } + dcPublishManage.setPublishChannels(2);//发布渠道类型:微信公众号 + dcPublishManageMapper.insertDcPublishManage(dcPublishManage);//加入推送记录 + continue; + } + } + DcEventProcess dcEventProcess = new DcEventProcess(); + dcEventProcess.setEventId(eventId); + dcEventProcess.setSource(1); + dcEventProcess.setProcessType(2); + String context = "出行信息发布:" + content; + dcEventProcess.setContext(context); + dcEventProcessService.insertDcEventProcess(dcEventProcess); + if ("短信推送成功".equals(message) && "微信推送成功".equals(weiXin)) { + return AjaxResult.success(message + "," + weiXin); + } else { + return AjaxResult.error(message + "," + weiXin); + } + } } \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml b/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml index 8613d775..7be095d3 100644 --- a/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcBoardReleaseLogMapper.xml @@ -45,6 +45,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.release_ip = #{releaseIp} and t1.platform = #{platform} + order by t1.id desc select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name, t1.device_code, t1.device_type, t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site,t1.use_state,t1.device_state,t1.other_config,t1.remark, - t1.create_time,t1.update_time,t1.facilities_type,t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type, + t1.create_time,t1.update_time,t1.facilities_type,t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type, t1.facilities_type,t2.longitude,t2.latitude,t3.manufacturer from dc_device t1 left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction @@ -101,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and t1.facilities_type = #{facilitiesType} and t1.device_ip = #{deviceIp} and t1.stake_mark_range = #{stakeMarkRange} + and t1.network_segment = #{networkSegment} and t1.device_img = #{deviceImg} and t1.child_type = #{childType} @@ -122,7 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name, t1.device_code, t1.device_type,t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site, t1.use_state,t1.device_state,t1.other_config,t1.remark,t1.create_time,t1.update_time,t1.facilities_type, - t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude + t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude from dc_device t1 left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction where !ISNULL(t1.iot_device_id) and t1.device_type = '1' and t1.direction = #{direction} @@ -132,7 +135,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select t1.id, t1.iot_device_id, t1.group_id, t1.product_id, t1.stake_mark, t1.direction, t1.device_name, t1.device_code, t1.device_type,t1.installation_Date,t1.production_date,t1.durable_years,t1.installation_site, t1.use_state,t1.device_state,t1.other_config,t1.remark,t1.create_time,t1.update_time,t1.facilities_type, - t1.device_ip,t1.stake_mark_range,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude + t1.device_ip,t1.stake_mark_range,t1.network_segment,t1.device_img,t1.child_type,t1.facilities_type,t2.longitude,t2.latitude from dc_device t1 left join dc_stake_mark t2 on t1.stake_mark = t2.stake_mark and t1.direction = t2.direction where t1.device_type = '2' and t1.direction = #{direction} diff --git a/zc-business/src/main/resources/mapper/business/DcEventImportantMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventImportantMapper.xml index 2e61910a..700322c0 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventImportantMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventImportantMapper.xml @@ -105,7 +105,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" chemicals_name = #{chemicalsName}, leakage_level = #{leakageLevel}, - where id = #{id} + where event_id = #{eventId} diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml index 10718b22..5b4267f5 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml @@ -144,9 +144,9 @@ --> - + SELECT id, dc_event.dept_id as dept_id, @@ -500,6 +500,10 @@ where dc_event.id = #{id} + @@ -748,12 +752,18 @@ + diff --git a/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml index 28e045e5..cab4e024 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventProcessMapper.xml @@ -9,6 +9,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, event_id, operation_time, operator, source, process_type, context, process_id, process_name, `type` from dc_event_process + select id, event_id, operation_time, operator,operator_name, source, process_type, context, process_id, process_name, `type` from dc_event_process SELECT - d.iot_device_id, - d.stake_mark, - d.direction, - d.device_name, - d.device_state, - lm.create_time AS latest_create_time, - lm.rainfall, - lm.visibility_type, - lm.visibility, - lm.atmospheric_pressure, - lm.temperature, - lm.humidity, - lm.wind_direction, - lm.wind_speed, - lm.precipitation_type, - lm.wet_slippery_coefficient, - lm.remote_road_surface_temperature, - lm.remote_road_surface_status, - lm.water_film_ice_snow_value + d.iot_device_id, d.stake_mark, d.direction, d.device_name, d.device_state, + m.create_time, + m.rainfall, m.visibility_type, m.visibility, m.atmospheric_pressure, + m.temperature, m.humidity, m.wind_direction, m.wind_speed, + m.precipitation_type, m.wet_slippery_coefficient, + m.remote_road_surface_temperature, m.remote_road_surface_status, + m.water_film_ice_snow_value FROM dc_device d LEFT JOIN - dc_meteorological_detector_data lm + dc_meteorological_detector_data m ON - d.iot_device_id = lm.iot_device_id - AND lm.id IN ( - SELECT MAX(id) - FROM dc_meteorological_detector_data - WHERE iot_device_id = d.iot_device_id + d.iot_device_id = m.iot_device_id + AND m.create_time = ( + SELECT MAX(create_time) + FROM dc_meteorological_detector_data m2 + WHERE m2.iot_device_id = d.iot_device_id ) WHERE - d.device_type = 3; - + d.device_type = 3 + ORDER BY d.stake_mark ASC; \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml b/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml new file mode 100644 index 00000000..d7559a6d --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcPublishManageMapper.xml @@ -0,0 +1,174 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select facility.facility_name, + manage.id, manage.event_id, manage.publish_channels_id, + manage.title, manage.publish_channels , manage.publisher, + manage.publish_time, manage.create_time, + manage.publish_status, manage.content_details, manage.remark, + event.create_time eventTime,event.direction,event.stake_mark, + event.event_type,event.event_subclass,event.event_state + from dc_publish_manage as manage + LEFT JOIN dc_event as event on event.id=manage.event_id + LEFT JOIN dc_event_traffic_control as traffic on event.id=traffic.id + LEFT JOIN dc_facility as facility ON traffic.facility_id=facility.id + + + + + + + + + + + insert into dc_publish_manage + + event_id, + dept_id, + publish_channels_id, + title, + publish_channels, + isverify, + publisher, + auditor_1, + auditor_2, + audit_time_1, + audit_time_2, + audit_comment_1, + audit_comment_2, + publish_time, + publish_status, + content_details, + remark, + update_time, + create_time, + + + #{eventId}, + #{deptId}, + #{publishChannelsId}, + #{title}, + #{publishChannels}, + #{isverify}, + #{publisher}, + #{auditor1}, + #{auditor2}, + #{auditTime1}, + #{auditTime2}, + #{auditComment1}, + #{auditComment2}, + #{publishTime}, + #{publishStatus}, + #{contentDetails}, + #{remark}, + #{updateTime}, + #{createTime}, + + + + + update dc_publish_manage + + event_id = #{eventId}, + dept_id = #{deptId}, + publish_channels_id = #{publishChannelsId}, + title = #{title}, + publish_channels = #{publishChannels}, + isverify = #{isverify}, + publisher = #{publisher}, + auditor_1 = #{auditor1}, + auditor_2 = #{auditor2}, + audit_time_1 = #{auditTime1}, + audit_time_2 = #{auditTime2}, + audit_comment_1 = #{auditComment1}, + audit_comment_2 = #{auditComment2}, + publish_time = #{publishTime}, + publish_status = #{publishStatus}, + content_details = #{contentDetails}, + remark = #{remark}, + update_time = #{updateTime}, + create_time = #{createTime}, + + where id = #{id} + + + + delete from dc_publish_manage where id = #{id} + + + + delete from dc_publish_manage where id in + + #{id} + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml b/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml new file mode 100644 index 00000000..9dffa6fb --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcPublishingChannelsMapper.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + select id, data_category, info_level, enabled, audit_method, publish_channels, enable_date, create_time, update_time from dc_publishing_channels + + + + + + + + + insert into dc_publishing_channels + + data_category, + info_level, + enabled, + audit_method, + publish_channels, + enable_date, + create_time, + update_time, + + + #{dataCategory}, + #{infoLevel}, + #{enabled}, + #{auditMethod}, + #{publishChannels}, + #{enableDate}, + #{createTime}, + #{updateTime}, + + + + + update dc_publishing_channels + + data_category = #{dataCategory}, + info_level = #{infoLevel}, + enabled = #{enabled}, + audit_method = #{auditMethod}, + publish_channels = #{publishChannels}, + enable_date = #{enableDate}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from dc_publishing_channels where id = #{id} + + + + delete from dc_publishing_channels where id in + + #{id} + + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml b/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml new file mode 100644 index 00000000..8f3e77be --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcSwitchMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + select switch_id, + parent_id, + ancestors, + switch_name, + stake_mark, + device_list, + switch_ip, + ring_netWork, + netWork_status, + user_state, + create_time, + update_time + from dc_switch + + + + + + update dc_switch set netWork_status = + + when #{item.switchId} then #{item.netWorkStatus} + + where switch_id in + + #{item.switchId} + + + + diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml index ce150537..4bb2278e 100644 --- a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml @@ -263,7 +263,7 @@ LEFT JOIN dc_event_traffic_control t2 on t1.id = t2.id LEFT JOIN dc_facility t3 on t3.id = t2.facility_id where - t1.event_type = '3' and t1.event_subclass = '3-2' + t1.event_type = '3' and t1.event_subclass = '3-2' and t1.event_state != '0' and date_format(t1.start_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s') and (date_format(t1.end_time,'%Y-%m-%d %H:%i:%s') > date_format(#{startTime},'%Y-%m-%d %H:%i:%s') or ISNULL(t1.end_time)) and t2.classify in ('6','7','9') @@ -288,7 +288,7 @@ sum(case when t2.control_type = '2' then 1 else 0 end) trafficRestriction from dc_event t1 left join dc_event_traffic_control t2 on t1.id = t2.id where (DATE_FORMAT(t1.start_time,'%Y-%m') = DATE_FORMAT(now(),'%Y-%m') or DATE_FORMAT(t1.end_time,'%Y-%m') = DATE_FORMAT(now(),'%Y-%m') or ISNULL(t1.end_time)) - and t1.event_type = '3' and t1.event_subclass = '3-2' + and t1.event_type = '3' and t1.event_subclass = '3-2' and t1.event_state != '0' GROUP BY t2.facility_id) t4 on t3.id = t4.facilityId diff --git a/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml b/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml new file mode 100644 index 00000000..45b14aa3 --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcVoiceBroadcastMapper.xml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + select id, category, content, remark, create_time, update_time from dc_voice_broadcast + + + + + + + + + + insert into dc_voice_broadcast + + category, + content, + remark, + create_time, + update_time, + + + #{category}, + #{content}, + #{remark}, + #{createTime}, + #{updateTime}, + + + + + update dc_voice_broadcast + + category = #{category}, + content = #{content}, + remark = #{remark}, + create_time = #{createTime}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from dc_voice_broadcast where id = #{id} + + + + delete from dc_voice_broadcast where id in + + #{id} + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 7a2d46e2..ce22fa4c 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -172,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" start_time, end_time, remark, + dept_id, #{id}, @@ -182,6 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{startTime}, #{endTime}, #{remark}, + #{deptId}, @@ -231,6 +233,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item.id} + + update dc_dispatch set organization_id=#{organization_id} where id=#{id} + delete from dc_warning where id = #{id} @@ -250,6 +255,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{item.id} + + delete from dc_dispatch_resource where dispatch_id=#{dispatchId} + + + + + + + + + + + diff --git a/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml index 9e8b9615..1baa680b 100644 --- a/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml +++ b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml @@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{isDeleted}, #{deleterUserId}, #{deletionTime}, - current_date + now() @@ -355,7 +355,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update event - fusionId = #{fusionId}, event_name = #{eventName}, event_type_code = #{eventTypeCode}, event_desc = #{eventDesc}, @@ -392,7 +391,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" DeleterUserId = #{deleterUserId}, DeletionTime = #{deletionTime}, - where id = #{id} + where fusionId = #{fusionId}