diff --git a/src/main/java/com/zcloud/controller/eightWork/AppConfinedSpaceController.java b/src/main/java/com/zcloud/controller/eightWork/AppConfinedSpaceController.java index d08c218..ecf5917 100644 --- a/src/main/java/com/zcloud/controller/eightWork/AppConfinedSpaceController.java +++ b/src/main/java/com/zcloud/controller/eightWork/AppConfinedSpaceController.java @@ -173,7 +173,7 @@ public class AppConfinedSpaceController extends BaseController { sendMessageUtil.sendMessages(mes1, paramsList1); } TenCorpDto tenCorpDto = new TenCorpDto(); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setMark(pd.getString("CONFINEDSPACE_ID")); tenCorpDto.setMessage(TenCorpConst.confinedSpace); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); @@ -256,7 +256,7 @@ public class AppConfinedSpaceController extends BaseController { sendMessageUtil.sendMessages(mes, paramsList); } TenCorpDto tenCorpDto = new TenCorpDto(); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setMark(pd.getString("CONFINEDSPACE_ID")); tenCorpDto.setMessage(TenCorpConst.confinedSpace); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); @@ -713,7 +713,7 @@ public class AppConfinedSpaceController extends BaseController { paramsList.add(params4); sendMessageUtil.sendMessages(mes, paramsList); TenCorpDto tenCorpDto = new TenCorpDto(); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setMark(pd.getString("CONFINEDSPACE_ID")); tenCorpDto.setMessage(TenCorpConst.confinedSpace); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); diff --git a/src/main/java/com/zcloud/controller/eightWork/AppElectricityController.java b/src/main/java/com/zcloud/controller/eightWork/AppElectricityController.java index e18554a..53bf86b 100644 --- a/src/main/java/com/zcloud/controller/eightWork/AppElectricityController.java +++ b/src/main/java/com/zcloud/controller/eightWork/AppElectricityController.java @@ -155,7 +155,7 @@ public class AppElectricityController extends BaseController { tenCorpDto.setMark(pd.getString("ELECTRICITY_ID")); tenCorpDto.setMark_name("ELECTRICITY_ID"); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setData(pd); tenCorpDto.setMessage(TenCorpConst.electricity); @@ -260,7 +260,7 @@ public class AppElectricityController extends BaseController { tenCorpDto.setMark(pd.getString("ELECTRICITY_ID")); tenCorpDto.setMark_name("ELECTRICITY_ID"); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setData(pd); tenCorpDto.setMessage(TenCorpConst.electricity); @@ -638,7 +638,7 @@ public class AppElectricityController extends BaseController { tenCorpDto.setMark(pd.getString("ELECTRICITY_ID")); tenCorpDto.setMark_name("ELECTRICITY_ID"); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setData(pd); tenCorpDto.setMessage(TenCorpConst.electricity); diff --git a/src/main/java/com/zcloud/controller/eightWork/AppHotworkController.java b/src/main/java/com/zcloud/controller/eightWork/AppHotworkController.java index 9f6072e..4d03d9b 100644 --- a/src/main/java/com/zcloud/controller/eightWork/AppHotworkController.java +++ b/src/main/java/com/zcloud/controller/eightWork/AppHotworkController.java @@ -176,7 +176,7 @@ public class AppHotworkController extends BaseController { tenCorpDto.setMark(pd.getString("HOTWORK_ID")); tenCorpDto.setMark_name("HOTWORK_ID"); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setData(pd); tenCorpDto.setMessage(TenCorpConst.hotWork); @@ -264,7 +264,7 @@ public class AppHotworkController extends BaseController { tenCorpDto.setMark(pd.getString("HOTWORK_ID")); tenCorpDto.setMark_name("HOTWORK_ID"); tenCorpDto.setTime_stamp(pd.getString("WORK_START_DATE") + ":00:000"); - tenCorpDto.setTopic("eightWork"); + tenCorpDto.setTopic(Const.TOPIC_EIGHTWORK); tenCorpDto.setData(pd); tenCorpDto.setMessage(TenCorpConst.hotWork); diff --git a/src/main/java/com/zcloud/service/mq/SendMessageService.java b/src/main/java/com/zcloud/service/mq/SendMessageService.java index 2475d71..2c51f32 100644 --- a/src/main/java/com/zcloud/service/mq/SendMessageService.java +++ b/src/main/java/com/zcloud/service/mq/SendMessageService.java @@ -4,8 +4,5 @@ import com.zcloud.dto.TenCorpDto; public interface SendMessageService { - void sendMessage(TenCorpDto tenCorpDto) throws Exception; - void sendDelayQueue(TenCorpDto tenCorpDto); - void sendDelayQueue(String message); } diff --git a/src/main/java/com/zcloud/service/mq/impl/SendMessageServiceImpl.java b/src/main/java/com/zcloud/service/mq/impl/SendMessageServiceImpl.java index d2f8c50..b291a0a 100644 --- a/src/main/java/com/zcloud/service/mq/impl/SendMessageServiceImpl.java +++ b/src/main/java/com/zcloud/service/mq/impl/SendMessageServiceImpl.java @@ -22,9 +22,6 @@ import javax.annotation.Resource; @Service public class SendMessageServiceImpl implements SendMessageService { - @Value("${mq.topic.info}") - private String info; - @Resource private RocketMQTemplate rocketMQTemplate; @@ -37,28 +34,6 @@ public class SendMessageServiceImpl implements SendMessageService { @Resource private MqMessageLogMapper mqMessageLogMapper; - public void sendMessage(TenCorpDto tenCorpDto) throws Exception { - try { - PageData log = tenCorpDto.getPd(); - log.put("MESSAGE_LOG_ID", Warden.get32UUID()); - log.put("CREATE_TIME", DateUtil.getTime()); - mqMessageLogMapper.save(log); - System.out.println("生产者:" + tenCorpDto.toString()); - SendResult sendResult = rocketMQTemplate.syncSend(this.info, tenCorpDto.toString()); - if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { - throw new RuntimeException("产品入栈失败"); - } - } catch (Exception e) { - e.printStackTrace(); - PageData log = tenCorpDto.getPd(); - log.put("MESSAGE_ERROR_LOG_ID", Warden.get32UUID()); - log.put("ERROR_MESSAGE", e.getMessage()); - log.put("TYPE", "0"); - log.put("TIME", DateUtil.getTime()); - mqErrorMessageLogMapper.save(log); - } - } - @Override public void sendDelayQueue(TenCorpDto tenCorpDto) { PageData log = tenCorpDto.getPd(); @@ -72,7 +47,7 @@ public class SendMessageServiceImpl implements SendMessageService { System.out.println("生产者:" + tenCorpDto.toString()); // 推送消息 SendResult sendResult = rocketMQTemplate.syncSend( - MqUtil.analysistopic(tenCorpDto.getTopic()), + tenCorpDto.getTopic(), new GenericMessage<>(tenCorpDto.toString()), 3000, MqUtil.analysisTime(tenCorpDto.getTime_stamp())); @@ -90,33 +65,6 @@ public class SendMessageServiceImpl implements SendMessageService { } } - @Override - public void sendDelayQueue(String message) { - TenCorpDto tenCorpDto = JSONObject.parseObject(message,TenCorpDto.class); - try { - PageData log = tenCorpDto.getPd(); - log.put("CREATE_TIME", DateUtil.getTime()); - log.put("PRODUCER_NAME",tenCorpDto.getProducer_name()); - log.put("MESSAGE_LOG_ID", Warden.get32UUID()); - mqMessageLogMapper.save(log); - System.out.println("生产者:" + tenCorpDto.toString()); - // 推送消息 - SendResult sendResult = rocketMQTemplate.syncSend( - MqUtil.analysistopic(tenCorpDto.getTopic()), - new GenericMessage<>(message), - 3000, - MqUtil.analysisTime(tenCorpDto.getTime_stamp())); - - if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { - throw new RuntimeException("产品入栈失败"); - } - } catch (Exception e) { - PageData log = tenCorpDto.getPd(); - logService.saveErrorMessage(log,e.getMessage()); - e.printStackTrace(); - } - } - public static void main(String[] args) { try { System.out.println(MqUtil.analysisTime("2023-06-30 14:30:00:000")); diff --git a/src/main/java/com/zcloud/util/Const.java b/src/main/java/com/zcloud/util/Const.java index 571664d..1f1aac9 100644 --- a/src/main/java/com/zcloud/util/Const.java +++ b/src/main/java/com/zcloud/util/Const.java @@ -67,6 +67,5 @@ public class Const { public static final String ALIYUN_REGIONID = "cn-beijing"; // 点播服务接入地域 public static final String ENDPOINT = "vod.cn-beijing.aliyuncs.com";// 访问的域名 - public static final String topic_eightWork="eightWork"; - public static final String topic_info="info"; + public static final String TOPIC_EIGHTWORK="eightWork_whb"; } diff --git a/src/main/java/com/zcloud/util/MqUtil.java b/src/main/java/com/zcloud/util/MqUtil.java index 4b209fc..0bded3b 100644 --- a/src/main/java/com/zcloud/util/MqUtil.java +++ b/src/main/java/com/zcloud/util/MqUtil.java @@ -71,14 +71,6 @@ public class MqUtil { return 0; } - public static String analysistopic(String producerName) { - switch (producerName){ - case "eightWork" : return Const.topic_eightWork; - case "info" : return Const.topic_info; - default: return ""; - } - } - public static Date dateFormat(String date) throws Exception{ return timeFormat.parse(date); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 5fdb381..1af04b4 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -62,14 +62,14 @@ rocketmq.producer.retry-times-when-send-async-failed=3 ## topic 前缀 mq.topic.info=info -mq.topic.eightWork=eightWork +mq.topic.eightWork=eightWork_whb mq.group.info=scheduled_tasks mq.group.eightWork=scheduled_tasks_eightWork #字符 -spring.http.encoding.charset=UTF-8 -spring.http.encoding.force=true -spring.http.encoding.enabled=true +spring.servlet.encoding.charset=UTF-8 +spring.servlet.encoding.force=true +spring.servlet.encoding.enabled=true # 关闭springboot启动时的banner spring.main.banner-mode=off #jar包部署时去掉注释 diff --git a/src/main/resources/mybatis/datasource/check/ListManagerMapper.xml b/src/main/resources/mybatis/datasource/check/ListManagerMapper.xml index 75c728d..b1ec6db 100644 --- a/src/main/resources/mybatis/datasource/check/ListManagerMapper.xml +++ b/src/main/resources/mybatis/datasource/check/ListManagerMapper.xml @@ -232,6 +232,7 @@ p.NAME PERIODNAME, t.NAME TYPENAME, d.NAME as DEPARTMENT_NAME, + tt.NAME as TASK_TYPE_NAME, sp.NAME AS POST_NAME, s.NAME AS SCREENTYPENAME, @@ -244,6 +245,7 @@ left join sys_dictionaries p on f.PERIOD = p.BIANMA left join sys_dictionaries t on f.TYPE = t.BIANMA left join sys_dictionaries s on f.SCREENTYPE = s.BIANMA + left join sys_dictionaries tt on f.TASK_TYPE = tt.DICTIONARIES_ID left join OA_DEPARTMENT d on d.DEPARTMENT_ID=f.DEPARTMENT_ID left join SYS_POST sp on sp.POST_ID = f.POST_ID LEFT JOIN SYS_USER u on u.USER_ID = f.USER_ID