Explorar el Código

云端与库端数据同步;

zlq hace 1 año
padre
commit
420c28c9e5
Se han modificado 28 ficheros con 602 adiciones y 201 borrados
  1. 15 9
      src/main/java/com/unissoft/basic/controller/BasicEnumController.java
  2. 7 7
      src/main/java/com/unissoft/basic/model/BasicEnum.java
  3. 2 2
      src/main/java/com/unissoft/basic/service/impl/BasicEnumServiceImpl.java
  4. 21 0
      src/main/java/com/unissoft/common/MessageEnum.java
  5. 33 0
      src/main/java/com/unissoft/common/ServiceEnum.java
  6. 109 0
      src/main/java/com/unissoft/config/IdGenerator16Bit.java
  7. 82 0
      src/main/java/com/unissoft/mqConsumer/Consumer.java
  8. 188 0
      src/main/java/com/unissoft/mqConsumer/Manager/ServiceManager.java
  9. 0 53
      src/main/java/com/unissoft/mqConsumer/TeDataConsumer.java
  10. 0 44
      src/main/java/com/unissoft/mqConsumer/UserInfoConsumer.java
  11. 22 9
      src/main/java/com/unissoft/mqProducer/Producer.java
  12. 6 17
      src/main/java/com/unissoft/parameter/controller/HardwareParameterController.java
  13. 1 1
      src/main/java/com/unissoft/parameter/service/impl/HardwareParameterServiceImpl.java
  14. 12 8
      src/main/java/com/unissoft/systemManage/controller/NBasicEdgeController.java
  15. 12 9
      src/main/java/com/unissoft/systemManage/controller/OrgInfoController.java
  16. 14 5
      src/main/java/com/unissoft/systemManage/controller/RoleInfoController.java
  17. 8 6
      src/main/java/com/unissoft/systemManage/controller/UserInfoController.java
  18. 1 1
      src/main/java/com/unissoft/systemManage/mapper/OrgInfoMapper.java
  19. 3 3
      src/main/java/com/unissoft/systemManage/model/OrgInfo.java
  20. 1 1
      src/main/java/com/unissoft/systemManage/model/PointData.java
  21. 2 2
      src/main/java/com/unissoft/systemManage/model/RoleInfo.java
  22. 1 1
      src/main/java/com/unissoft/systemManage/model/StorehouseClxx.java
  23. 2 2
      src/main/java/com/unissoft/systemManage/model/UserInfo.java
  24. 14 4
      src/main/java/com/unissoft/systemManage/service/impl/NBasicEdgeServiceImpl.java
  25. 11 11
      src/main/java/com/unissoft/systemManage/service/impl/OrgInfoServiceImpl.java
  26. 1 1
      src/main/java/com/unissoft/systemManage/service/impl/RoleInfoServiceImpl.java
  27. 29 0
      src/main/java/com/unissoft/utils/idUtils.java
  28. 5 5
      src/main/resources/bootstrap.yml

+ 15 - 9
src/main/java/com/unissoft/basic/controller/BasicEnumController.java

@@ -4,6 +4,8 @@ package com.unissoft.basic.controller;
4 4
 import java.util.Date;
5 5
 import java.util.List;
6 6
 
7
+import com.unissoft.common.*;
8
+import com.unissoft.mqProducer.Producer;
7 9
 import org.springframework.beans.factory.annotation.Autowired;
8 10
 import org.springframework.http.MediaType;
9 11
 import org.springframework.web.bind.annotation.GetMapping;
@@ -16,9 +18,6 @@ import org.springframework.web.bind.annotation.RestController;
16 18
 import com.baomidou.mybatisplus.core.metadata.IPage;
17 19
 import com.unissoft.basic.model.BasicEnum;
18 20
 import com.unissoft.basic.service.BasicEnumService;
19
-import com.unissoft.common.PageParam;
20
-import com.unissoft.common.ResultView;
21
-import com.unissoft.common.SystemLog;
22 21
 import com.unissoft.parameter.model.HardwareParameter;
23 22
 
24 23
 import io.swagger.annotations.ApiOperation;
@@ -34,6 +33,8 @@ import io.swagger.annotations.ApiOperation;
34 33
 @RestController
35 34
 @RequestMapping("/basic-enum")
36 35
 public class BasicEnumController {
36
+    @Autowired
37
+    private Producer producer;
37 38
 
38 39
 	private BasicEnumService enumService;
39 40
 
@@ -56,7 +57,7 @@ public class BasicEnumController {
56 57
 
57 58
     /**
58 59
      * 新增
59
-     * @param hdParameter
60
+     * @param basicEnum
60 61
      * @return
61 62
      */
62 63
     @SystemLog(operModul = "参数设置", operType = "数据字典", operDesc = "数据字典新增")
@@ -66,16 +67,18 @@ public class BasicEnumController {
66 67
     	basicEnum.setCreateTime(date);
67 68
     	basicEnum.setUpdateTime(date);
68 69
         boolean save = enumService.save(basicEnum);
69
-        if (save)
70
+        if (save) {
71
+            producer.send(basicEnum, MessageEnum.SAVE, ServiceEnum.BASIC_ENUM);
70 72
             return ResultView.success();
71
-        else
73
+        }else {
72 74
             return ResultView.error();
75
+        }
73 76
     }
74 77
     
75 78
     
76 79
     /**
77 80
      * 修改
78
-     * @param hdParameter
81
+     * @param basicEnum
79 82
      * @return
80 83
      */
81 84
     @SystemLog(operModul = "参数设置", operType = "数据字典", operDesc = "数据字典修改")
@@ -83,10 +86,13 @@ public class BasicEnumController {
83 86
     public ResultView update(@RequestBody BasicEnum basicEnum) {
84 87
     	basicEnum.setUpdateTime(new Date());
85 88
         boolean b = enumService.updateById(basicEnum);
86
-        if (b)
89
+        if (b) {
90
+            //发送消息
91
+            producer.send(basicEnum, MessageEnum.UPDATE,ServiceEnum.BASIC_ENUM);
87 92
             return ResultView.success();
88
-        else
93
+        }else {
89 94
             return ResultView.error();
95
+        }
90 96
     }
91 97
     
92 98
     

+ 7 - 7
src/main/java/com/unissoft/basic/model/BasicEnum.java

@@ -30,8 +30,8 @@ public class BasicEnum implements Serializable {
30 30
     private static final long serialVersionUID = 1L;
31 31
 
32 32
     @ApiModelProperty(value = "字典表")
33
-    @TableId(value = "id", type = IdType.AUTO)
34
-    private Integer id;
33
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
34
+    private Long id;
35 35
 
36 36
     @ApiModelProperty(value = "编码")
37 37
     @TableField("enum_code")
@@ -43,7 +43,7 @@ public class BasicEnum implements Serializable {
43 43
 
44 44
     @ApiModelProperty(value = "父节点id")
45 45
     @TableField("parent_id")
46
-    private Integer parentId;
46
+    private Long parentId;
47 47
 
48 48
     @ApiModelProperty(value = "创建时间")
49 49
     @TableField("create_time")
@@ -73,11 +73,11 @@ public class BasicEnum implements Serializable {
73 73
 	}
74 74
 	
75 75
 
76
-	public Integer getId() {
76
+	public Long getId() {
77 77
 		return id;
78 78
 	}
79 79
 
80
-	public void setId(Integer id) {
80
+	public void setId(Long id) {
81 81
 		this.id = id;
82 82
 	}
83 83
 
@@ -97,11 +97,11 @@ public class BasicEnum implements Serializable {
97 97
 		this.enumName = enumName;
98 98
 	}
99 99
 
100
-	public Integer getParentId() {
100
+	public Long getParentId() {
101 101
 		return parentId;
102 102
 	}
103 103
 
104
-	public void setParentId(Integer parentId) {
104
+	public void setParentId(Long parentId) {
105 105
 		this.parentId = parentId;
106 106
 	}
107 107
 

+ 2 - 2
src/main/java/com/unissoft/basic/service/impl/BasicEnumServiceImpl.java

@@ -70,12 +70,12 @@ public class BasicEnumServiceImpl extends ServiceImpl<BasicEnumMapper, BasicEnum
70 70
         }*/
71 71
 		ew.orderByAsc("parent_id");
72 72
 		List<BasicEnum> list = enumMapper.selectList(ew); //查询到满足条件所有的数据
73
-		List<BasicEnum> firstlist = this.getChildren(list, 0,condition);
73
+		List<BasicEnum> firstlist = this.getChildren(list, 0L,condition);
74 74
 		this.fillTree(list, firstlist);
75 75
 		return firstlist;
76 76
 	}
77 77
 	
78
-	private List<BasicEnum> getChildren(List<BasicEnum> list, Integer parentId,String condition) {
78
+	private List<BasicEnum> getChildren(List<BasicEnum> list, Long parentId,String condition) {
79 79
         String  enumName = null;
80 80
         String  enumCode = null;
81 81
 		if (!StringUtils.isEmpty(condition)) {

+ 21 - 0
src/main/java/com/unissoft/common/MessageEnum.java

@@ -0,0 +1,21 @@
1
+package com.unissoft.common;
2
+
3
+import org.apache.ibatis.annotations.Param;
4
+
5
+import java.util.Map;
6
+
7
+/**
8
+ * ClassName: MessageTypeEnum
9
+ * Package: com.unissoft.common
10
+ * Description: MQ传递消息类型
11
+ *
12
+ * @Author zlq
13
+ * @Create 2023/3/6 10:37
14
+ * @Version 1.0
15
+ */
16
+public enum MessageEnum {
17
+    SAVE,UPDATE,DELETE;
18
+
19
+    private Map Param;
20
+
21
+}

+ 33 - 0
src/main/java/com/unissoft/common/ServiceEnum.java

@@ -0,0 +1,33 @@
1
+package com.unissoft.common;
2
+
3
+import com.unissoft.parameter.model.HardwareParameter;
4
+
5
+/**
6
+ * ClassName: ServiceEnum
7
+ * Package: com.unissoft.common
8
+ * Description:
9
+ *
10
+ * @Author zlq
11
+ * @Create 2023/3/6 14:38
12
+ * @Version 1.0
13
+ */
14
+public enum ServiceEnum {
15
+    HD_PARAMETER(1),
16
+    BASIC_ENUM(2),
17
+    NBASIC_EDGE(3),
18
+    ROLE_INFO(4),
19
+    ORG_INFO(5),
20
+    STOREHOUSE_CLXX(6),
21
+    USER_INFO(7);
22
+
23
+
24
+
25
+    private int code;
26
+
27
+    ServiceEnum(int code) {
28
+        this.code = code;
29
+    }
30
+    public int getCode(){
31
+        return code;
32
+    }
33
+}

+ 109 - 0
src/main/java/com/unissoft/config/IdGenerator16Bit.java

@@ -0,0 +1,109 @@
1
+package com.unissoft.config;
2
+
3
+import java.util.Date;
4
+import java.util.UUID;
5
+
6
+/**
7
+ * ClassName: IdGenerator16Bit
8
+ * Package: com.unissoft.config
9
+ * Description:
10
+ *
11
+ * @Author zlq
12
+ * @Create 2023/3/3 17:56
13
+ * @Version 1.0
14
+ */
15
+public class IdGenerator16Bit {
16
+    private static IdGenerator16Bit instance = new IdGenerator16Bit(0);
17
+
18
+    public static IdGenerator16Bit initDefaultInstance(int machineId) {
19
+        instance = new IdGenerator16Bit(machineId);
20
+        return instance;
21
+    }
22
+
23
+    public static IdGenerator16Bit getInstance() {
24
+        return instance;
25
+    }
26
+
27
+    public static long generateId() {
28
+        return instance.nextId();
29
+    }
30
+
31
+    // total bits=53(max 2^53-1:9007199254740992-1)
32
+
33
+    // private final static long TIME_BIT = 40; // max: 2318-06-04
34
+    private final static long MACHINE_BIT = 5; // max 31
35
+    private final static long SEQUENCE_BIT = 8; // 256/10ms
36
+
37
+    /**
38
+     * mask/max value
39
+     */
40
+    private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT);
41
+    private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT);
42
+
43
+    private final static long MACHINE_LEFT = SEQUENCE_BIT;
44
+    private final static long TIMESTMP_LEFT = MACHINE_BIT + SEQUENCE_BIT;
45
+
46
+    private long machineId;
47
+    private long sequence = 0L;
48
+    private long lastStmp = -1L;
49
+
50
+    private IdGenerator16Bit(long machineId) {
51
+        if (machineId > MAX_MACHINE_NUM || machineId < 0) {
52
+            throw new IllegalArgumentException(
53
+                    "machineId can't be greater than " + MAX_MACHINE_NUM + " or less than 0");
54
+        }
55
+        this.machineId = machineId;
56
+    }
57
+
58
+    /**
59
+     * generate new ID
60
+     *
61
+     * @return
62
+     */
63
+    public synchronized long nextId() {
64
+        long currStmp = getTimestamp();
65
+        if (currStmp < lastStmp) {
66
+            throw new RuntimeException("Clock moved backwards.  Refusing to generate id");
67
+        }
68
+
69
+        if (currStmp == lastStmp) {
70
+            sequence = (sequence + 1) & MAX_SEQUENCE;
71
+            if (sequence == 0L) {
72
+                currStmp = getNextTimestamp();
73
+            }
74
+        } else {
75
+            sequence = 0L;
76
+        }
77
+
78
+        lastStmp = currStmp;
79
+
80
+        return currStmp << TIMESTMP_LEFT //
81
+                | machineId << MACHINE_LEFT //
82
+                | sequence;
83
+    }
84
+
85
+    private long getNextTimestamp() {
86
+        long mill = getTimestamp();
87
+        while (mill <= lastStmp) {
88
+            mill = getTimestamp();
89
+        }
90
+        return mill;
91
+    }
92
+
93
+    private long getTimestamp() {
94
+        // per 10ms
95
+        return System.currentTimeMillis() / 10;// 10ms
96
+    }
97
+
98
+    public static Date parseIdTimestamp(long id) {
99
+        return new Date((id >>> TIMESTMP_LEFT) * 10);
100
+    }
101
+
102
+    public static String uuid() {
103
+        return UUID.randomUUID().toString().replaceAll("-", "");
104
+    }
105
+}
106
+
107
+
108
+
109
+

+ 82 - 0
src/main/java/com/unissoft/mqConsumer/Consumer.java

@@ -0,0 +1,82 @@
1
+package com.unissoft.mqConsumer;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.alibaba.fastjson.JSONObject;
5
+import com.unissoft.mqConsumer.Manager.ServiceManager;
6
+import com.unissoft.parameter.model.HardwareParameter;
7
+import com.unissoft.parameter.service.HardwareParameterService;
8
+import lombok.extern.slf4j.Slf4j;
9
+import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
10
+import org.apache.rocketmq.spring.core.RocketMQListener;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.stereotype.Component;
13
+import org.springframework.util.StringUtils;
14
+
15
+/**
16
+ * ClassName: HardwareParameterConsumer
17
+ * Package: com.unissoft.mqConsumer
18
+ * Description: 硬件参数 消息消费者
19
+ *
20
+ * @Author zlq
21
+ * @Create 2023/3/3 10:42
22
+ * @Version 1.0
23
+ */
24
+@Slf4j
25
+@Component
26
+public class Consumer {
27
+    @Autowired
28
+    private ServiceManager serviceManager;
29
+
30
+
31
+    private final String topic = "TOPIC_LOCAL";
32
+    //库端TOPIK,云端使用
33
+    private final String topicLocal="TOPIC_LOCAL";
34
+    //云端topic,库端使用
35
+    private final String topicCloud="TOPIC_CLOUD";
36
+
37
+    private final String consumerGroup = "consumerGroup";
38
+
39
+    @Component
40
+    @RocketMQMessageListener(topic = topicLocal,consumerGroup = "local")
41
+    public class HPSave implements RocketMQListener<String>{
42
+        @Override
43
+        public void onMessage(String message) {
44
+            if (message == null) {
45
+                log.info("消息为空:{}",message);
46
+                return;
47
+            }
48
+            log.info("接收到的消息:{}",message);
49
+            JSONObject message1 = JSON.parseObject(message);
50
+            JSONObject headers = message1.getJSONObject("headers");
51
+
52
+            String type = headers.getString("type");
53
+            String payload = message1.getString("payload");
54
+            //获取消息所在业务
55
+            String service = headers.getString("service");
56
+
57
+            switch (service){
58
+                case "HD_PARAMETER":
59
+                    serviceManager.HDManager(payload,type);
60
+                    break;
61
+                case "BASIC_ENUM":
62
+                    serviceManager.BasicEnumManager(payload,type);
63
+                    break;
64
+                case "NBASIC_EDGE":
65
+                    serviceManager.NBasicEdgeManager(payload,type);
66
+                    break;
67
+                case "ROLE_INFO":
68
+                    serviceManager.RoleInfoManager(payload,type);
69
+                    break;
70
+                case "USER_INFO":
71
+                    serviceManager.UserInfoManager(payload,type);
72
+                    break;
73
+                case "ORG_INFO":
74
+                    serviceManager.OrgInfoManager(payload,type);
75
+                    break;
76
+                default:
77
+                    log.info("没有可用的业务类型!!");
78
+            }
79
+        }
80
+    }
81
+
82
+}

+ 188 - 0
src/main/java/com/unissoft/mqConsumer/Manager/ServiceManager.java

@@ -0,0 +1,188 @@
1
+package com.unissoft.mqConsumer.Manager;
2
+
3
+import com.alibaba.fastjson.JSON;
4
+import com.unissoft.basic.model.BasicEnum;
5
+import com.unissoft.basic.service.BasicEnumService;
6
+import com.unissoft.parameter.model.HardwareParameter;
7
+import com.unissoft.parameter.service.HardwareParameterService;
8
+import com.unissoft.systemManage.model.*;
9
+import com.unissoft.systemManage.service.*;
10
+import lombok.extern.slf4j.Slf4j;
11
+import org.springframework.beans.factory.annotation.Autowired;
12
+import org.springframework.stereotype.Component;
13
+
14
+import javax.annotation.Resource;
15
+
16
+/**
17
+ * ClassName: HDManager
18
+ * Package: com.unissoft.mqConsumer.Manager
19
+ * Description: 接收处理业务数据
20
+ *
21
+ * @Author zlq
22
+ * @Create 2023/3/6 15:08
23
+ * @Version 1.0
24
+ */
25
+@Slf4j
26
+@Component
27
+public class ServiceManager {
28
+    @Resource
29
+    private RoleInfoService roleInfoService;
30
+    @Resource
31
+    private NBasicEdgeService nBasicEdgeService;
32
+    @Autowired
33
+    private BasicEnumService basicEnumService;
34
+
35
+    @Autowired
36
+    private HardwareParameterService hardwareParameterService;
37
+
38
+    /**
39
+     * 硬件参数
40
+     * @param payload
41
+     * @param type
42
+     */
43
+    public void HDManager(String payload,String type){
44
+        //对不同的业务操作进行处理:SAVE,UPDATE,DELETE;
45
+        switch (type){
46
+            case "SAVE":
47
+                //获取硬件参数对象
48
+                HardwareParameter hardwareParameter = JSON.parseObject(payload, HardwareParameter.class);
49
+                //新增硬件数据
50
+                    boolean save = hardwareParameterService.save(hardwareParameter);
51
+                log.info("新增硬件信息{},是否成功:{}",payload,save);
52
+                break;
53
+            case "UPDATE":
54
+                //获取硬件参数对象
55
+
56
+                HardwareParameter hardwareParameter1 = JSON.parseObject(payload, HardwareParameter.class);
57
+                    boolean b1 = hardwareParameterService.updateById(hardwareParameter1);
58
+                log.info("修改硬件信息{},是否成功:{}",payload,b1);
59
+                break;
60
+            case "DELETE":
61
+                    boolean b2 = hardwareParameterService.removeById(payload);
62
+                log.info("删除硬件id{},是否成功:{}",payload,b2);
63
+                break;
64
+        }
65
+    }
66
+
67
+    /**
68
+     * 字典
69
+     * @param payload
70
+     * @param type
71
+     */
72
+    public void BasicEnumManager(String payload,String type){
73
+        //对不同的业务操作进行处理:SAVE,UPDATE,DELETE;
74
+        switch (type){
75
+            case "SAVE":
76
+                BasicEnum basicEnum = JSON.parseObject(payload, BasicEnum.class);
77
+                boolean save = basicEnumService.save(basicEnum);
78
+                log.info("新增字典{},是否成功:{}",payload,save);
79
+                break;
80
+            case "UPDATE":
81
+                BasicEnum basicEnum1 = JSON.parseObject(payload, BasicEnum.class);
82
+                boolean b = basicEnumService.updateById(basicEnum1);
83
+                log.info("修改字典信息{},是否成功:{}",payload,b);
84
+                break;
85
+        }
86
+    }
87
+
88
+    /**
89
+     *打点的数据查询表
90
+     * @param payload
91
+     * @param type
92
+     */
93
+    public void NBasicEdgeManager(String payload,String type){
94
+        //对不同的业务操作进行处理:SAVE,UPDATE,DELETE;
95
+        switch (type){
96
+            case "SAVE":
97
+                NBasicEdge nBasicEdge = JSON.parseObject(payload, NBasicEdge.class);
98
+                boolean save = nBasicEdgeService.save(nBasicEdge);
99
+                log.info("新增打点的数据信息{},是否成功:{}",payload,save);
100
+                break;
101
+            case "UPDATE":
102
+                NBasicEdge nBasicEdge1 = JSON.parseObject(payload, NBasicEdge.class);
103
+                boolean b = nBasicEdgeService.updateById(nBasicEdge1);
104
+                log.info("修改打点的数据信息{},是否成功:{}",payload,b);
105
+                break;
106
+        }
107
+    }
108
+
109
+
110
+    /**
111
+     *用户角色消息
112
+     * @param payload
113
+     * @param type
114
+     */
115
+    public void RoleInfoManager(String payload,String type){
116
+        //对不同的业务操作进行处理:SAVE,UPDATE,DELETE;
117
+        switch (type){
118
+            case "SAVE":
119
+                RoleInfo roleInfo = JSON.parseObject(payload, RoleInfo.class);
120
+                boolean save = roleInfoService.save(roleInfo);
121
+                log.info("新增角色消息{},是否成功:{}",payload,save);
122
+                break;
123
+            case "UPDATE":
124
+                RoleInfo roleInfo1 = JSON.parseObject(payload, RoleInfo.class);
125
+                boolean b = roleInfoService.updateById(roleInfo1);
126
+                log.info("修改角色消息{},是否成功:{}",payload,b);
127
+                break;
128
+            case "DELETE":
129
+                boolean b2 = roleInfoService.removeById(payload);
130
+                log.info("删除角色id{},是否成功:{}",payload,b2);
131
+                break;
132
+        }
133
+    }
134
+
135
+    @Resource
136
+    private UserInfoService userInfoService;
137
+
138
+    /**
139
+     *用户消息
140
+     * @param payload
141
+     * @param type
142
+     */
143
+    public void UserInfoManager(String payload,String type){
144
+        //对不同的业务操作进行处理:SAVE,UPDATE,DELETE;
145
+        switch (type){
146
+            case "SAVE":
147
+                UserInfo userInfo = JSON.parseObject(payload, UserInfo.class);
148
+                boolean save = userInfoService.save(userInfo);
149
+                log.info("新增用户{},是否成功:{}",payload,save);
150
+                break;
151
+            case "UPDATE":
152
+                UserInfo userInfo1 = JSON.parseObject(payload, UserInfo.class);
153
+                boolean b = userInfoService.updateById(userInfo1);
154
+                log.info("修改用户{},是否成功:{}",payload,b);
155
+                break;
156
+            case "DELETE":
157
+                boolean b2 = userInfoService.removeById(payload);
158
+                log.info("删除用户{},是否成功:{}",payload,b2);
159
+                break;
160
+        }
161
+    }
162
+    @Resource
163
+    private OrgInfoService orgInfoService;
164
+    /**
165
+     *组织机构消息
166
+     * @param payload
167
+     * @param type
168
+     */
169
+    public void OrgInfoManager(String payload,String type){
170
+        //对不同的业务操作进行处理:SAVE,UPDATE,DELETE;
171
+        switch (type){
172
+            case "SAVE":
173
+                OrgInfo orgInfo = JSON.parseObject(payload, OrgInfo.class);
174
+                boolean save = orgInfoService.save(orgInfo);
175
+                log.info("新增组织机构{},是否成功:{}",payload,save);
176
+                break;
177
+            case "UPDATE":
178
+                OrgInfo orgInfo1 = JSON.parseObject(payload, OrgInfo.class);
179
+                boolean b = orgInfoService.updateById(orgInfo1);
180
+                log.info("修改组织机构信息{},是否成功:{}",payload,b);
181
+                break;
182
+            case "DELETE":
183
+                boolean b2 = orgInfoService.removeById(payload);
184
+                log.info("删除组织机构id{},是否成功:{}",payload,b2);
185
+                break;
186
+        }
187
+    }
188
+}

+ 0 - 53
src/main/java/com/unissoft/mqConsumer/TeDataConsumer.java

@@ -1,53 +0,0 @@
1
-package com.unissoft.mqConsumer;
2
-
3
-import com.alibaba.fastjson.JSON;
4
-import com.unissoft.interaction.entity.TeData;
5
-import lombok.extern.slf4j.Slf4j;
6
-import org.apache.rocketmq.common.TopicConfig;
7
-import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
8
-import org.apache.rocketmq.spring.core.RocketMQListener;
9
-import org.springframework.stereotype.Component;
10
-import org.springframework.stereotype.Service;
11
-
12
-/**
13
- * ClassName: ConService
14
- * Package: com.unissoft.mqConsumer
15
- * Description:新增,修改,删除
16
- *
17
- * @Author zlq
18
- * @Create 2023/3/2 10:36
19
- * @Version 1.0
20
- */
21
-@Slf4j
22
-@Component
23
-public class TeDataConsumer{
24
-
25
-    @Component
26
-    @RocketMQMessageListener(topic = "TOPIC_LOCAL",consumerGroup = "${rocketmq.consumer.group}",selectorExpression = "TD_SAVE")
27
-    public class TDSave implements RocketMQListener<TeData>{
28
-        /**
29
-         * 新增tedata
30
-         * @param teData 接收到的数据
31
-         */
32
-        @Override
33
-        public void onMessage(TeData teData) {
34
-            System.out.println("接收到的消息"+teData.toString());
35
-        }
36
-    }
37
-
38
-//
39
-//    // topic需要和生产者的topic一致,consumerGroup属性是必须指定的,内容可以随意
40
-//    // selectorExpression的意思指的就是tag,默认为“*”,不设置的话会监听所有消息
41
-//    @Service
42
-//    @RocketMQMessageListener(topic = "TOPIC_1", selectorExpression = "tag1", consumerGroup = "Con_Group_One")
43
-//    public class ConsumerSend implements RocketMQListener<TeData> {
44
-//
45
-//        // 监听到消息就会执行此方法
46
-//        @Override
47
-//        public void onMessage(TeData teData) {
48
-//            System.out.println("接收到的消息"+teData.toString());
49
-//            log.info("监听到消息:user={}", JSON.toJSONString(teData));
50
-//        }
51
-//    }
52
-
53
-}

+ 0 - 44
src/main/java/com/unissoft/mqConsumer/UserInfoConsumer.java

@@ -1,44 +0,0 @@
1
-package com.unissoft.mqConsumer;
2
-
3
-import com.alibaba.fastjson.JSON;
4
-import com.unissoft.interaction.entity.TeData;
5
-import com.unissoft.systemManage.model.UserInfo;
6
-import lombok.extern.slf4j.Slf4j;
7
-import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
8
-import org.apache.rocketmq.spring.core.RocketMQListener;
9
-import org.springframework.stereotype.Component;
10
-
11
-/**
12
- * ClassName: ConService
13
- * Package: com.unissoft.mqConsumer
14
- * Description:
15
- *
16
- * @Author zlq
17
- * @Create 2023/3/2 10:36
18
- * @Version 1.0
19
- */
20
-@Slf4j
21
-@Component
22
-@RocketMQMessageListener(topic = "TOPIC_LOCAL",consumerGroup = "${rocketmq.consumer.group}",selectorExpression = "userInfo")
23
-public class UserInfoConsumer implements RocketMQListener<UserInfo> {
24
-
25
-    @Override
26
-    public void onMessage(UserInfo s) {
27
-        log.info("监听到消息:user={}", JSON.toJSONString(s));
28
-    }
29
-//
30
-//    // topic需要和生产者的topic一致,consumerGroup属性是必须指定的,内容可以随意
31
-//    // selectorExpression的意思指的就是tag,默认为“*”,不设置的话会监听所有消息
32
-//    @Service
33
-//    @RocketMQMessageListener(topic = "TOPIC_1", selectorExpression = "tag1", consumerGroup = "Con_Group_One")
34
-//    public class ConsumerSend implements RocketMQListener<TeData> {
35
-//
36
-//        // 监听到消息就会执行此方法
37
-//        @Override
38
-//        public void onMessage(TeData teData) {
39
-//            System.out.println("接收到的消息"+teData.toString());
40
-//            log.info("监听到消息:user={}", JSON.toJSONString(teData));
41
-//        }
42
-//    }
43
-
44
-}

+ 22 - 9
src/main/java/com/unissoft/mqProducer/Producer.java

@@ -1,14 +1,20 @@
1 1
 package com.unissoft.mqProducer;
2 2
 
3 3
 
4
-import com.unissoft.interaction.entity.TeData;
4
+import com.unissoft.common.MessageEnum;
5
+import com.unissoft.common.ServiceEnum;
5 6
 import lombok.extern.slf4j.Slf4j;
6 7
 import org.apache.rocketmq.client.producer.SendResult;
7 8
 import org.apache.rocketmq.spring.core.RocketMQTemplate;
8 9
 import org.springframework.beans.factory.annotation.Autowired;
10
+import org.springframework.beans.factory.annotation.Value;
11
+import org.springframework.messaging.MessageHeaders;
9 12
 import org.springframework.messaging.support.MessageBuilder;
10 13
 import org.springframework.stereotype.Component;
11 14
 
15
+import java.util.HashMap;
16
+import java.util.Map;
17
+
12 18
 /**
13 19
  * ClassName: ProService
14 20
  * Package: com.unissoft.mqProducer
@@ -21,29 +27,36 @@ import org.springframework.stereotype.Component;
21 27
 @Slf4j
22 28
 @Component("producer")
23 29
 public class Producer {
24
-    //topic名称
25
-    private final String topic="TOPIC_LOCAL:";
30
+    //库端TOPIK,库端使用
31
+    private final String topicLocal="TOPIC_LOCAL";
32
+    //云端topic,云端使用
33
+    private final String topicCloud="TOPIC_CLOUD";
26 34
 
27 35
     @Autowired
28 36
     private RocketMQTemplate rocketMQTemplate;
29 37
 
30 38
     /**
31 39
      *
32
-     * @param msgBody 消息内容
33
-     * @param tag  消息类型
40
+     * @param body 消息内容
41
+     * @param type  消息属性
34 42
      */
35
-    public void send(Object msgBody, String tag){
36
-        rocketMQTemplate.convertAndSend(topic+tag,msgBody);
43
+    public void send(Object body, MessageEnum type, ServiceEnum ser){
44
+        Map<String, Object> map = new HashMap<>();
45
+        map.put("type",type);
46
+        map.put("service",ser);
47
+        org.springframework.messaging.Message<Object> message = MessageBuilder.createMessage(body, new MessageHeaders(map));
48
+        rocketMQTemplate.convertAndSend(topicCloud,message);
49
+        log.info("发送消息:{}",message);
37 50
     }
38 51
 
39 52
     /**
40 53
      *
41
-     * @param msgBody  需要发送的消息
54
+     * @param msgBody  同步发送的消息
42 55
      * @param tag  消息类型
43 56
      * @return
44 57
      */
45 58
     public SendResult sendMsg(String msgBody,String tag) {
46
-        SendResult sendResult = rocketMQTemplate.syncSend(topic+tag, MessageBuilder.withPayload(msgBody).build());
59
+        SendResult sendResult = rocketMQTemplate.syncSend(topicLocal+tag, MessageBuilder.withPayload(msgBody).build());
47 60
         return sendResult;
48 61
     }
49 62
 

+ 6 - 17
src/main/java/com/unissoft/parameter/controller/HardwareParameterController.java

@@ -2,18 +2,14 @@ package com.unissoft.parameter.controller;
2 2
 
3 3
 
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
-import com.unissoft.common.PageParam;
6
-import com.unissoft.common.ResultView;
7
-import com.unissoft.common.SystemLog;
5
+import com.unissoft.common.*;
8 6
 import com.unissoft.mqProducer.Producer;
9 7
 import com.unissoft.parameter.model.HardwareParameter;
10 8
 import com.unissoft.parameter.service.HardwareParameterService;
11 9
 
12 10
 import io.swagger.annotations.ApiOperation;
13 11
 
14
-import java.math.BigDecimal;
15 12
 import java.util.Date;
16
-import java.util.Random;
17 13
 
18 14
 import org.springframework.beans.factory.annotation.Autowired;
19 15
 import org.springframework.web.bind.annotation.*;
@@ -66,7 +62,7 @@ public class HardwareParameterController {
66 62
     	hdParameter.setCreateTime(new Date());
67 63
         boolean save = hdService.save(hdParameter);
68 64
         if (save) {
69
-            producer.send(hdParameter, "HP_SAVE");
65
+            producer.send(hdParameter, MessageEnum.SAVE, ServiceEnum.HD_PARAMETER);
70 66
             return ResultView.success();
71 67
         }else
72 68
             return ResultView.error();
@@ -82,7 +78,7 @@ public class HardwareParameterController {
82 78
     public ResultView updateUser(@RequestBody HardwareParameter hdParameter) {
83 79
         boolean b = hdService.updateById(hdParameter);
84 80
         if (b) {
85
-            producer.send(hdParameter, "HP_UPDATE");
81
+            producer.send(hdParameter, MessageEnum.UPDATE,ServiceEnum.HD_PARAMETER);
86 82
             return ResultView.success();
87 83
         }else
88 84
             return ResultView.error();
@@ -99,18 +95,11 @@ public class HardwareParameterController {
99 95
     @DeleteMapping("/deleteById/{id}")
100 96
     public ResultView deleteById(@PathVariable String id) {
101 97
     	boolean b = hdService.removeById(id);
102
-        int i = hdService.deleteHarParamer(id);
103
-        if(i>0){
104
-            producer.send(id, "HP_DELETE");
98
+        if (b) {
99
+            producer.send(id, MessageEnum.DELETE,ServiceEnum.HD_PARAMETER);
105 100
             return ResultView.success();
106
-        }else {
101
+        }else
107 102
             return ResultView.error();
108
-        }
109
-//        if (b) {
110
-//            producer.send(id, "HP_DELETE");
111
-//            return ResultView.success();
112
-//        }else
113
-//            return ResultView.error();
114 103
     }
115 104
     
116 105
 }

+ 1 - 1
src/main/java/com/unissoft/parameter/service/impl/HardwareParameterServiceImpl.java

@@ -48,7 +48,7 @@ public class HardwareParameterServiceImpl extends ServiceImpl<HardwareParameterM
48 48
     		String deviceName = jsStr.getString("deviceName");//设备名称
49 49
     		Integer houseId = jsStr.getInteger("houseId");
50 50
     		if(!StringUtils.isEmpty(houseId.toString())){
51
-    			ew.ge("house_id", houseId);
51
+    			ew.eq("house_id", houseId);
52 52
     		}
53 53
     		if (!StringUtils.isEmpty(deviceName)) {
54 54
                 ew.like("device_name", deviceName);

+ 12 - 8
src/main/java/com/unissoft/systemManage/controller/NBasicEdgeController.java

@@ -2,10 +2,8 @@ package com.unissoft.systemManage.controller;
2 2
 
3 3
 
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5
-import com.unissoft.common.DateUtils;
6
-import com.unissoft.common.PageParam;
7
-import com.unissoft.common.ResultView;
8
-import com.unissoft.common.SystemLog;
5
+import com.unissoft.common.*;
6
+import com.unissoft.mqProducer.Producer;
9 7
 import com.unissoft.systemManage.model.LogOperation;
10 8
 import com.unissoft.systemManage.model.NBasicEdge;
11 9
 import com.unissoft.systemManage.model.RoleInfo;
@@ -42,6 +40,8 @@ import javax.servlet.http.HttpServletResponse;
42 40
 @RestController
43 41
 @RequestMapping("/n-basic-edge")
44 42
 public class NBasicEdgeController {
43
+    @Autowired
44
+    private Producer producer;
45 45
 
46 46
     private NBasicEdgeService nBasicEdgeService;
47 47
 
@@ -79,20 +79,24 @@ public class NBasicEdgeController {
79 79
     @PostMapping("/basic/saveNBasicEdge")
80 80
     public ResultView saveRoleInfo(@RequestBody NBasicEdge nBasicEdge) {
81 81
         boolean save = nBasicEdgeService.save(nBasicEdge);
82
-        if (save)
82
+        if (save) {
83
+            producer.send(nBasicEdge, MessageEnum.SAVE, ServiceEnum.NBASIC_EDGE);
83 84
             return ResultView.success();
84
-        else
85
+        }else {
85 86
             return ResultView.error();
87
+        }
86 88
     }
87 89
 
88 90
     @ApiOperation(value = "修改扫描规则", notes = "")
89 91
     @PostMapping("/basic/updateNBasicEdge")
90 92
     public ResultView updateRoleInfo(@RequestBody NBasicEdge nBasicEdge) {
91 93
         boolean b = nBasicEdgeService.updateById(nBasicEdge);
92
-        if (b)
94
+        if (b) {
95
+            producer.send(nBasicEdge, MessageEnum.UPDATE, ServiceEnum.NBASIC_EDGE);
93 96
             return ResultView.success();
94
-        else
97
+        }else {
95 98
             return ResultView.error();
99
+        }
96 100
     }
97 101
     
98 102
     

+ 12 - 9
src/main/java/com/unissoft/systemManage/controller/OrgInfoController.java

@@ -3,10 +3,8 @@ package com.unissoft.systemManage.controller;
3 3
 
4 4
 import com.alibaba.fastjson.JSON;
5 5
 import com.unissoft.basic.model.BasicEnum;
6
-import com.unissoft.common.DateUtils;
7
-import com.unissoft.common.MyConstant;
8
-import com.unissoft.common.ResultView;
9
-import com.unissoft.common.SystemLog;
6
+import com.unissoft.common.*;
7
+import com.unissoft.mqProducer.Producer;
10 8
 import com.unissoft.systemManage.model.OrgInfo;
11 9
 import com.unissoft.systemManage.model.OrgInfoChildren;
12 10
 import com.unissoft.systemManage.service.OrgInfoService;
@@ -29,6 +27,8 @@ import java.util.stream.Collectors;
29 27
 @RestController
30 28
 @RequestMapping("/orgInfo")
31 29
 public class OrgInfoController {
30
+    @Autowired
31
+    private Producer producer;
32 32
 
33 33
     private OrgInfoService orgInfoService;
34 34
 
@@ -54,9 +54,10 @@ public class OrgInfoController {
54 54
     public ResultView save(@RequestBody OrgInfo orgInfo) {
55 55
         orgInfo.setBuildTime(DateUtils.getDate());
56 56
         boolean save = orgInfoService.save(orgInfo);
57
-        if (save)
57
+        if (save) {
58
+            producer.send(orgInfo, MessageEnum.SAVE, ServiceEnum.ORG_INFO);
58 59
             return ResultView.success();
59
-        else
60
+        }else
60 61
             return ResultView.error();
61 62
     }
62 63
 
@@ -65,9 +66,10 @@ public class OrgInfoController {
65 66
     public ResultView update(@RequestBody OrgInfo orgInfo) {
66 67
         orgInfo.setBuildTime(DateUtils.getDate());
67 68
         boolean b = orgInfoService.updateById(orgInfo);
68
-        if (b)
69
+        if (b) {
70
+            producer.send(orgInfo, MessageEnum.UPDATE, ServiceEnum.ORG_INFO);
69 71
             return ResultView.success();
70
-        else
72
+        }else
71 73
             return ResultView.error();
72 74
     }
73 75
 
@@ -87,6 +89,7 @@ public class OrgInfoController {
87 89
     @GetMapping("/authority/getByIdDelete/{id}")
88 90
     public ResultView getByIdDelete(@PathVariable String id) {
89 91
         if (orgInfoService.removeById(id)) {
92
+            producer.send(id, MessageEnum.DELETE, ServiceEnum.ORG_INFO);
90 93
             return ResultView.success();
91 94
         }
92 95
         return ResultView.error(MyConstant.ID_NULL);
@@ -100,7 +103,7 @@ public class OrgInfoController {
100 103
     @GetMapping("/authority/getListMap")
101 104
     public ResultView getListMap(@PathParam("orgId") String orgId) {
102 105
         List<OrgInfo> list = orgInfoService.getOrgMap(orgId);
103
-        Map<Integer, String> collect = list.stream().collect(Collectors.toMap(OrgInfo::getId, OrgInfo::getOrgName));
106
+        Map<Long, String> collect = list.stream().collect(Collectors.toMap(OrgInfo::getId, OrgInfo::getOrgName));
104 107
         return ResultView.success(collect);
105 108
     }
106 109
 

+ 14 - 5
src/main/java/com/unissoft/systemManage/controller/RoleInfoController.java

@@ -3,12 +3,15 @@ package com.unissoft.systemManage.controller;
3 3
 
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.unissoft.common.*;
6
+import com.unissoft.mqProducer.Producer;
6 7
 import com.unissoft.systemManage.model.RoleInfo;
7 8
 import com.unissoft.systemManage.model.UserInfo;
8 9
 import com.unissoft.systemManage.service.RoleInfoService;
9 10
 import org.springframework.beans.factory.annotation.Autowired;
10 11
 import org.springframework.web.bind.annotation.*;
11 12
 
13
+import javax.annotation.Resource;
14
+
12 15
 /**
13 16
  * <p>
14 17
  * 用户角色表 前端控制器
@@ -20,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
20 23
 @RestController
21 24
 @RequestMapping("/roleInfo")
22 25
 public class RoleInfoController {
26
+    @Resource
27
+    private Producer producer;
23 28
 
24 29
     private RoleInfoService roleInfoService;
25 30
 
@@ -45,9 +50,10 @@ public class RoleInfoController {
45 50
     public ResultView saveRoleInfo(@RequestBody RoleInfo roleInfo) {
46 51
         roleInfo.setBulidTime(DateUtils.getDate());
47 52
         boolean save = roleInfoService.save(roleInfo);
48
-        if (save)
53
+        if (save) {
54
+            producer.send(roleInfo, MessageEnum.SAVE, ServiceEnum.ROLE_INFO);
49 55
             return ResultView.success();
50
-        else
56
+        }else
51 57
             return ResultView.error();
52 58
     }
53 59
 
@@ -56,16 +62,19 @@ public class RoleInfoController {
56 62
     public ResultView updateRoleInfo(@RequestBody RoleInfo roleInfo) {
57 63
         roleInfo.setBulidTime(DateUtils.getDate());
58 64
         boolean b = roleInfoService.updateById(roleInfo);
59
-        if (b)
65
+        if (b) {
66
+            producer.send(roleInfo, MessageEnum.UPDATE, ServiceEnum.ROLE_INFO);
60 67
             return ResultView.success();
61
-        else
68
+        }else
62 69
             return ResultView.error();
63 70
     }
64 71
 
65 72
     @SystemLog(operModul = "系统管理", operType = "角色管理", operDesc = "删除角色信息")
66 73
     @GetMapping("/authority/getByIdDeleteRoleInfo/{id}")
67 74
     public ResultView getByIdDeleteRoleInfo(@PathVariable String id) {
68
-        if (roleInfoService.removeById(id)) {
75
+        boolean  b= roleInfoService.removeById(id);
76
+        if (b) {
77
+            producer.send(id, MessageEnum.DELETE, ServiceEnum.ROLE_INFO);
69 78
             return ResultView.success();
70 79
         }
71 80
         return ResultView.error(MyConstant.ID_NULL);

+ 8 - 6
src/main/java/com/unissoft/systemManage/controller/UserInfoController.java

@@ -73,13 +73,13 @@ public class UserInfoController {
73 73
     public ResultView saveUser(@RequestBody UserInfo userInfo) {
74 74
         userInfo.setBuildTime(DateUtils.getDate());
75 75
         userInfo.setUserPassword(MD5Util.getMD5(userInfo.getUserPassword()));
76
-        String s = UUID.randomUUID().toString().trim().replaceAll("_", "");
76
+        String s = UuidUtils.getCode();
77 77
         userInfo.setUserId(s);
78
-        producer.send(userInfo,"userInfo");
79 78
         boolean save = userInfoService.save(userInfo);
80
-        if (save)
79
+        if (save) {
80
+            producer.send(userInfo, MessageEnum.SAVE, ServiceEnum.USER_INFO);
81 81
             return ResultView.success();
82
-        else
82
+        }else
83 83
             return ResultView.error();
84 84
     }
85 85
 
@@ -89,9 +89,10 @@ public class UserInfoController {
89 89
         userInfo.setBuildTime(DateUtils.getDate());
90 90
         userInfo.setUserPassword(MD5Util.getMD5(userInfo.getUserPassword()));
91 91
         boolean b = userInfoService.updateById(userInfo);
92
-        if (b)
92
+        if (b) {
93
+            producer.send(userInfo, MessageEnum.UPDATE, ServiceEnum.USER_INFO);
93 94
             return ResultView.success();
94
-        else
95
+        }else
95 96
             return ResultView.error();
96 97
     }
97 98
 
@@ -99,6 +100,7 @@ public class UserInfoController {
99 100
     @GetMapping("/authority/deleteById/{id}")
100 101
     public ResultView getByIdForUserDelete(@PathVariable String id) {
101 102
         if (userInfoService.removeById(id)) {
103
+            producer.send(id, MessageEnum.DELETE, ServiceEnum.USER_INFO);
102 104
             return ResultView.success();
103 105
         }
104 106
         return ResultView.error(MyConstant.ID_NULL);

+ 1 - 1
src/main/java/com/unissoft/systemManage/mapper/OrgInfoMapper.java

@@ -21,7 +21,7 @@ import java.util.Map;
21 21
 @Repository
22 22
 public interface OrgInfoMapper extends BaseMapper<OrgInfo> {
23 23
 
24
-    Page<List<Map<String, Object>>> getStorehouse(IPage<List<Map<String, Object>>> page, @Param("id") Integer param);
24
+    Page<List<Map<String, Object>>> getStorehouse(IPage<List<Map<String, Object>>> page, @Param("id") Long param);
25 25
 
26 26
     List<OrgInfo> getOrgMap(@Param("orgId") String orgId);
27 27
 

+ 3 - 3
src/main/java/com/unissoft/systemManage/model/OrgInfo.java

@@ -32,8 +32,8 @@ public class OrgInfo implements Serializable {
32 32
     private static final long serialVersionUID = 1L;
33 33
 
34 34
     @ApiModelProperty(value = "主键id")
35
-    @TableId(value = "id", type = IdType.AUTO)
36
-    private Integer id;
35
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
36
+    private Long id;
37 37
 
38 38
     @ApiModelProperty(value = "组织机构名称(仓房名称)")
39 39
     @TableField("org_name")
@@ -53,7 +53,7 @@ public class OrgInfo implements Serializable {
53 53
 
54 54
     @ApiModelProperty(value = "父级ID(默认值为0,0表示顶级机构)")
55 55
     @TableField("parent_id")
56
-    private Integer parentId;
56
+    private Long parentId;
57 57
 
58 58
     @ApiModelProperty(value = "创建时间")
59 59
     @TableField("build_time")

+ 1 - 1
src/main/java/com/unissoft/systemManage/model/PointData.java

@@ -33,7 +33,7 @@ public class PointData implements Serializable {
33 33
 
34 34
     @ApiModelProperty(value = "仓房id")
35 35
     @TableField("house_id")
36
-    private Integer houseId;
36
+    private Long houseId;
37 37
 
38 38
     @ApiModelProperty(value = "高")
39 39
     @JsonProperty("LKHeight")

+ 2 - 2
src/main/java/com/unissoft/systemManage/model/RoleInfo.java

@@ -28,12 +28,12 @@ public class RoleInfo implements Serializable {
28 28
     private static final long serialVersionUID = 1L;
29 29
 
30 30
     @ApiModelProperty(value = "主键")
31
-    @TableId(value = "id", type = IdType.AUTO)
31
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
32 32
     private Integer id;
33 33
 
34 34
     @ApiModelProperty(value = "组织机构编码")
35 35
     @TableField("org_id")
36
-    private Integer orgId;
36
+    private Long orgId;
37 37
 
38 38
     @ApiModelProperty(value = "角色编码")
39 39
     @TableField("role_code")

+ 1 - 1
src/main/java/com/unissoft/systemManage/model/StorehouseClxx.java

@@ -36,7 +36,7 @@ public class StorehouseClxx implements Serializable {
36 36
 
37 37
     @ApiModelProperty(value = "关联org_info的主键ID")
38 38
     @TableField("main_id")
39
-    private Integer mainId;
39
+    private Long mainId;
40 40
 
41 41
     @ApiModelProperty(value = "组织机构ID")
42 42
     @TableField("org_id")

+ 2 - 2
src/main/java/com/unissoft/systemManage/model/UserInfo.java

@@ -28,8 +28,8 @@ public class UserInfo implements Serializable {
28 28
     private static final long serialVersionUID = 1L;
29 29
 
30 30
     @ApiModelProperty(value = "id主键")
31
-    @TableId(value = "id", type = IdType.AUTO)
32
-    private Integer id;
31
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
32
+    private Long id;
33 33
 
34 34
     @ApiModelProperty(value = "用户ID")
35 35
     @TableField("user_id")

+ 14 - 4
src/main/java/com/unissoft/systemManage/service/impl/NBasicEdgeServiceImpl.java

@@ -7,7 +7,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
7 7
 import com.baomidou.mybatisplus.core.metadata.IPage;
8 8
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
9 9
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
10
+import com.unissoft.common.MessageEnum;
10 11
 import com.unissoft.common.PageParam;
12
+import com.unissoft.common.ServiceEnum;
13
+import com.unissoft.mqProducer.Producer;
11 14
 import com.unissoft.systemManage.mapper.NBasicEdgeMapper;
12 15
 import com.unissoft.systemManage.mapper.PointDataMapper;
13 16
 import com.unissoft.systemManage.model.LogOperation;
@@ -15,6 +18,7 @@ import com.unissoft.systemManage.model.NBasicEdge;
15 18
 import com.unissoft.systemManage.model.PointData;
16 19
 import com.unissoft.systemManage.model.SyncV2xyz;
17 20
 import com.unissoft.systemManage.service.NBasicEdgeService;
21
+import org.springframework.beans.factory.annotation.Autowired;
18 22
 import org.springframework.stereotype.Service;
19 23
 import org.springframework.util.StringUtils;
20 24
 
@@ -39,6 +43,8 @@ import java.util.List;
39 43
  */
40 44
 @Service
41 45
 public class NBasicEdgeServiceImpl extends ServiceImpl<NBasicEdgeMapper, NBasicEdge> implements NBasicEdgeService  {
46
+	@Resource
47
+	private Producer producer;
42 48
 
43 49
     @Resource
44 50
     private NBasicEdgeMapper nBasicEdgeMapper;
@@ -140,9 +146,13 @@ public class NBasicEdgeServiceImpl extends ServiceImpl<NBasicEdgeMapper, NBasicE
140 146
 		nBasicEdge.setHouseId("44");
141 147
 		nBasicEdge.setCron("0 0 0 */1 * ?");
142 148
 		nBasicEdge.setEquiName("3号筒仓");
143
-		
144
-		
145
-		return nBasicEdgeMapper.insert(nBasicEdge);
149
+
150
+
151
+		int i = nBasicEdgeMapper.insert(nBasicEdge);
152
+		if (i>=0){
153
+			producer.send(nBasicEdge, MessageEnum.SAVE, ServiceEnum.NBASIC_EDGE);
154
+		}
155
+		return i;
146 156
 	}
147 157
 
148 158
 
@@ -207,7 +217,7 @@ public class NBasicEdgeServiceImpl extends ServiceImpl<NBasicEdgeMapper, NBasicE
207 217
 		 nBasicEdgeMapper.insert(nBasicEdge);
208 218
 		
209 219
 		PointData ponitData = new PointData();
210
-		ponitData.setHouseId(44);
220
+		ponitData.setHouseId(44L);
211 221
 		ponitData.setCreateTime(date);
212 222
 		ponitData.setPoints(xyz);
213 223
 		

+ 11 - 11
src/main/java/com/unissoft/systemManage/service/impl/OrgInfoServiceImpl.java

@@ -50,7 +50,7 @@ public class OrgInfoServiceImpl extends ServiceImpl<OrgInfoMapper, OrgInfo> impl
50 50
         QueryWrapper<OrgInfo> queryWrapper = new QueryWrapper<>();
51 51
         if (orgInfo != null) {
52 52
             Integer storeTypeCode = orgInfo.getStoreTypeCode();
53
-            Integer parentId = orgInfo.getParentId();
53
+            Long parentId = orgInfo.getParentId();
54 54
             if (storeTypeCode != null) {
55 55
                 queryWrapper.eq("store_type_code", storeTypeCode);
56 56
             }
@@ -75,7 +75,7 @@ public class OrgInfoServiceImpl extends ServiceImpl<OrgInfoMapper, OrgInfo> impl
75 75
         if (!StringUtils.isEmpty(condition)) {
76 76
             OrgInfo orgInfo = JSON.parseObject(condition, OrgInfo.class);
77 77
             // 获取查询条件
78
-            Integer cf_id = orgInfo.getId();
78
+            Long cf_id = orgInfo.getId();
79 79
             //param.put("id", cf_id);
80 80
             Page<List<Map<String, Object>>> a = orgInfoMapper.getStorehouse(page, cf_id);
81 81
             return a;
@@ -91,18 +91,18 @@ public class OrgInfoServiceImpl extends ServiceImpl<OrgInfoMapper, OrgInfo> impl
91 91
         List<OrgInfoChildren> orgInfoChildren;
92 92
         String s;
93 93
         List<OrgInfo> orgInfoS;
94
-        Integer parentId = MyConstant.ZERO;
94
+        Long parentId = 0L;
95 95
         // 没有搜索条件时
96 96
         if (!StringUtils.isEmpty(orgName)) {
97 97
             queryWrapper.like("org_name", orgName);
98 98
             List<OrgInfo> orgInfoList1 = orgInfoMapper.selectList(queryWrapper);
99 99
             // 二次查询list
100
-            ArrayList<Integer> ids = Lists.newArrayList(); // id缓存区
100
+            ArrayList<Long> ids = Lists.newArrayList(); // id缓存区
101 101
             for (OrgInfo orgInfo : orgInfoList1) {
102 102
                 ids.add(orgInfo.getId());
103 103
             }
104 104
             // 获取最顶级父id
105
-            Optional<OrgInfo> min = orgInfoList1.stream().min(Comparator.comparingInt(OrgInfo::getParentId));
105
+            Optional<OrgInfo> min = orgInfoList1.stream().min(Comparator.comparingLong(OrgInfo::getParentId));
106 106
             if (min.isPresent()) {
107 107
                 parentId = min.get().getParentId();
108 108
             }
@@ -117,7 +117,7 @@ public class OrgInfoServiceImpl extends ServiceImpl<OrgInfoMapper, OrgInfo> impl
117 117
             s = JSON.toJSONString(orgInfoS);
118 118
             orgInfoChildren = JSON.parseArray(s, OrgInfoChildren.class);
119 119
         }
120
-        return buildTree(orgInfoChildren, parentId);
120
+        return buildTree(orgInfoChildren, (long) parentId);
121 121
     }
122 122
 
123 123
     @Override
@@ -133,8 +133,8 @@ public class OrgInfoServiceImpl extends ServiceImpl<OrgInfoMapper, OrgInfo> impl
133 133
         if (!StringUtils.isEmpty(condition)) {
134 134
             OrgInfo orgInfo = JSON.parseObject(condition, OrgInfo.class);
135 135
             // 获取查询条件
136
-            Integer org_id = orgInfo.getParentId();
137
-            Integer cf_id = orgInfo.getId();
136
+            Long org_id = orgInfo.getParentId();
137
+            Long cf_id = orgInfo.getId();
138 138
             if (!StringUtils.isEmpty(org_id)) {
139 139
                 queryWrapper.eq("parent_id", org_id);
140 140
             }
@@ -200,15 +200,15 @@ public class OrgInfoServiceImpl extends ServiceImpl<OrgInfoMapper, OrgInfo> impl
200 200
      * @param parentId  用于获取key 为最顶级 parentId
201 201
      * @return tree 结构 数据
202 202
      */
203
-    private List<OrgInfoChildren> buildTree(List<OrgInfoChildren> listParam, Integer parentId) {
203
+    private List<OrgInfoChildren> buildTree(List<OrgInfoChildren> listParam, Long parentId) {
204 204
         // 接收参数非空判断
205 205
         if (CollectionUtils.isEmpty(listParam)) {
206 206
             return Collections.emptyList();
207 207
         }
208 208
         // id 为key list 转map
209
-        Map<Integer, OrgInfoChildren> idMap = listParam.parallelStream().collect(Collectors.toMap(OrgInfoChildren::getId, p -> p));
209
+        Map<Long, OrgInfoChildren> idMap = listParam.parallelStream().collect(Collectors.toMap(OrgInfoChildren::getId, p -> p));
210 210
         // 数据根据ParentId分组
211
-        Map<Integer, List<OrgInfoChildren>> pidGroupRolesMap = listParam.parallelStream().collect(Collectors.groupingBy(OrgInfoChildren::getParentId));
211
+        Map<Long, List<OrgInfoChildren>> pidGroupRolesMap = listParam.parallelStream().collect(Collectors.groupingBy(OrgInfoChildren::getParentId));
212 212
         // set children 值
213 213
         pidGroupRolesMap.forEach((k, v) -> {
214 214
             // 获取parent id key

+ 1 - 1
src/main/java/com/unissoft/systemManage/service/impl/RoleInfoServiceImpl.java

@@ -42,7 +42,7 @@ public class RoleInfoServiceImpl extends ServiceImpl<RoleInfoMapper, RoleInfo> i
42 42
             // 查询条件转Java对象
43 43
             RoleInfo roleInfo = JSON.parseObject(condition, RoleInfo.class);
44 44
             // 获取查询条件
45
-            Integer orgId = roleInfo.getOrgId();
45
+            Long orgId = roleInfo.getOrgId();
46 46
             String roleName = roleInfo.getRoleName();
47 47
             if (!StringUtils.isEmpty(orgId))
48 48
                 queryWrapper.eq("org_id", roleInfo.getOrgId());

+ 29 - 0
src/main/java/com/unissoft/utils/idUtils.java

@@ -0,0 +1,29 @@
1
+package com.unissoft.utils;
2
+
3
+import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
4
+import com.unissoft.config.IdGenerator16Bit;
5
+import org.springframework.expression.spel.ast.Identifier;
6
+import org.springframework.stereotype.Component;
7
+import org.springframework.util.IdGenerator;
8
+
9
+import java.util.Date;
10
+import java.util.UUID;
11
+
12
+/**
13
+ * ClassName: idUtils
14
+ * Package: com.unissoft.utils
15
+ * Description: 自定义ID生成长度为16位
16
+ *
17
+ * @Author zlq
18
+ * @Create 2023/3/3 17:36
19
+ * @Version 1.0
20
+ */
21
+@Component
22
+public class idUtils  implements IdentifierGenerator {
23
+    @Override
24
+    public Long nextId(Object esntity) {
25
+        // 填充自己的Id生成器,
26
+        return IdGenerator16Bit.generateId();
27
+    }
28
+
29
+}

+ 5 - 5
src/main/resources/bootstrap.yml

@@ -13,12 +13,14 @@ spring:
13 13
     driver-class-name: com.mysql.cj.jdbc.Driver
14 14
     #username: root
15 15
     #password: 123456
16
-#    url: jdbc:mysql://127.0.0.1:3306/numberec?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
16
+    url: jdbc:mysql://127.0.0.1:3306/numberec?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
17
+#    url: jdbc:mysql://192.168.8.101:3306/numberEC?characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
17 18
     username: root
19
+#    password: 123456
18 20
     password: 123456
19 21
     # 06 to 02 可外网访问,不必vpn。
20 22
 #    url: jdbc:mysql://101.36.160.140:31004/numberEC?characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
21
-    url: jdbc:mysql://101.36.160.140:31004/numberEC?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
23
+#    url: jdbc:mysql://101.36.160.140:31004/numberEC?characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
22 24
 
23 25
     # Hikari pool https://github.com/brettwooldridge/HikariCP
24 26
     type: com.zaxxer.hikari.HikariDataSource
@@ -65,10 +67,8 @@ version: 20121021
65 67
 
66 68
 rocketmq:
67 69
   name-server: 192.168.8.142:9876 # 访问地址
68
-  consumer:
69
-    group: consumer_number
70 70
   producer:
71
-    group: Group_local # 必须指定group
71
+    group: Grouplocal # 必须指定group
72 72
     send-message-timeout: 3000 # 消息发送超时时长,默认3s
73 73
     retry-times-when-send-failed: 3 # 同步发送消息失败重试次数,默认2
74 74
     retry-times-when-send-async-failed: 3 # 异步发送消息失败重试次数,默认2