八项作业前端更新

pull/4/head
liujun 2023-12-19 17:12:17 +08:00
parent a87827104e
commit d50f6f2d28
28 changed files with 512 additions and 619 deletions

View File

@ -6,6 +6,7 @@ import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.bus.CorpInfoService;
import com.zcloud.service.bus.MSMLoginService;
import com.zcloud.service.bus.NoticeCorpService;
@ -21,9 +22,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
@ -58,6 +57,9 @@ public class AppConfinedSpaceController extends BaseController {
@Autowired
private NoticeCorpService noticeCorpService;
@Autowired
private SendMessageUtil sendMessageUtil;
/**
* @param
* @throws Exception
@ -551,4 +553,93 @@ public class AppConfinedSpaceController extends BaseController {
map.put("count", count);
return map;
}
/**
* @param out
* @throws Exception
*/
@PostMapping(value="/cancel")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限空间",instructionsOperate = "受限空间",instructionsType = "作废")
public void cancel(@RequestBody PageData pd) throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
System.out.println(JSONObject.toJSONString(pd));
PageData cpd = new PageData();
cpd = confinedspaceService.findById(pd);
if(cpd!=null && cpd.size()>0 && cpd.getString("ANALYZE_TIME") != null && cpd.getString("GUARDIAN_USER_SIGNER_TIME") != null){
return;
}else if (cpd!=null && cpd.size()>0 && cpd.getString("ANALYZE_TIME") == null){
pd.put("APPLY_STATUS",-98);
confinedspaceService.cancel(pd);
PageData pd2 = new PageData();
pd2 = confinedspaceService.checkno(pd);
PageData pd3 = new PageData();
pd3.put("CHECK_NO",pd2.getString("CHECK_NO"));
pd3.put("CORPINFO_ID",pd.getString("CORPINFO_ID"));
confinedspaceService.editSpecialwork(pd3);
confinedspaceService.editSpecialwork1(pd3);
confinedspaceService.editSpecialwork2(pd3);
confinedspaceService.editSpecialwork3(pd3);
confinedspaceService.editSpecialwork4(pd3);
confinedspaceService.editSpecialwork5(pd3);
confinedspaceService.editSpecialwork6(pd3);
confinedspaceService.editSpecialwork7(pd3);
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd.get("CONFIRM_USER_ID"));// 收信人userid
mes.put("templateCode", "YX_ZF1");// 短信模板编码
mes.put("SMSCode", "SMS_462060039");// 短信模板编码
mes.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "params1");// 存入短信模板中的参数名称
params2.put("value", "受限空间作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
}else if (cpd!=null && cpd.size()>0 && cpd.getString("ANALYZE_TIME") != null && cpd.getString("GUARDIAN_USER_SIGNER_TIME") == null){
pd.put("APPLY_STATUS",-99);
confinedspaceService.cancel(pd);
PageData pd2 = new PageData();
pd2 = confinedspaceService.checkno(pd);
PageData pd3 = new PageData();
pd3.put("CHECK_NO",pd2.getString("CHECK_NO"));
pd3.put("CORPINFO_ID",pd.getString("CORPINFO_ID"));
confinedspaceService.editSpecialwork(pd3);
confinedspaceService.editSpecialwork1(pd3);
confinedspaceService.editSpecialwork2(pd3);
confinedspaceService.editSpecialwork3(pd3);
confinedspaceService.editSpecialwork4(pd3);
confinedspaceService.editSpecialwork5(pd3);
confinedspaceService.editSpecialwork6(pd3);
confinedspaceService.editSpecialwork7(pd3);
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd.get("CONFIRM_USER_ID"));// 收信人userid
mes.put("templateCode", "YX_ZF2");// 短信模板编码
mes.put("SMSCode", "SMS_462060039");// 短信模板编码
mes.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "params1");// 存入短信模板中的参数名称
params2.put("value", "受限空间作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
}
map.put("result", errInfo); //返回结果
return ;
}
}

View File

@ -6,6 +6,7 @@ import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.zcloud.controller.base.BaseController;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.logs.LogAnno;
import com.zcloud.service.bus.CorpInfoService;
import com.zcloud.service.bus.MSMLoginService;
import com.zcloud.service.bus.NoticeCorpService;
@ -22,12 +23,12 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -60,6 +61,9 @@ public class AppElectricityController extends BaseController {
private NoticeCorpService noticeCorpService;
@Autowired
private DepartmentService departmentService;
@Autowired
private SendMessageUtil sendMessageUtil;
/**
* @param
* @throws Exception
@ -1160,4 +1164,95 @@ public class AppElectricityController extends BaseController {
map.put("count", count);
return map;
}
/**
* @param out
* @throws Exception
*/
@PostMapping(value="/cancel")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "受限空间",instructionsOperate = "受限空间",instructionsType = "作废")
public void cancel(@RequestBody PageData pd) throws Exception{
Map<String,String> map = new HashMap<String,String>();
String errInfo = "success";
System.out.println(JSONObject.toJSONString(pd));
PageData cpd = new PageData();
cpd = electricityService.findById(pd);
if(cpd!=null && cpd.size()>0 && cpd.getString("ANALYZE_TIME") != null){
String WORK_START_DATE = pd.getString("WORK_START_DATE");
String ANALYZE_TIME = cpd.getString("ANALYZE_TIME");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm");
System.out.println(WORK_START_DATE);
System.out.println(ANALYZE_TIME);
System.out.println("-------------123----------");
try {
Date date1 = format.parse(WORK_START_DATE);
Date date2 = format.parse(ANALYZE_TIME);
long workTime = date1.getTime();
long analyzeTime = date2.getTime();
System.out.println(workTime - analyzeTime);
System.out.println(analyzeTime - workTime);
if (workTime - analyzeTime >= 0) {
return;
} else {
electricityService.cancel(pd);
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd.get("CONFIRM_USER_ID"));// 收信人userid
mes.put("templateCode", "YD_ZF");// 短信模板编码
mes.put("SMSCode", "SMS_462060039");// 短信模板编码
mes.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "params1");// 存入短信模板中的参数名称
params2.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
}
} catch (ParseException e) {
e.printStackTrace();
}
}else{
electricityService.cancel(pd);
PageData pd2 = new PageData();
pd2 = electricityService.checkno(pd);
PageData pd3 = new PageData();
pd3.put("CHECK_NO",pd2.getString("CHECK_NO"));
pd3.put("CORPINFO_ID",pd.getString("CORPINFO_ID"));
electricityService.editSpecialwork(pd3);
electricityService.editSpecialwork1(pd3);
electricityService.editSpecialwork2(pd3);
electricityService.editSpecialwork3(pd3);
electricityService.editSpecialwork4(pd3);
electricityService.editSpecialwork5(pd3);
electricityService.editSpecialwork6(pd3);
electricityService.editSpecialwork7(pd3);
PageData mes = new PageData();
mes.put("RECEIVER_ID", pd.get("CONFIRM_USER_ID"));// 收信人userid
mes.put("templateCode", "YD_ZF");// 短信模板编码
mes.put("SMSCode", "SMS_462060039");// 短信模板编码
mes.put("CORPINFO_ID", pd.get("CORPINFO_ID"));// 企业id
// 参数集合
List<PageData> paramsList = new ArrayList<PageData>();
// 第1个参数
PageData params1 = new PageData();
params1.put("name", "number");// 存入短信模板中的参数名称
params1.put("value", pd.get("CHECK_NO"));// 存入上面参数名称所传递的值
paramsList.add(params1);
// 第2个参数
PageData params2 = new PageData();
params2.put("name", "params1");// 存入短信模板中的参数名称
params2.put("value", "临时用电安全作业");// 存入上面参数名称所传递的值
paramsList.add(params2);
sendMessageUtil.sendMessages(mes, paramsList);
}
map.put("result", errInfo); //返回结果
return ;
}
}

View File

@ -3,11 +3,12 @@ package com.zcloud.controller.gf;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.dto.TenCorpConst;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mq.util.TenCorpConst;
import com.zcloud.service.gf.*;
import com.zcloud.service.mq.SendMessageService;
import com.zcloud.util.*;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -16,7 +17,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import com.zcloud.mq.service.SendMessageService;
import javax.annotation.Resource;
import java.text.DecimalFormat;

View File

@ -3,12 +3,12 @@ package com.zcloud.controller.gf;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.dto.mq.Response;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.dto.TenCorpConst;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mq.util.TenCorpConst;
import com.zcloud.service.gf.*;
import com.zcloud.service.mq.SendMessageService;
import com.zcloud.util.*;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,7 +17,6 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartRequest;
import com.zcloud.mq.service.SendMessageService;
import javax.annotation.Resource;
import java.text.DecimalFormat;
@ -182,8 +181,6 @@ public class AppGFElectricityController extends BaseController {
}
/**
* @param out
* @throws Exception
*/
@RequestMapping(value="/delete")
@ResponseBody

View File

@ -3,13 +3,12 @@ package com.zcloud.controller.gf;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.controller.base.BaseController;
import com.zcloud.dto.mq.Response;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.dto.TenCorpConst;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import com.zcloud.mq.service.SendMessageService;
import com.zcloud.mq.util.TenCorpConst;
import com.zcloud.service.gf.*;
import com.zcloud.service.mq.SendMessageService;
import com.zcloud.util.*;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -195,8 +194,6 @@ public class AppGFHotworkController extends BaseController {
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/edit")
@ResponseBody

View File

@ -1,6 +1,8 @@
package com.zcloud.controller.mq;
import com.alibaba.fastjson.JSON;
import com.zcloud.controller.app.highriskwork.AppConfinedSpaceController;
import com.zcloud.controller.app.highriskwork.AppElectricityController;
import com.zcloud.controller.app.highriskwork.AppHotworkCfdController;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.PageData;
@ -30,10 +32,10 @@ import java.util.Date;
public class EightWorkListener implements RocketMQListener<String> {
// @Resource
// private AppConfinedSpaceController appConfinedSpaceController;
// @Resource
// private AppElectricityController appElectricityController;
@Resource
private AppConfinedSpaceController appConfinedSpaceController;
@Resource
private AppElectricityController appElectricityController;
@Resource
private AppHotworkCfdController appHotworkCfdController;
@ -64,11 +66,11 @@ public class EightWorkListener implements RocketMQListener<String> {
switch (data.getMessage()){
case "confined-space":
System.out.println("受限空间模块消费");
// appConfinedSpaceController.cancel(data.getData());
appConfinedSpaceController.cancel(data.getData());
break;
case "electricity":
System.out.println("临时用电模块消费");
// appElectricityController.cancel(data.getData());
appElectricityController.cancel(data.getData());
break;
case "hot-work":
System.out.println("动火模块消费");

View File

@ -1,68 +0,0 @@
package com.zcloud.dto.mq;
import com.alibaba.fastjson.JSON;
import lombok.Data;
@Data
public class Response {
private String result;
private String exception;
private String code;
private String message;
public Response Ok() {
this.result = "succeed";
this.code = "0";
return this;
}
public static Response OK() {
Response response = new Response();
response.result = "succeed";
response.code = "0";
return response;
}
public Response Error() {
this.result = "succeed";
this.code = "9999";
this.exception = "系统异常";
return this;
}
public Response Error(String errorMessage) {
this.result = "succeed";
this.code = "9999";
this.exception = errorMessage;
return this;
}
public Response Error(String code, String errorMessage) {
this.result = "succeed";
this.code = code;
this.exception = errorMessage;
return this;
}
public static Response ERROR() {
Response response = new Response();
response.result = "succeed";
response.code = "0";
return response;
}
public static Response ERROR(String errorMessage) {
Response response = new Response();
response.result = "succeed";
response.code = "9999";
response.exception = errorMessage;
return response;
}
public void setMessage(Object obj) {
this.message = JSON.toJSONString(obj);
}
}

View File

@ -1,46 +0,0 @@
package com.zcloud.dto.mq;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.PageData;
import com.zcloud.util.Warden;
import lombok.Data;
@Data
public class TenCorpDto {
// 请秋id
private String id;
// 消息来源名称
private String producer_name;
private String topic;
//印记(方便寻找该条请求)
private String mark;
// 标记名称
private String mark_name;
// 消息发送时间(yyyy-MM-dd HH:mm:ss:SSS)
private String time_stamp;
// 消息体
private String message;
private PageData data;
public TenCorpDto() {
this.id = Warden.get32UUID();
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
public PageData getPd() {
PageData info = new PageData();
info.put("ID", this.id);
info.put("PRODUCER_NAME", this.producer_name);
info.put("MARK", this.mark);
info.put("MARK_NAME", this.mark_name);
info.put("MESSAGE", JSONObject.toJSONString(this.data));
info.put("TOPIC",this.topic);
return info;
}
}

View File

@ -63,5 +63,15 @@ public interface ConfinedSpaceMapper {
* @return
*/
PageData countCheck(PageData pd);
void cancel(PageData pd);
PageData checkno(PageData pd);
void editSpecialwork(PageData pd);
void editSpecialwork1(PageData pd);
void editSpecialwork2(PageData pd);
void editSpecialwork3(PageData pd);
void editSpecialwork4(PageData pd);
void editSpecialwork5(PageData pd);
void editSpecialwork6(PageData pd);
void editSpecialwork7(PageData pd);
}

View File

@ -77,5 +77,16 @@ public interface ElectricityMapper{
*/
int numberCheck(PageData pd);
PageData getCode(PageData pd);
void cancel(PageData pd);
PageData checkno(PageData pd);
void editSpecialwork(PageData pd);
void editSpecialwork1(PageData pd);
void editSpecialwork2(PageData pd);
void editSpecialwork3(PageData pd);
void editSpecialwork4(PageData pd);
void editSpecialwork5(PageData pd);
void editSpecialwork6(PageData pd);
void editSpecialwork7(PageData pd);
}

View File

@ -1,87 +0,0 @@
package com.zcloud.mq.controller;
import com.alibaba.fastjson.JSON;
import com.zcloud.controller.gf.GFEightWorkController;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.mq.MqMessageLogMapper;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.mq.service.LogService;
import com.zcloud.mq.service.SendMessageService;
import com.zcloud.mq.util.MqUtil;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Warden;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
/**
* topic tag DEMO
* wangxuan
* www.zcloudchina.com
*/
@Component
@RocketMQMessageListener(consumerGroup = "${mq.group.eightWork}",
topic = "${mq.topic.eightWork}",
selectorType = SelectorType.TAG)
public class EightWorkListener implements RocketMQListener<String> {
@Resource
private GFEightWorkController eightWorkClient;
@Resource
private SendMessageService sendMessageService;
@Resource
private LogService logService;
@Resource
private MqMessageLogMapper mqMessageLogMapper;
@Override
public void onMessage(String message) {
TenCorpDto data = JSON.parseObject(message, TenCorpDto.class);
PageData log = data.getPd();
log.put("MESSAGE_LOG_ID", Warden.get32UUID());
log.put("CREATE_TIME", DateUtil.getTime());
log.put("PRODUCER_NAME",data.getProducer_name());
log.put("TYPE","1");
try {
System.out.println("消费者:" + data.toString());
Date limit_date = MqUtil.dateFormat(data.getTime_stamp());
if (limit_date.getTime() - new Date().getTime() > 1000) {
sendMessageService.SendDelayQueue(data);
log.put("DIGESTION_FLAG","0");
} else {
switch (data.getMessage()){
case "confined-space":
System.out.println("受限空间模块消费");
// eightWorkClient.confinedSpaceCancel(data.getData());
break;
case "electricity":
System.out.println("临时用电模块消费");
// eightWorkClient.electricityCancel(data.getData());
break;
case "hot-work":
System.out.println("动火模块消费");
// eightWorkClient.hotWorkCancel(data.getData());
break;
default:
System.out.println("异常模块不消费");
throw new RuntimeException("未找到对应的消费者");
}
log.put("DIGESTION_FLAG","1");
}
mqMessageLogMapper.save(log);
} catch (Exception e) {
e.printStackTrace();
logService.saveErrorMessage(log,e.getMessage());
throw new RuntimeException(e);
}
}
}

View File

@ -1,32 +0,0 @@
package com.zcloud.mq.controller;
import com.alibaba.fastjson.JSON;
import com.zcloud.dto.mq.TenCorpDto;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.annotation.SelectorType;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
/**
* topic tag DEMO
* wangxuan
* www.zcloudchina.com
*/
@Component
@RocketMQMessageListener(consumerGroup = "${mq.group.info}",
topic = "${mq.topic.info}",
selectorType = SelectorType.TAG)
public class MqListener implements RocketMQListener<String> {
@Override
public void onMessage(String message) {
TenCorpDto data = JSON.parseObject(message, TenCorpDto.class);
try {
System.out.println("2消费者:" + data.toString());
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
}

View File

@ -1,54 +0,0 @@
package com.zcloud.mq.controller;
import com.zcloud.controller.base.BaseController;
import com.zcloud.dto.mq.Response;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.mq.service.SendMessageService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* TODO
* wangxuan
* www.zcloudchina.com
*/
@RestController
@RequestMapping("/messageQueue")
public class SendController extends BaseController {
@Resource
private SendMessageService sendMessageService;
@RequestMapping("/sendMessage")
public Response sendMessage(@RequestParam("tenCorpDto") TenCorpDto tenCorpDto) throws Exception {
try {
sendMessageService.sendMessage(tenCorpDto);
} catch (Exception e) {
e.printStackTrace();
}
return Response.OK();
}
@PostMapping("SendTimelyQueue")
public Response timelyQueue(@RequestBody TenCorpDto tenCorpDto) throws Exception {
try {
sendMessageService.sendMessage(tenCorpDto);
} catch (Exception e) {
e.printStackTrace();
}
return Response.OK();
}
@PostMapping("/SendDelayQueue")
public Response SendDelayQueue(@RequestBody TenCorpDto tenCorpDto) throws Exception {
try {
sendMessageService.SendDelayQueue(tenCorpDto);
return Response.OK();
} catch (Exception e) {
e.printStackTrace();
return Response.ERROR(e.getMessage());
}
}
}

View File

@ -1,11 +0,0 @@
package com.zcloud.mq.service;
import com.zcloud.entity.PageData;
public interface LogService {
void saveLog(PageData pageData);
void saveLog(PageData pageData,String type);
void saveErrorMessage(PageData pageData,String errorMessage);
}

View File

@ -1,11 +0,0 @@
package com.zcloud.mq.service;
import com.zcloud.dto.mq.TenCorpDto;
public interface SendMessageService {
void sendMessage(TenCorpDto tenCorpDto) throws Exception;
void SendDelayQueue(TenCorpDto tenCorpDto);
void SendDelayQueue(String message);
}

View File

@ -1,43 +0,0 @@
package com.zcloud.mq.service.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.mq.MqErrorMessageLogMapper;
import com.zcloud.mapper.datasource.mq.MqMessageLogMapper;
import com.zcloud.mq.service.LogService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Warden;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class LogServiceImpl implements LogService {
@Resource
private MqErrorMessageLogMapper mqErrorMessageLogMapper;
@Resource
private MqMessageLogMapper mqMessageLogMapper;
@Override
@Async
public void saveLog(PageData pageData) {
this.saveLog(pageData,"0");
}
@Override
public void saveLog(PageData pageData, String type) {
}
@Override
@Async
public void saveErrorMessage(PageData log,String errorMessage) {
log.put("ERROR_MESSAGE", errorMessage);
log.put("MESSAGE_ERROR_LOG_ID", Warden.get32UUID());
log.put("TYPE", "0");
log.put("TIME", DateUtil.getTime());
mqErrorMessageLogMapper.save(log);
}
}

View File

@ -1,129 +0,0 @@
package com.zcloud.mq.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.zcloud.dto.mq.TenCorpDto;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.mq.MqErrorMessageLogMapper;
import com.zcloud.mapper.datasource.mq.MqMessageLogMapper;
import com.zcloud.mq.service.LogService;
import com.zcloud.mq.service.SendMessageService;
import com.zcloud.mq.util.MqUtil;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Warden;
import org.apache.rocketmq.client.producer.SendResult;
import org.apache.rocketmq.client.producer.SendStatus;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@Service
public class SendMessageServiceImpl implements SendMessageService {
@Value("${mq.topic.info}")
private String info;
@Resource
private RocketMQTemplate rocketMQTemplate;
@Resource
private MqErrorMessageLogMapper mqErrorMessageLogMapper;
@Resource
private LogService logService;
@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();
log.put("MESSAGE_LOG_ID", Warden.get32UUID());
try {
log.put("CREATE_TIME", DateUtil.getTime());
log.put("PRODUCER_NAME",tenCorpDto.getProducer_name());
log.put("TYPE","0");
log.put("PLAN_TIME",tenCorpDto.getTime_stamp());
mqMessageLogMapper.save(log);
System.out.println("生产者:" + tenCorpDto.toString());
// 推送消息
SendResult sendResult = rocketMQTemplate.syncSend(
MqUtil.analysistopic(tenCorpDto.getTopic()),
new GenericMessage<>(tenCorpDto.toString()),
3000,
MqUtil.analysisTime(tenCorpDto.getTime_stamp()));
if (!sendResult.getSendStatus().equals(SendStatus.SEND_OK)) {
throw new RuntimeException("产品入栈失败");
}
} catch (Exception e) {
e.printStackTrace();
log.put("ERROR_MESSAGE", e.getMessage());
log.put("MESSAGE_ERROR_LOG_ID", Warden.get32UUID());
log.put("TYPE", "0");
log.put("TIME", DateUtil.getTime());
mqErrorMessageLogMapper.save(log);
}
}
@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"));
}catch (Exception e){
e.printStackTrace();
}
}
}

View File

@ -1,6 +0,0 @@
package com.zcloud.mq.util;
public class Const {
public static final String topic_eightWork="eightWork";
public static final String topic_info="info";
}

View File

@ -1,84 +0,0 @@
package com.zcloud.mq.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class MqUtil {
private final static SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
public static Integer analysisTime(String time) throws Exception{
Date agreed_date = timeFormat.parse(time);
long time_difference = agreed_date.getTime() - new Date().getTime();
if (time_difference < 0){
return 0;
}
if (time_difference > 2*60*60*1000){
return 18;
}
if (time_difference > 60 * 60 * 1000){
return 17;
}
if (time_difference > 30 * 60 * 1000){
return 16;
}
if (time_difference > 20 * 60 * 1000){
return 15;
}
if (time_difference > 10 * 60 * 1000){
return 14;
}
if (time_difference > 9 * 60 * 1000){
return 13;
}
if (time_difference > 8 * 60 * 1000){
return 12;
}
if (time_difference > 7 * 60 * 1000){
return 11;
}
if (time_difference > 6 * 60 * 1000){
return 10;
}
if (time_difference > 5 * 60 * 1000){
return 9;
}
if (time_difference > 4 * 60 * 1000){
return 8;
}
if (time_difference > 3 * 60 * 1000){
return 7;
}
if (time_difference > 2 * 60 * 1000){
return 6;
}
if (time_difference > 60 * 1000){
return 5;
}
if (time_difference > 30 * 1000){
return 4;
}
if (time_difference > 10 * 1000){
return 3;
}
if (time_difference > 5 * 1000){
return 2;
}
if (time_difference > 1000){
return 1;
}
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);
}
}

View File

@ -1,7 +0,0 @@
package com.zcloud.mq.util;
public class TenCorpConst {
public static final String confinedSpace = "confined-space";
public static final String electricity = "electricity";
public static final String hotWork = "hot-work";
}

View File

@ -64,5 +64,15 @@ public interface ConfinedSpaceService {
* @throws Exception
*/
PageData countCheck(PageData pd)throws Exception;
void editSpecialwork(PageData pd)throws Exception;
void editSpecialwork1(PageData pd)throws Exception;
void editSpecialwork2(PageData pd)throws Exception;
void editSpecialwork3(PageData pd)throws Exception;
void editSpecialwork4(PageData pd)throws Exception;
void editSpecialwork5(PageData pd)throws Exception;
void editSpecialwork6(PageData pd)throws Exception;
void editSpecialwork7(PageData pd)throws Exception;
void cancel(PageData pd)throws Exception;
PageData checkno(PageData pd)throws Exception;
}

View File

@ -78,5 +78,16 @@ public interface ElectricityService{
public int numberCheck(PageData pd)throws Exception;
PageData getCode(PageData pd)throws Exception;
void cancel(PageData pd)throws Exception;
PageData checkno(PageData pd)throws Exception;
void editSpecialwork(PageData pd)throws Exception;
void editSpecialwork1(PageData pd)throws Exception;
void editSpecialwork2(PageData pd)throws Exception;
void editSpecialwork3(PageData pd)throws Exception;
void editSpecialwork4(PageData pd)throws Exception;
void editSpecialwork5(PageData pd)throws Exception;
void editSpecialwork6(PageData pd)throws Exception;
void editSpecialwork7(PageData pd)throws Exception;
}

View File

@ -118,5 +118,38 @@ public class ConfinedSpaceServiceImpl implements ConfinedSpaceService {
public PageData countCheck(PageData pd) throws Exception {
return confinedspaceMapper.countCheck(pd);
}
public void cancel(PageData pd)throws Exception{
confinedspaceMapper.cancel(pd);
}
public PageData checkno(PageData pd)throws Exception{
return confinedspaceMapper.checkno(pd);
}
public void editSpecialwork(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork(pd);
}
public void editSpecialwork1(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork1(pd);
}
public void editSpecialwork2(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork2(pd);
}
public void editSpecialwork3(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork3(pd);
}
public void editSpecialwork4(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork4(pd);
}
public void editSpecialwork5(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork5(pd);
}
public void editSpecialwork6(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork6(pd);
}
public void editSpecialwork7(PageData pd)throws Exception{
confinedspaceMapper.editSpecialwork7(pd);
}
}

View File

@ -231,5 +231,36 @@ public class ElectricityServiceImpl implements ElectricityService {
public PageData getCode(PageData pd)throws Exception{
return electricityMapper.getCode(pd);
}
public void cancel(PageData pd)throws Exception{
electricityMapper.cancel(pd);
}
public PageData checkno(PageData pd)throws Exception{
return electricityMapper.checkno(pd);
}
public void editSpecialwork(PageData pd)throws Exception{
electricityMapper.editSpecialwork(pd);
}
public void editSpecialwork1(PageData pd)throws Exception{
electricityMapper.editSpecialwork1(pd);
}
public void editSpecialwork2(PageData pd)throws Exception{
electricityMapper.editSpecialwork2(pd);
}
public void editSpecialwork3(PageData pd)throws Exception{
electricityMapper.editSpecialwork3(pd);
}
public void editSpecialwork4(PageData pd)throws Exception{
electricityMapper.editSpecialwork4(pd);
}
public void editSpecialwork5(PageData pd)throws Exception{
electricityMapper.editSpecialwork5(pd);
}
public void editSpecialwork6(PageData pd)throws Exception{
electricityMapper.editSpecialwork6(pd);
}
public void editSpecialwork7(PageData pd)throws Exception{
electricityMapper.editSpecialwork7(pd);
}
}

View File

@ -151,6 +151,4 @@ public interface DictionariesService {
*/
public List<PageData> getIdsByParentIds(List<String> parentIds) throws Exception;
public List<PageData> getTreeById(String id) throws Exception;
}

View File

@ -256,16 +256,4 @@ public class DictionariesServiceImpl implements DictionariesService {
return dictionariesMapper.getIdsByParentIds(parentIds);
}
@Override
public List<PageData> getTreeById(String id) throws Exception {
List<Dictionaries> _list = this.listSubDictByParentId(id); //用传过来的ID获取此ID下的子列表数据
return _list.stream().map(n -> {
PageData entity = new PageData();
entity.put("DICTIONARIES_ID", n.getDICTIONARIES_ID());
entity.put("BIANMA", n.getBIANMA());
entity.put("NAME", n.getNAME());
return entity;
}).collect(Collectors.toList());
}
}

View File

@ -622,4 +622,103 @@
WHERE f.ISDELETE = '0' AND f.CORPINFO_ID = #{CORPINFO_ID}
</select>
<update id="cancel" parameterType="pd">
update
<include refid="tableName"></include>
set
APPLY_STATUS = #{APPLY_STATUS}
where
CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
</update>
<select id="checkno" parameterType="pd" resultType="pd">
SELECT
CONCAT_WS( " ", "受限空间作业", f.CHECK_NO ) AS CHECK_NO,
f.CONFINEDSPACE_ID AS ID
FROM
bus_confinedspace f
WHERE
f.CONFINEDSPACE_ID = #{CONFINEDSPACE_ID}
AND f.ISDELETE = '0'
</select>
<update id="editSpecialwork" parameterType = "pd">
update
bus_confinedspace f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork1" parameterType = "pd">
update
bus_blindboard f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork2" parameterType = "pd">
update
bus_electricity f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork3" parameterType = "pd">
update
bus_hoisting f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork4" parameterType = "pd">
update
bus_breakground f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork5" parameterType = "pd">
update
bus_cutroad f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork6" parameterType = "pd">
update
bus_highwork f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork7" parameterType = "pd">
update
bus_hotwork f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
</mapper>

View File

@ -675,4 +675,102 @@
WHERE f.CORPINFO_ID = #{CORPINFO_ID}
and f.CREATTIME LIKE CONCAT(#{CREATDATE},'%')
</select>
<update id="cancel" parameterType="pd">
update
<include refid="tableName"></include>
set
APPLY_STATUS = '-99'
where
ELECTRICITY_ID = #{ELECTRICITY_ID}
</update>
<select id="checkno" parameterType="pd" resultType="pd">
SELECT
CONCAT_WS( " ", "临时用电作业", f.CHECK_NO ) AS CHECK_NO
FROM
bus_electricity f
WHERE
f.ELECTRICITY_ID = #{ELECTRICITY_ID}
AND f.ISDELETE = '0'
</select>
<update id="editSpecialwork" parameterType = "pd">
update
bus_confinedspace f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork1" parameterType = "pd">
update
bus_blindboard f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork2" parameterType = "pd">
update
bus_electricity f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork3" parameterType = "pd">
update
bus_hoisting f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork4" parameterType = "pd">
update
bus_breakground f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork5" parameterType = "pd">
update
bus_cutroad f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork6" parameterType = "pd">
update
bus_highwork f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
<update id="editSpecialwork7" parameterType = "pd">
update
bus_hotwork f
set f.SPECIAL_WORK = REPLACE(f.SPECIAL_WORK,#{CHECK_NO},CONCAT(#{CHECK_NO},'(已作废)'))
WHERE
f.ISDELETE = '0'
AND f.APPLY_STATUS > 0
AND f.CORPINFO_ID = #{CORPINFO_ID}
and ( FIND_IN_SET( #{CHECK_NO}, f.SPECIAL_WORK ) )
</update>
</mapper>