Преглед на файлове

流程功能优化,添加WebSocket消息推送APP方式

xianwait преди 2 години
родител
ревизия
9656099d26
променени са 100 файла, в които са добавени 906 реда и са изтрити 4701 реда
  1. 0 11
      pom.xml
  2. 0 5
      willalp-admin/pom.xml
  3. 2 14
      willalp-admin/src/main/java/com/willalp/WillalpApplication.java
  4. 1 0
      willalp-admin/src/main/java/com/willalp/web/controller/api/ApiOneController.java
  5. 2 2
      willalp-admin/src/main/java/com/willalp/web/controller/app/AppFLowController.java
  6. 4 0
      willalp-admin/src/main/java/com/willalp/web/controller/app/AppThreeController.java
  7. 3 2
      willalp-admin/src/main/java/com/willalp/web/controller/app/AppTwoController.java
  8. 1 1
      willalp-admin/src/main/java/com/willalp/web/controller/clockingin/FileApprovalController.java
  9. 0 116
      willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlAppController.java
  10. 0 120
      willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlDeviceInfoController.java
  11. 0 120
      willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlStatController.java
  12. 0 120
      willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlTimingController.java
  13. 0 97
      willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlUsenoConfigController.java
  14. 2 1
      willalp-admin/src/main/java/com/willalp/web/controller/system/HsPostConfigController.java
  15. 8 0
      willalp-admin/src/test/java/com/willalp/CanteenTest.java
  16. 1 1
      willalp-apply/src/main/java/com/willalp/apply/mapper/xml/HsSysApplyMapper.xml
  17. 4 0
      willalp-clocking-in/pom.xml
  18. 6 6
      willalp-clocking-in/src/main/java/com/willalp/flow/domain/HsFlowBase.java
  19. 8 8
      willalp-clocking-in/src/main/java/com/willalp/flow/domain/HsFlowCc.java
  20. 5 0
      willalp-clocking-in/src/main/java/com/willalp/flow/domain/req/FlowReq.java
  21. 4 4
      willalp-clocking-in/src/main/java/com/willalp/flow/mapper/xml/HsFlowBaseMapper.xml
  22. 4 4
      willalp-clocking-in/src/main/java/com/willalp/flow/mapper/xml/HsFlowCcMapper.xml
  23. 69 1
      willalp-clocking-in/src/main/java/com/willalp/flow/service/HsFlowEngineService.java
  24. 1 1
      willalp-clocking-in/src/main/java/com/willalp/flow/service/IHsFlowBaseService.java
  25. 5 0
      willalp-clocking-in/src/main/java/com/willalp/flow/service/IHsFlowTaskService.java
  26. 249 185
      willalp-clocking-in/src/main/java/com/willalp/flow/service/impl/HsFlowEngineServiceImpl.java
  27. 3 1
      willalp-clocking-in/src/main/java/com/willalp/flow/service/impl/HsFlowTaskServiceImpl.java
  28. 10 0
      willalp-clocking-in/src/main/java/com/willalp/msg/domain/HsAppUserMsg.java
  29. 2 0
      willalp-clocking-in/src/main/java/com/willalp/msg/mapper/xml/HsAppUserMsgMapper.xml
  30. 1 2
      willalp-clocking-in/src/main/java/com/willalp/msg/service/IHsAppUserMsgService.java
  31. 38 43
      willalp-clocking-in/src/main/java/com/willalp/msg/service/impl/HsAppUserMsgServiceImpl.java
  32. 0 29
      willalp-control/pom.xml
  33. 0 57
      willalp-control/src/main/java/com/willalp/control/aspect/ControlCacheAspect.java
  34. 0 88
      willalp-control/src/main/java/com/willalp/control/domain/HsControlCmdRelation.java
  35. 0 139
      willalp-control/src/main/java/com/willalp/control/domain/HsControlDeviceInfo.java
  36. 0 55
      willalp-control/src/main/java/com/willalp/control/domain/HsControlLog.java
  37. 0 75
      willalp-control/src/main/java/com/willalp/control/domain/HsControlStat.java
  38. 0 82
      willalp-control/src/main/java/com/willalp/control/domain/HsControlTiming.java
  39. 0 133
      willalp-control/src/main/java/com/willalp/control/domain/HsControlUsenoConfig.java
  40. 0 35
      willalp-control/src/main/java/com/willalp/control/domain/vo/OpenOrCloseVo.java
  41. 0 25
      willalp-control/src/main/java/com/willalp/control/mapper/HsControlDeviceInfoMapper.java
  42. 0 33
      willalp-control/src/main/java/com/willalp/control/mapper/HsControlLogMapper.java
  43. 0 42
      willalp-control/src/main/java/com/willalp/control/mapper/HsControlStatMapper.java
  44. 0 23
      willalp-control/src/main/java/com/willalp/control/mapper/HsControlTimingMapper.java
  45. 0 32
      willalp-control/src/main/java/com/willalp/control/mapper/HsControlUsenoConfigMapper.java
  46. 0 88
      willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlDeviceInfoMapper.xml
  47. 0 58
      willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlLogMapper.xml
  48. 0 65
      willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlStatMapper.xml
  49. 0 60
      willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlTimingMapper.xml
  50. 0 75
      willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlUsenoConfigMapper.xml
  51. 0 67
      willalp-control/src/main/java/com/willalp/control/netty/HreatbeatClient.java
  52. 0 15
      willalp-control/src/main/java/com/willalp/control/netty/IAddNettyChannelMap.java
  53. 0 71
      willalp-control/src/main/java/com/willalp/control/netty/NettyServer.java
  54. 0 21
      willalp-control/src/main/java/com/willalp/control/netty/RefrigerateCell.java
  55. 0 95
      willalp-control/src/main/java/com/willalp/control/netty/TcpServer.java
  56. 0 12
      willalp-control/src/main/java/com/willalp/control/netty/Tool.java
  57. 0 112
      willalp-control/src/main/java/com/willalp/control/netty/Util.java
  58. 0 163
      willalp-control/src/main/java/com/willalp/control/netty/handler/DeviceChannelHandler.java
  59. 0 68
      willalp-control/src/main/java/com/willalp/control/netty/handler/RwxdSocket.java
  60. 0 40
      willalp-control/src/main/java/com/willalp/control/netty/model/ChannelMsgModel.java
  61. 0 112
      willalp-control/src/main/java/com/willalp/control/netty/model/ControlDataModel.java
  62. 0 64
      willalp-control/src/main/java/com/willalp/control/netty/model/DeviceChannelMap.java
  63. 0 23
      willalp-control/src/main/java/com/willalp/control/netty/service/CommandControlService.java
  64. 0 45
      willalp-control/src/main/java/com/willalp/control/netty/service/CommandNettyService.java
  65. 0 85
      willalp-control/src/main/java/com/willalp/control/netty/service/impl/CommandControlServiceImpl.java
  66. 0 197
      willalp-control/src/main/java/com/willalp/control/netty/service/impl/CommandNettyServiceImpl.java
  67. 0 41
      willalp-control/src/main/java/com/willalp/control/service/ControlService.java
  68. 0 58
      willalp-control/src/main/java/com/willalp/control/service/IHsControlDeviceInfoService.java
  69. 0 31
      willalp-control/src/main/java/com/willalp/control/service/IHsControlLogService.java
  70. 0 39
      willalp-control/src/main/java/com/willalp/control/service/IHsControlStatService.java
  71. 0 37
      willalp-control/src/main/java/com/willalp/control/service/IHsControlTimingService.java
  72. 0 29
      willalp-control/src/main/java/com/willalp/control/service/IHsControlUsenoConfigService.java
  73. 0 130
      willalp-control/src/main/java/com/willalp/control/service/impl/ControlServiceImpl.java
  74. 0 183
      willalp-control/src/main/java/com/willalp/control/service/impl/HsControlDeviceInfoServiceImpl.java
  75. 0 46
      willalp-control/src/main/java/com/willalp/control/service/impl/HsControlLogServiceImpl.java
  76. 0 67
      willalp-control/src/main/java/com/willalp/control/service/impl/HsControlStatServiceImpl.java
  77. 0 88
      willalp-control/src/main/java/com/willalp/control/service/impl/HsControlTimingServiceImpl.java
  78. 0 40
      willalp-control/src/main/java/com/willalp/control/service/impl/HsControlUsenoConfigServiceImpl.java
  79. 0 160
      willalp-control/src/main/java/com/willalp/control/webSocket/WebSocketServer.java
  80. 17 0
      willalp-framework/src/main/java/com/willalp/framework/config/WebSocketConfigurator.java
  81. 26 0
      willalp-framework/src/main/java/com/willalp/framework/config/properties/CustomSpringConfigurator.java
  82. 27 14
      willalp-framework/src/main/java/com/willalp/framework/websocket/WebSocketServer.java
  83. 14 4
      willalp-framework/src/main/java/com/willalp/framework/websocket/WebSocketUsers.java
  84. 20 0
      willalp-framework/src/test/java/com/willalp/framework/WebSocketTest.java
  85. 0 138
      willalp-quartz/src/main/java/com/willalp/quartz/task/RyTask.java
  86. 9 0
      willalp-system/src/main/java/com/willalp/system/domain/HsPostConfig.java
  87. 1 1
      willalp-system/src/main/java/com/willalp/system/mapper/SysUserMapper.java
  88. 2 0
      willalp-system/src/main/java/com/willalp/system/mapper/xml/HsPostConfigMapper.xml
  89. 4 1
      willalp-system/src/main/java/com/willalp/system/service/IHsPostConfigService.java
  90. 33 25
      willalp-system/src/main/java/com/willalp/system/service/impl/HsPostConfigServiceImpl.java
  91. 1 1
      willalp-ui/src/views/apply/apply/applyindex.vue
  92. 5 5
      willalp-ui/src/views/apply/apply/components/registindex.vue
  93. 2 2
      willalp-ui/src/views/apply/apply/components/ruleindex.vue
  94. 287 287
      willalp-ui/src/views/control/relation/index.vue
  95. 4 4
      willalp-ui/src/views/device/device/index.vue
  96. 2 2
      willalp-ui/src/views/device/networkconfig/index.vue
  97. 1 1
      willalp-ui/src/views/files/approval/index.vue
  98. 7 7
      willalp-ui/src/views/flow/cc/index.vue
  99. 7 7
      willalp-ui/src/views/flow/flowBase/index.vue
  100. 4 4
      willalp-ui/src/views/leave/leave/index.vue

+ 0 - 11
pom.xml

@@ -128,16 +128,6 @@
                 <artifactId>commons-io</artifactId>
                 <version>${commons.io.version}</version>
             </dependency>
-            <dependency>
-                <groupId>org.apache.commons</groupId>
-                <artifactId>commons-text</artifactId>
-                <version>${commons-text.version}</version>
-            </dependency>
-            <dependency>
-                <groupId>com.ibeetl</groupId>
-                <artifactId>beetl-framework-starter</artifactId>
-                <version>${beetl.version}</version>
-            </dependency>
 
             <!-- 文件上传工具类 -->
             <dependency>
@@ -324,7 +314,6 @@
         <module>willalp-code</module>
         <module>willalp-apply</module>
         <module>willalp-app</module>
-        <module>willalp-control</module>
         <module>willalp-clocking-in</module>
     </modules>
     <packaging>pom</packaging>

+ 0 - 5
willalp-admin/pom.xml

@@ -110,11 +110,6 @@
             <artifactId>willalp-app</artifactId>
             <scope>compile</scope>
         </dependency>
-        <dependency>
-            <groupId>com.willalp</groupId>
-            <artifactId>willalp-control</artifactId>
-            <scope>compile</scope>
-        </dependency>
         <dependency>
             <groupId>com.willalp</groupId>
             <artifactId>willalp-clocking-in</artifactId>

+ 2 - 14
willalp-admin/src/main/java/com/willalp/WillalpApplication.java

@@ -1,11 +1,9 @@
 package com.willalp;
 
-import com.willalp.control.netty.NettyServer;
 import org.apache.catalina.connector.Connector;
 import org.mybatis.spring.annotation.MapperScan;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
@@ -20,8 +18,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 
-import javax.annotation.Resource;
-
 /**
  * 启动程序
  *
@@ -32,11 +28,8 @@ import javax.annotation.Resource;
 @EnableAsync
 @MapperScan(basePackages = {"com.willalp.**.mapper"})
 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,})
-public class WillalpApplication extends SpringBootServletInitializer implements CommandLineRunner {
-    protected final static Logger logger = LoggerFactory.getLogger(WillalpApplication.class);
-
-    @Resource
-    private NettyServer nettyServer;
+    public class WillalpApplication extends SpringBootServletInitializer {
+        protected final static Logger logger = LoggerFactory.getLogger(WillalpApplication.class);
 
     public static void main(String[] args) {
         SpringApplication.run(WillalpApplication.class, args);
@@ -58,11 +51,6 @@ public class WillalpApplication extends SpringBootServletInitializer implements
         return new ThreadPoolTaskExecutor();
     }
 
-    @Override
-    public void run(String... args) {
-        logger.info("----Netty 启动----");
-        nettyServer.start();
-    }
 
     @Bean
     public ServletWebServerFactory servletContainer() {

+ 1 - 0
willalp-admin/src/main/java/com/willalp/web/controller/api/ApiOneController.java

@@ -42,6 +42,7 @@ public class ApiOneController {
             user.setUserType("1");
             user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
             HsOrgPersonnelFiles opf = new HsOrgPersonnelFiles();
+            opf.setUserName(URLDecoder.decode(user.getNickName(), "utf8"));
             opf.setUserCode(user.getUserName());
             opf.setPhone(user.getPhonenumber());
             opf.setOrgCode(SysOrgCodeEnum.MLHuiZhuLi.getCode());

+ 2 - 2
willalp-admin/src/main/java/com/willalp/web/controller/app/AppFLowController.java

@@ -86,7 +86,7 @@ public class AppFLowController extends BaseController {
         }
         String bizLeaveFlowRunId = sysConfigService.selectConfigByKey(HsFlowEngineService.BIZ_LEAVE_FLOW_KEY);
         return AjaxResult.success(
-                flowEngineService.submitATask(new HsFlowTask(taskId, idStr, bizLeaveFlowRunId), map));
+                flowEngineService.submitTask(new HsFlowTask(taskId, idStr, bizLeaveFlowRunId), map));
     }
 
     @Resource
@@ -117,7 +117,7 @@ public class AppFLowController extends BaseController {
         }
         String reserveConsumingRunId = sysConfigService.selectConfigByKey(HsFlowEngineService.RESERVE_FLOW_KEY);
         return AjaxResult.success(
-                flowEngineService.submitATask(new HsFlowTask(taskId, idStr, reserveConsumingRunId), map));
+                flowEngineService.submitTask(new HsFlowTask(taskId, idStr, reserveConsumingRunId), map));
     }
 
     /**

+ 4 - 0
willalp-admin/src/main/java/com/willalp/web/controller/app/AppThreeController.java

@@ -51,5 +51,9 @@ public class AppThreeController extends BaseController {
         return getDataTable(flowCcService.selectHsFlowCcListByUserId(request.getHeader("UserName")));
     }
 
+    @RequestMapping("/sendTestMsg")
+    public void testSendWebSocketMsg(HttpServletRequest request) {
+//        WebSocketUsers.sendMessageToUserByText(WebSocketUsers.getUsers().get("admin"), "user-name");
+    }
 }
  

+ 3 - 2
willalp-admin/src/main/java/com/willalp/web/controller/app/AppTwoController.java

@@ -137,7 +137,7 @@ public class AppTwoController extends BaseController {
     public AjaxResult readTask(String taskId, HttpServletRequest request) {
         taskService.readTask(taskId);
         hsAppUserMsgService.readMsgByTaskId(taskId, request.getHeader("UserName"));
-        return AjaxResult.success();
+        return AjaxResult.success(taskId);
     }
 
     /**
@@ -166,7 +166,8 @@ public class AppTwoController extends BaseController {
      */
     @RequestMapping("/msgs")
     public AjaxResult msgSum(HttpServletRequest request) {
-        return AjaxResult.success(hsAppUserMsgService.msgSum(request.getHeader("UserName")));
+//        return AjaxResult.success(hsAppUserMsgService.pushMsgSum(request.getHeader("UserName")));
+        return AjaxResult.success();
     }
 
     @Resource

+ 1 - 1
willalp-admin/src/main/java/com/willalp/web/controller/clockingin/FileApprovalController.java

@@ -91,7 +91,7 @@ public class FileApprovalController extends BaseController {
         fileApproval.setCreateTime(DateUtils.getNowDate());
         String idStr = IdWorker.getIdStr();
         fileApproval.setId(idStr);
-        flowEngineService.submitATask(new HsFlowTask(idStr, idStr, sysConfigService.selectConfigByKey("file_approval_flow_run_key")), fileApproval.getParams());
+        flowEngineService.submitTask(new HsFlowTask(idStr, idStr, sysConfigService.selectConfigByKey("file_approval_flow_run_key")), fileApproval.getParams());
         StringBuffer content = new StringBuffer();
         content.append("<p>标题:").append(fileApproval.getTitle()).append("</p>")
                 .append("<p>申请人:").append(fileApproval.getApplyUserName()).append("</p>");

+ 0 - 116
willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlAppController.java

@@ -1,116 +0,0 @@
-package com.willalp.web.controller.control;
-
-import com.willalp.common.core.controller.BaseController;
-import com.willalp.common.core.domain.AjaxResult;
-import com.willalp.control.domain.HsControlDeviceInfo;
-import com.willalp.control.domain.HsControlTiming;
-import com.willalp.control.domain.vo.OpenOrCloseVo;
-import com.willalp.control.service.*;
-import io.swagger.annotations.ApiOperation;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-import java.util.List;
-
-/**
- * @author hs
- */
-@RestController
-@RequestMapping("/api/control")
-public class HsControlAppController extends BaseController {
-
-    @Resource
-    private IHsControlDeviceInfoService deviceInfoService;
-
-    @Resource
-    private IHsControlTimingService controlTimingService;
-
-    @Resource
-    private IHsControlUsenoConfigService controlUseNoConfigService;
-
-    @Resource
-    private IHsControlStatService statService;
-
-    @Resource
-    private IHsControlLogService logService;
-
-    @Resource
-    private ControlService controlService;
-
-    @ApiOperation("设备状态信息列表")
-    @GetMapping("/list")
-    public AjaxResult getControlDeviceList(@RequestParam("userId") Long userId) {
-        List<HsControlDeviceInfo> hsControlDeviceInfos = deviceInfoService.appSelectHsControlDeviceInfoList(userId);
-        return AjaxResult.success(hsControlDeviceInfos);
-    }
-
-    @ApiOperation("可添加设备列表")
-    @GetMapping("/useNoList")
-    public AjaxResult getControlUseNoList() {
-        return AjaxResult.success(controlUseNoConfigService.canAddUseNoListList());
-    }
-
-    @ApiOperation("添加设备")
-    @PostMapping("/add")
-    public AjaxResult addDevice(@RequestBody HsControlDeviceInfo deviceInfo) {
-        return toAjax(deviceInfoService.addDeviceInfo(deviceInfo));
-    }
-
-    @ApiOperation("删除设备")
-    @GetMapping("/delete")
-    public AjaxResult deleteDevice(String deviceInfoId) {
-        return toAjax(deviceInfoService.removeById(deviceInfoId));
-    }
-
-    @ApiOperation("获取年-月统计列表")
-    @GetMapping("/statList")
-    public AjaxResult getStatList(@RequestParam("useNoId") String useNoId) {
-        return AjaxResult.success(statService.appControlStatList(useNoId));
-    }
-
-    @ApiOperation("获取日统计列表")
-    @GetMapping("/statDayList")
-    public AjaxResult getStatList1(@RequestParam("useNoId") String useNoId,
-                                  @RequestParam("yearMonth") String yearMonth) {
-        return AjaxResult.success(statService.appControlStatList(useNoId, yearMonth));
-    }
-
-    @GetMapping("/useLogList")
-    public AjaxResult getUseLog(@RequestParam("useNoId") String useNoId,
-                                @RequestParam("date") String date) {
-        return AjaxResult.success(logService.selectLogListByUseNoIdAndDate(useNoId, date));
-    }
-
-    @ApiOperation("修改设备名称")
-    @PutMapping("/editDevice")
-    public AjaxResult updateDeviceName(@RequestBody HsControlDeviceInfo deviceInfo) {
-        return toAjax(deviceInfoService.updateById(deviceInfo));
-    }
-
-    @ApiOperation("开或关")
-    @PostMapping("/openOrClose")
-    public AjaxResult open(@RequestBody OpenOrCloseVo openOrCloseVo) {
-        return toAjax(controlService.openOrClose(openOrCloseVo));
-    }
-
-    /**
-     * 获取定时任务信息
-     *
-     * @param useNoId
-     * @return
-     */
-    @ApiOperation("获取定时任务信息")
-    @GetMapping("/timing")
-    public AjaxResult getTimingInfo(@RequestParam("useNoId") String useNoId) {
-        return AjaxResult.success(controlTimingService.getTimingInfo(useNoId));
-    }
-
-    /**
-     * 修改设备定时任务
-     */
-    @PutMapping("/timing")
-    public AjaxResult editTiming(@RequestBody HsControlTiming hsControlTiming) {
-        return toAjax(controlTimingService.saveOrUpdateTiming(hsControlTiming));
-    }
-
-}

+ 0 - 120
willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlDeviceInfoController.java

@@ -1,120 +0,0 @@
-package com.willalp.web.controller.control;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.willalp.common.utils.DateUtils;
-import com.willalp.common.utils.SecurityUtils;
-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.willalp.common.annotation.Log;
-import com.willalp.common.core.controller.BaseController;
-import com.willalp.common.core.domain.AjaxResult;
-import com.willalp.common.enums.BusinessType;
-import com.willalp.control.domain.HsControlDeviceInfo;
-import com.willalp.control.service.IHsControlDeviceInfoService;
-import com.willalp.common.utils.poi.ExcelUtil;
-import com.willalp.common.core.page.TableDataInfo;
-
-/**
- * 控制设备状态信息Controller
- *
- * @author willalp
- * @date 2022-02-16
- */
-@RestController
-@RequestMapping("/control/info")
-public class HsControlDeviceInfoController extends BaseController
-{
-    @Autowired
-    private IHsControlDeviceInfoService hsControlDeviceInfoService;
-
-    /**
-     * 查询控制设备状态信息列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:info:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(HsControlDeviceInfo hsControlDeviceInfo)
-    {
-        startPage();
-        List<HsControlDeviceInfo> list = hsControlDeviceInfoService.selectHsControlDeviceInfoList(hsControlDeviceInfo);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出控制设备状态信息列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:info:export')")
-    @Log(title = "控制设备状态信息", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(HsControlDeviceInfo hsControlDeviceInfo)
-    {
-        List<HsControlDeviceInfo> list = hsControlDeviceInfoService.selectHsControlDeviceInfoList(hsControlDeviceInfo);
-        ExcelUtil<HsControlDeviceInfo> util = new ExcelUtil<HsControlDeviceInfo>(HsControlDeviceInfo.class);
-        return util.exportExcel(list, "控制设备状态信息数据");
-    }
-
-    /**
-     * 获取控制设备状态信息详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:info:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return AjaxResult.success(hsControlDeviceInfoService.getById(id));
-    }
-
-    /**
-     * 新增控制设备状态信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:info:add')")
-    @Log(title = "控制设备状态信息", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody HsControlDeviceInfo hsControlDeviceInfo)
-    {
-        while (true) {
-            String idStr = IdWorker.getIdStr();
-            HsControlDeviceInfo byId = hsControlDeviceInfoService.getById(idStr);
-            if (null == byId) {
-                hsControlDeviceInfo.setId(Long.valueOf(idStr));
-                break;
-            }
-        }
-        hsControlDeviceInfo.setCreateBy(SecurityUtils.getUsername());
-        hsControlDeviceInfo.setCreateTime(DateUtils.getNowDate());
-        return toAjax(hsControlDeviceInfoService.save(hsControlDeviceInfo));
-    }
-
-    /**
-     * 修改控制设备状态信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:info:edit')")
-    @Log(title = "控制设备状态信息", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody HsControlDeviceInfo hsControlDeviceInfo)
-    {
-        hsControlDeviceInfo.setUpdateBy(SecurityUtils.getUsername());
-        hsControlDeviceInfo.setUpdateTime(DateUtils.getNowDate());
-        return toAjax(hsControlDeviceInfoService.updateById(hsControlDeviceInfo));
-    }
-
-    /**
-     * 删除控制设备状态信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:info:remove')")
-    @Log(title = "控制设备状态信息", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(hsControlDeviceInfoService.removeByIds(Arrays.asList(ids)));
-    }
-}

+ 0 - 120
willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlStatController.java

@@ -1,120 +0,0 @@
-package com.willalp.web.controller.control;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.willalp.common.utils.DateUtils;
-import com.willalp.common.utils.SecurityUtils;
-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.willalp.common.annotation.Log;
-import com.willalp.common.core.controller.BaseController;
-import com.willalp.common.core.domain.AjaxResult;
-import com.willalp.common.enums.BusinessType;
-import com.willalp.control.domain.HsControlStat;
-import com.willalp.control.service.IHsControlStatService;
-import com.willalp.common.utils.poi.ExcelUtil;
-import com.willalp.common.core.page.TableDataInfo;
-
-/**
- * 设备使用统计Controller
- *
- * @author willalp
- * @date 2022-03-02
- */
-@RestController
-@RequestMapping("/control/stat")
-public class HsControlStatController extends BaseController
-{
-    @Autowired
-    private IHsControlStatService hsControlStatService;
-
-    /**
-     * 查询设备使用统计列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:stat:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(HsControlStat hsControlStat)
-    {
-        startPage();
-        List<HsControlStat> list = hsControlStatService.selectHsControlStatList(hsControlStat);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出设备使用统计列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:stat:export')")
-    @Log(title = "设备使用统计", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(HsControlStat hsControlStat)
-    {
-        List<HsControlStat> list = hsControlStatService.selectHsControlStatList(hsControlStat);
-        ExcelUtil<HsControlStat> util = new ExcelUtil<HsControlStat>(HsControlStat.class);
-        return util.exportExcel(list, "设备使用统计数据");
-    }
-
-    /**
-     * 获取设备使用统计详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:stat:query')")
-    @GetMapping(value = "/{statId}")
-    public AjaxResult getInfo(@PathVariable("statId") String statId)
-    {
-        return AjaxResult.success(hsControlStatService.getById(statId));
-    }
-
-    /**
-     * 新增设备使用统计
-     */
-    @PreAuthorize("@ss.hasPermi('control:stat:add')")
-    @Log(title = "设备使用统计", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody HsControlStat hsControlStat)
-    {
-        while (true) {
-            String idStr = IdWorker.getIdStr();
-            HsControlStat byId = hsControlStatService.getById(Long.valueOf(idStr));
-            if (null == byId) {
-                hsControlStat.setStatId(idStr);
-                break;
-            }
-        }
-        hsControlStat.setCreateBy(SecurityUtils.getUsername());
-        hsControlStat.setCreateTime(DateUtils.getNowDate());
-        return toAjax(hsControlStatService.save(hsControlStat));
-    }
-
-    /**
-     * 修改设备使用统计
-     */
-    @PreAuthorize("@ss.hasPermi('control:stat:edit')")
-    @Log(title = "设备使用统计", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody HsControlStat hsControlStat)
-    {
-        hsControlStat.setUpdateBy(SecurityUtils.getUsername());
-        hsControlStat.setUpdateTime(DateUtils.getNowDate());
-        return toAjax(hsControlStatService.updateById(hsControlStat));
-    }
-
-    /**
-     * 删除设备使用统计
-     */
-    @PreAuthorize("@ss.hasPermi('control:stat:remove')")
-    @Log(title = "设备使用统计", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{statIds}")
-    public AjaxResult remove(@PathVariable String[] statIds)
-    {
-        return toAjax(hsControlStatService.removeByIds(Arrays.asList(statIds)));
-    }
-}

+ 0 - 120
willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlTimingController.java

@@ -1,120 +0,0 @@
-package com.willalp.web.controller.control;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.willalp.common.utils.DateUtils;
-import com.willalp.common.utils.SecurityUtils;
-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.willalp.common.annotation.Log;
-import com.willalp.common.core.controller.BaseController;
-import com.willalp.common.core.domain.AjaxResult;
-import com.willalp.common.enums.BusinessType;
-import com.willalp.control.domain.HsControlTiming;
-import com.willalp.control.service.IHsControlTimingService;
-import com.willalp.common.utils.poi.ExcelUtil;
-import com.willalp.common.core.page.TableDataInfo;
-
-/**
- * 设备定时任务Controller
- *
- * @author willalp
- * @date 2022-02-16
- */
-@RestController
-@RequestMapping("/control/timing")
-public class HsControlTimingController extends BaseController
-{
-    @Autowired
-    private IHsControlTimingService hsControlTimingService;
-
-    /**
-     * 查询设备定时任务列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:timing:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(HsControlTiming hsControlTiming)
-    {
-        startPage();
-        List<HsControlTiming> list = hsControlTimingService.selectHsControlTimingList(hsControlTiming);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出设备定时任务列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:timing:export')")
-    @Log(title = "设备定时任务", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(HsControlTiming hsControlTiming)
-    {
-        List<HsControlTiming> list = hsControlTimingService.selectHsControlTimingList(hsControlTiming);
-        ExcelUtil<HsControlTiming> util = new ExcelUtil<HsControlTiming>(HsControlTiming.class);
-        return util.exportExcel(list, "设备定时任务数据");
-    }
-
-    /**
-     * 获取设备定时任务详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:timing:query')")
-    @GetMapping(value = "/{timingId}")
-    public AjaxResult getInfo(@PathVariable("timingId") Long timingId)
-    {
-        return AjaxResult.success(hsControlTimingService.getById(timingId));
-    }
-
-    /**
-     * 新增设备定时任务
-     */
-    @PreAuthorize("@ss.hasPermi('control:timing:add')")
-    @Log(title = "设备定时任务", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody HsControlTiming hsControlTiming)
-    {
-        while (true) {
-            String idStr = IdWorker.getIdStr();
-            HsControlTiming byId = hsControlTimingService.getById(idStr);
-            if (null == byId) {
-                hsControlTiming.setTimingId(Long.valueOf(idStr));
-                break;
-            }
-        }
-        hsControlTiming.setCreateBy(SecurityUtils.getUsername());
-        hsControlTiming.setCreateTime(DateUtils.getNowDate());
-        return toAjax(hsControlTimingService.save(hsControlTiming));
-    }
-
-    /**
-     * 修改设备定时任务
-     */
-    @PreAuthorize("@ss.hasPermi('control:timing:edit')")
-    @Log(title = "设备定时任务", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody HsControlTiming hsControlTiming)
-    {
-        hsControlTiming.setUpdateBy(SecurityUtils.getUsername());
-        hsControlTiming.setUpdateTime(DateUtils.getNowDate());
-        return toAjax(hsControlTimingService.updateById(hsControlTiming));
-    }
-
-    /**
-     * 删除设备定时任务
-     */
-    @PreAuthorize("@ss.hasPermi('control:timing:remove')")
-    @Log(title = "设备定时任务", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{timingIds}")
-    public AjaxResult remove(@PathVariable Long[] timingIds)
-    {
-        return toAjax(hsControlTimingService.removeByIds(Arrays.asList(timingIds)));
-    }
-}

+ 0 - 97
willalp-admin/src/main/java/com/willalp/web/controller/control/HsControlUsenoConfigController.java

@@ -1,97 +0,0 @@
-package com.willalp.web.controller.control;
-
-import com.willalp.common.annotation.Log;
-import com.willalp.common.core.controller.BaseController;
-import com.willalp.common.core.domain.AjaxResult;
-import com.willalp.common.core.page.TableDataInfo;
-import com.willalp.common.enums.BusinessType;
-import com.willalp.common.utils.DateUtils;
-import com.willalp.common.utils.SecurityUtils;
-import com.willalp.common.utils.poi.ExcelUtil;
-import com.willalp.control.domain.HsControlUsenoConfig;
-import com.willalp.control.service.IHsControlUsenoConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 空开设备号口配置Controller
- *
- * @author willalp
- * @date 2022-02-21
- */
-@RestController
-@RequestMapping("/control/useNoConfig")
-public class HsControlUsenoConfigController extends BaseController {
-    @Autowired
-    private IHsControlUsenoConfigService hsControlUsenoConfigService;
-
-    /**
-     * 查询空开设备号口配置列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:useNoConfig:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(HsControlUsenoConfig hsControlUsenoConfig) {
-        startPage();
-        List<HsControlUsenoConfig> list = hsControlUsenoConfigService.selectHsControlUsenoConfigList(hsControlUsenoConfig);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出空开设备号口配置列表
-     */
-    @PreAuthorize("@ss.hasPermi('control:useNoConfig:export')")
-    @Log(title = "空开设备号口配置", businessType = BusinessType.EXPORT)
-    @GetMapping("/export")
-    public AjaxResult export(HsControlUsenoConfig hsControlUsenoConfig) {
-        List<HsControlUsenoConfig> list = hsControlUsenoConfigService.selectHsControlUsenoConfigList(hsControlUsenoConfig);
-        ExcelUtil<HsControlUsenoConfig> util = new ExcelUtil<HsControlUsenoConfig>(HsControlUsenoConfig.class);
-        return util.exportExcel(list, "空开设备号口配置数据");
-    }
-
-    /**
-     * 获取空开设备号口配置详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('control:useNoConfig:query')")
-    @GetMapping(value = "/{useNoId}")
-    public AjaxResult getInfo(@PathVariable("useNoId") Long useNoId) {
-        return AjaxResult.success(hsControlUsenoConfigService.getById(useNoId));
-    }
-
-    /**
-     * 新增空开设备号口配置
-     */
-    @PreAuthorize("@ss.hasPermi('control:useNoConfig:add')")
-    @Log(title = "空开设备号口配置", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody HsControlUsenoConfig hsControlUsenoConfig) {
-        hsControlUsenoConfig.setCreateBy(SecurityUtils.getUsername());
-        hsControlUsenoConfig.setCreateTime(DateUtils.getNowDate());
-        return toAjax(hsControlUsenoConfigService.save(hsControlUsenoConfig));
-    }
-
-    /**
-     * 修改空开设备号口配置
-     */
-    @PreAuthorize("@ss.hasPermi('control:useNoConfig:edit')")
-    @Log(title = "空开设备号口配置", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody HsControlUsenoConfig hsControlUsenoConfig) {
-        hsControlUsenoConfig.setUpdateBy(SecurityUtils.getUsername());
-        hsControlUsenoConfig.setUpdateTime(DateUtils.getNowDate());
-        return toAjax(hsControlUsenoConfigService.updateById(hsControlUsenoConfig));
-    }
-
-    /**
-     * 删除空开设备号口配置
-     */
-    @PreAuthorize("@ss.hasPermi('control:useNoConfig:remove')")
-    @Log(title = "空开设备号口配置", businessType = BusinessType.DELETE)
-    @DeleteMapping("/{useNoIds}")
-    public AjaxResult remove(@PathVariable Long[] useNoIds) {
-        return toAjax(hsControlUsenoConfigService.removeByIds(Arrays.asList(useNoIds)));
-    }
-}

+ 2 - 1
willalp-admin/src/main/java/com/willalp/web/controller/system/HsPostConfigController.java

@@ -45,7 +45,7 @@ public class HsPostConfigController extends BaseController {
      */
     @GetMapping("/pcTreeList")
     public AjaxResult pcTreeList() {
-        return AjaxResult.success(hsPostConfigService.getTreePost());
+        return AjaxResult.success(hsPostConfigService.getTreePost(null));
     }
 
     /**
@@ -78,6 +78,7 @@ public class HsPostConfigController extends BaseController {
     public AjaxResult add(@RequestBody HsPostConfig hsPostConfig) {
         hsPostConfig.setCreateBy(SecurityUtils.getUsername());
         hsPostConfig.setCreateTime(DateUtils.getNowDate());
+        hsPostConfig.setOrgCode("G00000007");
         return toAjax(hsPostConfigService.save(hsPostConfig));
     }
 

+ 8 - 0
willalp-admin/src/test/java/com/willalp/CanteenTest.java

@@ -7,6 +7,7 @@
 package com.willalp;
 
 import com.willalp.canteen.service.IHsGiftService;
+import com.willalp.msg.service.IHsAppUserMsgService;
 import org.junit.jupiter.api.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -27,6 +28,8 @@ public class CanteenTest {
     @Autowired
     private IHsGiftService giftService;
 
+    @Autowired
+    private IHsAppUserMsgService appUserMsgService;
     @Test
     public void test() {
         //测试积分兑换是否会超卖
@@ -41,5 +44,10 @@ public class CanteenTest {
             }).start();
         }
     }
+
+    @Test
+    public void test1() {
+        appUserMsgService.pushMsgSum();
+    }
 }
  

+ 1 - 1
willalp-apply/src/main/java/com/willalp/apply/mapper/xml/HsSysApplyMapper.xml

@@ -2,7 +2,7 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.willalp.apply.mapper.HsSysApplyMapper">
+<mapper namespace="com.willalp.taskId.mapper.HsSysApplyMapper">
 
     <resultMap type="HsSysApply" id="HsSysApplyResult">
                     <result property="id"    column="id"    />

+ 4 - 0
willalp-clocking-in/pom.xml

@@ -20,6 +20,10 @@
             <groupId>com.willalp</groupId>
             <artifactId>willalp-system</artifactId>
         </dependency>
+        <dependency>
+            <groupId>com.willalp</groupId>
+            <artifactId>willalp-framework</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 6 - 6
willalp-clocking-in/src/main/java/com/willalp/flow/domain/HsFlowBase.java

@@ -23,7 +23,7 @@ public class HsFlowBase {
 
     /** 模型ID */
     @Excel(name = "模型ID")
-    private String modelId;
+    private String modelType;
 
     /** 实例ID */
     @Excel(name = "实例ID")
@@ -87,12 +87,12 @@ public class HsFlowBase {
         return id;
     }
 
-    public void setModelId(String modelId) {
-        this.modelId = modelId;
+    public void setModelType(String modelType) {
+        this.modelType = modelType;
     }
 
-    public String getModelId() {
-        return modelId;
+    public String getModelType() {
+        return modelType;
     }
 
     public void setExamplesId(String examplesId) {
@@ -203,7 +203,7 @@ public class HsFlowBase {
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                 .append("id", getId())
-                .append("modelId", getModelId())
+                .append("modelType", getModelType())
                 .append("examplesId", getExamplesId())
                 .append("groupId", getGroupId())
                 .append("flowModuleName", getFlowModuleName())

+ 8 - 8
willalp-clocking-in/src/main/java/com/willalp/flow/domain/HsFlowCc.java

@@ -31,9 +31,9 @@ public class HsFlowCc extends BaseEntity
     @Excel(name = "业务数据")
     private String formData;
 
-    /** 发起人 */
-    @Excel(name = "发起人")
-    private String apply;
+    /** 任务ID */
+    @Excel(name = "任务ID")
+    private String taskId;
 
     /** 抄送用户 */
     @Excel(name = "抄送用户")
@@ -73,14 +73,14 @@ public class HsFlowCc extends BaseEntity
         this.formData = formData;
     }
 
-    public void setApply(String apply)
+    public void setTaskId(String taskId)
     {
-        this.apply = apply;
+        this.taskId = taskId;
     }
 
-    public String getApply()
+    public String getTaskId()
     {
-        return apply;
+        return taskId;
     }
     public void setUsers(String users)
     {
@@ -116,7 +116,7 @@ public class HsFlowCc extends BaseEntity
             .append("id", getId())
             .append("title", getTitle())
             .append("jsonData", getFormData())
-            .append("apply", getApply())
+            .append("taskId", getTaskId())
             .append("users", getUsers())
             .append("isDelete", getIsDelete())
             .append("examplesId", getExamplesId())

+ 5 - 0
willalp-clocking-in/src/main/java/com/willalp/flow/domain/req/FlowReq.java

@@ -8,12 +8,17 @@ import lombok.Data;
  */
 @Data
 public class FlowReq {
+    /** 同意/拒绝*/
     private String comment;
+    /** 结果code*/
     private String result;
     private String baseId;
     private String taskId;
+    /** 拒绝时用户选择的节点ID*/
     private String rejectBaseId;
+    /** 用户选择的下一级审批人*/
     private String nextApproval;
+    /** 用户选择的下一级审批人姓名*/
     private String nextUserName;
     private JSONObject formData;
 }

+ 4 - 4
willalp-clocking-in/src/main/java/com/willalp/flow/mapper/xml/HsFlowBaseMapper.xml

@@ -6,7 +6,7 @@
 
     <resultMap type="com.willalp.flow.domain.HsFlowBase" id="HsFlowBaseResult">
         <result property="id" column="id"/>
-        <result property="modelId" column="model_id"/>
+        <result property="modelType" column="model_type"/>
         <result property="examplesId" column="examples_id"/>
         <result property="groupId" column="group_id"/>
         <result property="flowModuleName" column="flow_module_name"/>
@@ -23,7 +23,7 @@
 
     <sql id="selectHsFlowBaseVo">
         select id,
-               model_id,
+               model_type,
                examples_id,
                group_id,
                flow_module_name,
@@ -42,8 +42,8 @@
     <select id="selectHsFlowBaseList" parameterType="HsFlowBase" resultMap="HsFlowBaseResult">
         <include refid="selectHsFlowBaseVo"/>
         <where>
-            <if test="modelId != null  and modelId != ''">
-                and model_id = #{modelId}
+            <if test="modelType != null  and modelType != ''">
+                and model_type = #{modelType}
             </if>
             <if test="examplesId != null  and examplesId != ''">
                 and examples_id = #{examplesId}

+ 4 - 4
willalp-clocking-in/src/main/java/com/willalp/flow/mapper/xml/HsFlowCcMapper.xml

@@ -8,7 +8,7 @@
         <result property="id" column="id"/>
         <result property="title" column="title"/>
         <result property="formData" column="form_data"/>
-        <result property="apply" column="apply"/>
+        <result property="taskId" column="task_id"/>
         <result property="users" column="users"/>
         <result property="isDelete" column="is_delete"/>
         <result property="examplesId" column="examples_id"/>
@@ -23,7 +23,7 @@
         select id,
                title,
                form_data,
-               apply,
+               task_id,
                users,
                is_delete,
                examples_id,
@@ -45,8 +45,8 @@
             <if test="jsonData != null  and jsonData != ''">
                 and json_data = #{jsonData}
             </if>
-            <if test="apply != null  and apply != ''">
-                and apply = #{apply}
+            <if test="taskId != null  and taskId != ''">
+                and task_id = #{taskId}
             </if>
             <if test="users != null  and users != ''">
                 and users = #{users}

+ 69 - 1
willalp-clocking-in/src/main/java/com/willalp/flow/service/HsFlowEngineService.java

@@ -1,5 +1,6 @@
 package com.willalp.flow.service;
 
+import com.willalp.flow.domain.HsFlowBase;
 import com.willalp.flow.domain.HsFlowRunningRecord;
 import com.willalp.flow.domain.HsFlowTask;
 import com.willalp.flow.domain.req.FlowReq;
@@ -14,17 +15,74 @@ import java.util.Map;
  */
 public interface HsFlowEngineService {
 
+    /** 请假流程配置key*/
     String BIZ_LEAVE_FLOW_KEY = "biz_leave_flow_run_key";
+
+    /** 投稿流程配置key*/
     String FILE_APPROVAL_FLOW_KEY = "file_approval_flow_run_key";
+
+    /** 物资流程配置key*/
     String RESERVE_FLOW_KEY = "reserve_consuming_flow_run_key";
 
+    /** 空节点*/
+    String EMPTY = "EMPTY";
+
+    /** 根节点*/
+    String ROOT = "ROOT";
+
+    /** 审批节点*/
+    String APPROVAL = "APPROVAL";
+
+    /** 条件节点*/
+    String CONDITION = "CONDITION";
+
+    /** 条件节点组*/
+    String CONDITIONS = "CONDITIONS";
+
+    /** 并行节点*/
+    String CONCURRENT = "CONCURRENT";
+
+    /** 抄送节点*/
+    String CC = "CC";
+
+    /** 延时处理节点*/
+    String DELAY = "DELAY";
+
+    /** 触发器节点*/
+    String TRIGGER = "TRIGGER";
+
+    /** 通用常量*/
+    String ONE = "1";
+    String ZERO = "0";
+    String FOUR = "4";
+    String SEVEN = "7";
+    String TITLE = "title";
+
+    /** 任务结束中文*/
+    String TASK_END_CN_TEXT = "任务已结束";
+
+    /** 任务自动结束中文*/
+    String TASK_AUTO_END_CN_TEXT = "自动结束";
+
+    /** 审批状态*/
+    String APPROVED = "已通过";
+    String UNDERWAY = "进行中";
+    String DENIED = "已拒绝";
+    String REJECT = "驳回";
+    String CONSENT = "同意";
+
+    /** 抄送信息*/
+    String CC_TITLE = "审批抄送";
+
+
     /**
      * 提交并生成任务实例
      * @param task
      * @param params
      * @return
      */
-    Map<String,Object> submitATask(HsFlowTask task, Map<String, Object> params);
+    Map<String,Object> submitTask(HsFlowTask task, Map<String, Object> params);
+
 
     /**
      * 提交任务候选人
@@ -44,6 +102,16 @@ public interface HsFlowEngineService {
      */
     int nextStep(FlowReq flow);
 
+    /**
+     * 所有基础节点运行逻辑封装
+     *
+     *  @param base 当前节点基本信息
+     * @param task 当前任务
+     * @param formData 表单业务数据
+     * @return
+     */
+    HsFlowBase baseRun(HsFlowBase base, HsFlowTask task, Map<String,Object> formData);
+
     /**
      * 获取待办
      *

+ 1 - 1
willalp-clocking-in/src/main/java/com/willalp/flow/service/IHsFlowBaseService.java

@@ -22,7 +22,7 @@ public interface IHsFlowBaseService extends IService<HsFlowBase>
     public List<HsFlowBase> selectHsFlowBaseList(HsFlowBase hsFlowBase);
 
     /**
-     * 获取当前流程任务 Base组件信息
+     * 获取流程任务 Base组件信息
      *
      * @param groupId
      * @param baseId

+ 5 - 0
willalp-clocking-in/src/main/java/com/willalp/flow/service/IHsFlowTaskService.java

@@ -30,6 +30,11 @@ public interface IHsFlowTaskService extends IService<HsFlowTask>
     void readTask(String taskId);
 
 
+    /**
+     * 删除已提交但没有选择审批人员的任务
+     *
+     * @param task
+     */
     @Async("threadPoolTaskExecutor")
     void removeWaitTimeOutTask(HsFlowTask task);
 }

+ 249 - 185
willalp-clocking-in/src/main/java/com/willalp/flow/service/impl/HsFlowEngineServiceImpl.java

@@ -4,6 +4,8 @@ import cn.hutool.json.JSONObject;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.willalp.common.core.domain.entity.SysUser;
+import com.willalp.common.core.domain.model.LoginUser;
 import com.willalp.common.exception.base.BaseException;
 import com.willalp.common.utils.DateUtils;
 import com.willalp.common.utils.SecurityUtils;
@@ -16,7 +18,9 @@ import com.willalp.flow.mapper.*;
 import com.willalp.flow.service.*;
 import com.willalp.msg.domain.HsAppUserMsg;
 import com.willalp.msg.service.IHsAppUserMsgService;
+import com.willalp.system.domain.HsPostConfig;
 import com.willalp.system.domain.vo.PostTreeVo;
+import com.willalp.system.service.IHsPostConfigService;
 import com.willalp.system.service.ISysConfigService;
 import com.willalp.wx.domain.WxMsgTemplateApproval;
 import com.willalp.wx.enums.WxTemplateKeyEnum;
@@ -80,9 +84,12 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
     @Resource
     private ISysConfigService sysConfigService;
 
+    @Resource
+    private IHsPostConfigService postConfigService;
+
 
     @Override
-    public Map<String, Object> submitATask(HsFlowTask task, Map<String, Object> params) {
+    public Map<String, Object> submitTask(HsFlowTask task, Map<String, Object> params) {
         String examplesId = task.getExamplesId();
         if (StringUtils.isBlank(examplesId)) {
             throw new BaseException("EXAMPLES_ID - IS_NULL");
@@ -130,8 +137,8 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
         //启动超时删除线程
         taskService.removeWaitTimeOutTask(task);
         Map<String, Object> map = new HashMap<>(4);
-        map.put("taskId" , task.getId());
-        map.put("tree" , getApprovalTreePost(task.getBaseGroupId(), task.getBaseId()));
+        map.put("taskId", task.getId());
+        map.put("tree", getApprovalTreePost(task.getBaseGroupId(), task.getBaseId()));
         return map;
     }
 
@@ -167,7 +174,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                         "<p>申请数量:" + formData.get("apply_amount") + "</p>";
             }
             //异步生成审批消息列表
-            userMsgService.saveApprovalMsgAndPush("1" ,
+            userMsgService.saveApprovalMsgAndPush("1",
                     String.valueOf(formData.get("title")), content, taskId,
                     candidate, applyUserName, new Date());
         } catch (ParseException e) {
@@ -191,11 +198,14 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
         if (StringUtils.isBlank(flow.getResult())) {
             throw new BaseException("FLOW_RESULT - IS_NULL");
         }
-        //获取任务实例
+        //获取任务实例并验证
         HsFlowTask hsFlowTask = hsFlowTaskMapper.selectById(flow.getTaskId());
         if (null == hsFlowTask) {
             throw new BaseException("没有找到任务实例");
         }
+        if (!SecurityUtils.getUsername().equals(hsFlowTask.getOperator())) {
+            throw new BaseException("无操作权限");
+        }
         if ("1".equals(hsFlowTask.getIsEnd())) {
             throw new BaseException("任务已结束");
         }
@@ -205,40 +215,44 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
         if (StringUtils.isBlank(hsFlowTask.getBaseGroupId())) {
             throw new BaseException("FLOW_BASE_GROUP_ID - IS_NULL");
         }
-        //获取当前基础组件
-        HsFlowBase hsFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), flow.getBaseId());
-        if (null == hsFlowBase) {
-            throw new BaseException("没有找到组件");
-        }
+        //获取当前基础组件并验证
+        HsFlowBase flowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), flow.getBaseId());
         //判断是否存在上级节点 不存在则为父级组件 然后跳过
-        if (StringUtils.isBlank(hsFlowBase.getUpStepId())) {
-            if (StringUtils.isNotBlank(hsFlowBase.getDownStepId())) {
-                hsFlowBase = hsFlowBaseMapper.selectById(hsFlowBase.getDownStepId());
+        if (StringUtils.isBlank(flowBase.getUpStepId())) {
+            if (StringUtils.isNotBlank(flowBase.getDownStepId())) {
+                flowBase = hsFlowBaseMapper.selectById(flowBase.getDownStepId());
             } else {
                 throw new BaseException("流程配置错误");
             }
         }
-        if (!SecurityUtils.getUsername().equals(hsFlowTask.getOperator())) {
-            throw new BaseException("无操作权限");
-        }
-        if (FlowEnum.IS_ONE.getValue().equals(hsFlowTask.getIsEnd())) {
-            throw new BaseException("任务已经结束");
-        }
         String stepId = null;
         //获取是否 是同意结果
         boolean resultTrue = FlowEnum.RESULT_TRUE.getValue().equals(flow.getResult());
         boolean resultCaseOf = FlowEnum.RESULT_CASE_OF.getValue().equals(flow.getResult());
         Map<String, Object> formData = flow.getFormData();
+        //申请人[userCode]
+        String applyUserId = String.valueOf(formData.get("apply_user_id"));
+        //操作人信息
+        SysUser operator;
+        String username = null;
+        String nickName = null;
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        if (null != loginUser && null != loginUser.getUser()) {
+            operator = loginUser.getUser();
+            username = operator.getUserName();
+            nickName = operator.getNickName();
+        }
         List<HsFlowRunningRecord> list = new ArrayList<>();
-        HsFlowBase nextFlowBase = null;
         //生成审批记录
         HsFlowRunningRecord frr = new HsFlowRunningRecord();
-        String username = SecurityUtils.getUsername();
         frr.setBaseId(flow.getBaseId());
         frr.setTaskId(flow.getTaskId());
         frr.setCreateTime(new Date());
+        //当前流程名 + 操作人
+        String frrComment = hsFlowTask.getBaseName() + ":" + nickName;
         frr.setOperator(username);
-        String baseName = null;
+        frr.setYesOrNo(flow.getResult());
+        list.add(frr);
         if (resultCaseOf) {
             //转交
             hsFlowTask.setOperator(flow.getNextApproval());
@@ -247,180 +261,91 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             frr.setYesOrNo(flow.getResult());
         } else {
             if (resultTrue) {
-                //查看有无条件组件
-                hsFlowBase = getFlowBaseByTermResult(flow.getTaskId(), hsFlowBase, formData);
-                stepId = hsFlowBase.getDownStepId();
+                //同意
+                frr.setComment(frrComment + (StringUtils.equals(CONSENT, flow.getComment()) ? " - " + CONSENT : " - " + CONSENT + ":" + flow.getComment()));
+                flowBase = baseRun(flowBase, hsFlowTask, formData);
+                stepId = flowBase.getDownStepId();
             } else {
+                //拒绝
+                frr.setComment(frrComment + (StringUtils.equals(REJECT, flow.getComment()) ? " - " + REJECT : " - " + REJECT + ":" + flow.getComment()));
                 stepId = flow.getRejectBaseId();
+                flowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
             }
-            nextFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
-            //判断新组件下一步是否需要抄送
-            if (nextFlowBase != null && StringUtils.isNotBlank(nextFlowBase.getCcId())) {
-                HsFlowCc cc = new HsFlowCc();
-                cc.setExamplesId(hsFlowTask.getExamplesId());
-                cc.setFormData(JSON.toJSONString(formData));
-                cc.setApply(hsFlowTask.getInitiator());
-                cc.setTitle(hsFlowTask.getTaskName());
-                Operators operators = JSON.parseObject(nextFlowBase.getOperator(), Operators.class);
-                List<Operators.OperatorDto> assignedUser = operators.getAssignedUser();
-                StringBuilder sbUid = new StringBuilder();
-                StringBuilder sbUname = new StringBuilder();
-
-                if (0 != assignedUser.size()) {
-                    for (int i = 0; i < assignedUser.size(); i++) {
-                        if (i != (assignedUser.size() - 1)) {
-                            sbUid.append(assignedUser.get(i).getId()).append(",");
-                            sbUname.append(assignedUser.get(i).getName()).append(",");
-                        } else {
-                            sbUid.append(assignedUser.get(i).getId());
-                            sbUname.append(assignedUser.get(i).getName());
-                        }
-                    }
-                    cc.setUsers(sbUid.toString());
-                }
-                List<HsAppUserMsg> msgs = new ArrayList<>();
-                //先持久化抄送数据
-                flowCcService.save(cc);
-                //再发送推送和生成审批结果消息列表
-                if (0 != assignedUser.size()) {
-                    for (Operators.OperatorDto operatorDto : assignedUser) {
-                        //再发送推送和生成审批结果消息列表
-                        HsAppUserMsg appUserMsg = new HsAppUserMsg();
-                        appUserMsg.setMsgContent(String.valueOf(formData.get("apply_user_name")) + "的" + formData.get("title"));
-                        appUserMsg.setMsgTitle("审批抄送");
-                        appUserMsg.setMsgIsRead("0");
-                        appUserMsg.setUserCode(operatorDto.getId());
-                        appUserMsg.setMsgType("4");
-                        appUserMsg.setRemark(hsFlowTask.getId());
-                        appUserMsg.setCreateTime(new Date());
-                        msgs.add(appUserMsg);
-                        if (StringUtils.isBlank(nextFlowBase.getDownStepId())) {
-                            if (resultTrue) {
-                                wxMsgService.sendResultMsg("审批抄送 - " + formData.get("title"), "已通过" , operatorDto.getId());
-                            }
-                        } else {
-                            stepId = nextFlowBase.getDownStepId();
-                            nextFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
-                            baseName = nextFlowBase.getFlowModuleName();
-                            wxMsgService.sendResultMsg("审批抄送 - " + formData.get("title"), "进行中" , operatorDto.getId());
-                        }
-                    }
-                    userMsgService.saveBatch(msgs);
-                }
-                HsFlowRunningRecord frrCc = new HsFlowRunningRecord();
-                frrCc.setBaseId(flow.getBaseId());
-                frrCc.setTaskId(flow.getTaskId());
-                frrCc.setCreateTime(new Date());
-                frrCc.setComment("已抄送至下述人员:" + sbUname);
-                frrCc.setOperator(username);
-                frrCc.setYesOrNo(FlowEnum.CC.getValue());
-                list.add(frrCc);
-            } else {
-                nextFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
-            }
-            frr.setComment(hsFlowTask.getBaseName() + ":" + SecurityUtils.getLoginUser().getUser().getNickName() + " - " + flow.getComment());
-            frr.setYesOrNo(flow.getResult());
-        }
-        list.add(frr);
-        if (StringUtils.isNotBlank(stepId) && StringUtils.isBlank(nextFlowBase.getCcId())) {
-            hsFlowTask.setBaseId(stepId);
-            //判断新组件下一步是否需要选择人员
-            if (StringUtils.isNotBlank(flow.getNextApproval())) {
-                frr.setOperator(SecurityUtils.getUsername());
-                hsFlowTask.setOperator(flow.getNextApproval());
-                //如果有抄送获取抄送下一级的baseName
-                if (StringUtils.isNotBlank(nextFlowBase.getCcId())) {
-                    hsFlowTask.setBaseName(baseName);
-                } else {
-                    hsFlowTask.setBaseName(nextFlowBase.getFlowModuleName());
-                }
-            } else if (!resultTrue) {
-                hsFlowTask.setBaseId(stepId);
-                hsFlowTask.setOperator(flow.getNextApproval());
-                HsFlowBase currentFlowTaskBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
-                hsFlowTask.setBaseName(currentFlowTaskBase.getFlowModuleName());
-            } else {
-                //避免异常找不到任务默认admin
-                hsFlowTask.setOperator("admin");
-                throw new BaseException("未选择下一步审批人员");
-            }
-            String isCandidate = null;
-            if (StringUtils.isNotBlank(nextFlowBase.getDownStepId())) {
-                //查询是否是抄送组件
-                HsFlowBase base = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), nextFlowBase.getDownStepId());
-                if (base != null && StringUtils.isNotBlank(base.getCcId())) {
-                    isCandidate = "1";
-                } else {
-                    isCandidate = "0";
-                }
-            } else if (StringUtils.isBlank(nextFlowBase.getTermModuleId())) {
-                isCandidate = "1";
-            } else {
-                isCandidate = "0";
-            }
-            hsFlowTask.setIsCandidate(isCandidate);
-        } else {
-            stepId = null;
         }
         //任务结束
         if (StringUtils.isBlank(stepId) && !resultCaseOf) {
             hsFlowTask.setBaseId(null);
             hsFlowTask.setOperator(hsFlowTask.getOperator());
-            hsFlowTask.setIsEnd("1");
-            hsFlowTask.setRemark("任务已结束");
-            HsFlowRunningRecord frr1 = new HsFlowRunningRecord();
-            frr1.setComment("自动结束");
-            frr1.setOperator(SecurityUtils.getUsername());
-            frr1.setTaskId(flow.getTaskId());
-            frr1.setCreateTime(new Date(System.currentTimeMillis() + 1000));
-            list.add(frr1);
+            hsFlowTask.setIsEnd(ONE);
+            hsFlowTask.setRemark(TASK_END_CN_TEXT);
+            HsFlowRunningRecord frrEnd = new HsFlowRunningRecord();
+            frrEnd.setComment(TASK_AUTO_END_CN_TEXT);
+            frrEnd.setOperator(SecurityUtils.getUsername());
+            frrEnd.setTaskId(flow.getTaskId());
+            frrEnd.setCreateTime(new Date(System.currentTimeMillis() + 1000));
+            list.add(frrEnd);
             //生成审批结果消息列表
             HsAppUserMsg appUserMsg = new HsAppUserMsg();
-            appUserMsg.setMsgContent("您的 [" + formData.get("title") + "] 申请" + (resultTrue ? "已通过" : "已拒绝"));
+            appUserMsg.setMsgContent("您的 [" + formData.get(TITLE) + "] 申请" + (resultTrue ? APPROVED : DENIED));
             appUserMsg.setMsgTitle("审批结果");
-            appUserMsg.setMsgIsRead("0");
-            appUserMsg.setUserCode(String.valueOf(formData.get("apply_user_id")));
-            appUserMsg.setMsgType("4");
+            appUserMsg.setMsgIsRead(ZERO);
+            appUserMsg.setUserCode(applyUserId);
+            appUserMsg.setMsgType(FOUR);
+            appUserMsg.setIsPush(ZERO);
             appUserMsg.setRemark(hsFlowTask.getId());
             appUserMsg.setCreateTime(new Date());
             userMsgService.save(appUserMsg);
             //推送微信审批结果通知
-            wxMsgService.sendResultMsg(String.valueOf(formData.get("title")), resultTrue ? "已通过" : "已拒绝" , String.valueOf(formData.get("apply_user_id")));
+            wxMsgService.sendResultMsg(String.valueOf(formData.get(TITLE)), resultTrue ? APPROVED : DENIED, applyUserId);
         } else {
             //任务继续
-            hsFlowTask.setMsgIsRead("0");
+            hsFlowTask.setMsgIsRead(ZERO);
+            hsFlowTask.setOperator(flow.getNextApproval());
+            hsFlowTask.setBaseName(flowBase.getFlowModuleName());
+            hsFlowTask.setBaseId(flowBase.getId());
+            if (StringUtils.isNotBlank(flowBase.getDownStepId())) {
+                HsFlowBase nextFlowBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(hsFlowTask.getBaseGroupId(), stepId);
+                if (nextFlowBase != null && nextFlowBase.getModelType().equals(APPROVAL)) {
+                    hsFlowTask.setIsCandidate(ZERO);
+                } else {
+                    hsFlowTask.setIsCandidate(ONE);
+                }
+            } else {
+                hsFlowTask.setIsCandidate(ONE);
+            }
             //生成审批结果消息列表
             HsAppUserMsg appUserMsg = new HsAppUserMsg();
             String content = null;
             String examplesId = hsFlowTask.getExamplesId();
             if (examplesId.equals(sysConfigService.selectConfigByKey(HsFlowEngineService.BIZ_LEAVE_FLOW_KEY))) {
-                content = "<p>标题:" + formData.get("title") + "</p>" +
+                content = "<p>标题:" + formData.get(TITLE) + "</p>" +
                         "<p>申请人:" + formData.get("apply_user_name") + "</p>" +
                         "<p>开始时间:" + formData.get("leave_start_time").toString() + "</p>" +
                         "<p>结束时间:" + formData.get("leave_end_time").toString() + "</p>";
             } else if (examplesId.equals(sysConfigService.selectConfigByKey(HsFlowEngineService.FILE_APPROVAL_FLOW_KEY))) {
                 //异步生成审批消息列表
-                content = "<p>标题:" + formData.get("title") + "</p>" +
+                content = "<p>标题:" + formData.get(TITLE) + "</p>" +
                         "<p>申请人:" + formData.get("apply_user_name") + "</p>";
             } else if (examplesId.equals(sysConfigService.selectConfigByKey(HsFlowEngineService.RESERVE_FLOW_KEY))) {
-                content = "<p>标题:" + formData.get("title") + "</p>" +
+                content = "<p>标题:" + formData.get(TITLE) + "</p>" +
                         "<p>申请人:" + formData.get("apply_user_name") + "</p>" +
                         "<p>物资名称:" + formData.get("reserve_name") + "</p>" +
                         "<p>申请数量:" + formData.get("apply_amount") + "</p>";
             }
             appUserMsg.setMsgContent(content);
-            appUserMsg.setMsgTitle(String.valueOf(formData.get("title")));
-            appUserMsg.setMsgIsRead("0");
+            appUserMsg.setMsgTitle(String.valueOf(formData.get(TITLE)));
+            appUserMsg.setMsgIsRead(ZERO);
             appUserMsg.setUserCode(hsFlowTask.getOperator());
-            appUserMsg.setMsgType("1");
+            appUserMsg.setMsgType(ONE);
+            appUserMsg.setIsPush(ZERO);
             appUserMsg.setRemark(hsFlowTask.getId());
             appUserMsg.setCreateTime(new Date());
             userMsgService.save(appUserMsg);
             //推送微信待审批通知
             WxMsgTemplateApproval wxMsgTemplateApproval = new WxMsgTemplateApproval();
-            wxMsgTemplateApproval.setThing5(wxUtils.getFormat(String.valueOf(formData.get("title"))));
+            wxMsgTemplateApproval.setThing5(wxUtils.getFormat(String.valueOf(formData.get(TITLE))));
             wxMsgTemplateApproval.setThing11(wxUtils.getFormat(String.valueOf(formData.get("apply_user_name"))));
-            wxMsgTemplateApproval.setTime12(wxUtils.getFormat(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss" , new Date())));
+            wxMsgTemplateApproval.setTime12(wxUtils.getFormat(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", new Date())));
             wxMsgService.sendQRCodeMsg(hsFlowTask.getOperator(), wxMsgTemplateApproval, WxTemplateKeyEnum.APPROVAL_WAIT, true);
         }
         hsFlowTaskMapper.updateById(hsFlowTask);
@@ -428,6 +353,109 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
         return 1;
     }
 
+    @Override
+    public HsFlowBase baseRun(HsFlowBase base, HsFlowTask task, Map<String, Object> formData) {
+        switch (base.getModelType()) {
+            case APPROVAL:
+                //直接获取下一级节点
+                base = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(task.getBaseGroupId(), base.getDownStepId());
+                //如果下一个不是审批组件则再进行一步,如抄送,延时处理,触发器等
+                if (!APPROVAL.equals(base.getModelType())) {
+                    return baseRun(base, task, formData);
+                } else {
+                    return base;
+                }
+            case DELAY:
+                //延时处理节点
+                break;
+            case TRIGGER:
+                //触发器节点
+                break;
+            case CONCURRENT:
+                //并行节点
+                break;
+            case CONDITIONS:
+                //设置条件组ID,并与父级ID组合为复合主键确认唯一性(逻辑唯一)
+                return getFlowBaseByTermResult(task.getId(), base, formData);
+            case CONDITION:
+                //解析单个条件中的详细数据
+                break;
+            case CC:
+                //抄送节点
+                HsFlowCc cc = new HsFlowCc();
+                cc.setExamplesId(task.getExamplesId());
+                cc.setFormData(JSON.toJSONString(formData));
+                cc.setTaskId(task.getId());
+                cc.setTitle(task.getTaskName());
+                cc.setCreateTime(new Date());
+                cc.setUpdateTime(new Date());
+                Operators operators = JSON.parseObject(base.getOperator(), Operators.class);
+                List<Operators.OperatorDto> assignedUser = operators.getAssignedUser();
+                List<String> sbUid = new ArrayList<>();
+                StringBuilder sbUname = new StringBuilder();
+                if (0 != assignedUser.size()) {
+                    for (int i = 0; i < assignedUser.size(); i++) {
+                        if (i != (assignedUser.size() - 1)) {
+                            sbUid.add(assignedUser.get(i).getId() + ",");
+                            sbUname.append(assignedUser.get(i).getName()).append(",");
+                        } else {
+                            sbUid.add(assignedUser.get(i).getId());
+                            sbUname.append(assignedUser.get(i).getName());
+                        }
+                    }
+                }
+                List<PostTreeVo> postTreeVos = new ArrayList<>();
+                for (String id : sbUid) {
+                    HsPostConfig postConfig = postConfigService.getBaseMapper().selectOne(new QueryWrapper<HsPostConfig>()
+                            .eq("id", id));
+                    cc.setUsers(postConfig.getPostUserG());
+                    postTreeVos.addAll(postConfigService.setUsers(postConfig));
+                }
+                HsFlowRunningRecord frrCc = new HsFlowRunningRecord();
+                frrCc.setBaseId(base.getId());
+                frrCc.setTaskId(task.getId());
+                frrCc.setCreateTime(new Date());
+                frrCc.setComment("已抄送至:" + sbUname);
+                frrCc.setOperator(SecurityUtils.getUsername());
+                frrCc.setYesOrNo(FlowEnum.CC.getValue());
+                frrCc.setCreateTime(new Date());
+                //先持久化抄送数据
+                flowCcService.save(cc);
+                flowRunningRecordService.save(frrCc);
+                List<HsAppUserMsg> msgs = new ArrayList<>();
+                //再发送推送和生成审批结果消息列表
+                if (0 != postTreeVos.size()) {
+                    for (PostTreeVo postTreeVo : postTreeVos) {
+                        //再发送推送和生成审批结果消息列表
+                        HsAppUserMsg appUserMsg = new HsAppUserMsg();
+                        appUserMsg.setMsgContent(formData.get("apply_user_name") + "的 [" + formData.get("title") + "]");
+                        appUserMsg.setMsgTitle(CC_TITLE);
+                        appUserMsg.setMsgIsRead(ZERO);
+                        appUserMsg.setUserCode(postTreeVo.getValue());
+                        appUserMsg.setMsgType(SEVEN);
+                        appUserMsg.setIsPush(ZERO);
+                        appUserMsg.setRemark(task.getId());
+                        appUserMsg.setCreateTime(new Date());
+                        msgs.add(appUserMsg);
+                        if (StringUtils.isBlank(base.getDownStepId())) {
+                            wxMsgService.sendResultMsg(CC_TITLE + " - " + formData.get(TITLE), APPROVED, postTreeVo.getValue());
+                        } else {
+                            base = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(task.getBaseGroupId(), base.getDownStepId());
+                            wxMsgService.sendResultMsg(CC_TITLE + " - " + formData.get(TITLE), UNDERWAY, postTreeVo.getValue());
+                        }
+                    }
+                    userMsgService.saveBatch(msgs);
+                }
+                return base;
+            case ROOT:
+
+                break;
+            default:
+                break;
+        }
+        throw new BaseException("流程配置出错");
+    }
+
 
     /**
      * 通过条件组件判断结果获取流程组件
@@ -458,7 +486,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                     if (conditionModelService.executeConditionJudgment(item, params.get(paramName))) {
                         //对应条件组件
                         HsFlowBase termModule = hsFlowBaseMapper.selectOne(
-                                new QueryWrapper<HsFlowBase>().eq("term_module_id" , item.getId()));
+                                new QueryWrapper<HsFlowBase>().eq("term_module_id", item.getId()));
                         if (null == termModule) {
                             throw new BaseException("流程条件配置出错");
                         }
@@ -477,7 +505,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             }
             hsFlowTaskMapper.deleteById(taskId);
             flowRunningRecordService.remove(new QueryWrapper<HsFlowRunningRecord>()
-                    .eq("task_id" , taskId));
+                    .eq("task_id", taskId));
             throw new BaseException("流程条件未满足,流程关闭,请重新发起");
         } else {
             return hsFlowBase;
@@ -490,7 +518,7 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             return null;
         }
         List<HsFlowTask> hsFlowTasks = hsFlowTaskMapper.selectList(new QueryWrapper<HsFlowTask>()
-                .eq("id" , taskId));
+                .eq("id", taskId));
         return getHsFlowTasks(hsFlowTasks);
     }
 
@@ -533,8 +561,8 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
                                     .selectBusinessCase(example.getBusinessTableName(), businessId);
                             if (ObjectUtils.isNotNull(stringObjectMap)) {
                                 if ("biz_leave".equals(example.getBusinessTableName())) {
-                                    List<Map<String, Object>> leaveImgs = leaveImgService.getBaseMapper().selectMaps(new QueryWrapper<BizLeaveImg>().eq("biz_leave_id" , businessId));
-                                    stringObjectMap.put("imgUrls" , leaveImgs);
+                                    List<Map<String, Object>> leaveImgs = leaveImgService.getBaseMapper().selectMaps(new QueryWrapper<BizLeaveImg>().eq("biz_leave_id", businessId));
+                                    stringObjectMap.put("imgUrls", leaveImgs);
                                 }
                                 //统一时间类型字段处理
                                 Set<String> strings = stringObjectMap.keySet();
@@ -569,6 +597,10 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
     @Override
     public List<HsFlowRunningRecord> rejectTaskRecords(String taskId) {
         if (StringUtils.isNotBlank(taskId)) {
+            HsFlowTask task = taskService.getById(taskId);
+            if (task == null) {
+                throw new BaseException("task not found");
+            }
             List<HsFlowRunningRecord> flowRunningRecords = new ArrayList<>();
             HsFlowRunningRecord hsFlowRunningRecord = new HsFlowRunningRecord();
             hsFlowRunningRecord.setTaskId(taskId);
@@ -576,22 +608,27 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             hsFlowRunningRecord.setYesOrNo("LAUNCH");
             flowRunningRecords.add(hsFlowRunningRecord);
             List<HsFlowRunningRecord> records = flowRunningRecordService.getBaseMapper().selectList(new QueryWrapper<HsFlowRunningRecord>()
-                    .eq("task_id" , taskId).last("AND yes_or_no = 'RESULT_TRUE' GROUP BY base_id"));
-            records.forEach(flowRunningRecord -> {
-                String comment = flowRunningRecord.getComment();
-                flowRunningRecord.setComment(comment.substring(0, comment.indexOf("-")));
-            });
-            flowRunningRecords.addAll(records);
+                    .eq("task_id", taskId).last("AND yes_or_no = 'RESULT_TRUE' GROUP BY base_id"));
+
+            for (HsFlowRunningRecord record : records) {
+                if (StringUtils.isNotBlank(record.getBaseId()) &&
+                        StringUtils.equals(record.getBaseId(), task.getBaseId())) {
+                    break;
+                }
+                String comment = record.getComment();
+                record.setComment(comment.substring(0, comment.indexOf("-")));
+                flowRunningRecords.add(record);
+            }
             return flowRunningRecords;
         }
-        return null;
+        return new ArrayList<>();
     }
 
     @Override
     public int revoke(String taskId) {
         if (StringUtils.isNotBlank(taskId)) {
             long selectCount = flowRunningRecordService.getBaseMapper().selectCount(new QueryWrapper<HsFlowRunningRecord>()
-                    .eq("task_id" , taskId));
+                    .eq("task_id", taskId));
             if (selectCount > 0) {
                 throw new BaseException("已有审批结果无法撤销");
             }
@@ -623,33 +660,24 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
             return null;
         }
         //如果是抄送组件
-        if (StringUtils.isNotBlank(flowTaskCurrentBase.getCcId())) {
+        if (CC.equals(flowTaskCurrentBase.getModelType())) {
             String downStepId = flowTaskCurrentBase.getDownStepId();
             if (StringUtils.isNotBlank(downStepId)) {
                 flowTaskCurrentBase = flowBaseService.getFlowTaskBaseByGroupIdAndBaseId(groupId, downStepId);
             }
         }
-        PostTreeVo postTreeVo = new PostTreeVo();
-        postTreeVo.setText(flowTaskCurrentBase.getFlowModuleName());
-        postTreeVo.setValue(flowTaskCurrentBase.getId());
         Operators operators = JSON.parseObject(flowTaskCurrentBase.getOperator(), Operators.class);
         List<Operators.OperatorDto> assignedUser = operators.getAssignedUser();
         List<PostTreeVo> list = new ArrayList<>();
+        PostTreeVo postTreeVo = new PostTreeVo();
+        postTreeVo.setText(flowTaskCurrentBase.getFlowModuleName());
+        postTreeVo.setValue(flowTaskCurrentBase.getId());
         if (0 != assignedUser.size()) {
-            List<PostTreeVo> postTreeCcVos = new ArrayList<>();
-            assignedUser.forEach(item -> {
-                PostTreeVo postTreeCcVo = new PostTreeVo();
-                postTreeCcVo.setText(item.getName());
-                postTreeCcVo.setValue(item.getId());
-                postTreeCcVos.add(postTreeCcVo);
-            });
-            if (postTreeCcVos.size() != 0) {
-                postTreeVo.setChildren(postTreeCcVos);
-            } else {
-                postTreeVo.setChildren(null);
-            }
-            list.add(postTreeVo);
+            List<HsPostConfig> postConfigs = postConfigService.getBaseMapper().selectList(new QueryWrapper<HsPostConfig>()
+                    .eq("id", assignedUser.get(0).getId()));
+            postTreeVo.setChildren(postConfigService.getTreePost(postConfigs).get(0).getChildren());
         }
+        list.add(postTreeVo);
         return list;
     }
 
@@ -661,5 +689,41 @@ public class HsFlowEngineServiceImpl implements HsFlowEngineService {
         }
         return getApprovalTreePost(groupId, nextFlowTaskBase.getId());
     }
+
+    public static void main(String[] args) {
+        int[][] array = {
+                {1, 2, 3, 1, 2, 3},
+                {4, 5, 6, 1, 2, 3},
+                {7, 8, 9, 1, 2, 3},
+                {7, 8, 9, 1, 2, 3},
+                {7, 8, 9, 1, 2, 3},
+                {7, 8, 9, 1, 2, 3}
+        };
+        int column = 0;
+        int sum = 0;
+        //高
+        int height = array.length;
+        //宽
+        int width = array[0].length;
+        if (width != height) {
+            return;
+        }
+        int sumItem = width * height;
+        if (sumItem % 2 == 0) {
+            //偶数
+            for (int i = 0; i < array.length; i++) {
+                sum += array[i][column];
+                column++;
+            }
+            column = width - 1;
+            for (int i = array.length - 1; i >= 0; i--) {
+                sum += array[i][column];
+                column--;
+            }
+            System.out.println("SUM - " + sum);
+        } else {
+            //奇数
+        }
+    }
 }
 

+ 3 - 1
willalp-clocking-in/src/main/java/com/willalp/flow/service/impl/HsFlowTaskServiceImpl.java

@@ -6,6 +6,7 @@ import com.willalp.flow.domain.HsFlowTask;
 import com.willalp.flow.mapper.HsFlowTaskMapper;
 import com.willalp.flow.service.HsFlowEngineService;
 import com.willalp.flow.service.IHsFlowTaskService;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -44,6 +45,7 @@ public class HsFlowTaskServiceImpl extends ServiceImpl<HsFlowTaskMapper, HsFlowT
     }
 
 
+    @Async("threadPoolTaskExecutor")
     @Override
     public void removeWaitTimeOutTask(HsFlowTask hsFlowTask) {
         int timeout = 0;
@@ -58,7 +60,7 @@ public class HsFlowTaskServiceImpl extends ServiceImpl<HsFlowTaskMapper, HsFlowT
             if (StringUtils.isNotBlank(hsFlowTask.getOperator())) {
                 break;
             }
-            //超过分钟未选择候选人删除任务及提交的表单
+            //超过[1]分钟未选择候选人删除任务及提交的表单
             if (timeout >= 60) {
                 if (StringUtils.isBlank(hsFlowTask.getOperator())) {
                     flowEngineService.removeBusinessForm(hsFlowTask.getExamplesId(), hsFlowTask.getBusinessId());

+ 10 - 0
willalp-clocking-in/src/main/java/com/willalp/msg/domain/HsAppUserMsg.java

@@ -55,6 +55,8 @@ public class HsAppUserMsg extends BaseEntity {
     @Excel(name = "是否已读", readConverterExp = "0=:未读,1=:已读)")
     private String msgIsRead;
 
+    private String isPush;
+
     /**
      * 是否删除(0.未删除;1.已删除)
      */
@@ -139,4 +141,12 @@ public class HsAppUserMsg extends BaseEntity {
     public void setMsgIsRead(String msgIsRead) {
         this.msgIsRead = msgIsRead;
     }
+
+    public String getIsPush() {
+        return isPush;
+    }
+
+    public void setIsPush(String isPush) {
+        this.isPush = isPush;
+    }
 }

+ 2 - 0
willalp-clocking-in/src/main/java/com/willalp/msg/mapper/xml/HsAppUserMsgMapper.xml

@@ -11,6 +11,7 @@
         <result property="msgType" column="msg_type"/>
         <result property="msgContent" column="msg_content"/>
         <result property="msgIsRead" column="msg_is_read"/>
+        <result property="isPush" column="is_push"/>
         <result property="isDelete" column="is_delete"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
@@ -26,6 +27,7 @@
                msg_type,
                msg_content,
                msg_is_read,
+               is_push,
                is_delete,
                create_by,
                create_time,

+ 1 - 2
willalp-clocking-in/src/main/java/com/willalp/msg/service/IHsAppUserMsgService.java

@@ -26,9 +26,8 @@ public interface IHsAppUserMsgService extends IService<HsAppUserMsg>
     /**
      * 消息总信息
      *
-     * @param uc
      */
-    Object msgSum(String uc);
+    void pushMsgSum();
 
     /**
      * 按照ID 已读

+ 38 - 43
willalp-clocking-in/src/main/java/com/willalp/msg/service/impl/HsAppUserMsgServiceImpl.java

@@ -3,17 +3,21 @@ package com.willalp.msg.service.impl;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.willalp.common.core.domain.entity.SysDictData;
+import com.willalp.common.exception.base.BaseException;
 import com.willalp.common.utils.StringUtils;
+import com.willalp.framework.websocket.WebSocketUsers;
 import com.willalp.msg.domain.HsAppUserMsg;
 import com.willalp.msg.mapper.HsAppUserMsgMapper;
 import com.willalp.msg.service.IHsAppUserMsgService;
+import com.willalp.system.service.ISysDictTypeService;
 import com.willalp.wx.service.WxMsgService;
+import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 /**
  * APP用户消息Service业务层处理
@@ -29,6 +33,9 @@ public class HsAppUserMsgServiceImpl extends ServiceImpl<HsAppUserMsgMapper, HsA
     @Resource
     private WxMsgService wxMsgService;
 
+    @Resource
+    private ISysDictTypeService sysDictTypeService;
+
     /**
      * 查询APP用户消息列表
      *
@@ -41,47 +48,34 @@ public class HsAppUserMsgServiceImpl extends ServiceImpl<HsAppUserMsgMapper, HsA
     }
 
     @Override
-    public Object msgSum(String uc) {
-        if (StringUtils.isNotBlank(uc)) {
-            List<HsAppUserMsg> msgsByUserCode = hsAppUserMsgMapper.selectList(new QueryWrapper<HsAppUserMsg>()
-                    .eq("user_code", uc)
-                    .eq("msg_is_read", "0"));
-            //hsAppUserMsgMapper.insertBatchSomeColumn(msgsByUserCode);
-            List<HsAppUserMsg> l1 = new ArrayList<>();
-            List<HsAppUserMsg> l3 = new ArrayList<>();
-            List<HsAppUserMsg> l2 = new ArrayList<>();
-            List<HsAppUserMsg> l4 = new ArrayList<>();
-            msgsByUserCode.forEach((i) -> {
-                switch (i.getMsgType()) {
-                    case "1":
-                    case "5":
-                        l1.add(i);
-                        break;
-                    case "2":
-                        l2.add(i);
-                        break;
-                    case "3":
-                        l3.add(i);
-                        break;
-                    case "4":
-                        l4.add(i);
-                        break;
-//                    case "6":
-//                        l4.add(i);
-//                        break;
-                    default:
-                        break;
-                }
-            });
-            JSONObject jsonObject = new JSONObject();
-            jsonObject.put("sum", msgsByUserCode.size());
-            jsonObject.put("t1", l1.size());
-            jsonObject.put("t2", l2.size());
-            jsonObject.put("t3", l3.size());
-            jsonObject.put("t4", l4.size());
-            return jsonObject;
+    @Scheduled(fixedRate = 1, timeUnit = TimeUnit.SECONDS)
+    public void pushMsgSum() {
+        List<HsAppUserMsg> msgsByUserCode = hsAppUserMsgMapper.selectList(new QueryWrapper<HsAppUserMsg>()
+                .eq("msg_is_read", "0"));
+        List<SysDictData> appMsgType = sysDictTypeService.selectDictDataByType("app_msg_type");
+        if (null == appMsgType || appMsgType.size() <= 0) {
+            throw new BaseException("消息推送配置错误:【请配置字典】");
         }
-        return null;
+        Map<String, JSONObject> userMap = new HashMap<>();
+        msgsByUserCode.forEach((item) -> {
+            if (StringUtils.isNotBlank(item.getUserCode()) && null != userMap.get(item.getUserCode())) {
+                userMap.get(item.getUserCode()).put("m" + item.getMsgType(), (Integer) userMap.get(item.getUserCode()).get("m" + item.getMsgType()) + 1);
+            } else {
+                //初始化Map<用户编号,JSONObj>
+                JSONObject jsonObject = new JSONObject();
+                for (int i = 0; i < appMsgType.size(); i++) {
+                    //jsonObj key -> m1 ~ m[n]
+                    jsonObject.put("m" + (i + 1), 0);
+                }
+                jsonObject.put("m" + item.getMsgType(), 1);
+                userMap.put(item.getUserCode(), jsonObject);
+            }
+        });
+        userMap.forEach((k, v) -> {
+            if (null != WebSocketUsers.getUsers().get(k)) {
+                WebSocketUsers.sendMessageToUserByText(WebSocketUsers.getUsers().get(k), v.toString());
+            }
+        });
     }
 
     @Override
@@ -112,6 +106,7 @@ public class HsAppUserMsgServiceImpl extends ServiceImpl<HsAppUserMsgMapper, HsA
         appUserMsg.setUserCode(sendUser);
         appUserMsg.setMsgType(msgType);
         appUserMsg.setRemark(taskId);
+        appUserMsg.setIsPush("0");
         appUserMsg.setCreateTime(createTime);
         save(appUserMsg);
         wxMsgService.sendApprovalMsg(title, sendUser, applyUn, createTime);

+ 0 - 29
willalp-control/pom.xml

@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
-         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>willalp</artifactId>
-        <groupId>com.willalp</groupId>
-        <version>3.7.0</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-
-    <artifactId>willalp-control</artifactId>
-
-
-    <dependencies>
-        <dependency>
-            <groupId>com.willalp</groupId>
-            <artifactId>willalp-common</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.willalp</groupId>
-            <artifactId>willalp-system</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>com.willalp</groupId>
-            <artifactId>willalp-device</artifactId>
-        </dependency>
-    </dependencies>
-</project>

+ 0 - 57
willalp-control/src/main/java/com/willalp/control/aspect/ControlCacheAspect.java

@@ -1,57 +0,0 @@
-package com.willalp.control.aspect;
-
-import com.willalp.control.domain.HsControlStat;
-import com.willalp.control.netty.model.ControlDataModel;
-import org.aspectj.lang.annotation.After;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-
-/**
- *
- * @author hs
- */
-@Aspect
-@Component
-public class ControlCacheAspect {
-    private final static Logger log = LoggerFactory.getLogger(ControlCacheAspect.class);
-
-
-    @Resource
-    private ControlDataModel controlDataModel;
-
-
-    /**
-     * 对设备信息和执行口信息配置AOP切入
-     */
-    @Pointcut("execution(* com.willalp.device.service.impl.DeviceServiceImpl.*(..)) || " +
-            "execution(* com.willalp.control.service.impl.HsControlUsenoConfigServiceImpl.*(..))")
-    public void updateCache(){}
-
-    @Pointcut(value = "execution(* com.willalp.control.service.IHsControlStatService.*(..)) && args(stat)", argNames = "stat")
-    public void saveStat(HsControlStat stat){}
-
-    /**
-     * 对信息和执行口信息操作后 更新jvm中的缓存
-     */
-    @After("updateCache()")
-    public void runUpdate(){
-        log.info("更新 {设备} {执行口} 缓存");
-        controlDataModel.updateMap();
-    }
-
-
-    /**
-     * 前置操作 实体对象
-     */
-    @Before(value = "saveStat(stat)", argNames = "stat")
-    public void runSave(HsControlStat stat){
-
-    }
-}
-

+ 0 - 88
willalp-control/src/main/java/com/willalp/control/domain/HsControlCmdRelation.java

@@ -1,88 +0,0 @@
-package com.willalp.control.domain;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.willalp.common.annotation.Excel;
-import com.willalp.common.core.domain.BaseEntity;
-
-/**
- * 设备指令关系对象 hs_device_cmd_relation
- *
- * @author willalp
- * @date 2022-02-10
- */
-
-@TableName("hs_control_cmd_relation")
-public class HsControlCmdRelation extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 主键ID */
-    @TableId
-    private Long id;
-
-    /** 设备ID */
-    @Excel(name = "设备ID")
-    private Long deviceId;
-
-    /** 指令集ID */
-    @Excel(name = "指令集ID")
-    private Long cmdGroupId;
-
-    /** 是否删除(0.未删除;1.已删除) */
-    private Integer isDelete;
-
-    public void setId(Long id)
-    {
-        this.id = id;
-    }
-
-    public Long getId()
-    {
-        return id;
-    }
-    public void setDeviceId(Long deviceId)
-    {
-        this.deviceId = deviceId;
-    }
-
-    public Long getDeviceId()
-    {
-        return deviceId;
-    }
-    public void setCmdGroupId(Long cmdGroupId)
-    {
-        this.cmdGroupId = cmdGroupId;
-    }
-
-    public Long getCmdGroupId()
-    {
-        return cmdGroupId;
-    }
-    public void setIsDelete(Integer isDelete)
-    {
-        this.isDelete = isDelete;
-    }
-
-    public Integer getIsDelete()
-    {
-        return isDelete;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("id", getId())
-            .append("deviceId", getDeviceId())
-            .append("cmdGroupId", getCmdGroupId())
-            .append("isDelete", getIsDelete())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
-}

+ 0 - 139
willalp-control/src/main/java/com/willalp/control/domain/HsControlDeviceInfo.java

@@ -1,139 +0,0 @@
-package com.willalp.control.domain;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.willalp.common.annotation.Excel;
-import com.willalp.common.core.domain.BaseEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.util.Date;
-
-/**
- * 控制设备状态信息对象 hs_control_device_info
- *
- * @author willalp
- * @date 2022-02-16
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("hs_control_device_info")
-public class HsControlDeviceInfo extends BaseEntity {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键
-     */
-    @TableId
-    private Long id;
-
-    /**
-     * 用户ID
-     */
-    @Excel(name = "用户ID")
-    private Long userId;
-
-    /**
-     * 设备ID
-     */
-    @Excel(name = "设备ID")
-    private String deviceId;
-
-    /**
-     * 执行口ID
-     */
-    @Excel(name = "执行口ID")
-    private String deviceUseNo;
-
-    /**
-     * 设备名字
-     */
-    @Excel(name = "设备名字")
-    private String deviceName;
-
-    /**
-     * 用量
-     */
-    @Excel(name = "用量")
-    private String dosage;
-
-    /**
-     * XX时XX分 统计用时
-     */
-    private Long statTime;
-
-    /**
-     * 用量单位
-     */
-    @Excel(name = "用量单位")
-    private String dosageUnit;
-
-    /**
-     * 用量百分比
-     */
-    @Excel(name = "用量百分比")
-    private Integer dosagePct;
-
-    /**
-     * 设备图标
-     */
-    @Excel(name = "设备图标")
-    private String deviceIcon;
-
-    /**
-     * 背景颜色
-     */
-    @Excel(name = "背景颜色")
-    private String pageBgkcolor;
-
-    /**
-     * 运行状态(0=关,1=开)
-     */
-    @Excel(name = "运行状态", readConverterExp = "0==关,1=开")
-    private Integer runningStatus;
-
-    /**
-     * 最近打开时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
-    @Excel(name = "最近打开时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date lastOpenTime;
-
-    /**
-     * 最近关闭时间
-     */
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
-    @Excel(name = "最近关闭时间", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date lastCloseTime;
-
-    /**
-     * 是否删除(0.未删除;1.已删除)
-     */
-    private Integer isDelete;
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("id", getId())
-                .append("deviceId", getDeviceId())
-                .append("deviceName", getDeviceName())
-                .append("dosage", getDosage())
-                .append("dosageUnit", getDosageUnit())
-                .append("dosagePct", getDosagePct())
-                .append("deviceIcon", getDeviceIcon())
-                .append("pageBgkcolor", getPageBgkcolor())
-                .append("runningStatus", getRunningStatus())
-                .append("lastOpenTime", getLastOpenTime())
-                .append("lastCloseTime", getLastCloseTime())
-                .append("isDelete", getIsDelete())
-                .append("createBy", getCreateBy())
-                .append("createTime", getCreateTime())
-                .append("updateBy", getUpdateBy())
-                .append("updateTime", getUpdateTime())
-                .append("remark", getRemark())
-                .toString();
-    }
-}

+ 0 - 55
willalp-control/src/main/java/com/willalp/control/domain/HsControlLog.java

@@ -1,55 +0,0 @@
-package com.willalp.control.domain;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.willalp.common.annotation.Excel;
-import com.willalp.common.core.domain.BaseEntity;
-
-/**
- * 控制日志对象 hs_control_log
- *
- * @author willalp
- * @date 2022-03-11
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("hs_control_log")
-public class HsControlLog extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 主键 */
-    @TableId
-    private String controlLogId;
-
-    /** 执行口ID */
-    @Excel(name = "执行口ID")
-    private String useNoId;
-
-    /** 使用描述(如:开,关) */
-    @Excel(name = "使用描述", readConverterExp = "如=:开,关")
-    private String useDescribe;
-
-    /** 是否删除(0.未删除;1.已删除) */
-    private Integer isDelete;
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("controlLogId", getControlLogId())
-            .append("useNoId", getUseNoId())
-            .append("useDescribe", getUseDescribe())
-            .append("isDelete", getIsDelete())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
-}

+ 0 - 75
willalp-control/src/main/java/com/willalp/control/domain/HsControlStat.java

@@ -1,75 +0,0 @@
-package com.willalp.control.domain;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.willalp.common.annotation.Excel;
-import com.willalp.common.core.domain.BaseEntity;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import java.util.Date;
-
-/**
- * 设备使用统计对象 hs_control_stat
- *
- * @author willalp
- * @date 2022-03-02
- */
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("hs_control_stat")
-public class HsControlStat extends BaseEntity {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 主键
-     */
-    @TableId
-    private String statId;
-
-    /**
-     * 执行口ID
-     */
-    @Excel(name = "执行口ID")
-    private String useNoId;
-
-    /**
-     * 用量
-     */
-    @Excel(name = "用量")
-    private String dosage;
-
-    private Date createTime;
-
-    @TableField(exist = false)
-    private String createTimeVo;
-
-    /**
-     * 统计是否生效
-     */
-    private int isStat;
-
-    /**
-     * 是否删除(0.未删除;1.已删除)
-     */
-    @Excel(name = "是否删除", readConverterExp = "0=.未删除;1.已删除")
-    @TableLogic
-    private Integer isDelete;
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-                .append("statId", getStatId())
-                .append("useNoId", getUseNoId())
-                .append("dosage", getDosage())
-                .append("isDelete", getIsDelete())
-                .append("createBy", getCreateBy())
-                .append("createTime", getCreateTime())
-                .toString();
-    }
-}

+ 0 - 82
willalp-control/src/main/java/com/willalp/control/domain/HsControlTiming.java

@@ -1,82 +0,0 @@
-package com.willalp.control.domain;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import java.sql.Time;
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.willalp.common.annotation.Excel;
-import com.willalp.common.core.domain.BaseEntity;
-import org.springframework.format.annotation.DateTimeFormat;
-
-/**
- * 设备定时任务对象 hs_control_timing
- *
- * @author willalp
- * @date 2022-02-16
- */
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("hs_control_timing")
-public class HsControlTiming extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 主键 */
-    @TableId
-    private Long timingId;
-
-    /** 用户ID */
-    @Excel(name = "用户ID")
-    private Long userId;
-
-    /** 控制设备ID */
-    @Excel(name = "使用号口ID")
-    private Long useNoId;
-
-    /**
-     * 周期
-     */
-    @Excel(name = "周期")
-    private String cycle;
-
-    /** 开始时间 */
-    @Excel(name = "开始时间", width = 30)
-    private Time startTime;
-
-    /** 结束时间 */
-    @Excel(name = "结束时间", width = 30)
-    private Time endTime;
-
-    /** 当前状态(0=启用,1=停用) */
-    @Excel(name = "当前状态", readConverterExp = "0=启用,1=停用")
-    private Integer state;
-
-    /** 是否删除(0.未删除;1.已删除) */
-    private Integer isDelete;
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("timingId", getTimingId())
-            .append("userId", getUserId())
-            .append("useNoId", getUseNoId())
-            .append("startTime", getStartTime())
-            .append("endTime", getEndTime())
-            .append("cycle", getCycle())
-            .append("state", getState())
-            .append("isDelete", getIsDelete())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
-}

+ 0 - 133
willalp-control/src/main/java/com/willalp/control/domain/HsControlUsenoConfig.java

@@ -1,133 +0,0 @@
-package com.willalp.control.domain;
-
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import com.baomidou.mybatisplus.annotation.TableName;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.willalp.common.annotation.Excel;
-import com.willalp.common.core.domain.BaseEntity;
-
-/**
- * 空开设备号口配置对象 hs_control_useno_config
- *
- * @author willalp
- * @date 2022-02-21
- */
-
-@TableName("hs_control_useno_config")
-public class HsControlUsenoConfig extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 使用号口ID */
-    @TableId
-    private Long useNoId;
-
-    /** 设备ID */
-    @Excel(name = "设备ID")
-    private String deviceId;
-
-    /** 号口名称 */
-    @Excel(name = "号口名称")
-    private String useNoName;
-
-    /** 指令默认 */
-    @Excel(name = "指令默认")
-    private String commandDefault;
-
-    /** 指令:开 */
-    @Excel(name = "指令:开")
-    private String commandOpen;
-
-    /** 指令:关 */
-    @Excel(name = "指令:关")
-    private String commandClose;
-
-    /** 是否删除(0.未删除;1.已删除) */
-    @Excel(name = "是否删除", readConverterExp = "0=.未删除;1.已删除")
-    @TableLogic
-    private Integer isDelete;
-
-    public void setUseNoId(Long useNoId)
-    {
-        this.useNoId = useNoId;
-    }
-
-    public Long getUseNoId()
-    {
-        return useNoId;
-    }
-    public void setDeviceId(String deviceId)
-    {
-        this.deviceId = deviceId;
-    }
-
-    public String getDeviceId()
-    {
-        return deviceId;
-    }
-    public void setUseNoName(String useNoName)
-    {
-        this.useNoName = useNoName;
-    }
-
-    public String getUseNoName()
-    {
-        return useNoName;
-    }
-    public void setCommandDefault(String commandDefault)
-    {
-        this.commandDefault = commandDefault;
-    }
-
-    public String getCommandDefault()
-    {
-        return commandDefault;
-    }
-    public void setCommandOpen(String commandOpen)
-    {
-        this.commandOpen = commandOpen;
-    }
-
-    public String getCommandOpen()
-    {
-        return commandOpen;
-    }
-    public void setCommandClose(String commandClose)
-    {
-        this.commandClose = commandClose;
-    }
-
-    public String getCommandClose()
-    {
-        return commandClose;
-    }
-    public void setIsDelete(Integer isDelete)
-    {
-        this.isDelete = isDelete;
-    }
-
-    public Integer getIsDelete()
-    {
-        return isDelete;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("useNoId", getUseNoId())
-            .append("deviceId", getDeviceId())
-            .append("useNoName", getUseNoName())
-            .append("commandDefault", getCommandDefault())
-            .append("commandOpen", getCommandOpen())
-            .append("commandClose", getCommandClose())
-            .append("isDelete", getIsDelete())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .toString();
-    }
-}

+ 0 - 35
willalp-control/src/main/java/com/willalp/control/domain/vo/OpenOrCloseVo.java

@@ -1,35 +0,0 @@
-package com.willalp.control.domain.vo;
-
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-
-/**
- * @author hs
- * <p>
- * 打开或关闭信息接收伪类
- */
-@Data
-public class OpenOrCloseVo {
-
-    /**
-     * 设备信息ID
-     */
-    private String deviceInfoId;
-    /**
-     * 控制基站ID
-     */
-    private String deviceId;
-
-    /**
-     * 空开设备执行口ID
-     */
-    private String useNoId;
-
-    /**
-     * 是开还是关
-     */
-    private int isOpenOrClose;
-
-
-}

+ 0 - 25
willalp-control/src/main/java/com/willalp/control/mapper/HsControlDeviceInfoMapper.java

@@ -1,25 +0,0 @@
-package com.willalp.control.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import java.util.List;
-import com.willalp.control.domain.HsControlDeviceInfo;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Select;
-
-/**
- * 控制设备状态信息Mapper接口
- *
- * @author willalp
- * @date 2022-02-16
- */
-public interface HsControlDeviceInfoMapper extends BaseMapper<HsControlDeviceInfo>
-{
-    /**
-     * 查询控制设备状态信息列表
-     *
-     * @param hsControlDeviceInfo 控制设备状态信息
-     * @return 控制设备状态信息集合
-     */
-    public List<HsControlDeviceInfo> selectHsControlDeviceInfoList(HsControlDeviceInfo hsControlDeviceInfo);
-
-}

+ 0 - 33
willalp-control/src/main/java/com/willalp/control/mapper/HsControlLogMapper.java

@@ -1,33 +0,0 @@
-package com.willalp.control.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-import com.willalp.control.domain.HsControlLog;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * 控制日志Mapper接口
- *
- * @author willalp
- * @date 2022-03-11
- */
-public interface HsControlLogMapper extends BaseMapper<HsControlLog> {
-    /**
-     * 查询控制日志列表
-     *
-     * @param hsControlLog 控制日志
-     * @return 控制日志集合
-     */
-    public List<HsControlLog> selectHsControlLogList(HsControlLog hsControlLog);
-
-    /**
-     * 根据执行口和时候获取日志列表
-     *
-     * @param useNoId
-     * @param date
-     * @return
-     */
-    List<HsControlLog> selectLogListByUseNoIdAndDate(@Param("useNoId") String useNoId, @Param("date") String date);
-}

+ 0 - 42
willalp-control/src/main/java/com/willalp/control/mapper/HsControlStatMapper.java

@@ -1,42 +0,0 @@
-package com.willalp.control.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.willalp.control.domain.HsControlStat;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 设备使用统计Mapper接口
- *
- * @author willalp
- * @date 2022-03-02
- */
-public interface HsControlStatMapper extends BaseMapper<HsControlStat> {
-    /**
-     * 查询设备使用统计列表
-     *
-     * @param hsControlStat 设备使用统计
-     * @return 设备使用统计集合
-     */
-    public List<HsControlStat> selectHsControlStatList(HsControlStat hsControlStat);
-
-    /**
-     * 根据执行口id获取所有使用过的 年,月份
-     *
-     * @param useNoId
-     * @return
-     */
-    List<HsControlStat> getStatYearMonthDateByUseNoId(@Param("useNoId") String useNoId);
-
-
-    /**
-     * 根据执行口id和月份 获取日统计信息
-     *
-     * @param useNoId
-     * @param yearMonth
-     * @return
-     */
-    List<HsControlStat> getStatYearMonthDateByUseNoIdAndYearMonth(@Param("useNoId") String useNoId,
-                                                                  @Param("yearMonth") String yearMonth);
-}

+ 0 - 23
willalp-control/src/main/java/com/willalp/control/mapper/HsControlTimingMapper.java

@@ -1,23 +0,0 @@
-package com.willalp.control.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-import com.willalp.control.domain.HsControlTiming;
-
-/**
- * 设备定时任务Mapper接口
- *
- * @author willalp
- * @date 2022-02-16
- */
-public interface HsControlTimingMapper extends BaseMapper<HsControlTiming> {
-    /**
-     * 查询设备定时任务列表
-     *
-     * @param hsControlTiming 设备定时任务
-     * @return 设备定时任务集合
-     */
-    List<HsControlTiming> selectHsControlTimingList(HsControlTiming hsControlTiming);
-}

+ 0 - 32
willalp-control/src/main/java/com/willalp/control/mapper/HsControlUsenoConfigMapper.java

@@ -1,32 +0,0 @@
-package com.willalp.control.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-import java.util.List;
-
-import com.willalp.control.domain.HsControlUsenoConfig;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * 空开设备号口配置Mapper接口
- *
- * @author willalp
- * @date 2022-02-21
- */
-public interface HsControlUsenoConfigMapper extends BaseMapper<HsControlUsenoConfig> {
-    /**
-     * 查询空开设备号口配置列表
-     *
-     * @param hsControlUsenoConfig 空开设备号口配置
-     * @return 空开设备号口配置集合
-     */
-    public List<HsControlUsenoConfig> selectHsControlUsenoConfigList(HsControlUsenoConfig hsControlUsenoConfig);
-
-    /**
-     * 查询当前可添加的执行口
-     *
-     * @return
-     * @param userId
-     */
-    List<HsControlUsenoConfig> canAddUseNoListList(@Param("userId") Long userId);
-}

+ 0 - 88
willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlDeviceInfoMapper.xml

@@ -1,88 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.willalp.control.mapper.HsControlDeviceInfoMapper">
-
-    <resultMap type="com.willalp.control.domain.HsControlDeviceInfo" id="HsControlDeviceInfoResult">
-        <result property="id" column="id"/>
-        <result property="deviceId" column="device_id"/>
-        <result property="deviceUseNo" column="device_use_no"/>
-        <result property="deviceName" column="device_name"/>
-        <result property="dosage" column="dosage"/>
-        <result property="statTime" column="stat_time"/>
-        <result property="dosageUnit" column="dosage_unit"/>
-        <result property="dosagePct" column="dosage_pct"/>
-        <result property="deviceIcon" column="device_icon"/>
-        <result property="pageBgkcolor" column="page_bgkcolor"/>
-        <result property="runningStatus" column="running_status"/>
-        <result property="lastOpenTime" column="last_open_time"/>
-        <result property="lastCloseTime" column="last_close_time"/>
-        <result property="isDelete" column="is_delete"/>
-        <result property="createBy" column="create_by"/>
-        <result property="createTime" column="create_time"/>
-        <result property="updateBy" column="update_by"/>
-        <result property="updateTime" column="update_time"/>
-        <result property="remark" column="remark"/>
-    </resultMap>
-
-    <sql id="selectHsControlDeviceInfoVo">
-        select id,
-               device_id,
-               device_name,
-               device_use_no,
-               dosage,
-               dosage_unit,
-               dosage_pct,
-               device_icon,
-               page_bgkcolor,
-               running_status,
-               last_open_time,
-               last_close_time,
-               is_delete,
-               create_by,
-               create_time,
-               update_by,
-               update_time,
-               remark
-        from hs_control_device_info
-    </sql>
-
-    <select id="selectHsControlDeviceInfoList" parameterType="HsControlDeviceInfo"
-            resultMap="HsControlDeviceInfoResult">
-        <include refid="selectHsControlDeviceInfoVo"/>
-        <where>
-            is_delete = 0
-            <if test="deviceId != null ">
-                  and device_id = #{deviceId}
-            </if>
-            <if test="deviceName != null  and deviceName != ''">
-                  and device_name like concat('%', #{deviceName}, '%')
-            </if>
-            <if test="dosage != null  and dosage != ''">
-                  and dosage = #{dosage}
-            </if>
-            <if test="dosageUnit != null  and dosageUnit != ''">
-                  and dosage_unit = #{dosageUnit}
-            </if>
-            <if test="dosagePct != null ">
-                  and dosage_pct = #{dosagePct}
-            </if>
-            <if test="deviceIcon != null  and deviceIcon != ''">
-                  and device_icon = #{deviceIcon}
-            </if>
-            <if test="pageBgkcolor != null  and pageBgkcolor != ''">
-                  and page_bgkcolor = #{pageBgkcolor}
-            </if>
-            <if test="runningStatus != null ">
-                  and running_status = #{runningStatus}
-            </if>
-            <if test="lastOpenTime != null ">
-                  and last_open_time = #{lastOpenTime}
-            </if>
-            <if test="lastCloseTime != null ">
-                  and last_close_time = #{lastCloseTime}
-            </if>
-        </where>
-    </select>
-</mapper>

+ 0 - 58
willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlLogMapper.xml

@@ -1,58 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.willalp.control.mapper.HsControlLogMapper">
-
-    <resultMap type="com.willalp.control.domain.HsControlLog" id="HsControlLogResult">
-        <result property="controlLogId" column="control_log_id"/>
-        <result property="useNoId" column="use_no_id"/>
-        <result property="useDescribe" column="use_describe"/>
-        <result property="isDelete" column="is_delete"/>
-        <result property="createBy" column="create_by"/>
-        <result property="createTime" column="create_time"/>
-        <result property="updateBy" column="update_by"/>
-        <result property="updateTime" column="update_time"/>
-        <result property="remark" column="remark"/>
-    </resultMap>
-
-    <sql id="selectHsControlLogVo">
-        select control_log_id,
-               use_no_id,
-               use_describe,
-               is_delete,
-               create_by,
-               create_time,
-               update_by,
-               update_time,
-               remark
-        from hs_control_log
-    </sql>
-
-    <select id="selectHsControlLogList" parameterType="HsControlLog" resultMap="HsControlLogResult">
-        <include refid="selectHsControlLogVo"/>
-        <where>
-            is_delete = 0
-            <if test="useNoId != null  and useNoId != ''">
-                  and use_no_id = #{useNoId}
-            </if>
-            <if test="useDescribe != null  and useDescribe != ''">
-                  and use_describe = #{useDescribe}
-            </if>
-        </where>
-    </select>
-    <select id="selectLogListByUseNoIdAndDate" resultMap="HsControlLogResult">
-        SELECT control_log_id,
-        use_no_id,
-        use_describe,
-        create_time
-        from hs_control_log
-        <where>
-            create_time like concat(#{date,jdbcType=VARCHAR}, '%')
-                             AND
-            is_delete = 0
-                             AND
-            use_no_id = #{useNoId,jdbcType=BIGINT}
-        </where>
-    </select>
-</mapper>

+ 0 - 65
willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlStatMapper.xml

@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.willalp.control.mapper.HsControlStatMapper">
-
-    <resultMap type="com.willalp.control.domain.HsControlStat" id="HsControlStatResult">
-        <result property="statId" column="stat_id"/>
-        <result property="useNoId" column="use_no_id"/>
-        <result property="dosage" column="dosage"/>
-        <result property="isStat" column="is_stat"/>
-        <result property="isDelete" column="is_delete"/>
-        <result property="createBy" column="create_by"/>
-        <result property="createTime" column="create_time"/>
-        <result property="createTimeVo" column="createTimeVo"/>
-    </resultMap>
-
-    <sql id="selectHsControlStatVo">
-        select stat_id, use_no_id, dosage, is_delete, create_by, create_time
-        from hs_control_stat
-    </sql>
-
-    <select id="selectHsControlStatList" parameterType="HsControlStat" resultMap="HsControlStatResult">
-        <include refid="selectHsControlStatVo"/>
-        <where>
-            is_delete = 0
-            <if test="useNoId != null  and useNoId != ''">
-                  and use_no_id = #{useNoId}
-            </if>
-            <if test="dosage != null  and dosage != ''">
-                  and dosage = #{dosage}
-            </if>
-            <if test="isDelete != null ">
-                  and is_delete = #{isDelete}
-                        </if>
-        </where>
-    </select>
-    <select id="getStatYearMonthDateByUseNoId" resultMap="HsControlStatResult">
-        SELECT use_no_id,
-               SUM(dosage)               dosage,
-               is_stat,
-               substr(create_time, 1, 7) createTimeVo
-        FROM hs_control_stat
-        WHERE use_no_id = #{useNoId}
-          AND is_delete = 0
-        GROUP BY substr(
-                         create_time,
-                         1,
-                         7
-                     )
-        ORDER BY create_time desc
-    </select>
-    <select id="getStatYearMonthDateByUseNoIdAndYearMonth" resultMap="HsControlStatResult">
-        SELECT use_no_id,
-               dosage                    dosage,
-               substr(create_time, 9, 2) createTimeVo,
-               is_stat,
-               create_time
-        FROM hs_control_stat
-        WHERE use_no_id = #{useNoId}
-          AND create_time like CONCAT(#{yearMonth}, '%')
-          AND is_delete = 0
-        ORDER BY create_time desc
-    </select>
-</mapper>

+ 0 - 60
willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlTimingMapper.xml

@@ -1,60 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.willalp.control.mapper.HsControlTimingMapper">
-
-    <resultMap type="com.willalp.control.domain.HsControlTiming" id="HsControlTimingResult">
-        <result property="timingId" column="timing_id"/>
-        <result property="userId" column="user_id"/>
-        <result property="useNoId" column="use_no_id"/>
-        <result property="cycle" column="cycle"/>
-        <result property="startTime" column="start_time"/>
-        <result property="endTime" column="end_time"/>
-        <result property="state" column="state"/>
-        <result property="isDelete" column="is_delete"/>
-        <result property="createBy" column="create_by"/>
-        <result property="createTime" column="create_time"/>
-        <result property="updateBy" column="update_by"/>
-        <result property="updateTime" column="update_time"/>
-        <result property="remark" column="remark"/>
-    </resultMap>
-
-    <sql id="selectHsControlTimingVo">
-        select timing_id,
-               user_id,
-               `cycle`,
-               start_time,
-               end_time,
-               state,
-               is_delete,
-               create_by,
-               create_time,
-               update_by,
-               update_time,
-               remark
-        from hs_control_timing
-    </sql>
-
-    <select id="selectHsControlTimingList" parameterType="HsControlTiming" resultMap="HsControlTimingResult">
-        <include refid="selectHsControlTimingVo"/>
-        <where>
-            is_delete = 0
-            <if test="userId != null ">
-                  and user_id = #{userId}
-            </if>
-            <if test="useNoId != null ">
-                  and use_no_id = #{useNoId}
-            </if>
-            <if test="startTime != null ">
-                  and start_time = #{startTime}
-            </if>
-            <if test="endTime != null ">
-                  and end_time = #{endTime}
-            </if>
-            <if test="state != null ">
-                  and state = #{state}
-                        </if>
-        </where>
-    </select>
-</mapper>

+ 0 - 75
willalp-control/src/main/java/com/willalp/control/mapper/xml/HsControlUsenoConfigMapper.xml

@@ -1,75 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!DOCTYPE mapper
-        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.willalp.control.mapper.HsControlUsenoConfigMapper">
-
-    <resultMap type="com.willalp.control.domain.HsControlUsenoConfig" id="HsControlUsenoConfigResult">
-        <result property="useNoId" column="use_no_id"/>
-        <result property="deviceId" column="device_id"/>
-        <result property="useNoName" column="use_no_name"/>
-        <result property="commandDefault" column="command_default"/>
-        <result property="commandOpen" column="command_open"/>
-        <result property="commandClose" column="command_close"/>
-        <result property="isDelete" column="is_delete"/>
-        <result property="createBy" column="create_by"/>
-        <result property="createTime" column="create_time"/>
-        <result property="updateBy" column="update_by"/>
-        <result property="updateTime" column="update_time"/>
-        <result property="remark" column="remark"/>
-    </resultMap>
-
-    <sql id="selectHsControlUsenoConfigVo">
-        select use_no_id,
-               device_id,
-               use_no_name,
-               command_default,
-               command_open,
-               command_close,
-               is_delete,
-               create_by,
-               create_time,
-               update_by,
-               update_time,
-               remark
-        from hs_control_useno_config
-    </sql>
-
-    <select id="selectHsControlUsenoConfigList" parameterType="HsControlUsenoConfig"
-            resultMap="HsControlUsenoConfigResult">
-        <include refid="selectHsControlUsenoConfigVo"/>
-        <where>
-            is_delete = 0
-            <if test="deviceId != null ">
-                  and device_id = #{deviceId}
-            </if>
-            <if test="useNoName != null  and useNoName != ''">
-                  and use_no_name like concat('%', #{useNoName}, '%')
-            </if>
-            <if test="commandDefault != null  and commandDefault != ''">
-                  and command_default = #{commandDefault}
-            </if>
-            <if test="commandOpen != null  and commandOpen != ''">
-                  and command_open = #{commandOpen}
-            </if>
-            <if test="commandClose != null  and commandClose != ''">
-                  and command_close = #{commandClose}
-            </if>
-            <if test="isDelete != null ">
-                  and is_delete = #{isDelete}
-                        </if>
-        </where>
-    </select>
-    <select id="canAddUseNoListList" resultMap="HsControlUsenoConfigResult">
-        SELECT use_no_id,
-               use_no_name
-        FROM hs_control_useno_config uc,
-             pns_device pd
-        WHERE uc.device_id = pd.device_id
-          AND pd.device_use_id LIKE concat('%', #{userId,jdbcType=BIGINT}, '%')
-          AND uc.use_no_id NOT IN (
-            SELECT device_use_no
-            FROM hs_control_device_info
-        )
-    </select>
-</mapper>

+ 0 - 67
willalp-control/src/main/java/com/willalp/control/netty/HreatbeatClient.java

@@ -1,67 +0,0 @@
-package com.willalp.control.netty;
-
-import io.netty.bootstrap.Bootstrap;
-import io.netty.channel.*;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioSocketChannel;
-import io.netty.handler.codec.string.StringDecoder;
-import io.netty.handler.codec.string.StringEncoder;
-
-import java.util.Random;
-
-/**
- * @author hs
- */
-public class HreatbeatClient {
-    public static void main(String[] args) {
-        //客户端只需要一个事件循环组
-        EventLoopGroup group = new NioEventLoopGroup();
-        //    客户端启动的对象
-        Bootstrap bootstrap = new Bootstrap();
-        bootstrap.group(group)
-                .channel(NioSocketChannel.class)
-                .handler(new ChannelInitializer<SocketChannel>() {
-                    @Override
-                    protected void initChannel(SocketChannel socketChannel) throws Exception {
-                        ChannelPipeline pipeline = socketChannel.pipeline();
-                        pipeline.addLast(new StringDecoder());
-                        pipeline.addLast(new StringEncoder());
-                        socketChannel.pipeline().addLast(new HreatbeatClientHandler());
-                    }
-                });
-        System.out.println("客户端初始化完成");
-        try {
-            ChannelFuture future = bootstrap.connect("127.0.0.1", 8802);
-            String data = "I am alive";
-            while (future.channel().isActive()) {
-                //模拟空闲状态
-                int num = new Random().nextInt(10);
-                Thread.sleep(num * 1000);
-                future.channel().writeAndFlush(data);
-            }
-            //future.channel().closeFuture().sync();
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            group.shutdownGracefully();
-        }
-
-    }
-
-    static class HreatbeatClientHandler extends SimpleChannelInboundHandler<String> {
-
-        @Override
-        protected void channelRead0(ChannelHandlerContext channelHandlerContext, String s) throws Exception {
-            System.out.println("server data:" + s);
-            if ("you are out".equals(s)) {
-                System.out.println("关闭");
-                channelHandlerContext.channel().close();
-            }
-
-        }
-    }
-}
-
-
-

+ 0 - 15
willalp-control/src/main/java/com/willalp/control/netty/IAddNettyChannelMap.java

@@ -1,15 +0,0 @@
-package com.willalp.control.netty;
-
-import io.netty.channel.socket.SocketChannel;
-
-/**
- * @author hs
- */
-public interface IAddNettyChannelMap {
-
-    /**
-     * @param ch
-     */
-    void execute(SocketChannel ch);
-
-}

+ 0 - 71
willalp-control/src/main/java/com/willalp/control/netty/NettyServer.java

@@ -1,71 +0,0 @@
-package com.willalp.control.netty;
-
-import cn.hutool.core.thread.NamedThreadFactory;
-import com.willalp.control.netty.handler.DeviceChannelHandler;
-import com.willalp.control.netty.model.ChannelMsgModel;
-import com.willalp.control.netty.model.ControlDataModel;
-import com.willalp.control.netty.model.DeviceChannelMap;
-import com.willalp.device.mapper.DeviceMapper;
-import lombok.Data;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.Date;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.SynchronousQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @author hs
- */
-@Data
-@Component
-@ConfigurationProperties(prefix = "netty")
-public class NettyServer {
-
-    protected final static Logger logger = LoggerFactory.getLogger(NettyServer.class);
-
-    /**
-     * 处理器核心数
-     */
-    @Value("${netty.server-config.serverCoreNum}")
-    private static int serverCoreNum;
-
-    @Resource
-    private DeviceMapper deviceMapper;
-
-    @Resource
-    private ControlDataModel dataModel;
-
-    /**
-     * 控制线程数,最优选择是处理器线程数*3
-     */
-    private static final int THREAD_COUNT = serverCoreNum * 3;
-
-    public static final ExecutorService THREAD_POOL = new ThreadPoolExecutor(THREAD_COUNT,
-            300,
-            60L, TimeUnit.SECONDS,
-            new SynchronousQueue<>(),
-            new NamedThreadFactory("netty", false));
-
-    /**
-     * 设备控制中心端口
-     */
-    @Value("${netty.server-port.deviceControlCorePort}")
-    private int deviceControlCorePort;
-
-
-    public void start() {
-        //设备控制中心 :8802
-        THREAD_POOL.submit(() -> new TcpServer(
-                deviceControlCorePort/*端口*/,
-                new DeviceChannelHandler(/*注入service*/deviceMapper,dataModel))/*业务处理*/
-                .init(channel -> DeviceChannelMap.add(Tool.subRemoteAddr(channel.remoteAddress().toString()),
-                        new ChannelMsgModel().setChannel(channel).setLastChange(new Date()))));
-    }
-}

+ 0 - 21
willalp-control/src/main/java/com/willalp/control/netty/RefrigerateCell.java

@@ -1,21 +0,0 @@
-package com.willalp.control.netty;
-
-public class RefrigerateCell {
-
-    /**
-     * 是否打开(0:已关闭  1:已打开  2:已打开未关闭)
-     */
-    private Integer openOff;
-
-    public Integer getOpenOff() {
-        return openOff;
-    }
-
-    public void setOpenOff(Integer openOff) {
-        this.openOff = openOff;
-    }
-
-    public RefrigerateCell(Integer openOff) {
-        this.openOff = openOff;
-    }
-}

+ 0 - 95
willalp-control/src/main/java/com/willalp/control/netty/TcpServer.java

@@ -1,95 +0,0 @@
-package com.willalp.control.netty;
-
-import io.netty.bootstrap.ServerBootstrap;
-import io.netty.channel.*;
-import io.netty.channel.nio.NioEventLoopGroup;
-import io.netty.channel.socket.SocketChannel;
-import io.netty.channel.socket.nio.NioServerSocketChannel;
-import io.netty.handler.timeout.IdleStateHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * @author hs
- */
-public final class TcpServer {
-
-    private final static Logger logger = LoggerFactory.getLogger(TcpServer.class);
-
-    private ChannelHandlerAdapter channelHandlerAdapter;
-
-    private volatile EventLoopGroup bossGroup;
-
-    private volatile EventLoopGroup workerGroup;
-
-    private volatile ServerBootstrap bootstrap;
-
-    private volatile boolean closed = false;
-
-    private int localPort;
-
-    public TcpServer(int localPort, ChannelHandlerAdapter channelHandlerAdapter) {
-        this.localPort = localPort;
-        this.channelHandlerAdapter = channelHandlerAdapter;
-    }
-
-    public void close() {
-        closed = true;
-        bossGroup.shutdownGracefully();
-        workerGroup.shutdownGracefully();
-        logger.info("Stopped Tcp Server: " + localPort);
-    }
-
-    public void init(IAddNettyChannelMap iAddNettyChannelMap) {
-        closed = false;
-        bossGroup = new NioEventLoopGroup();
-        workerGroup = new NioEventLoopGroup();
-        bootstrap = new ServerBootstrap();
-        bootstrap.group(bossGroup, workerGroup);
-        bootstrap.channel(NioServerSocketChannel.class);
-        bootstrap.childHandler(new ChannelInitializer<SocketChannel>() {
-            @Override
-            protected void initChannel(SocketChannel ch) throws Exception {
-                iAddNettyChannelMap.execute(ch);
-                /*
-                 * 使用心跳检测处理器
-                 * 读空闲 写空闲 读写空闲 的超时时间
-                 * 最后一个参数是 时间的单位
-                 * IdleStateHandler发现有空闲的时候 会触发 IdleStateEvent时间
-                 * 他会把事件推送给下一个 handler的指定方法 userEventTriggered 去处理
-                 * */
-                ch.pipeline().addLast(new IdleStateHandler(5, 10, 20, TimeUnit.SECONDS));
-                ch.pipeline().addLast(channelHandlerAdapter);
-            }
-        });
-        doBind();
-    }
-
-    protected void doBind() {
-        if (closed) {
-            return;
-        }
-
-        ChannelFuture f = bootstrap.bind(localPort).addListener(new ChannelFutureListener() {
-            @Override
-            public void operationComplete(ChannelFuture f) throws Exception {
-                if (f.isSuccess()) {
-                    logger.info("Started Tcp Server: " + localPort);
-                } else {
-                    logger.info("Started Tcp Server Failed: " + localPort);
-                    f.channel().eventLoop().schedule(() -> doBind(), 1, TimeUnit.SECONDS);
-                }
-            }
-        });
-        try {
-            f.sync();
-            f.channel().closeFuture().sync();
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-
-    }
-}

+ 0 - 12
willalp-control/src/main/java/com/willalp/control/netty/Tool.java

@@ -1,12 +0,0 @@
-package com.willalp.control.netty;
-
-public class Tool {
-    public static String subRemoteAddr(String remoteAddr){
-        if(null == remoteAddr){
-            return null;
-        }
-        int sindex = remoteAddr.indexOf('/')+1;
-        int eindex = remoteAddr.indexOf(':');
-        return remoteAddr.substring(sindex,eindex);
-    }
-}

+ 0 - 112
willalp-control/src/main/java/com/willalp/control/netty/Util.java

@@ -1,112 +0,0 @@
-package com.willalp.control.netty;
-
-import com.willalp.common.utils.StringUtils;
-
-import java.io.UnsupportedEncodingException;
-
-public class Util {
-    /**
-     * 将十六进制的字符串转换成字节数组
-     * @param hexString
-     * @return
-     */
-    public static byte[] hexStrToByteArrs(String hexString) {
-        if (StringUtils.isEmpty(hexString)) {
-            return null;
-        }
-
-        hexString = hexString.replaceAll(" ", "");
-        int len = hexString.length();
-        int index = 0;
-
-        byte[] bytes = new byte[len / 2];
-
-        while (index < len) {
-            String sub = hexString.substring(index, index + 2);
-            bytes[index / 2] = (byte) Integer.parseInt(sub, 16);
-            index += 2;
-        }
-
-        return bytes;
-    }
-
-    /**
-     * 字节数组转换成十六进制字符串
-     * @param bArray
-     * @return
-     */
-    public static final String bytesToHexString(byte[] bArray) {
-        StringBuffer sb = new StringBuffer(bArray.length);
-        String sTemp;
-        for (int i = 0; i < bArray.length; i++) {
-            sTemp = Integer.toHexString(0xFF & bArray[i]);
-            if (sTemp.length() < 2) {
-                sb.append(0);
-            }
-            sb.append(sTemp.toUpperCase());
-        }
-        return sb.toString();
-    }
-
-    /**
-     * 从一个byte[]数组中截取一部分
-     * @param src
-     * @param begin
-     * @param count
-     * @return
-     */
-    public static byte[] subBytes(byte[] src, int begin, int count) {
-        byte[] bs = new byte[count];
-        for (int i=begin; i<begin+count; i++) bs[i-begin] = src[i];
-        return bs;
-    }
-
-    public static String getURLEncoderString(String str) {
-        String result = "";
-        if (null == str) {
-            return "";
-        }
-        try {
-            result = java.net.URLEncoder.encode(str, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-
-    public static String URLDecoderString(String str) {
-        String result = "";
-        if (null == str) {
-            return "";
-        }
-        try {
-            result = java.net.URLDecoder.decode(str, "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            e.printStackTrace();
-        }
-        return result;
-    }
-    //转换十六进制编码为字符串
-    public static String toStringHex(String s) {
-        if ("0x".equals(s.substring(0, 2))) {
-            s = s.substring(2);
-        }
-        byte[] baKeyword = new byte[s.length() / 2];
-        for (int i = 0; i < baKeyword.length; i++) {
-            try {
-                baKeyword[i] = (byte) (0xff & Integer.parseInt(s.substring(
-                        i * 2, i * 2 + 2), 16));
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-
-        try {
-            s = new String(baKeyword, "utf-8");//UTF-16le:Not
-        } catch (Exception e1) {
-            e1.printStackTrace();
-        }
-        return s;
-    }
-
-}

+ 0 - 163
willalp-control/src/main/java/com/willalp/control/netty/handler/DeviceChannelHandler.java

@@ -1,163 +0,0 @@
-package com.willalp.control.netty.handler;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.willalp.common.core.domain.AjaxResult;
-import com.willalp.control.netty.Tool;
-import com.willalp.control.netty.model.ChannelMsgModel;
-import com.willalp.control.netty.model.ControlDataModel;
-import com.willalp.control.netty.model.DeviceChannelMap;
-import com.willalp.device.domain.Device;
-import com.willalp.device.mapper.DeviceMapper;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import io.netty.channel.ChannelHandler;
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.timeout.IdleStateEvent;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import java.nio.charset.StandardCharsets;
-import java.util.Date;
-
-/**
- * @author hs
- */
-@Component
-@ChannelHandler.Sharable
-public class DeviceChannelHandler extends SimpleChannelInboundHandler<Object> {
-    private final static Logger logger = LoggerFactory.getLogger(DeviceChannelHandler.class);
-
-    public static DeviceChannelHandler deviceChannelHandler;
-
-    /**
-     * 超时记录
-     */
-    private int timeOut;
-
-    @Resource
-    private DeviceMapper deviceMapper;
-    @Resource
-    private ControlDataModel dataModel;
-
-    public DeviceChannelHandler(DeviceMapper deviceMapper, ControlDataModel dataModel) {
-        this.deviceMapper = deviceMapper;
-        this.dataModel = dataModel;
-    }
-
-    /**
-     * 因为是new出来ChannelHandler,没有托给spring容器,所以一定要先初始化,否则autowired失效
-     */
-    @PostConstruct
-    public void init() {
-        deviceChannelHandler = this;
-        deviceChannelHandler.deviceMapper = this.deviceMapper;
-    }
-
-    @Override
-    protected void channelRead0(ChannelHandlerContext ctx, Object msg) {
-        timeOut = 0;
-        ByteBuf buf = (ByteBuf) msg;
-        byte[] req = new byte[buf.readableBytes()];
-        buf.readBytes(req);
-        String body = new String(req, StandardCharsets.UTF_8);
-        String remoteAddr = Tool.subRemoteAddr(ctx.channel().remoteAddress().toString());
-        logger.info("IP - " + remoteAddr + " - 的消息:" + body);
-        ChannelMsgModel cmm = new ChannelMsgModel();
-        cmm.setChannel(ctx.channel());
-        cmm.setMsg(body);
-        cmm.setLastChange(new Date());
-        DeviceChannelMap.add(remoteAddr, cmm);
-        try {
-            AjaxResult resultMap = AjaxResult.success();
-            String patientPdStr = JSON.toJSONString(resultMap);
-            patientPdStr += "\n";
-            byte[] bytes = patientPdStr.getBytes(StandardCharsets.UTF_8);
-            ByteBuf resp = Unpooled.copiedBuffer(bytes);
-            DeviceChannelMap.get(remoteAddr).getChannel().writeAndFlush(resp);
-            if (body.contains(",")) {
-                String[] split = body.split(",");
-                Device device = deviceMapper.selectOne(
-                        new QueryWrapper<Device>().eq("device_no", split[0]));
-                if (ObjectUtil.isNull(device)) {
-                    logger.error("上电检查错误 - 未找到该设备");
-                    return;
-                }
-                device.setDeviceIpAddr(remoteAddr);
-                deviceMapper.updateById(device);
-                logger.info("基站上电检查完毕 - " + split[0] + " - " + remoteAddr);
-                dataModel.updateMap();
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-            logger.error("没有该设备");
-        }
-    }
-
-    /**
-     * 客户端建立新的连接时
-     *
-     * @param ctx
-     * @throws Exception
-     */
-    @Override
-    public void channelActive(ChannelHandlerContext ctx) throws Exception {
-        timeOut = 0;
-    }
-
-    /**
-     * 处理心跳检测事件的方法
-     *
-     * @param ctx
-     * @param evt
-     */
-    @Override
-    public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
-        IdleStateEvent event = (IdleStateEvent) evt;
-        String eventDesc = null;
-        switch (event.state()) {
-            case READER_IDLE:
-                eventDesc = "读空闲";
-                break;
-            case WRITER_IDLE:
-                eventDesc = "写空闲";
-                break;
-            case ALL_IDLE:
-                eventDesc = "读写空闲";
-                break;
-            default:
-                break;
-        }
-
-        String remoteAddr = Tool.subRemoteAddr(ctx.channel().remoteAddress().toString());
-        logger.info(remoteAddr + " -  " + eventDesc);
-        timeOut++;
-        if (timeOut > 3) {
-            DeviceChannelMap.remove(remoteAddr);
-            logger.info("DeviceChannelMap - 清除 - " + remoteAddr);
-            logger.info("空闲次数超过三次 关闭连接");
-            ctx.writeAndFlush("you are out");
-            ctx.channel().close();
-        }
-        //super.userEventTriggered(ctx, evt);
-
-    }
-
-    @Override
-    public void channelReadComplete(ChannelHandlerContext ctx) {
-        ctx.flush();
-    }
-
-    @Override
-    public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) {
-        String remoteAddr = Tool.subRemoteAddr(ctx.channel().remoteAddress().toString());
-        logger.info(remoteAddr + " - 断开连接");
-        ctx.close();
-    }
-
-}

+ 0 - 68
willalp-control/src/main/java/com/willalp/control/netty/handler/RwxdSocket.java

@@ -1,68 +0,0 @@
-package com.willalp.control.netty.handler;
-
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.StringUtils;
-import com.willalp.control.netty.model.ChannelMsgModel;
-import com.willalp.control.netty.model.ControlDataModel;
-import com.willalp.control.netty.model.DeviceChannelMap;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import io.netty.channel.Channel;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.nio.charset.StandardCharsets;
-import java.util.Date;
-import java.util.Map;
-
-/**
- * 任务下达socket发送消息
- *
- * @author hs
- */
-public class RwxdSocket {
-    private static final Logger logger = LoggerFactory.getLogger(RwxdSocket.class);
-
-    /**
-     * 推送指令到基站
-     */
-    public static boolean sendDeviceCommand(String command, String lockIp) {
-        synchronized (ControlDataModel.WAIT_MAP) {
-            //当前IP不存在时新增到map中
-            ControlDataModel.WAIT_MAP.computeIfAbsent(lockIp, k -> new Date());
-            long time = System.currentTimeMillis() - ControlDataModel.WAIT_MAP.get(lockIp).getTime();
-            try {
-                if (1000 > time) {
-                    //保证每个IP发送信息时都能间隔1s
-                    Thread.sleep(1000 - time);
-                }
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-            if (StringUtils.isBlank(command)) {
-                throw new BaseException("指令不能为空!");
-            }
-            if (StringUtils.isBlank(lockIp)) {
-                throw new BaseException("基站IP不能为空!");
-            }
-            //获取所有通道
-            Map<String, ChannelMsgModel> allChannelMap = DeviceChannelMap.getAll();
-            if (0 == allChannelMap.size()) {
-                throw new BaseException("control.openOrClose.device.not.network", new Object[]{allChannelMap});
-            }
-            //循环通道
-            for (String remoteAddress : allChannelMap.keySet()) {
-                if (lockIp.equals(remoteAddress)) {
-                    byte[] bytes = command.getBytes(StandardCharsets.UTF_8);
-                    ByteBuf resp = Unpooled.copiedBuffer(bytes);
-                    Channel channel = allChannelMap.get(remoteAddress).getChannel();
-                    channel.writeAndFlush(resp);
-                    logger.info("成功向设备(" + remoteAddress + ")下达指令:" + command);
-                    ControlDataModel.WAIT_MAP.put(lockIp, new Date());
-                    return true;
-                }
-            }
-            throw new BaseException("IP地址为:" + lockIp + "的基站未建立连接");
-        }
-    }
-}

+ 0 - 40
willalp-control/src/main/java/com/willalp/control/netty/model/ChannelMsgModel.java

@@ -1,40 +0,0 @@
-package com.willalp.control.netty.model;
-
-import io.netty.channel.Channel;
-
-import java.util.Date;
-
-public class ChannelMsgModel {
-
-    private Channel channel;
-    private String msg;
-    private Date lastChange;
-
-    public Channel getChannel() {
-        return channel;
-    }
-
-    public ChannelMsgModel setChannel(Channel channel) {
-        this.channel = channel;
-        return this;
-    }
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-
-    public Date getLastChange() {
-        return lastChange;
-    }
-
-    public ChannelMsgModel setLastChange(Date lastChange) {
-        this.lastChange = lastChange;
-        return this;
-    }
-
-}

+ 0 - 112
willalp-control/src/main/java/com/willalp/control/netty/model/ControlDataModel.java

@@ -1,112 +0,0 @@
-package com.willalp.control.netty.model;
-
-import com.willalp.control.domain.HsControlUsenoConfig;
-import com.willalp.control.service.IHsControlUsenoConfigService;
-import com.willalp.device.domain.Device;
-import com.willalp.device.service.IDeviceService;
-import lombok.Data;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
-import java.util.*;
-
-/**
- * @author xian
- */
-@Data
-@Component
-public class ControlDataModel {
-    /**
-     * 针头
-     */
-    public static final String PINHEAD = "HS";
-    /**
-     * 针尾
-     */
-    public static final String PIN_TAIL = "WP";
-    /**
-     * 返回值:成功
-     */
-    public static final String RETURN_SUCCESS = "00";
-    /**
-     * 针头
-     */
-    public static final String ERROR_LOGO = "ERROR";
-    /**
-     * 等待数据时 超时时间
-     */
-    public static final long OVER_TIME = 15 * 1000;
-
-    private final String[] weekDays = {"0", "1", "2", "3", "4", "5", "6"};
-
-    public String getWeek() {
-        Calendar calendar = Calendar.getInstance();
-        return weekDays[calendar.get(Calendar.DAY_OF_WEEK) - 1];
-    }
-
-    /**
-     * 执行口jvm缓存
-     */
-    public static Map<Long, HsControlUsenoConfig> useMap = new HashMap<>(16);
-
-    /**
-     * 设备jvm缓存
-     */
-    public static Map<String, Device> deviceMap = new HashMap<>(16);
-
-    /**
-     * 等待延迟时间
-     */
-    public static final Map<String, Date> WAIT_MAP = new Hashtable<>(16);
-
-    @Resource
-    private IHsControlUsenoConfigService useNoConfigService;
-    @Resource
-    private IDeviceService deviceService;
-    /**
-     * 共享通道 Map<IP地址,数据>
-     */
-    private Map<String, String[]> dataIntermediaryMap;
-    /**
-     * 锁定IP
-     */
-    private String lockIp;
-    /**
-     * 需要中断的IP
-     */
-    private String breakOffIp = "";
-    /**
-     * 需要中断的类型
-     */
-    private int breakOffType;
-
-    @PostConstruct
-    public void updateMap() {
-        List<HsControlUsenoConfig> list1 = useNoConfigService.list(null);
-        if (0 != list1.size()) {
-            list1.forEach((d) -> useMap.put(d.getUseNoId(), d));
-        }
-        List<Device> list2 = deviceService.list(null);
-        if (0 != list2.size()) {
-            list2.forEach((d) -> deviceMap.put(d.getDeviceId(), d));
-        }
-    }
-
-    /**
-     * 清除缓存数据
-     */
-    public void clear() {
-        this.dataIntermediaryMap.clear();
-        this.lockIp = null;
-    }
-
-    /**
-     * 中断等待中的数据
-     */
-    public void cancelBreakOff() {
-        breakOffIp = null;
-        breakOffType = 0;
-    }
-
-}

+ 0 - 64
willalp-control/src/main/java/com/willalp/control/netty/model/DeviceChannelMap.java

@@ -1,64 +0,0 @@
-package com.willalp.control.netty.model;
-
-import io.netty.channel.Channel;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
-
-/**
- * @author hs
- */
-public class DeviceChannelMap {
-
-    private static Map<String, ChannelMsgModel> map = new ConcurrentHashMap<>();
-
-    public static void add(String clientId, ChannelMsgModel channelMsgModel) {
-        map.put(clientId, channelMsgModel);
-    }
-
-    public static ChannelMsgModel get(String clientId) {
-        return map.get(clientId);
-    }
-
-    public static Map<String, ChannelMsgModel> getAll() {
-        return map;
-    }
-
-    public static void remove(Channel socketChannel) {
-        for (Map.Entry entry : map.entrySet()) {
-            if (entry.getValue() == socketChannel) {
-                map.remove(entry.getKey());
-            }
-        }
-    }
-
-    public static void remove(String key){
-        map.remove(key);
-    }
-
-    public static void clear(){
-        map.clear();
-    }
-
-
-
-
-    private static Map<String, Channel> channelMap = new ConcurrentHashMap<>();
-    public static void setChannel(String key, Channel channel){
-        channelMap.put(key,channel);
-    }
-
-    public static Channel getChannel(String key){
-        return channelMap.get(key);
-    }
-
-    private static Map<String,Lock> channelLockMap = new ConcurrentHashMap<>();
-    public static void setChannelLock(String key,Lock lock){
-        channelLockMap.put(key,lock);
-    }
-
-    public static Lock getChannelLock(String key){
-        return channelLockMap.get(key);
-    }
-}

+ 0 - 23
willalp-control/src/main/java/com/willalp/control/netty/service/CommandControlService.java

@@ -1,23 +0,0 @@
-package com.willalp.control.netty.service;
-
-/**
- * @author xian
- */
-public interface CommandControlService {
-
-    /**
-     * 拆封收到的指令
-     *
-     * @param str
-     * @return
-     */
-    String[] dismantlingCommand(String str);
-
-    /**
-     * 传入一个偶数 然后 从第 1,2 位数开始 解析为 每俩位数为一组的数组
-     *
-     * @param cmd
-     * @return
-     */
-    String[] parsingInstructions(String cmd);
-}

+ 0 - 45
willalp-control/src/main/java/com/willalp/control/netty/service/CommandNettyService.java

@@ -1,45 +0,0 @@
-package com.willalp.control.netty.service;
-
-
-/**
- * @author xian
- * @Description 基站交互接口
- * @date 2021/7/31
- */
-public interface CommandNettyService {
-
-    /**
-     *
-     * 指令业务处理
-     *
-     * @param str
-     * @param ipAddr
-     */
-    void commandServiceControl(String str, String ipAddr);
-
-    /**
-     * 获取需要发送命令的基站IP
-     *
-     * @param deviceId
-     * @return
-     */
-    String getNeedSendCommandBaseStationIp(String deviceId);
-
-    /**
-     * 传入基站IP等待获取通道内传输的数据
-     *
-     * @param baseIp
-     * @param type
-     * @return
-     */
-    String waitingToReceiveData(String baseIp, int type);
-
-
-    /**
-     * 传入控制数据获得整句指令
-     *
-     * @param str 俩位的控制指令
-     * @return
-     */
-    String getCommandToStr(String str);
-}

+ 0 - 85
willalp-control/src/main/java/com/willalp/control/netty/service/impl/CommandControlServiceImpl.java

@@ -1,85 +0,0 @@
-package com.willalp.control.netty.service.impl;
-
-import com.willalp.control.netty.model.ControlDataModel;
-import com.willalp.control.netty.service.CommandControlService;
-import com.willalp.control.netty.service.CommandNettyService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-/**
- * @author xian
- */
-@Service
-public class CommandControlServiceImpl implements CommandControlService {
-    protected final static Logger logger = LoggerFactory.getLogger(CommandControlServiceImpl.class);
-
-    @Resource
-    private ControlDataModel commandDataControl;
-
-    @Resource
-    private CommandNettyService commandNettyService;
-
-
-    @Override
-    public String[] dismantlingCommand(String str) {
-        if (str.length() <= 18) {
-            return null;
-        }
-        //针头
-        String pinHead = str.substring(0, 2);
-        //通讯地址
-        String txAddress = str.substring(2, 12);
-        //指令类型
-        String type = str.substring(12, 14);
-        //指令内容
-        String content = str.substring(14, str.length() - 4);
-        //返回结果
-        String result = str.substring(str.length() - 4).substring(0, 2);
-        //针尾
-        String pinTail = str.substring(str.length() - 2);
-        String[] strings = new String[6];
-        strings[0] = pinHead;
-        strings[1] = txAddress;
-        strings[2] = type;
-        strings[3] = content;
-        strings[4] = result;
-        strings[5] = pinTail;
-        return strings;
-
-    }
-
-
-
-
-    /**
-     * 传入一个长度为偶数的字符 然后 从第 1 和 2 位数开始 一起放入数组的第一个下标处
-     * 以此类推
-     * 解析成 每俩位数为一组的数组
-     *
-     * @param str
-     * @return
-     */
-    @Override
-    public String[] parsingInstructions(String str) {
-        if (null == str) {
-            return null;
-        }
-        //字符长度只能为偶数
-        if (0 != str.length() % 2) {
-            return null;
-        }
-        String[] sArray = new String[str.length() / 2];
-        int head = 0;
-        int tail = 2;
-        for (int i = 0; i < sArray.length; i++) {
-            sArray[i] = str.substring(head, tail);
-            //解析为每2位为一组
-            head += 2;
-            tail += 2;
-        }
-        return sArray;
-    }
-}

+ 0 - 197
willalp-control/src/main/java/com/willalp/control/netty/service/impl/CommandNettyServiceImpl.java

@@ -1,197 +0,0 @@
-package com.willalp.control.netty.service.impl;
-
-import com.willalp.common.exception.GlobalException;
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.StringUtils;
-import com.willalp.control.netty.model.ControlDataModel;
-import com.willalp.control.netty.service.CommandControlService;
-import com.willalp.control.netty.service.CommandNettyService;
-import com.willalp.device.domain.Device;
-import com.willalp.device.mapper.DeviceMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-
-/**
- * @author xian
- * @Description 基站交互接口实现类
- * @date 2021/7/31
- */
-@Service
-public class CommandNettyServiceImpl implements CommandNettyService {
-    protected final static Logger logger = LoggerFactory.getLogger(CommandNettyServiceImpl.class);
-
-
-    @Resource
-    private ControlDataModel commandDataControl;
-
-    @Resource
-    private CommandControlService commandControlService;
-
-    @Resource
-    private DeviceMapper deviceMapper;
-
-
-    @Override
-    public void commandServiceControl(String str, String ipAddr) {
-        if (StringUtils.isBlank(str)) {
-            return;
-        }
-        /*
-         *  拆分收到的指令
-         *  示例:HS01010000002C00000000000000000000WP
-         *    针头: HS                       strings[0]
-         *    通讯地址: 0101000000            strings[1]
-         *    指令类型: 2C                    strings[2]
-         *    指令内容: 000000000000000000    strings[3]
-         *    返回结果: 00                    strings[4]
-         *    针尾: WP                       strings[5]
-         */
-        String[] strings = commandControlService.dismantlingCommand(str);
-        if (null == strings) {
-            return;
-        }
-        //拆分五级地址
-/*        String[] fiveAddress = commandControlService.parsingInstructions(strings[1]);
-        String executiveUnit = null;
-        for (int i = 0; i < fiveAddress.length; i++) {
-            //获取第一个为00的地址的下标
-            if (WCmdGrid.RETURN_SUCCESS.equals(fiveAddress[i])) {
-                if (i != 0) {
-                    //获取到上一级 确定执行单位
-                    executiveUnit = fiveAddress[i - 1];
-                    break;
-                } else {
-                    return;
-                }
-            }
-        }
-        if (StringUtils.isBlank(executiveUnit)) {
-            return;
-        }*/
-        long txAddress = Long.parseLong(strings[2], 16);
-
-/*        if (0 < txAddress && 36 >= txAddress) {
-            commandControlService.lockControlBoardLogicControl(strings, ipAddr);
-        } else if (43 == txAddress) {
-            commandControlService.icCardLogicControl(strings, ipAddr);
-        } else if (37 <= txAddress && 42 >= txAddress) {
-            commandControlService.fingerprintLogicControl(strings, ipAddr);
-        } else if (44 == txAddress) {
-            commandControlService.lockControlBoardLogicControl(strings, ipAddr);
-        } else {
-            logger.info("没有找到对应的控制");
-        }*/
-
-        /*//边缘数采前置机
-        if (txAddress > 0 && txAddress <= 100) {
-
-        }
-        //多功能控制器
-        else if (txAddress >= 101 && txAddress <= 200) {
-
-        }
-        //IC卡/读卡器模块
-        else if (txAddress >= 201 && txAddress <= 210) {
-        }
-        //指纹模块
-        else if (txAddress >= 211 && txAddress <= 220) {
-        }
-        //二维码模块
-        else if (txAddress >= 221 && txAddress <= 230) {
-
-        }
-        //锁控板模块
-        else if (txAddress >= 231 && txAddress <= 240) {
-            commandControlService.lockControlBoardLogicControl(strings);
-        }
-        //其他
-        else if (txAddress >= 241 && txAddress <= 250) {
-
-        }
-        //其他
-        else if (txAddress >= 251 && txAddress <= 255) {
-
-        }
-*/
-    }
-
-
-    /**
-     * 获取需要发送命令的基站IP
-     *
-     * @param deviceId
-     * @return
-     */
-    @Override
-    public String getNeedSendCommandBaseStationIp(String deviceId) {
-        if (StringUtils.isBlank(deviceId)) {
-            throw new BaseException("设备信息ID不得为空");
-        }
-        Device device = deviceMapper.selectById(deviceId);
-        if (null == device) {
-            throw new BaseException("此设备暂无配置信息,或不存在");
-        }
-        String deviceIpAddr = device.getDeviceIpAddr();
-        if (null == deviceIpAddr) {
-            throw new BaseException("此设备还未配置IP");
-        }
-        return deviceIpAddr;
-    }
-
-    @Override
-    public String waitingToReceiveData(String baseIp, int type) {
-        //开始等待时间   默认: 15s 没有结果,则结束请求
-        long beginTime = System.currentTimeMillis();
-
-        try {
-            for (; ; ) {
-                if (baseIp.equals(commandDataControl.getBreakOffIp())) {
-                    if (type == commandDataControl.getBreakOffType()) {
-                        BaseException nowBreakOff = new BaseException("已中断");
-                        nowBreakOff.setCode("444");
-                        logger.info(Thread.currentThread().getName() + " - 已中断");
-                        throw nowBreakOff;
-                    }
-                }
-                //阻塞线程释放占用的cpu资源  优化无限循环对cpu的占用
-                Thread.sleep(100);
-
-                if (StringUtils.isNotBlank(baseIp)) {
-                    //锁定基站IP 获取数据
-                    if (baseIp.equals(commandDataControl.getLockIp())) {
-                        switch (type) {
-                            case 1:
-                                break;
-                            case 2:
-                                break;
-                            case 3:
-                                break;
-                            default:
-                                throw new GlobalException("识别类型传递出错");
-                        }
-                    }
-                    //等待 15s 结束
-                    if (beginTime + ControlDataModel.OVER_TIME <= System.currentTimeMillis()) {
-                        throw new GlobalException("已等待超时,请重试");
-                    }
-                }
-            }
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-        return ControlDataModel.ERROR_LOGO;
-    }
-
-    @Override
-    public String getCommandToStr(String str) {
-        if (StringUtils.isBlank(str)) {
-            return null;
-        }
-        return ControlDataModel.PINHEAD + "0102030405" + str + ControlDataModel.RETURN_SUCCESS + ControlDataModel.PIN_TAIL;
-    }
-
-}

+ 0 - 41
willalp-control/src/main/java/com/willalp/control/service/ControlService.java

@@ -1,41 +0,0 @@
-package com.willalp.control.service;
-
-import com.willalp.control.domain.HsControlTiming;
-import com.willalp.control.domain.vo.OpenOrCloseVo;
-import org.springframework.scheduling.annotation.Async;
-
-import java.util.List;
-
-/**
- * @author hs
- *
- * 控制业务处理
- */
-public interface ControlService {
-
-    /**
-     * APP控制灯的打开或者关闭
-     *
-     * @param openOrCloseVo
-     * @return
-     */
-    int openOrClose(OpenOrCloseVo openOrCloseVo);
-
-    /**
-     * 异步获取jvm中执行口和设备信息并发送指令
-     *
-     * @param useNoId
-     * @param openOrClose
-     */
-    void getIpAndCmdByUseNoIdAndSend(Long useNoId,int openOrClose);
-
-    /**
-     * 异步检索定时开/关任务并执行
-     *
-     * @param list
-     * @param startOrEnd
-     */
-    @Async("asyncServiceExecutor")
-    void asyncTimingStartOrEnd(List<HsControlTiming>list,int startOrEnd);
-
-}

+ 0 - 58
willalp-control/src/main/java/com/willalp/control/service/IHsControlDeviceInfoService.java

@@ -1,58 +0,0 @@
-package com.willalp.control.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.willalp.control.domain.HsControlDeviceInfo;
-import com.willalp.control.domain.vo.OpenOrCloseVo;
-import org.springframework.scheduling.annotation.Async;
-
-import java.util.List;
-
-/**
- * 控制设备状态信息Service接口
- *
- * @author willalp
- * @date 2022-02-16
- */
-public interface IHsControlDeviceInfoService extends IService<HsControlDeviceInfo> {
-    /**
-     * 查询控制设备状态信息列表
-     *
-     * @param hsControlDeviceInfo 控制设备状态信息
-     * @return 控制设备状态信息集合
-     */
-    List<HsControlDeviceInfo> selectHsControlDeviceInfoList(HsControlDeviceInfo hsControlDeviceInfo);
-
-    /**
-     * APP查询控制设备状态信息列表
-     *
-     * @param userId 用户ID
-     * @return 控制设备状态信息集合
-     */
-    List<HsControlDeviceInfo> appSelectHsControlDeviceInfoList(Long userId);
-
-    /**
-     * 新增设备信息
-     *
-     *
-     * @param deviceInfo@return
-     */
-    int addDeviceInfo(HsControlDeviceInfo deviceInfo);
-
-    /**
-     * 打开或关闭后异步更新设备信息并生成日志
-     *
-     * @param openOrCloseVo
-     */
-    @Async("asyncServiceExecutor")
-    void openOrCloseUpdateDeviceInfo(OpenOrCloseVo openOrCloseVo);
-
-    /**
-     * 定时任务 打开或关闭后异步更新设备信息
-     *
-     * @param useNoId
-     * @param status
-     */
-    @Async("asyncServiceExecutor")
-    void timingOpenOrCloseUpdateDeviceInfo(Long useNoId, int status);
-
-}

+ 0 - 31
willalp-control/src/main/java/com/willalp/control/service/IHsControlLogService.java

@@ -1,31 +0,0 @@
-package com.willalp.control.service;
-
-import java.util.List;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.willalp.control.domain.HsControlLog;
-
-/**
- * 控制日志Service接口
- *
- * @author willalp
- * @date 2022-03-11
- */
-public interface IHsControlLogService extends IService<HsControlLog>
-{
-    /**
-     * 查询控制日志列表
-     *
-     * @param hsControlLog 控制日志
-     * @return 控制日志集合
-     */
-    public List<HsControlLog> selectHsControlLogList(HsControlLog hsControlLog);
-
-    /**
-     * 根据执行口和时候获取日志列表
-     *
-     * @param useNoId
-     * @param date
-     * @return
-     */
-    List<HsControlLog> selectLogListByUseNoIdAndDate(String useNoId, String date);
-}

+ 0 - 39
willalp-control/src/main/java/com/willalp/control/service/IHsControlStatService.java

@@ -1,39 +0,0 @@
-package com.willalp.control.service;
-
-import java.util.List;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.willalp.control.domain.HsControlStat;
-
-/**
- * 设备使用统计Service接口
- *
- * @author willalp
- * @date 2022-03-02
- */
-public interface IHsControlStatService extends IService<HsControlStat>
-{
-    /**
-     * 查询设备使用统计列表
-     *
-     * @param hsControlStat 设备使用统计
-     * @return 设备使用统计集合
-     */
-    public List<HsControlStat> selectHsControlStatList(HsControlStat hsControlStat);
-
-    /**
-     * app端获取年-月统计列表
-     *
-     * @param useNoId
-     * @return
-     */
-    List<HsControlStat> appControlStatList(String useNoId);
-
-    /**
-     *  app端根据年-月获取 日统计列表
-     *
-     * @param useNoId
-     * @param yearMonth
-     * @return
-     */
-    List<HsControlStat> appControlStatList(String useNoId,String yearMonth);
-}

+ 0 - 37
willalp-control/src/main/java/com/willalp/control/service/IHsControlTimingService.java

@@ -1,37 +0,0 @@
-package com.willalp.control.service;
-
-import java.util.List;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.willalp.control.domain.HsControlTiming;
-
-/**
- * 设备定时任务Service接口
- *
- * @author willalp
- * @date 2022-02-16
- */
-public interface IHsControlTimingService extends IService<HsControlTiming>
-{
-    /**
-     * 查询设备定时任务列表
-     *
-     * @param hsControlTiming 设备定时任务
-     * @return 设备定时任务集合
-     */
-    public List<HsControlTiming> selectHsControlTimingList(HsControlTiming hsControlTiming);
-
-    /**
-     * 根据执行口ID获取定时任务
-     * @param useNoId
-     * @return
-     */
-    HsControlTiming getTimingInfo(String useNoId);
-
-    /**
-     * 新增或修改定时任务
-     *
-     * @param timing
-     * @return
-     */
-    int saveOrUpdateTiming(HsControlTiming timing);
-}

+ 0 - 29
willalp-control/src/main/java/com/willalp/control/service/IHsControlUsenoConfigService.java

@@ -1,29 +0,0 @@
-package com.willalp.control.service;
-
-import java.util.List;
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.willalp.control.domain.HsControlUsenoConfig;
-
-/**
- * 空开设备号口配置Service接口
- *
- * @author willalp
- * @date 2022-02-21
- */
-public interface IHsControlUsenoConfigService extends IService<HsControlUsenoConfig>
-{
-    /**
-     * 查询空开设备号口配置列表
-     *
-     * @param hsControlUsenoConfig 空开设备号口配置
-     * @return 空开设备号口配置集合
-     */
-    public List<HsControlUsenoConfig> selectHsControlUsenoConfigList(HsControlUsenoConfig hsControlUsenoConfig);
-
-    /**
-     * 查询当前可添加的执行口
-     *
-     * @return
-     */
-    List<HsControlUsenoConfig> canAddUseNoListList();
-}

+ 0 - 130
willalp-control/src/main/java/com/willalp/control/service/impl/ControlServiceImpl.java

@@ -1,130 +0,0 @@
-package com.willalp.control.service.impl;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.StringUtils;
-import com.willalp.control.domain.HsControlTiming;
-import com.willalp.control.domain.HsControlUsenoConfig;
-import com.willalp.control.domain.vo.OpenOrCloseVo;
-import com.willalp.control.mapper.HsControlUsenoConfigMapper;
-import com.willalp.control.netty.handler.RwxdSocket;
-import com.willalp.control.netty.model.ControlDataModel;
-import com.willalp.control.netty.service.CommandControlService;
-import com.willalp.control.netty.service.CommandNettyService;
-import com.willalp.control.service.ControlService;
-import com.willalp.control.service.IHsControlDeviceInfoService;
-import com.willalp.control.service.IHsControlLogService;
-import com.willalp.control.service.IHsControlTimingService;
-import com.willalp.device.domain.Device;
-import com.willalp.device.mapper.DeviceMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-import java.sql.Time;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author hs
- * <p>
- * 控制业务实现类
- */
-@Service
-public class ControlServiceImpl implements ControlService {
-    private static final Logger log = LoggerFactory.getLogger(ControlServiceImpl.class);
-
-    @Resource
-    private IHsControlDeviceInfoService deviceInfoService;
-
-    @Resource
-    private HsControlUsenoConfigMapper useNoConfigMapper;
-
-    @Resource
-    private DeviceMapper deviceMapper;
-
-    @Resource
-    private CommandNettyService commandNettyService;
-
-
-    @Override
-    public int openOrClose(OpenOrCloseVo openOrCloseVo) {
-        int isOpenOrClose = openOrCloseVo.getIsOpenOrClose();
-        String useNoId = openOrCloseVo.getUseNoId();
-        String deviceId = openOrCloseVo.getDeviceId();
-        String deviceInfoId = openOrCloseVo.getDeviceInfoId();
-        if (StringUtils.isBlank(useNoId)) {
-            throw new BaseException("control.useNoId.null", new Object[]{openOrCloseVo.toString()});
-        }
-        if (StringUtils.isBlank(deviceId)) {
-            throw new BaseException("基站ID不得为空");
-        }
-        if (StringUtils.isBlank(deviceInfoId)) {
-            throw new BaseException("设备信息ID不得为空");
-        }
-        //查询执行口
-        HsControlUsenoConfig useNoConfig = useNoConfigMapper.selectById(useNoId);
-        //判断发送 开还是关
-        String command = isOpenOrClose == 0 ? useNoConfig.getCommandClose() : useNoConfig.getCommandOpen();
-        command = commandNettyService.getCommandToStr(command);
-        Device device = deviceMapper.selectById(deviceId);
-        String deviceIpAddr = device.getDeviceIpAddr();
-        //发送指令 发送成功后 异步 修改灯信息
-        if (RwxdSocket.sendDeviceCommand(command, deviceIpAddr)) {
-            //修改 设备(灯)运行信息 并生成日志
-            deviceInfoService.openOrCloseUpdateDeviceInfo(openOrCloseVo);
-            String text = isOpenOrClose == 0 ? "{ 关" : "{ 开";
-            log.info(text + " }指令 - 发送成功");
-            return 1;
-        } else {
-            return 0;
-        }
-    }
-
-    @Override
-    public void getIpAndCmdByUseNoIdAndSend(Long useNoId, int openOrClose) {
-        HsControlUsenoConfig useNoConfig = ControlDataModel.useMap.get(useNoId);
-        if (ObjectUtil.isNull(useNoConfig)) {
-            throw new BaseException("查询{jvm}中{执行口信息} - 为空 - 参数:" + useNoId, new Object[]{useNoId});
-        }
-        Device device = ControlDataModel.deviceMap.get(useNoConfig.getDeviceId());
-        if (ObjectUtil.isNull(device)) {
-            throw new BaseException("查询 {jvm} 中 {设备信息} - 为空 - 参数:" + useNoConfig.getDeviceId(),
-                    new Object[]{useNoConfig.getDeviceId()});
-        }
-        String ipAddr = device.getDeviceIpAddr();
-        String command = openOrClose == 1 ?
-                useNoConfig.getCommandOpen() : useNoConfig.getCommandClose();
-        String commandToStr = commandNettyService.getCommandToStr(command);
-        RwxdSocket.sendDeviceCommand(commandToStr, ipAddr);
-        //异步更新
-        deviceInfoService.timingOpenOrCloseUpdateDeviceInfo(useNoId, openOrClose);
-    }
-
-    @Override
-    public void asyncTimingStartOrEnd(List<HsControlTiming> list, int startOrEnd) {
-        for (HsControlTiming t : list) {
-            //获取DB中存储的时间
-            Time dbTime = 0 == startOrEnd ? t.getEndTime() :
-                    t.getStartTime();
-            //获取当前 时:分
-            SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
-            /*测试变量 */
-            //String nowTime = dateFormat.format(new Date(0, Calendar.JANUARY, 0, 9, 22, 0));
-            String nowTime = dateFormat.format(new Date());
-            //拆分比对 时分
-            String[] dbStartTimes = dbTime.toString().split(":");
-            String[] nowTimes = nowTime.split(":");
-            //比对 时 部分
-            if (dbStartTimes[0].equals(nowTimes[0])) {
-                //比对 分 部分
-                if (dbStartTimes[1].equals(nowTimes[1])) {
-                    this.getIpAndCmdByUseNoIdAndSend(t.getUseNoId(), startOrEnd);
-                }
-            }
-        }
-    }
-}

+ 0 - 183
willalp-control/src/main/java/com/willalp/control/service/impl/HsControlDeviceInfoServiceImpl.java

@@ -1,183 +0,0 @@
-package com.willalp.control.service.impl;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.DateUtils;
-import com.willalp.common.utils.SecurityUtils;
-import com.willalp.common.utils.StringUtils;
-import com.willalp.control.domain.HsControlDeviceInfo;
-import com.willalp.control.domain.HsControlLog;
-import com.willalp.control.domain.HsControlUsenoConfig;
-import com.willalp.control.domain.vo.OpenOrCloseVo;
-import com.willalp.control.mapper.HsControlDeviceInfoMapper;
-import com.willalp.control.service.IHsControlDeviceInfoService;
-import com.willalp.control.service.IHsControlLogService;
-import com.willalp.control.service.IHsControlTimingService;
-import com.willalp.control.service.IHsControlUsenoConfigService;
-import com.willalp.device.domain.Device;
-import com.willalp.device.mapper.DeviceMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import javax.annotation.Resource;
-import java.text.DateFormat;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 控制设备状态信息Service业务层处理
- *
- * @author willalp
- * @date 2022-02-16
- */
-@Transactional(rollbackFor = Exception.class)
-@Service
-public class HsControlDeviceInfoServiceImpl extends ServiceImpl<HsControlDeviceInfoMapper, HsControlDeviceInfo> implements IHsControlDeviceInfoService {
-    private static final Logger log = LoggerFactory.getLogger(HsControlDeviceInfoServiceImpl.class);
-
-    @Resource
-    private HsControlDeviceInfoMapper deviceInfoMapper;
-
-    @Resource
-    private IHsControlTimingService controlTimingService;
-
-    @Resource
-    private IHsControlUsenoConfigService configService;
-
-    @Resource
-    private DeviceMapper deviceMapper;
-
-    @Resource
-    private IHsControlLogService logService;
-
-    /**
-     * 查询控制设备状态信息列表
-     *
-     * @param hsControlDeviceInfo 控制设备状态信息
-     * @return 控制设备状态信息
-     */
-    @Override
-    public List<HsControlDeviceInfo> selectHsControlDeviceInfoList(HsControlDeviceInfo hsControlDeviceInfo) {
-        return deviceInfoMapper.selectHsControlDeviceInfoList(hsControlDeviceInfo);
-    }
-
-    @Override
-    public List<HsControlDeviceInfo> appSelectHsControlDeviceInfoList(Long userId) {
-        QueryWrapper<Device> qw1 = new QueryWrapper<>();
-        qw1.like("device_use_id", userId);
-        List<Device> devices = deviceMapper.selectList(qw1);
-        if (0 == devices.size()) {
-            throw new BaseException("请绑定一台您的设备");
-        }
-        List<HsControlDeviceInfo> hsControlDeviceInfos = new ArrayList<>();
-        devices.forEach((d) -> {
-            QueryWrapper<HsControlDeviceInfo> qw2 = new QueryWrapper<>();
-            qw2.eq("device_id", d.getDeviceId());
-            hsControlDeviceInfos.addAll(deviceInfoMapper.selectList(qw2));
-        });
-        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        hsControlDeviceInfos.sort((a1, a2) -> {
-            try {
-                return df.parse(sdf.format(a2.getCreateTime())).compareTo(df.parse(sdf.format(a1.getCreateTime())));
-            } catch (ParseException e) {
-                e.printStackTrace();
-            }
-            return 1;
-        });
-        return hsControlDeviceInfos;
-    }
-
-    @Override
-    public int addDeviceInfo(HsControlDeviceInfo deviceInfo) {
-        String deviceName = deviceInfo.getDeviceName();
-        String deviceUseNo = deviceInfo.getDeviceUseNo();
-        if (StringUtils.isBlank(deviceName)) {
-            throw new BaseException("设备名称不能为空");
-        }
-        if (StringUtils.isBlank(deviceUseNo)) {
-            throw new BaseException("执行口ID不能为空");
-        }
-        HsControlDeviceInfo useNo = this.baseMapper.selectOne(
-                new QueryWrapper<HsControlDeviceInfo>()
-                        .eq("device_use_no", deviceUseNo));
-        if (ObjectUtil.isNotNull(useNo)) {
-            throw new BaseException("该执行口已被使用,无法再次添加");
-        }
-        HsControlUsenoConfig byId = configService.getById(deviceUseNo);
-        if (ObjectUtil.isNull(byId)) {
-            throw new BaseException("没有改执行口信息");
-        }
-        String deviceId = byId.getDeviceId();
-        if (StringUtils.isBlank(deviceId)) {
-            throw new BaseException("该执行口未绑定设备");
-        }
-        deviceInfo.setDeviceId(deviceId);
-        deviceInfo.setDosage("0");
-        deviceInfo.setStatTime((long) 0);
-        deviceInfo.setDosagePct(0);
-        deviceInfo.setDosageUnit("小时");
-        deviceInfo.setUserId(SecurityUtils.getUserId());
-        deviceInfo.setCreateBy(SecurityUtils.getUsername());
-        deviceInfo.setCreateTime(DateUtils.getNowDate());
-        return this.baseMapper.insert(deviceInfo);
-    }
-
-    @Override
-    public void openOrCloseUpdateDeviceInfo(OpenOrCloseVo openOrCloseVo) {
-        HsControlDeviceInfo deviceInfo = deviceInfoMapper.selectById(openOrCloseVo.getDeviceInfoId());
-        int isOpenOrClose = openOrCloseVo.getIsOpenOrClose();
-        String useNoId = openOrCloseVo.getUseNoId();
-        setDeviceInfoStatus(deviceInfo, isOpenOrClose, useNoId);
-    }
-
-    @Override
-    public void timingOpenOrCloseUpdateDeviceInfo(Long useNoId, int status) {
-        HsControlDeviceInfo deviceInfo = this.baseMapper.selectOne(
-                new QueryWrapper<HsControlDeviceInfo>()
-                        .eq("device_use_no", useNoId));
-        deviceInfo.setRunningStatus(status);
-        setDeviceInfoStatus(deviceInfo, status, String.valueOf(useNoId));
-    }
-
-    private void setDeviceInfoStatus(HsControlDeviceInfo deviceInfo, int isOpenOrClose, String useNoId) {
-        if (isOpenOrClose == 0) {
-            deviceInfo.setRunningStatus(isOpenOrClose);
-            deviceInfo.setDosagePct(isOpenOrClose);
-            deviceInfo.setLastCloseTime(new Date());
-
-        } else {
-            deviceInfo.setRunningStatus(isOpenOrClose);
-            deviceInfo.setDosagePct(100);
-            deviceInfo.setLastOpenTime(new Date());
-        }
-        HsControlLog controlLog = null;
-        if (null != useNoId) {
-            controlLog = new HsControlLog();
-            controlLog.setUseNoId(useNoId);
-            String text = isOpenOrClose == 0 ? "关闭" : "打开";
-            controlLog.setUseDescribe(text);
-            controlLog.setCreateTime(new Date());
-        }
-        if (null != controlLog) {
-            if (logService.saveOrUpdate(controlLog)) {
-                log.info("异步生成{ " + deviceInfo.getDeviceName() + " }操作日志 - 成功");
-            } else {
-                log.info("异步生成{ " + deviceInfo.getDeviceName() + " }操作日志 - 失败");
-            }
-        }
-        if (this.baseMapper.updateById(deviceInfo) > 0) {
-            log.info("异步更新{ " + deviceInfo.getDeviceName() + " }开关信息 - 成功");
-        } else {
-            log.info("异步更新{ " + deviceInfo.getDeviceName() + " }开关信息 - 失败");
-        }
-
-    }
-}

+ 0 - 46
willalp-control/src/main/java/com/willalp/control/service/impl/HsControlLogServiceImpl.java

@@ -1,46 +0,0 @@
-package com.willalp.control.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import java.util.List;
-
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.DateUtils;
-import com.willalp.common.utils.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.willalp.control.mapper.HsControlLogMapper;
-import com.willalp.control.domain.HsControlLog;
-import com.willalp.control.service.IHsControlLogService;
-
-/**
- * 控制日志Service业务层处理
- *
- * @author willalp
- * @date 2022-03-11
- */
-@Service
-public class HsControlLogServiceImpl extends ServiceImpl<HsControlLogMapper, HsControlLog>  implements IHsControlLogService
-{
-    @Autowired
-    private HsControlLogMapper hsControlLogMapper;
-
-    /**
-     * 查询控制日志列表
-     *
-     * @param hsControlLog 控制日志
-     * @return 控制日志
-     */
-    @Override
-    public List<HsControlLog> selectHsControlLogList(HsControlLog hsControlLog)
-    {
-        return hsControlLogMapper.selectHsControlLogList(hsControlLog);
-    }
-
-    @Override
-    public List<HsControlLog> selectLogListByUseNoIdAndDate(String useNoId, String date) {
-        if (StringUtils.isBlank(useNoId) || StringUtils.isBlank(date)) {
-            throw new BaseException("参数错误");
-        }
-        return this.baseMapper.selectLogListByUseNoIdAndDate(useNoId,date);
-    }
-}

+ 0 - 67
willalp-control/src/main/java/com/willalp/control/service/impl/HsControlStatServiceImpl.java

@@ -1,67 +0,0 @@
-package com.willalp.control.service.impl;
-
-import cn.hutool.core.date.BetweenFormater;
-import cn.hutool.core.date.DateUtil;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.StringUtils;
-import com.willalp.control.domain.HsControlStat;
-import com.willalp.control.mapper.HsControlStatMapper;
-import com.willalp.control.service.IHsControlStatService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 设备使用统计Service业务层处理
- *
- * @author willalp
- * @date 2022-03-02
- */
-@Service
-public class HsControlStatServiceImpl extends ServiceImpl<HsControlStatMapper, HsControlStat> implements IHsControlStatService {
-    @Autowired
-    private HsControlStatMapper hsControlStatMapper;
-
-    /**
-     * 查询设备使用统计列表
-     *
-     * @param hsControlStat 设备使用统计
-     * @return 设备使用统计
-     */
-    @Override
-    public List<HsControlStat> selectHsControlStatList(HsControlStat hsControlStat) {
-        return hsControlStatMapper.selectHsControlStatList(hsControlStat);
-    }
-
-    @Override
-    public List<HsControlStat> appControlStatList(String useNoId) {
-        if (StringUtils.isBlank(useNoId)) {
-            throw new BaseException("control.useNoId.null", new Object[]{useNoId});
-        }
-        List<HsControlStat> statYearMonthDates = this.baseMapper.getStatYearMonthDateByUseNoId(useNoId);
-        statYearMonthDates.forEach((s) -> {
-            String dosage = s.getDosage();
-            s.setDosage(DateUtil.formatBetween(Long.parseLong(dosage), BetweenFormater.Level.SECOND));
-        });
-        return statYearMonthDates;
-    }
-
-    @Override
-    public List<HsControlStat> appControlStatList(String useNoId, String yearMonth) {
-        if (StringUtils.isBlank(useNoId)) {
-            throw new BaseException("control.useNoId.null", new Object[]{useNoId});
-        }
-        if (StringUtils.isBlank(yearMonth)) {
-            throw new BaseException("日期不能为空");
-        }
-        List<HsControlStat> dayList = this.baseMapper
-                .getStatYearMonthDateByUseNoIdAndYearMonth(useNoId, yearMonth);
-        dayList.forEach((d) -> {
-            String dosage = d.getDosage();
-            d.setDosage(DateUtil.formatBetween(Long.parseLong(dosage), BetweenFormater.Level.SECOND));
-        });
-        return dayList;
-    }
-}

+ 0 - 88
willalp-control/src/main/java/com/willalp/control/service/impl/HsControlTimingServiceImpl.java

@@ -1,88 +0,0 @@
-package com.willalp.control.service.impl;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.IdWorker;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.willalp.common.exception.base.BaseException;
-import com.willalp.common.utils.StringUtils;
-import com.willalp.control.domain.HsControlTiming;
-import com.willalp.control.mapper.HsControlTimingMapper;
-import com.willalp.control.service.IHsControlTimingService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.sql.Time;
-import java.util.List;
-
-/**
- * 设备定时任务Service业务层处理
- *
- * @author willalp
- * @date 2022-02-16
- */
-@Service
-public class HsControlTimingServiceImpl extends ServiceImpl<HsControlTimingMapper, HsControlTiming> implements IHsControlTimingService {
-    @Autowired
-    private HsControlTimingMapper hsControlTimingMapper;
-
-    /**
-     * 查询设备定时任务列表
-     *
-     * @param hsControlTiming 设备定时任务
-     * @return 设备定时任务
-     */
-    @Override
-    public List<HsControlTiming> selectHsControlTimingList(HsControlTiming hsControlTiming) {
-        return hsControlTimingMapper.selectHsControlTimingList(hsControlTiming);
-    }
-
-    @Override
-    public HsControlTiming getTimingInfo(String useNoId) {
-        if (StringUtils.isBlank(useNoId)) {
-            throw new BaseException("control.useNoId.null", new Object[]{useNoId});
-        }
-        HsControlTiming timing = hsControlTimingMapper.selectOne(
-                new QueryWrapper<HsControlTiming>()
-                        .eq("use_no_id", useNoId));
-        if (ObjectUtil.isEmpty(timing)) {
-            throw new BaseException("control.selectTiming.to.useNoId.null", new Object[]{useNoId});
-        }
-        return timing;
-    }
-
-    @Override
-    public int saveOrUpdateTiming(HsControlTiming timing) {
-        if (ObjectUtil.isNull(timing)) {
-            throw new BaseException("数据为空");
-        }
-        Long useNoId = timing.getUseNoId();
-        Time startTime = timing.getStartTime();
-        Time endTime = timing.getEndTime();
-        if (0 == useNoId) {
-            throw new BaseException("control.useNoId.null", new Object[]{useNoId});
-        }
-        if (null == startTime) {
-            throw new BaseException("开始时间不能为空");
-        }
-        if (null == endTime) {
-            throw new BaseException("结束时间不能为空");
-        }
-        QueryWrapper<HsControlTiming> qwEqUseNoId = new QueryWrapper<HsControlTiming>()
-                .eq("use_no_id", useNoId);
-        HsControlTiming timingDb = this.baseMapper.selectOne(qwEqUseNoId);
-        if (ObjectUtil.isNull(timingDb)) {
-            for (; ; ) {
-                String idStr = IdWorker.getIdStr();
-                HsControlTiming byId = this.baseMapper.selectById(idStr);
-                if (null == byId) {
-                    timing.setTimingId(Long.valueOf(idStr));
-                    break;
-                }
-            }
-            return this.baseMapper.insert(timing);
-        } else {
-            return this.baseMapper.update(timing, qwEqUseNoId);
-        }
-    }
-}

+ 0 - 40
willalp-control/src/main/java/com/willalp/control/service/impl/HsControlUsenoConfigServiceImpl.java

@@ -1,40 +0,0 @@
-package com.willalp.control.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.willalp.common.utils.SecurityUtils;
-import com.willalp.control.domain.HsControlUsenoConfig;
-import com.willalp.control.mapper.HsControlUsenoConfigMapper;
-import com.willalp.control.service.IHsControlUsenoConfigService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-
-/**
- * 空开设备号口配置Service业务层处理
- *
- * @author willalp
- * @date 2022-02-21
- */
-@Service
-public class HsControlUsenoConfigServiceImpl extends ServiceImpl<HsControlUsenoConfigMapper, HsControlUsenoConfig> implements IHsControlUsenoConfigService {
-    @Autowired
-    private HsControlUsenoConfigMapper hsControlUsenoConfigMapper;
-
-    /**
-     * 查询空开设备号口配置列表
-     *
-     * @param hsControlUsenoConfig 空开设备号口配置
-     * @return 空开设备号口配置
-     */
-    @Override
-    public List<HsControlUsenoConfig> selectHsControlUsenoConfigList(HsControlUsenoConfig hsControlUsenoConfig) {
-        return hsControlUsenoConfigMapper.selectHsControlUsenoConfigList(hsControlUsenoConfig);
-    }
-
-    @Override
-    public List<HsControlUsenoConfig> canAddUseNoListList() {
-        Long userId = SecurityUtils.getUserId();
-        return this.baseMapper.canAddUseNoListList(userId);
-    }
-}

+ 0 - 160
willalp-control/src/main/java/com/willalp/control/webSocket/WebSocketServer.java

@@ -1,160 +0,0 @@
-package com.willalp.control.webSocket;
-
-import com.willalp.common.websocket.ServerEncoder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.io.IOException;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * @Author xian
- **/
-//@ServerEndpoint(value = "/webSocket/{sid}", encoders = {ServerEncoder.class})
-//@Component
-public class WebSocketServer {
-    /**
-     * 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。
-     */
-    private static AtomicInteger onlineNum = new AtomicInteger();
-    /**
-     * concurrent包的线程安全Set,用来存放每个客户端对应的WebSocketServer对象。
-     */
-    private static ConcurrentHashMap<String, Session> sessionPools = new ConcurrentHashMap<>();
-    Logger log = LoggerFactory.getLogger(WebSocketServer.class);
-
-    public static void addOnlineCount() {
-        onlineNum.incrementAndGet();
-    }
-
-    public static void subOnlineCount() {
-        onlineNum.decrementAndGet();
-    }
-
-    /**
-     * 发送消息z
-     */
-    public void sendMessage(Session session, String message) throws IOException, EncodeException {
-        if (session != null) {
-            synchronized (session) {
-                log.info("发送数据:" + message);
-                session.getBasicRemote().sendObject(message);
-            }
-        }
-    }
-
-    /**
-     * 信息群发
-     *
-     * @param msg
-     */
-    public void sendAll(String msg) {
-        try {
-            for (String key : sessionPools.keySet()) {
-                sendMessage(sessionPools.get(key), msg);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 给指定用户发送信息
-     *
-     * @param userName
-     * @param message
-     */
-    public void sendInfo(String userName, String message) {
-        Session session = sessionPools.get(userName);
-        try {
-            sendMessage(session, message);
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 多个人发送给指定的几个用户
-     *
-     * @param msg
-     * @param persons
-     */
-    public void SendMany(String msg, String[] persons) {
-        try {
-            for (String userid : persons) {
-                sendMessage(sessionPools.get(userid), msg);
-            }
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 建立连接成功调用
-     *
-     * @param session
-     * @param userName
-     */
-    @OnOpen
-    public void onOpen(Session session, @PathParam(value = "sid") String userName) {
-        sessionPools.put(userName, session);
-        addOnlineCount();
-        log.info(userName + "加入webSocket!当前人数为" + onlineNum);
-        try {
-            sendMessage(session, "欢迎" + userName + "加入连接!");
-        } catch (Exception e) {
-            e.printStackTrace();
-        }
-    }
-
-    /**
-     * 关闭连接时调用
-     *
-     * @param userName
-     */
-
-    @OnClose
-    public void onClose(@PathParam(value = "sid") String userName) {
-        sessionPools.remove(userName);
-        subOnlineCount();
-        log.info(userName + "断开webSocket连接!当前人数为" + onlineNum);
-    }
-
-    /**
-     * 收到客户端信息
-     *
-     * @param message
-     * @throws IOException
-     */
-    @OnMessage
-    public void onMessage(String message) throws IOException {
-        message = "服务端已收到:" + message;
-        log.info(message);
-        for (Session session : sessionPools.values()) {
-            try {
-                sendMessage(session, message);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    /**
-     * 错误时调用
-     *
-     * @param session
-     * @param throwable
-     */
-    @OnError
-    public void onError(Session session, Throwable throwable) {
-        log.error("发生错误");
-        throwable.printStackTrace();
-    }
-
-
-}

+ 17 - 0
willalp-framework/src/main/java/com/willalp/framework/config/WebSocketConfigurator.java

@@ -0,0 +1,17 @@
+package com.willalp.framework.config;
+
+import com.willalp.framework.config.properties.CustomSpringConfigurator;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@ConditionalOnWebApplication
+@Configuration
+public class WebSocketConfigurator {
+
+    @Bean
+    public CustomSpringConfigurator customSpringConfigurator() {
+        // This is just to get context
+        return new CustomSpringConfigurator();
+    }
+}

+ 26 - 0
willalp-framework/src/main/java/com/willalp/framework/config/properties/CustomSpringConfigurator.java

@@ -0,0 +1,26 @@
+package com.willalp.framework.config.properties;
+
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.BeanFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+
+import javax.websocket.server.ServerEndpointConfig;
+
+public class CustomSpringConfigurator extends ServerEndpointConfig.Configurator implements ApplicationContextAware {
+
+    /**
+     * Spring application context.
+     */
+    private static volatile BeanFactory context;
+
+    @Override
+    public <T> T getEndpointInstance(Class<T> clazz) throws InstantiationException {
+        return context.getBean(clazz);
+    }
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        CustomSpringConfigurator.context = applicationContext;
+    }
+}

+ 27 - 14
willalp-framework/src/main/java/com/willalp/framework/websocket/WebSocketServer.java

@@ -1,11 +1,17 @@
 package com.willalp.framework.websocket;
 
+import com.willalp.common.core.domain.entity.SysUser;
+import com.willalp.common.utils.StringUtils;
 import com.willalp.common.websocket.ServerEncoder;
+import com.willalp.framework.config.properties.CustomSpringConfigurator;
+import com.willalp.system.service.ISysUserService;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import javax.websocket.*;
+import javax.websocket.server.PathParam;
 import javax.websocket.server.ServerEndpoint;
 import java.util.concurrent.Semaphore;
 
@@ -15,8 +21,12 @@ import java.util.concurrent.Semaphore;
  * @author ruoyi
  */
 @Component
-@ServerEndpoint(value = "/websocket/message", encoders = {ServerEncoder.class})
+@ServerEndpoint(value = "/websocket/message/{userCode}", encoders = {ServerEncoder.class},configurator = CustomSpringConfigurator.class)
 public class WebSocketServer {
+
+    @Autowired
+    private ISysUserService userService;
+
     /**
      * WebSocketServer 日志控制器
      */
@@ -27,26 +37,31 @@ public class WebSocketServer {
      */
     public static int socketMaxOnlineCount = 100;
 
-    private static final Semaphore socketSemaphore = new Semaphore(socketMaxOnlineCount);
+    private static final Semaphore SOCKET_SEMAPHORE = new Semaphore(socketMaxOnlineCount);
 
     /**
      * 连接建立成功调用的方法
      */
     @OnOpen
-    public void onOpen(Session session) throws Exception {
+    public void onOpen(Session session, @PathParam("userCode")String userCode) throws Exception {
         boolean semaphoreFlag = false;
         // 尝试获取信号量
-        semaphoreFlag = SemaphoreUtils.tryAcquire(socketSemaphore);
+        semaphoreFlag = SemaphoreUtils.tryAcquire(SOCKET_SEMAPHORE);
         if (!semaphoreFlag) {
             // 未获取到信号量
             LOGGER.error(" 当前在线人数超过限制数- {}", socketMaxOnlineCount);
             WebSocketUsers.sendMessageToUserByText(session, "当前在线人数超过限制数:" + socketMaxOnlineCount);
             session.close();
         } else {
-            // 添加用户
-            WebSocketUsers.put(session.getId(), session);
-            LOGGER.info(" 建立连接 - " + session.getId());
-            LOGGER.info(" 当前人数 - " + WebSocketUsers.getUsers().size());
+            if (StringUtils.isNotBlank(userCode)) {
+                SysUser sysUser = userService.selectUserByUserName(userCode);
+                if (sysUser != null) {
+                    // 添加用户
+                    WebSocketUsers.put(userCode, session);
+                    LOGGER.info("用户 [" + userCode + "] 建立连接");
+                    LOGGER.info(" 当前人数 - " + WebSocketUsers.getUserSize());
+                }
+            }
             WebSocketUsers.sendMessageToUserByText(session, "连接成功");
         }
     }
@@ -60,7 +75,7 @@ public class WebSocketServer {
         // 移除用户
         WebSocketUsers.remove(session.getId());
         // 获取到信号量则需释放
-        SemaphoreUtils.release(socketSemaphore);
+        SemaphoreUtils.release(SOCKET_SEMAPHORE);
     }
 
     /**
@@ -78,7 +93,7 @@ public class WebSocketServer {
         // 移出用户
         WebSocketUsers.remove(sessionId);
         // 获取到信号量则需释放
-        SemaphoreUtils.release(socketSemaphore);
+        SemaphoreUtils.release(SOCKET_SEMAPHORE);
     }
 
     /**
@@ -86,9 +101,7 @@ public class WebSocketServer {
      */
     @OnMessage
     public void onMessage(String message, Session session) {
-        String msg = message.replace("你", "我").replace("吗", "");
-        WebSocketUsers.sendMessageToUserByText(session, msg);
-        LOGGER.info(" 收到客户端消息 - " + msg);
-
+        WebSocketUsers.sendMessageToUserByText(session, message);
+        LOGGER.info(" 收到客户端消息 - " + message);
     }
 }

+ 14 - 4
willalp-framework/src/main/java/com/willalp/framework/websocket/WebSocketUsers.java

@@ -100,6 +100,16 @@ public class WebSocketUsers
         return USERS;
     }
 
+    /**
+     * 获取在线用户总数
+     *
+     * @return 返回用户集合
+     */
+    public static int getUserSize()
+    {
+        return USERS.size();
+    }
+
     /**
      * 群发消息文本消息
      *
@@ -133,9 +143,9 @@ public class WebSocketUsers
                 LOGGER.error("[发送消息异常]", e);
             }
         }
-        else
-        {
-            LOGGER.info("[你已离线]");
-        }
+//        else
+//        {
+//            LOGGER.info("[你已离线]");
+//        }
     }
 }

+ 20 - 0
willalp-framework/src/test/java/com/willalp/framework/WebSocketTest.java

@@ -0,0 +1,20 @@
+/**
+ * @projectName willalp-pns-ml
+ * @package com.willalp.framework
+ * @className com.willalp.framework.WebSocketTest
+ * @copyright Copyright 2019 HuiShan, Inc All rights reserved.
+ */
+package com.willalp.framework;
+
+/**
+ * WebSocketTest
+ * @description WebSeocket测试类
+ * @author hs
+ * @date 2023/3/3 17:01
+ * @version 1.0
+ */
+public class WebSocketTest {
+
+
+}
+ 

+ 0 - 138
willalp-quartz/src/main/java/com/willalp/quartz/task/RyTask.java

@@ -1,16 +1,8 @@
 package com.willalp.quartz.task;
 
-import cn.hutool.core.date.BetweenFormater;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.willalp.canteen.domain.HsCanteenOrder;
 import com.willalp.canteen.service.IHsCanteenOrderService;
-import com.willalp.common.utils.DateUtils;
 import com.willalp.common.utils.StringUtils;
-import com.willalp.control.domain.HsControlDeviceInfo;
-import com.willalp.control.domain.HsControlStat;
-import com.willalp.control.domain.HsControlTiming;
 import com.willalp.control.netty.model.ControlDataModel;
 import com.willalp.control.service.ControlService;
 import com.willalp.control.service.IHsControlDeviceInfoService;
@@ -26,8 +18,6 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.concurrent.TimeUnit;
 
@@ -80,140 +70,12 @@ public class RyTask {
         System.out.println("执行无参方法");
     }
 
-    /**
-     * control模块设备定时任务检索
-     */
-    public void controlTimingRunDeviceTask() {
-        //获取所有定时任务
-        List<HsControlTiming> list = controlTimingService.list();
-        // 存储本周今天的定时任务
-        List<HsControlTiming> nowWeekList = new ArrayList<>();
-        //获取今天周几
-        String week = controlDataModel.getWeek();
-        for (HsControlTiming t : list) {
-            if (t.getCycle().contains(week)) {
-                nowWeekList.add(t);
-            }
-        }
-        controlService.asyncTimingStartOrEnd(nowWeekList, 0);
-        controlService.asyncTimingStartOrEnd(nowWeekList, 1);
-    }
 
     @Scheduled(fixedRate = 1, timeUnit = TimeUnit.MINUTES)
     public void timingUpdateEventStatus() {
         eventService.timingUpdateEventStatus();
     }
 
-    /**
-     * 定时更新设备运行信息
-     *
-     * @param msNum 分钟(每多少分钟执行)
-     */
-    public void controlTimingUpdateDeviceInfo(Integer msNum) {
-        List<HsControlDeviceInfo> list = controlDeviceInfoService.list();
-        List<HsControlDeviceInfo> listCopy = new ArrayList<>();
-        long ms = 60000L * msNum;
-        for (HsControlDeviceInfo deviceInfo : list) {
-            Date lastOpenTime = deviceInfo.getLastOpenTime();
-            Date lastCloseTime = deviceInfo.getLastCloseTime();
-            if (lastOpenTime == null) {
-                continue;
-            }
-            if (lastCloseTime != null && lastOpenTime.getTime() < lastCloseTime.getTime()) {
-                deviceInfo.setRunningStatus(0);
-            } else {
-                deviceInfo.setRunningStatus(1);
-                //累加统计毫秒数
-                long statTime = 0;
-                long dateCha = System.currentTimeMillis() - deviceInfo.getLastOpenTime().getTime();
-                //如果实际运行不不足一小时计算本次差值赋值给统计时间
-                if (dateCha < ms) {
-                    statTime = dateCha + deviceInfo.getStatTime();
-                } else {
-                    statTime = ms + deviceInfo.getStatTime();
-                }
-                deviceInfo.setStatTime(statTime);
-                String dosage = DateUtil.formatBetween(statTime, BetweenFormater.Level.HOUR);
-                //long between = DateUtil.between(new Date(), deviceInfo.getLastOpenTime(), DateUnit.MS);
-                if (dosage.contains("天")) {
-                    dosage = "24";
-                } else if (dosage.contains("小时")) {
-                    dosage = dosage.substring(0, dosage.indexOf("小时"));
-                } else {
-                    dosage = "0";
-                }
-                //赋值到小记时长
-                deviceInfo.setDosage(dosage);
-                listCopy.add(deviceInfo);
-            }
-        }
-        controlDeviceInfoService.updateBatchById(listCopy);
-    }
-
-
-    /**
-     * control模块设备每日统计
-     */
-    public void controlTimingStatDayData() {
-        List<HsControlDeviceInfo> updateDeviceInfo = new ArrayList<>();
-        List<HsControlStat> updateStat = new ArrayList<>();
-        List<HsControlStat> saveStat = new ArrayList<>();
-        //今天
-        String now = DateUtils.parseDateToStr("yyyy-MM-dd", new Date());
-        //明天
-        Date tomorrow = new Date(DateUtil.tomorrow().getTime());
-
-        List<HsControlDeviceInfo> nowDeviceDosageInfos = controlDeviceInfoService.list();
-        for (HsControlDeviceInfo nowDeviceDosageInfo : nowDeviceDosageInfos) {
-            HsControlStat controlStat = statService.getOne(new QueryWrapper<HsControlStat>()
-                    .eq("use_no_id", nowDeviceDosageInfo.getDeviceUseNo())
-                    .like("create_time", now));
-            int isNull = 0;
-            if (ObjectUtil.isEmpty(controlStat)) {
-                controlStat = new HsControlStat();
-                controlStat.setUseNoId(nowDeviceDosageInfo.getDeviceUseNo());
-                controlStat.setDosage("0");
-                controlStat.setIsStat(1);
-                controlStat.setCreateTime(new Date());
-                isNull = 1;
-            }
-            //今天
-            Long statTime = nowDeviceDosageInfo.getStatTime();
-            if (0 == statTime) {
-                controlStat.setIsStat(2);
-            } else {
-                controlStat.setDosage(String.valueOf(statTime));
-                controlStat.setIsStat(0);
-            }
-            controlStat.setCreateTime(new Date());
-            if (isNull == 1) {
-                saveStat.add(controlStat);
-            } else {
-                updateStat.add(controlStat);
-            }
-
-            //明天日志入口
-            HsControlStat statTomorrow = new HsControlStat();
-            statTomorrow.setUseNoId(nowDeviceDosageInfo.getDeviceUseNo());
-            statTomorrow.setDosage("0");
-            statTomorrow.setIsStat(1);
-            statTomorrow.setCreateTime(tomorrow);
-            saveStat.add(statTomorrow);
-
-            //更新设备运行信息
-            nowDeviceDosageInfo.setDosage("0");
-            nowDeviceDosageInfo.setStatTime((long) 0);
-            if (1 == nowDeviceDosageInfo.getRunningStatus()) {
-                nowDeviceDosageInfo.setLastOpenTime(new Date());
-            }
-            updateDeviceInfo.add(nowDeviceDosageInfo);
-        }
-        //持久化操作
-        statService.updateBatchById(updateStat);
-        statService.saveBatch(saveStat);
-        controlDeviceInfoService.updateBatchById(updateDeviceInfo);
-    }
-
     public void reserveRemind() {
         //获取今日未下单用户
         List<HsCanteenOrder> hsCanteenOrders = canteenOrderService.todayNotOrderUser();

+ 9 - 0
willalp-system/src/main/java/com/willalp/system/domain/HsPostConfig.java

@@ -48,6 +48,7 @@ public class HsPostConfig extends BaseEntity {
      */
     @Excel(name = "岗位用户组", readConverterExp = "1=XX,2XX,3XX,4XX")
     private String postUserG;
+    private String orgCode;
 
     /**
      * 是否删除(0.未删除;1.已删除)
@@ -120,4 +121,12 @@ public class HsPostConfig extends BaseEntity {
                 .append("remark", getRemark())
                 .toString();
     }
+
+    public String getOrgCode() {
+        return orgCode;
+    }
+
+    public void setOrgCode(String orgCode) {
+        this.orgCode = orgCode;
+    }
 }

+ 1 - 1
willalp-system/src/main/java/com/willalp/system/mapper/SysUserMapper.java

@@ -172,7 +172,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
     List<SysUser> getUserBindingList(@Param("userIds") String[] userIds);
 
     /**
-     * 获取所用户列表
+     * 获取所用户列表
      *
      * @return
      */

+ 2 - 0
willalp-system/src/main/java/com/willalp/system/mapper/xml/HsPostConfigMapper.xml

@@ -10,6 +10,7 @@
         <result property="postName" column="post_name"/>
         <result property="postLevel" column="post_level"/>
         <result property="postUserG" column="post_user_g"/>
+        <result property="orgCode" column="org_code"/>
         <result property="isDelete" column="is_delete"/>
         <result property="createBy" column="create_by"/>
         <result property="createTime" column="create_time"/>
@@ -24,6 +25,7 @@
                post_name,
                post_level,
                post_user_g,
+               org_code,
                is_delete,
                create_by,
                create_time,

+ 4 - 1
willalp-system/src/main/java/com/willalp/system/service/IHsPostConfigService.java

@@ -26,6 +26,9 @@ public interface IHsPostConfigService extends IService<HsPostConfig>
      * 获取树岗位
      *
      * @return
+     * @param hsPostConfigs
      */
-    List<PostTreeVo> getTreePost();
+    List<PostTreeVo> getTreePost(List<HsPostConfig> hsPostConfigs);
+
+    List<PostTreeVo> setUsers(HsPostConfig postConfig);
 }

+ 33 - 25
willalp-system/src/main/java/com/willalp/system/service/impl/HsPostConfigServiceImpl.java

@@ -34,36 +34,15 @@ public class HsPostConfigServiceImpl extends ServiceImpl<HsPostConfigMapper, HsP
     }
 
     @Override
-    public List<PostTreeVo> getTreePost() {
-        List<HsPostConfig> hsPostConfigs = selectHsPostConfigList(null);
-        if (0 != hsPostConfigs.size()) {
+    public List<PostTreeVo> getTreePost(List<HsPostConfig> hsPostConfigs) {
+        if (hsPostConfigs != null && 0 != hsPostConfigs.size()) {
             List<PostTreeVo> list = new ArrayList<>();
-            String userBS = "AA";
             hsPostConfigs.forEach(item -> {
                 PostTreeVo postTreeVo = new PostTreeVo();
                 postTreeVo.setText(item.getPostName());
                 postTreeVo.setValue(item.getId());
                 String postUserG = item.getPostUserG();
-                List<PostTreeVo> postTreeCcVos = new ArrayList<>();
-                if (postUserG != null) {
-                    String[] split = postUserG.split(",");
-                    for (int i = 0; i < split.length; i++) {
-                        PostTreeVo postTreeCcVo = new PostTreeVo();
-                        String nick;
-                        String userId;
-                        int of = split[i].indexOf(userBS);
-                        if (of != -1) {
-                            nick = split[i].substring(0, of);
-                            userId = split[i].substring(of);
-                        } else {
-                            nick = "WILLALP";
-                            userId = "admin";
-                        }
-                        postTreeCcVo.setText(nick);
-                        postTreeCcVo.setValue(userId);
-                        postTreeCcVos.add(postTreeCcVo);
-                    }
-                }
+                List<PostTreeVo> postTreeCcVos = new ArrayList<>(setUsers(item));
                 if (postTreeCcVos.size() != 0) {
                     postTreeVo.setChildren(postTreeCcVos);
                 } else {
@@ -72,7 +51,36 @@ public class HsPostConfigServiceImpl extends ServiceImpl<HsPostConfigMapper, HsP
                 list.add(postTreeVo);
             });
             return list;
+        } else {
+            return getTreePost(selectHsPostConfigList(null));
+        }
+    }
+
+    @Override
+    public List<PostTreeVo> setUsers(HsPostConfig postConfig) {
+        List<PostTreeVo> postTreeVos = new ArrayList<>();
+        String userBS = "AA";
+        if (postConfig.getPostUserG() != null) {
+            String[] split = postConfig.getPostUserG().split(",");
+            for (int i = 0; i < split.length; i++) {
+                PostTreeVo postTreeCcVo = new PostTreeVo();
+                String nick = null;
+                String userId = null;
+                int of = split[i].indexOf(userBS);
+                if (of != -1) {
+                    nick = split[i].substring(0, of);
+                    userId = split[i].substring(of);
+                } else {
+                    if (split[i].contains("admin")) {
+                        nick = "WILLALP";
+                        userId = "admin";
+                    }
+                }
+                postTreeCcVo.setText(nick);
+                postTreeCcVo.setValue(userId);
+                postTreeVos.add(postTreeCcVo);
+            }
         }
-        return null;
+        return postTreeVos;
     }
 }

+ 1 - 1
willalp-ui/src/views/apply/apply/applyindex.vue

@@ -32,7 +32,7 @@
   import registindex from './components/registindex'
 
   export default {
-    name: 'apply',
+    name: 'taskId',
     components: { ruleindex, registindex },
     data() {
       return {

+ 5 - 5
willalp-ui/src/views/apply/apply/components/registindex.vue

@@ -22,7 +22,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['apply:apply:remove']"
+          v-hasPermi="['taskId:taskId:remove']"
         >删除</el-button>
         <el-button
           type="warning"
@@ -31,7 +31,7 @@
           size="mini"
           :loading="exportLoading"
           @click="handleExport"
-          v-hasPermi="['apply:apply:export']"
+          v-hasPermi="['taskId:taskId:export']"
         >导出</el-button>
       </el-form-item>
 
@@ -45,7 +45,7 @@
           size="mini"
           :disabled="multiple"
           @click="handleDelete"
-          v-hasPermi="['apply:apply:remove']"
+          v-hasPermi="['taskId:taskId:remove']"
         >删除</el-button>
       </el-col>
       <el-col :span="1.5">
@@ -56,7 +56,7 @@
           size="mini"
           :loading="exportLoading"
           @click="handleExport"
-          v-hasPermi="['apply:apply:export']"
+          v-hasPermi="['taskId:taskId:export']"
         >导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
@@ -77,7 +77,7 @@
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
-            v-hasPermi="['apply:apply:remove']"
+            v-hasPermi="['taskId:taskId:remove']"
           >删除</el-button>
         </template>
       </el-table-column>

+ 2 - 2
willalp-ui/src/views/apply/apply/components/ruleindex.vue

@@ -29,8 +29,8 @@
 
           <el-table-column   label="操作"  align="center"  width="160"  class-name="small-padding fixed-width">
             <template slot-scope="scope" >
-              <el-button id="apply"  size="mini"   type="text"     @click.native.stop="handleAdd(scope.row)"
-                          v-hasPermi="['apply:apply:add']" >申请</el-button>
+              <el-button id="taskId"  size="mini"   type="text"     @click.native.stop="handleAdd(scope.row)"
+                          v-hasPermi="['taskId:taskId:add']" >申请</el-button>
             </template>
           </el-table-column>
         </el-table>

+ 287 - 287
willalp-ui/src/views/control/relation/index.vue

@@ -179,7 +179,7 @@
               v-for="dict in dict.type.device_state"
               :key="dict.value"
               :label="parseInt(dict.value)"
-            >{{dict.label}}
+            >{{ dict.label }}
             </el-radio>
           </el-radio-group>
         </el-form-item>
@@ -268,299 +268,299 @@
 </template>
 
 <script>
-  import {
-    addDevice,
-    bindingUser,
-    delDevice,
-    exportDevice,
-    getDevice,
-    listAllDeviceUser,
-    listBindingDeviceUser,
-    listDevice,
-    untieUser,
-    updateDevice
-  } from "@/api/device/device";
-  import BaiduMapPoint from '../../../components/BaiduMap/baiduMapPoint'
-  import UseNoConfig from '../useNoConfig/index'
-  import user from "@/store/modules/user";
-  import {listPlace} from "@/api/canteen/place";
-  import Treeselect from "@riophae/vue-treeselect";
-  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+import {
+  addDevice,
+  bindingUser,
+  delDevice,
+  exportDevice,
+  getDevice,
+  listAllDeviceUser,
+  listBindingDeviceUser,
+  listDevice,
+  untieUser,
+  updateDevice
+} from "@/api/device/device";
+import BaiduMapPoint from '../../../components/BaiduMap/baiduMapPoint'
+import UseNoConfig from '../useNoConfig/index'
+import user from "@/store/modules/user";
+import {listPlace} from "@/api/canteen/place";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
-  export default {
-    name: "Device",
-    components: {
-      BaiduMapPoint,
-      Treeselect,
-      UseNoConfig
+export default {
+  name: "Device",
+  components: {
+    BaiduMapPoint,
+    Treeselect,
+    UseNoConfig
+  },
+  dicts: ['device_state'],
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      loading1: true,
+      loading2: true,
+      // 导出遮罩层
+      exportLoading: false,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      total1: 0,
+      total2: 0,
+      // device表格数据
+      deviceList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      open1: false,
+      open2: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        deviceNo: null,
+        deviceOrgId: null,
+        deviceUseId: null,
+        deviceName: null,
+        deviceInitCode: null,
+        deviceIpAddr: null,
+        deviceLocationAddr: null,
+        deviceState: null,
+        content: null,
+        sort: null,
+      },
+      queryParams1: {
+        pageNum: 1,
+        pageSize: 10,
+        userType: 11,
+      },
+      queryParams2: {
+        pageNum: 1,
+        pageSize: 10,
+        userType: 11,
+        deviceId: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        deviceNo: [
+          {required: true, message: "设备编号不能为空", trigger: "blur"}
+        ],
+        deviceName: [
+          {required: true, message: "设备名称不能为空", trigger: "blur"}
+        ],
+        deviceIpAddr: [
+          {required: true, message: "设备IP地址不能为空", trigger: "blur"}
+        ],
+        deviceState: [
+          {required: true, message: "设备状态不能为空", trigger: "blur"}
+        ],
+      },
+      useNoDeviceId: '',
+      bindingUserList: [],
+      allUserList: []
+    };
+  },
+  created() {
+    this.getTreeSelect();
+    this.getList();
+  },
+  methods: {
+    /** 查询device列表 */
+    getList() {
+      this.queryParams.deviceOrgId = user.state.organ;
+      this.loading = true;
+      listDevice(this.queryParams).then(response => {
+        this.deviceList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+      return this.deviceList;
+    },
+    /* 获取所有用户列表 */
+    getAllUserList() {
+      this.allUserList = []
+      this.loading1 = true;
+      listAllDeviceUser(this.queryParams1).then(response => {
+          this.allUserList = response.rows;
+          this.total1 = response.total;
+          this.loading1 = false;
+        }
+      ).catch(reason => {
+        this.loading1 = false;
+      });
+    },
+    /* 获取绑定用户列表 */
+    getBindingUserList() {
+      this.bindingUserList = []
+      this.loading2 = true;
+      listBindingDeviceUser(this.queryParams2).then(response => {
+          this.bindingUserList = response.rows;
+          this.total2 = response.total;
+          this.loading2 = false;
+        }
+      ).catch(reason => {
+        this.loading2 = false;
+      });
+    },
+    // 绑定按钮
+    binding(id) {
+      this.form.userId = id
+      this.form.deviceId = this.queryParams2.deviceId
+      bindingUser(this.form).then(re => {
+        this.getBindingUserList()
+      })
+    },
+    // 解绑按钮
+    untieUser(id) {
+      this.form.userId = id
+      this.form.deviceId = this.queryParams2.deviceId
+      untieUser(this.form).then(re => {
+        this.getBindingUserList()
+      })
     },
-    dicts: ['device_state'],
-    data() {
-      return {
-        // 遮罩层
-        loading: true,
-        loading1: true,
-        loading2: true,
-        // 导出遮罩层
-        exportLoading: false,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: true,
-        // 总条数
-        total: 0,
-        total1: 0,
-        total2: 0,
-        // device表格数据
-        deviceList: [],
-        // 弹出层标题
-        title: "",
-        // 是否显示弹出层
-        open: false,
-        open1: false,
-        open2: false,
-        // 查询参数
-        queryParams: {
-          pageNum: 1,
-          pageSize: 10,
-          deviceNo: null,
-          deviceOrgId: null,
-          deviceUseId: null,
-          deviceName: null,
-          deviceInitCode: null,
-          deviceIpAddr: null,
-          deviceLocationAddr: null,
-          deviceState: null,
-          content: null,
-          sort: null,
-        },
-        queryParams1: {
-          pageNum: 1,
-          pageSize: 10,
-          userType: 11,
-        },
-        queryParams2: {
-          pageNum: 1,
-          pageSize: 10,
-          userType: 11,
-          deviceId: null,
-        },
-        // 表单参数
-        form: {},
-        // 表单校验
-        rules: {
-          deviceNo: [
-            {required: true, message: "设备编号不能为空", trigger: "blur"}
-          ],
-          deviceName: [
-            {required: true, message: "设备名称不能为空", trigger: "blur"}
-          ],
-          deviceIpAddr: [
-            {required: true, message: "设备IP地址不能为空", trigger: "blur"}
-          ],
-          deviceState: [
-            {required: true, message: "设备状态不能为空", trigger: "blur"}
-          ],
-        },
-        useNoDeviceId: '',
-        bindingUserList: [],
-        allUserList: []
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        deviceId: null,
+        deviceNo: null,
+        deviceOrgId: null,
+        deviceUseId: null,
+        deviceName: null,
+        deviceInitCode: null,
+        deviceIpAddr: null,
+        deviceLocationAddr: null,
+        deviceState: 0,
+        expirationDate: null,
+        sort: null,
+        isDelete: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null
       };
+      this.resetForm("form");
     },
-    created() {
-      this.getTreeSelect();
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
       this.getList();
     },
-    methods: {
-      /** 查询device列表 */
-      getList() {
-        this.queryParams.deviceOrgId = user.state.organ;
-        this.loading = true;
-        listDevice(this.queryParams).then(response => {
-          this.deviceList = response.rows;
-          this.total = response.total;
-          this.loading = false;
-        });
-        return this.deviceList;
-      },
-      /* 获取所有用户列表 */
-      getAllUserList() {
-        this.allUserList = []
-        this.loading1 = true;
-        listAllDeviceUser(this.queryParams1).then(response => {
-            this.allUserList = response.rows;
-            this.total1 = response.total;
-            this.loading1 = false;
-          }
-        ).catch(reason => {
-          this.loading1 = false;
-        });
-      },
-      /* 获取绑定用户列表 */
-      getBindingUserList() {
-        this.bindingUserList = []
-        this.loading2 = true;
-        listBindingDeviceUser(this.queryParams2).then(response => {
-            this.bindingUserList = response.rows;
-            this.total2 = response.total;
-            this.loading2 = false;
-          }
-        ).catch(reason => {
-          this.loading2 = false;
-        });
-      },
-      // 绑定按钮
-      binding(id) {
-        this.form.userId = id
-        this.form.deviceId = this.queryParams2.deviceId
-        bindingUser(this.form).then(re => {
-          this.getBindingUserList()
-        })
-      },
-      // 解绑按钮
-      untieUser(id) {
-        this.form.userId = id
-        this.form.deviceId = this.queryParams2.deviceId
-        untieUser(this.form).then(re => {
-          this.getBindingUserList()
-        })
-      },
-      // 取消按钮
-      cancel() {
-        this.open = false;
-        this.reset();
-      },
-      // 表单重置
-      reset() {
-        this.form = {
-          deviceId: null,
-          deviceNo: null,
-          deviceOrgId: null,
-          deviceUseId: null,
-          deviceName: null,
-          deviceInitCode: null,
-          deviceIpAddr: null,
-          deviceLocationAddr: null,
-          deviceState: 0,
-          expirationDate: null,
-          sort: null,
-          isDelete: null,
-          createBy: null,
-          createTime: null,
-          updateBy: null,
-          updateTime: null,
-          remark: null
-        };
-        this.resetForm("form");
-      },
-      /** 搜索按钮操作 */
-      handleQuery() {
-        this.queryParams.pageNum = 1;
-        this.getList();
-      },
-      /** 重置按钮操作 */
-      resetQuery() {
-        this.resetForm("queryForm");
-        this.handleQuery();
-      },
-      // 多选框选中数据
-      handleSelectionChange(selection) {
-        this.ids = selection.map(item => item.deviceId)
-        this.single = selection.length !== 1
-        this.multiple = !selection.length
-      },
-      /** 新增按钮操作 */
-      handleAdd() {
-        this.reset();
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.deviceId)
+      this.single = selection.length !== 1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加设备";
+      this.form.deviceOrgId = user.state.organ;
+    },
+    /**
+     * 绑定用户
+     * */
+    openBindingUsers(row) {
+      this.queryParams2.deviceId = row.deviceId
+      this.getAllUserList();
+      this.getBindingUserList()
+      this.open1 = true;
+    },
+    /**
+     * 空开列表
+     * */
+    getDeviceUseNoList(row) {
+      this.useNoDeviceId = row.deviceId
+      this.$nextTick(_ => {
+        this.$refs.unc.getList()
+      })
+      this.open2 = true;
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const deviceId = row.deviceId || this.ids
+      getDevice(deviceId).then(response => {
+        this.form = response.data;
         this.open = true;
-        this.title = "添加设备";
-        this.form.deviceOrgId = user.state.organ;
-      },
-      /**
-       * 绑定用户
-       * */
-      openBindingUsers(row) {
-        this.queryParams2.deviceId = row.deviceId
-        this.getAllUserList();
-        this.getBindingUserList()
-        this.open1 = true;
-      },
-      /**
-       * 空开列表
-       * */
-      getDeviceUseNoList(row) {
-        this.useNoDeviceId = row.deviceId
-        this.$nextTick(_ => {
-          this.$refs.unc.getList()
-        })
-        this.open2 = true;
-      },
-      /** 修改按钮操作 */
-      handleUpdate(row) {
-        this.reset();
-        const deviceId = row.deviceId || this.ids
-        getDevice(deviceId).then(response => {
-          this.form = response.data;
-          this.open = true;
-          this.title = "修改设备";
-        });
-      },
-      /** 提交按钮 */
-      submitForm() {
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.deviceId != null) {
-              updateDevice(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.open = false;
-                this.getList();
-              });
-            } else {
-              addDevice(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.open = false;
-                this.getList();
-              });
-            }
+        this.title = "修改设备";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.deviceId != null) {
+            updateDevice(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addDevice(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
           }
-        });
-      },
-      /** 删除按钮操作 */
-      handleDelete(row) {
-        const deviceIds = row.deviceId || this.ids;
-        this.$modal.confirm('是否确认删除device编号为"' + deviceIds + '"的数据项?').then(function () {
-          return delDevice(deviceIds);
-        }).then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        }).catch(() => {
-        });
-      },
-      /** 导出按钮操作 */
-      handleExport() {
-        const queryParams = this.queryParams;
-        this.$modal.confirm('是否确认导出所有device数据项?').then(() => {
-          this.exportLoading = true;
-          return exportDevice(queryParams);
-        }).then(response => {
-          this.$download.name(response.msg);
-          this.exportLoading = false;
-        }).catch(() => {
-        });
-      },
-      getTreeSelect() {
-        listPlace({jgid: user.state.organ}).then(response => {
-          this.placeOptions = [];
-          const data = {placeId: 0, placeName: '顶级节点', children: []};
-          data.children = this.handleTree(response.data, "placeId", "parentId");
-          console.log(data);
-          this.placeOptions.push(data);
-        });
-      }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const deviceIds = row.deviceId || this.ids;
+      this.$modal.confirm('是否确认删除device编号为"' + deviceIds + '"的数据项?').then(function () {
+        return delDevice(deviceIds);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {
+      });
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$modal.confirm('是否确认导出所有device数据项?').then(() => {
+        this.exportLoading = true;
+        return exportDevice(queryParams);
+      }).then(response => {
+        this.$download.name(response.msg);
+        this.exportLoading = false;
+      }).catch(() => {
+      });
+    },
+    getTreeSelect() {
+      listPlace({jgid: user.state.organ}).then(response => {
+        this.placeOptions = [];
+        const data = {placeId: 0, placeName: '顶级节点', children: []};
+        data.children = this.handleTree(response.data, "placeId", "parentId");
+        console.log(data);
+        this.placeOptions.push(data);
+      });
     }
-  };
+  }
+};
 </script>

+ 4 - 4
willalp-ui/src/views/device/device/index.vue

@@ -197,10 +197,10 @@
 </template>
 
 <script>
-  import {addDevice, delDevice, exportDevice, getDevice, listDevice, updateDevice} from "@/api/device/device";
-  import BaiduMapPoint from '../../../components/BaiduMap/baiduMapPoint'
-  import user from "@/store/modules/user";
-  import {listPlace} from "@/api/canteen/place";
+  import {addDevice, delDevice, exportDevice, getDevice, listDevice, updateDevice} from "../../../../../../../../WQX_HS/BasicFramework/willalp_PNS/willalp-ui/src/api/device/device";
+  import BaiduMapPoint from '../../../../../../../../WQX_HS/BasicFramework/willalp_PNS/willalp-ui/src/components/BaiduMap/baiduMapPoint'
+  import user from "../../../../../../../../WQX_HS/BasicFramework/willalp_PNS/willalp-ui/src/store/modules/user";
+  import {listPlace} from "../../../../../../../../WQX_HS/BasicFramework/willalp_PNS/willalp-ui/src/api/canteen/place";
   import Treeselect from "@riophae/vue-treeselect";
   import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 

+ 2 - 2
willalp-ui/src/views/device/networkconfig/index.vue

@@ -165,8 +165,8 @@
     getNetworkconfig,
     listNetworkconfig,
     updateNetworkconfig
-  } from "@/api/device/networkconfig";
-  import {listDevice} from '@/api/device/device'
+  } from "../../../../../../../../WQX_HS/BasicFramework/willalp_PNS/willalp-ui/src/api/device/networkconfig";
+  import {listDevice} from '../../../../../../../../WQX_HS/BasicFramework/willalp_PNS/willalp-ui/src/api/device/device'
 
   export default {
     name: "Networkconfig",

+ 1 - 1
willalp-ui/src/views/files/approval/index.vue

@@ -235,7 +235,7 @@ export default {
       console.log(file)
     },
     handleChange(value) {
-      let node = this.$refs.apply.getCheckedNodes()[0]
+      let node = this.$refs.taskId.getCheckedNodes()[0]
       this.form.params = {
         apUserName: node.label,
         candidate: node.value

+ 7 - 7
willalp-ui/src/views/flow/cc/index.vue

@@ -10,9 +10,9 @@
           @keyup.enter.native="handleQuery"
         />
       </el-form-item>
-      <el-form-item label="发起人" prop="apply">
+      <el-form-item label="发起人" prop="taskId">
         <el-input
-          v-model="queryParams.apply"
+          v-model="queryParams.taskId"
           placeholder="请输入发起人"
           clearable
           size="small"
@@ -86,7 +86,7 @@
       <el-table-column label="主键ID" align="center" prop="id" />
       <el-table-column label="标题" align="center" prop="title" />
       <el-table-column label="业务数据" align="center" prop="jsonData" />
-      <el-table-column label="发起人" align="center" prop="apply" />
+      <el-table-column label="发起人" align="center" prop="taskId" />
       <el-table-column label="抄送用户" align="center" prop="users" />
       <el-table-column label="模型ID" align="center" prop="examplesId" />
       <el-table-column label="备注" align="center" prop="remark" />
@@ -124,8 +124,8 @@
         <el-form-item label="标题" prop="title">
           <el-input v-model="form.title" placeholder="请输入标题" />
         </el-form-item>
-        <el-form-item label="发起人" prop="apply">
-          <el-input v-model="form.apply" placeholder="请输入发起人" />
+        <el-form-item label="发起人" prop="taskId">
+          <el-input v-model="form.taskId" placeholder="请输入发起人" />
         </el-form-item>
         <el-form-item label="抄送用户" prop="users">
           <el-input v-model="form.users" type="textarea" placeholder="请输入内容" />
@@ -178,7 +178,7 @@ export default {
         pageSize: 10,
         title: null,
         jsonData: null,
-        apply: null,
+        taskId: null,
         users: null,
         examplesId: null,
       },
@@ -213,7 +213,7 @@ export default {
         id: null,
         title: null,
         jsonData: null,
-        apply: null,
+        taskId: null,
         users: null,
         isDelete: null,
         examplesId: null,

+ 7 - 7
willalp-ui/src/views/flow/flowBase/index.vue

@@ -1,9 +1,9 @@
 <template>
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch">
-      <el-form-item label="模型ID" prop="modelId">
+      <el-form-item label="模型ID" prop="modelType">
         <el-input
-          v-model="queryParams.modelId"
+          v-model="queryParams.modelType"
           placeholder="请输入模型ID"
           clearable
           size="small"
@@ -175,7 +175,7 @@
     <el-table v-loading="loading" :data="flowBaseList" @selection-change="handleSelectionChange">
       <el-table-column type="selection" width="55" align="center" />
       <el-table-column label="主键" align="center" prop="id" />
-      <el-table-column label="模型ID" align="center" prop="modelId" />
+      <el-table-column label="模型ID" align="center" prop="modelType" />
       <el-table-column label="实例ID" align="center" prop="examplesId" />
       <el-table-column label="组ID" align="center" prop="groupId" />
       <el-table-column label="流程模型名称" align="center" prop="flowModuleName" width="205"/>
@@ -223,8 +223,8 @@
     <!-- 添加或修改流程基础模型对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="600px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" >
-        <el-form-item label="模型ID" prop="modelId">
-          <el-input v-model="form.modelId" placeholder="请输入模型ID" />
+        <el-form-item label="模型ID" prop="modelType">
+          <el-input v-model="form.modelType" placeholder="请输入模型ID" />
         </el-form-item>
         <el-form-item label="实例ID" prop="examplesId">
           <el-input v-model="form.examplesId" placeholder="请输入实例ID" />
@@ -310,7 +310,7 @@ export default {
       queryParams: {
         pageNum: 1,
         pageSize: 10,
-        modelId: null,
+        modelType: null,
         examplesId: null,
         groupId: null,
         flowModuleName: null,
@@ -353,7 +353,7 @@ export default {
     reset() {
       this.form = {
         id: null,
-        modelId: null,
+        modelType: null,
         examplesId: null,
         groupId: null,
         flowModuleName: null,

+ 4 - 4
willalp-ui/src/views/leave/leave/index.vue

@@ -81,21 +81,21 @@
       <el-table-column label="当前任务名称" align="center" prop="taskName" width="150"/>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <apply-before
+          <taskId-before
             v-show="!scope.row.instanceId"
             :row="scope.row"
             :handleUpdate="handleUpdate"
             :handleDelete="handleDelete"
             :requestMapping="requestMapping"
             @getList="getList"
-          ></apply-before>
-          <apply-after
+          ></taskId-before>
+          <taskId-after
             v-show="scope.row.instanceId"
             :row="scope.row"
             :taskId="scope.row.taskId"
             :type="scope.row.type"
             @getList="getList"
-          ></apply-after>
+          ></taskId-after>
         </template>
       </el-table-column>
     </el-table>

Някои файлове не бяха показани, защото твърде много файлове са промени