动火作业流程图

pull/4/head
fangjiakai 2024-01-25 13:38:16 +08:00
parent 4c9801eacf
commit b1db99346e
10 changed files with 169 additions and 90 deletions

View File

@ -1198,7 +1198,7 @@ public class AppHiddenController extends BaseController {
PageData pd = new PageData();
pd = this.getPageData();
pd = hiddenService.findById(pd); // 根据ID读取
if(pd.getString("CONFIRM_USER")!=null || pd.getString("CONFIRM_USER").equals("undefined")){
if(pd.get("CONFIRM_USER")!=null || pd.getString("CONFIRM_USER").equals("undefined")){
pd.put("USER_ID",pd.getString("CONFIRM_USER"));
PageData user = usersService.findById(pd);
if(user!=null){

View File

@ -60,4 +60,16 @@ public class AppEightWorkController extends BaseController {
map.put("result",errorInfo);
return map;
}
@RequestMapping("/checkWork")
@ResponseBody
public Object checkWork() throws Exception{
Map<String,Object> map = new HashMap<>();
String errorInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
map.put("count",eightWorkService.checkWork(pd));
map.put("result",errorInfo);
return map;
}
}

View File

@ -266,4 +266,22 @@ public class AppHotworkController extends BaseController {
return map;
}
/**
* @param
* @throws Exception
*/
@RequestMapping(value="/getFlowList")
@ResponseBody
@LogAnno(menuType= "手机",menuServer= "动火作业",instructionsOperate = "动火作业",instructionsType = "获取动火作业流程")
public Object getFlowList() throws Exception{
Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success";
PageData pd = new PageData();
pd = this.getPageData();
List<PageData> flowList = hotworkService.getFlowList(pd);
map.put("flowList", flowList);
map.put("result", errInfo); //返回结果
return map;
}
}

View File

@ -1,85 +1,85 @@
package com.zcloud.controller.mq;
import com.alibaba.fastjson.JSON;
import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.mq.MqMessageLogMapper;
import com.zcloud.service.eightwork.HotworkService;
import com.zcloud.service.mq.LogService;
import com.zcloud.service.mq.SendMessageService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.MqUtil;
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.beans.factory.annotation.Autowired;
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 SendMessageService sendMessageService;
@Resource
private LogService logService;
@Resource
private MqMessageLogMapper mqMessageLogMapper;
@Autowired
private HotworkService hotworkService;
@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("受限空间模块消费");
// confinedSpaceService.cancel(data.getData());
//package com.zcloud.controller.mq;
//
//import com.alibaba.fastjson.JSON;
//import com.zcloud.dto.TenCorpDto;
//import com.zcloud.entity.PageData;
//import com.zcloud.mapper.dsno2.mq.MqMessageLogMapper;
//import com.zcloud.service.eightwork.HotworkService;
//import com.zcloud.service.mq.LogService;
//import com.zcloud.service.mq.SendMessageService;
//import com.zcloud.util.DateUtil;
//import com.zcloud.util.MqUtil;
//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.beans.factory.annotation.Autowired;
//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 SendMessageService sendMessageService;
// @Resource
// private LogService logService;
// @Resource
// private MqMessageLogMapper mqMessageLogMapper;
// @Autowired
// private HotworkService hotworkService;
//
// @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("受限空间模块消费");
//// confinedSpaceService.cancel(data.getData());
//// break;
//// case "electricity":
//// System.out.println("临时用电模块消费");
//// electricityService.cancel(data.getData());
//// break;
// case "hot-work":
// System.out.println("动火模块消费");
// hotworkService.cancel(data.getData());
// break;
// case "electricity":
// System.out.println("临时用电模块消费");
// electricityService.cancel(data.getData());
// break;
case "hot-work":
System.out.println("动火模块消费");
hotworkService.cancel(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);
}
}
}
// 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

@ -21,4 +21,6 @@ public interface HotworkMapper {
List<PageData> listAllMeasures();
List<PageData> checkWorkCount(PageData pd);
List<PageData> getFlowList(PageData pd);
}

View File

@ -10,4 +10,5 @@ import java.util.List;
*/
public interface EightWorkService {
public List<PageData> getTaskSetps(PageData pd);
PageData checkWork(PageData pd);
}

View File

@ -39,4 +39,5 @@ public interface HotworkService {
void saveGas(PageData pd,MultipartFile[] files) throws Exception;
List<PageData> getFlowList(PageData pd)throws Exception;
}

View File

@ -25,4 +25,10 @@ public class EightWorkServiceImpl implements EightWorkService {
public List<PageData> getTaskSetps(PageData pd) {
return eightWorkTaskFlowMapper.getTaskSetps(pd);
}
@Override
public PageData checkWork(PageData pd) {
return null;
}
}

View File

@ -149,10 +149,11 @@ public class HotworkServiceImpl implements HotworkService {
}
saveNextSigner(work,currentflow);
}else if(pd.getString("APPLY_STATUS").equals("-1")){
work.put("STEP_ID",-1);
hotworkMapper.editStep(work);
//保存日志
saveLog(work,work.getString(flow.get("ACTOR_FIELD")),"-1");
work.put("STEP_ID",-1);
hotworkMapper.editStep(work);
}
}
@ -267,13 +268,20 @@ public class HotworkServiceImpl implements HotworkService {
sign.put("SIGN_PATH", String.join(",", filePaths));
sign.put("DESCR", pd.get("DESCR"));
hotworkSignMapper.edit(sign);
work.put("STEP_ID",-1);
hotworkMapper.editStep(work);
//保存日志
saveLog(work,pd.getString("USER_ID"),"-2");
work.put("STEP_ID",-1);
hotworkMapper.editStep(work);
}
}
@Override
public List<PageData> getFlowList(PageData pd) throws Exception {
pd=findById(pd);
return hotworkMapper.getFlowList(pd);
}
private void saveNextSigner(PageData pd,PageData flow) throws Exception {
pd.put("STEP_ID",flow.get("NEXT_STEP_ID"));

View File

@ -454,9 +454,12 @@
left join oa_department as endo on f.WORK_END_DEPARTMENT_ID = endo.DEPARTMENT_ID
left join sys_user as endu on f.WORK_END_USER_ID = endu.USER_ID
left join (select * from(select * from vi_eightwork_flow_log log where log.STATUS != -1 having 1 order by log.ACT_TIME desc
left join (select * from(select * from vi_eightwork_flow_log log having 1 order by log.ACT_TIME desc
) tmp group by tmp.WORK_ID) log on log.WORK_ID = f.HOTWORK_ID
where f.ISDELETE = '0'
<if test="pd.KEYWORDS != null and pd.KEYWORDS != ''"><!-- 关键词检索 -->
and f.CHECK_NO LIKE CONCAT(CONCAT('%', #{pd.KEYWORDS}),'%')
</if>
<if test="pd.STEP_NAME != null and pd.STEP_NAME != ''"><!-- 关键词检索 -->
and exists (
select 1 from bus_hotwork_sign sign
@ -467,6 +470,9 @@
and step.STEP_NAME = #{pd.STEP_NAME}
)
</if>
<if test="pd.STEP_ID != null and pd.STEP_ID != ''"><!-- 关键词检索 -->
and log.NEXT_STEP_ID = #{pd.STEP_ID}
</if>
<if test="pd.CREATOR != null and pd.CREATOR != ''"><!-- 关键词检索 -->
and f.CREATOR = #{pd.CREATOR}
</if>
@ -494,4 +500,29 @@
from
BUS_HOTWORK_MEASURES
</select>
<select id="getFlowList" resultType="pd">
select
step.STEP_NAME,
user.NAME as ACT_USER_NAME,
log.ACT_TIME,
log.STATUS,
cu.SIGN_USER,
cu.STEP_ID as CURRENT_STEP
from
bus_eightwork_task_flow flow
left join bus_eightwork_step step on step.STEP_ID = flow.STEP_ID
left join bus_eightwork_flow_log log on log.STEP_ID = flow.STEP_ID and
log.WORK_ID = #{HOTWORK_ID}
left join sys_user user on user.USER_ID = log.ACT_USER
left join (select sign.STEP_ID,GROUP_CONCAT(signer.NAME) sign_user from bus_hotwork_sign sign
left join sys_user signer on signer.USER_ID = sign.SIGN_USER_ID where sign.HOTWORK_ID = #{HOTWORK_ID}
and sign.SIGN_TIME is null) cu on cu.STEP_ID = step.STEP_ID
where
flow.TASK_ID = #{TASK_ID}
and
flow.STEP_ID != 0
order by
flow.ORDER_BY
</select>
</mapper>