Commit fb4bd5d5 authored by chenzhao's avatar chenzhao

提交代码 维保待办

parent bc05eb7a
......@@ -787,6 +787,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
// this.updateBatchById(list);
// /*单位编辑后 code值也应做出修改 2021-09-09 陈召 结束 */8888
orgUsrMapper.updatelistByParentId(orgUsr.getBizOrgCode(), oriOrgUsr.getBizOrgCode());
}else {
orgUsr.setBizOrgCode(oriOrgUsr.getBizOrgCode());
}
updateById(orgUsr);
......
package com.yeejoin.amos.maintenance.business.dto;
import com.yeejoin.amos.component.rule.Label;
import com.yeejoin.amos.component.rule.RuleFact;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* @Author: xl
* @Description: 计划规则触发对象
* @Date: 2021/11/10 10:01
*/
@Data
@RuleFact(value = "维保任务",project = "消息规则")
public class PlanRo implements Serializable {
private static final long serialVersionUID = 1070080521549842475L;
@Label("任务名称")
private String name;
@Label(value = "检查类型名称")
private String checkTypeName;
@Label(value = "执行方法")
private String ruleType;
@Label(value = "执行状态")
private String excuteStateName;
@Label(value = "推送时间")
private String sendTime;
@Label(value = "接收人")
private List<String> recivers;
@Label(value = "发送到web标识")
private Boolean isSendWeb;
@Label(value = "发送到app标识")
private Boolean isSendApp;
@Label("关联id")
private String relationId;
@Label("消息类型")
private String msgType;
@Label(value = "终端标识")
private String terminal;
@Label(value = "类别")
private Integer category;
@Label(value = "扩展参数")
private Map<String, String> extras;
}
package com.yeejoin.amos.maintenance.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Joiner;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.RoleModel;
import com.yeejoin.amos.maintenance.business.constants.XJConstant;
import com.yeejoin.amos.maintenance.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.maintenance.business.dao.mapper.PlanMapper;
......@@ -68,6 +73,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
IPlanTaskDetailDao iPlanTaskDetailDao;
@Autowired
InputItemMapper inputItemMapper;
@Autowired
RulePlanService rulePlanService;
@Override
public Page<HashMap<String, Object>> getPlanTaskInfo(PlanTaskPageParam params) {
......@@ -430,6 +437,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// 2.保存执行数据明细表
planTaskDetail.saveAndFlush(planTaskDetailInstance);
}
sendMessage(plan);
// 定时任务监控
jobService.planTaskAddJob(planTask);
}
......@@ -464,6 +472,25 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
public void sendMessage(Plan plan) throws Exception {
// 查询检查对象对应防火监督负责人id
List<String> extraUserIds = com.google.common.collect.Lists.newArrayList();
//
log.info(String.format("计划对象:%s", JSON.toJSON(plan)));
/* // 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.消息型计划生成, extraUserIds);*/
// NOTIFY
String userIdString = plan.getUserId();
if (org.apache.commons.lang3.StringUtils.isNotBlank(userIdString)) {
String[] userIdArr = userIdString.split(",");
List<String> userIdList = Arrays.asList(userIdArr);
// 规则推送消息
rulePlanService.addPlanRule(plan, null, RuleTypeEnum.任务型计划生成, userIdList);
}
}
@Override
public List<PlanTask> getPlanTaskByRouteId(Long routeId) {
return planTaskMapper.getPlanTaskByRouteId(routeId);
......
package com.yeejoin.amos.maintenance.business.service.impl;
import com.yeejoin.amos.boot.biz.common.constants.RuleConstant;
import com.yeejoin.amos.boot.biz.common.enums.RuleTypeEnum;
import com.yeejoin.amos.component.rule.RuleTrigger;
import com.yeejoin.amos.maintenance.business.dto.PlanRo;
import com.yeejoin.amos.maintenance.business.feign.JCSFeignClient;
import com.yeejoin.amos.maintenance.business.util.DateUtil;
import com.yeejoin.amos.maintenance.dao.entity.Plan;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class RulePlanService {
private final String packageId = "消息/addMaintenance";
private final String msgType = "maintenance";
@Autowired
private RuleTrigger ruleTrigger;
@Autowired
private JCSFeignClient jcsFeignClient;
public Boolean addPlanRule(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) throws Exception {
PlanRo planRo = buildPlanRo(plan, userIds, ruleType, extraUserIds);
//触发规则
ruleTrigger.publish(planRo, packageId, new String[0]);
return true;
}
private PlanRo buildPlanRo(Plan plan, List<String> userIds, RuleTypeEnum ruleType, List<String> extraUserIds) {
PlanRo planRo = new PlanRo();
BeanUtils.copyProperties(plan, planRo);
planRo.setMsgType(msgType);
planRo.setRuleType(ruleType.getCode());
planRo.setRelationId(String.valueOf(plan.getId()));
planRo.setTerminal(ruleType.getTerminal());
planRo.setCategory(ruleType.getCategory());
Map<String, String> map = new HashMap<>();
map.put("planId", String.valueOf(plan.getId()));
if (!ValidationUtil.isEmpty(ruleType.getUrl())){
map.put("url", ruleType.getUrl());
}
if (RuleConstant.WEB.equals(ruleType.getTerminal())){
planRo.setIsSendWeb(true);
} else if (RuleConstant.APP.equals(ruleType.getTerminal())){
planRo.setIsSendApp(true);
} else if (RuleConstant.APP_WEB.equals(ruleType.getTerminal())){
planRo.setIsSendWeb(true);
planRo.setIsSendApp(true);
}
if (!ValidationUtil.isEmpty(extraUserIds)) {
List<String> finalUserIds = userIds;
extraUserIds.forEach(id -> {
if (!finalUserIds.contains(id)) {
finalUserIds.add(id);
}
});
userIds = finalUserIds;
}
planRo.setSendTime(DateUtil.date2LongStr(new Date()));
planRo.setRecivers(userIds);
planRo.setExtras(map);
return planRo;
}
}
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