Commit b676fbcd authored by helinlin's avatar helinlin

Merge remote-tracking branch 'origin/developer' into developer

parents 45d32b6f 20fe3fb4
...@@ -10,8 +10,9 @@ import com.yeejoin.amos.boot.biz.common.constants.RuleConstant; ...@@ -10,8 +10,9 @@ import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
public enum RuleTypeEnum { public enum RuleTypeEnum {
// 防火监督 // 防火监督
计划提交("计划提交", "addPlan","auditPage", RuleConstant.WEB, RuleConstant.TASK), 计划提交("计划提交", "addPlan","auditPage", RuleConstant.APP_WEB, RuleConstant.TASK),
计划审核("计划审核", "planAudit", "auditPage", RuleConstant.APP_WEB, RuleConstant.NOTIFY), 计划审核("计划审核", "planAudit", "auditPage", RuleConstant.APP_WEB, RuleConstant.NOTIFY),
计划审核任务("计划审核", "planAudit", "auditPage", RuleConstant.APP_WEB, RuleConstant.TASK),
计划审核完成("计划审核完成", "planAuditAll", "formulatePage", RuleConstant.APP_WEB, RuleConstant.TASK), 计划审核完成("计划审核完成", "planAuditAll", "formulatePage", RuleConstant.APP_WEB, RuleConstant.TASK),
消息型计划生成("计划生成", "addPlanTask", null, RuleConstant.APP, RuleConstant.NOTIFY), 消息型计划生成("计划生成", "addPlanTask", null, RuleConstant.APP, RuleConstant.NOTIFY),
任务型计划生成("计划生成", "addPlanTask", null, RuleConstant.APP, RuleConstant.TASK), 任务型计划生成("计划生成", "addPlanTask", null, RuleConstant.APP, RuleConstant.TASK),
......
...@@ -338,7 +338,7 @@ public class MaintenanceCompanyController extends BaseController { ...@@ -338,7 +338,7 @@ public class MaintenanceCompanyController extends BaseController {
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY) @TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@GetMapping(value = "/get/amosOrgIdsByIds") @GetMapping(value = "/get/amosOrgIdsByIds")
@ApiOperation(httpMethod = "GET", value = "根据主键查orgIds", notes = "根据主键查orgIds") @ApiOperation(httpMethod = "GET", value = "根据主键查orgIds", notes = "根据主键查orgIds")
public ResponseModel<List<String>> getAmosOrgIdsByIds(@RequestParam(value = "list", required = true) List<String> list) { public ResponseModel<List<String>> getAmosOrgIdsByIdsgetAmosOrgIdsByIds(@RequestParam(value = "list", required = true) List<String> list) {
return ResponseHelper.buildResponse(maintenanceCompanyServiceImpl.getAmosOrgIdsByIds(list)); return ResponseHelper.buildResponse(maintenanceCompanyServiceImpl.getAmosOrgIdsByIds(list));
} }
......
...@@ -1836,7 +1836,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al ...@@ -1836,7 +1836,7 @@ public class AlertSubmittedServiceImpl extends BaseService<AlertSubmittedDto, Al
PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo(); PushMessageWebAndAppRo pushMessageWebAndAppRo = new PushMessageWebAndAppRo();
pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId")); pushMessageWebAndAppRo.setRelationId(besidesMap.get("alterId"));
pushMessageWebAndAppRo.setRecivers(userList); pushMessageWebAndAppRo.setRecivers(userList);
pushMessageWebAndAppRo.setCategory(RuleConstant.NOTIFY); pushMessageWebAndAppRo.setCategory(RuleConstant.TASK);
pushMessageWebAndAppRo.setIsSendApp(true); pushMessageWebAndAppRo.setIsSendApp(true);
pushMessageWebAndAppRo.setIsSendWeb(true); pushMessageWebAndAppRo.setIsSendWeb(true);
pushMessageWebAndAppRo.setRuleType(type); pushMessageWebAndAppRo.setRuleType(type);
......
...@@ -2385,8 +2385,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -2385,8 +2385,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
List<LatentDangerFlowRecord> recordList = latentDangerFlowRecordService.list(recordQueryWrapper); List<LatentDangerFlowRecord> recordList = latentDangerFlowRecordService.list(recordQueryWrapper);
if (!ValidationUtil.isEmpty(recordList)) { if (!ValidationUtil.isEmpty(recordList)) {
recordList.forEach(r -> r.setDeleted(true)); recordList.forEach(r -> r.setDeleted(true));
//草稿状态下的隐患不存在隐患操作记录
latentDangerFlowRecordService.saveOrUpdateBatch(recordList);
} }
latentDangerFlowRecordService.saveOrUpdateBatch(recordList);
LambdaQueryWrapper<LatentDanger> dangerQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<LatentDanger> dangerQueryWrapper = new LambdaQueryWrapper<>();
dangerQueryWrapper.in(LatentDanger::getId, dangerIdList); dangerQueryWrapper.in(LatentDanger::getId, dangerIdList);
......
...@@ -17,7 +17,7 @@ import java.util.Map; ...@@ -17,7 +17,7 @@ import java.util.Map;
@RuleFact(value = "维保任务",project = "消息规则") @RuleFact(value = "维保任务",project = "消息规则")
public class PlanRo implements Serializable { public class PlanRo implements Serializable {
private static final long serialVersionUID = 1070080521549842475L; private static final long serialVersionUID = 1779427739908876854L;
@Label("任务名称") @Label("任务名称")
private String name; private String name;
......
...@@ -503,6 +503,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -503,6 +503,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
} }
if (CollectionUtils.isNotEmpty(extraUserIds)) { if (CollectionUtils.isNotEmpty(extraUserIds)) {
log.info("接收人ID:{}", extraUserIds);
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, extraUserIds); rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, extraUserIds);
} }
} }
......
...@@ -7,6 +7,8 @@ import com.yeejoin.amos.maintenance.business.dto.PlanRo; ...@@ -7,6 +7,8 @@ import com.yeejoin.amos.maintenance.business.dto.PlanRo;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient; import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.business.util.DateUtil; import com.yeejoin.amos.maintenance.business.util.DateUtil;
import com.yeejoin.amos.maintenance.dao.entity.Plan; import com.yeejoin.amos.maintenance.dao.entity.Plan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -18,10 +20,11 @@ import java.util.List; ...@@ -18,10 +20,11 @@ import java.util.List;
import java.util.Map; import java.util.Map;
@Service @Service
public class RulePlanService { public class RulePlanService {
private final String packageId = "消息/addMaintenance"; private final String packageId = "消息/addMaintenance";
private final String msgType = "maintenance"; private final String msgType = "maintenance";
private final Logger log = LoggerFactory.getLogger(RulePlanService.class);
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired @Autowired
...@@ -30,6 +33,7 @@ public class RulePlanService { ...@@ -30,6 +33,7 @@ public class RulePlanService {
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) throws Exception { public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, extraUserIds); PlanRo planRo = buildPlanRo(plan, userIds, ruleType, extraUserIds);
//触发规则 //触发规则
log.info("消防维保推规则触发消息入参:{}, packageId:{} ", planRo, packageId);
ruleTrigger.publish(planRo, packageId, new String[0]); ruleTrigger.publish(planRo, packageId, new String[0]);
return true; return true;
} }
......
package com.yeejoin.amos.patrol.business.service.impl; package com.yeejoin.amos.patrol.business.service.impl;
import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel; import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper; import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*; import com.yeejoin.amos.patrol.business.dao.repository.ICheckDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao;
import com.yeejoin.amos.patrol.business.dto.MsgRo;
import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo; import com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo;
import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo; import com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo;
import com.yeejoin.amos.patrol.business.feign.Business; import com.yeejoin.amos.patrol.business.feign.Business;
...@@ -53,7 +62,17 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil; ...@@ -53,7 +62,17 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -91,6 +110,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -91,6 +110,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired @Autowired
private EquipFeign equipFeign; private EquipFeign equipFeign;
@Autowired
private RulePlanService rulePlanService;
@Autowired
private RuleTrigger ruleTrigger;
private final String packageId = "消息/addCheckRule";
private final String msgType = "patrolSystem";
private final String APP = "APP";
private final String WEB = "WEB";
private final String APP_WEB = "APP/WEB";
private static final String TAB = "\r\n";
@Override @Override
public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) { public Page<HashMap<String, Object>> getPlanTaskInfo(String toke, String product, String appKey, PlanTaskPageParam params) {
long total = planTaskMapper.countPlanTask(params); long total = planTaskMapper.countPlanTask(params);
...@@ -680,6 +713,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -680,6 +713,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTask.setEndTime(endTime); planTask.setEndTime(endTime);
// 1.保存执行数据主表 // 1.保存执行数据主表
iplanTaskDao.saveAndFlush(planTask); iplanTaskDao.saveAndFlush(planTask);
// 发送APP待办消息
sendMessage(plan, planTask);
String executorId = planTask.getUserId(); String executorId = planTask.getUserId();
long planId = planTask.getId(); long planId = planTask.getId();
for (int i1 = 0; i1 < pointIdList.size(); i1++) { for (int i1 = 0; i1 < pointIdList.size(); i1++) {
...@@ -729,6 +764,42 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -729,6 +764,42 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// return deptMap; // return deptMap;
} }
public void sendMessage(Plan plan, PlanTask planTask) throws Exception {
MsgRo msgRo = new MsgRo();
// 标题
msgRo.setName(plan.getName());
// 内容
String body = "";
body += "待执行巡检任务" + TAB;
body += "巡检任务名称:" + plan.getName() + TAB;
body += "执行时间:" + planTask.getBeginTime() + "-" + planTask.getEndTime();
msgRo.setContent(body);
// 接收人
ArrayList<String> userIdList = new ArrayList<>();
userIdList.add(planTask.getUserId());
msgRo.setRecivers(userIdList);
msgRo.setMsgType(msgType);
msgRo.setTerminal(APP_WEB);
msgRo.setSendTime(DateTime.now().toString());
// 关联id
msgRo.setRelationId(String.valueOf(plan.getId()));
// 扩展参数
HashMap<String, String> extras = new HashMap<>();
extras.put("type", msgType);
extras.put("planId", String.valueOf(plan.getId()));
extras.put("planTaskId", String.valueOf(planTask.getId()));
msgRo.setExtras(extras);
msgRo.setIsSendApp(true);
msgRo.setIsSendWeb(true);
msgRo.setCategory(RuleConstant.TASK);
// PushMsgParam pushMsgParam = new PushMsgParam();
// rulePlanService.sendRule(pushMsgParam);
log.info("巡检待办任务:%s {}", JSON.toJSON(msgRo));
//触发规则
ruleTrigger.publish(msgRo, packageId, new String[0]);
}
@Override @Override
public List<PlanTask> getPlanTaskByRouteId(Long routeId) { public List<PlanTask> getPlanTaskByRouteId(Long routeId) {
List<PlanTask> planTaskList = planTaskMapper.getPlanTaskByRouteId(routeId); List<PlanTask> planTaskList = planTaskMapper.getPlanTaskByRouteId(routeId);
......
...@@ -261,6 +261,7 @@ public class PlanServiceImpl implements IPlanService { ...@@ -261,6 +261,7 @@ public class PlanServiceImpl implements IPlanService {
} else { } else {
if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){ if (PlanStatusEnum.EXAMINE_THREE.getValue() != status){
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核 rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核任务, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核任务通知
} else { } else {
rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核完成, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核完成 rulePlanService.addPlanAuditRule(plan, userIds, RuleTypeEnum.计划审核完成, ExecuteStateNameEnum.getNameByCode(excuteState)); // 计划审核完成
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment