Commit 061d3b27 authored by 高建强's avatar 高建强

item:巡查数据-站端与中心级数据同步

parent c7f385f5
package com.yeejoin.amos.patrol.common.enums;
public enum PatrolDataSyncTopicEnum {
EQM_PATROL_CREATED("check", "eqm.patrol.created"),
CHECK("check", "patrol/sync/check"),
CHECK_INPUT("checkInput", "patrol/sync/checkInput"),
CHECK_SHOT("checkShot", "patrol/sync/checkShot"),
PLAN_TASK_DETAIL("planTaskDetail", "patrol/sync/planTaskDetail");
PLAN_TASK("planTask", "patrol/sync/planTask"),
PLAN_TASK_DETAIL("planTaskDetail", "patrol/sync/planTaskDetail"),
CHECK_INPUT_BO("checkInputBo", "patrol/sync/checkShotBo");
private String type;
private String topic;
......
package com.yeejoin.amos.patrol.business.bo;
import lombok.Data;
import java.util.Date;
/**
* 基本实体扩展类
*/
@Data
public class BasicEntityBo {
private long id;
private Date createDate;
}
package com.yeejoin.amos.patrol.business.bo;
import lombok.Data;
/**
* @ProjectName: YeeAMOSPatrolRoot
* @Package: com.yeejoin.amos.patrol.business.bo
* @ClassName: CheckInputBo
* @Author: Jianqiang Gao
* @Description: CheckInputBo
* @Date: 2022/6/1 9:30
* @Version: 1.0
*/
@Data
public class CheckInputSyncBo extends BasicEntityBo {
/**
* 巡检记录id
*/
private Long checkId;
/**
* 检查项id
*/
private Long inputId;
/**
* 巡检点检查项
*/
private Long routePointItemId;
/**
* 是否合格
*/
private String isOk;
/**
* 序号
*/
private int orderNo;
/**
* 权限系统org code
*/
private String orgCode;
/**
* 检查点分类id
*/
private Long pointClassifyId;
/**
* 检查点分类名称
*/
private String pointClassifyName;
/**
* 评分
*/
private int score;
/**
* 备注
*/
private String remark;
private String bizOrgName;
private String bizOrgCode;
private String pointName;
private String pointId;
private String inputName;
private String inputValue;
private String checkStatus;
private String planName;
private String planId;
private String routeName;
private String routeId;
private String userName;
private String userId;
private String depName;
private String depId;
private String eqName;
private String eqId;
private String eqCode;
private String systemName;
private String planTaskId;
private String planCompletionTime;
private String equipmentTypeCode;
private String companyCode;
private String inputCode;
private String pointCode;
private String buildName;
private String buildCode;
private String protectedObjectCode;
private String protectedObjectName;
private String checkTime;
}
\ No newline at end of file
package com.yeejoin.amos.patrol.business.dao.mapper;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.dto.InputCheckDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface CheckInputMapper extends BaseMapper {
InputCheckDto getByCheckIdAndItemId(@Param(value = "checkId") Long checkId, @Param(value = "itemId") Long itemId);
InputCheckDto getByCheckIdAndItemIdAndRoutePointItemId(@Param(value = "checkId") Long checkId, @Param(value =
"itemId") Long itemId, @Param(value = "routePointItemId") Long routePointItemId, @Param(value = "checkInputId") Long checkInputId);
List<CheckInputSyncBo> getCheckInputSyncBoList(Map<String, Object> map);
}
......@@ -3,9 +3,12 @@ package com.yeejoin.amos.patrol.business.service.action;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckInputMapper;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckInputDao;
import com.yeejoin.amos.patrol.business.dao.repository.IInputItemDao;
import com.yeejoin.amos.patrol.business.entity.mybatis.EquipmentInputItemRo;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.common.enums.CheckStatusEnum;
import com.yeejoin.amos.patrol.common.enums.YesOrNoEnum;
import com.yeejoin.amos.patrol.dao.entity.CheckInput;
......@@ -16,7 +19,12 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/**
......@@ -38,6 +46,12 @@ public class AcceptEquipmentRules {
@Value("${input.statute.prefix}")
private String statutePre;
@Autowired
private IPatrolDataSyncService patrolDataSyncService;
@Autowired
private CheckInputMapper checkInputMapper;
public void getContent(
String itemNo,
......@@ -119,6 +133,17 @@ public class AcceptEquipmentRules {
checkInput.setIsOk(CheckStatusEnum.UNQUALIFIED.getCode());
}
checkInputDao.save(checkInput);
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
Map<String, Object> map = new HashMap<>();
map.put("id", checkInput.getId());
List<CheckInputSyncBo> checkInputSyncBoList = checkInputMapper.getCheckInputSyncBoList(map);
patrolDataSyncService.checkInputBoDataSync(checkInputSyncBoList);
}
});
log.info(checkInput.getPointClassifyName()+"规则校验返回结果修改成功");
}
}
......@@ -19,6 +19,8 @@ import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.dao.mapper.*;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.dao.entity.Plan;
......@@ -45,10 +47,6 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckMapper;
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.RouteMapper;
import com.yeejoin.amos.patrol.business.dao.repository.ICatalogTreeDao;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckDao;
import com.yeejoin.amos.patrol.business.dao.repository.ICheckInputDao;
......@@ -154,6 +152,9 @@ public class CheckServiceImpl implements ICheckService {
@Autowired
private IPatrolDataSyncService patrolDataSyncService;
@Autowired
private CheckInputMapper checkInputMapper;
// @Value("${file.ip}")
// private String fileIp;
//
......@@ -446,6 +447,17 @@ public class CheckServiceImpl implements ICheckService {
updateTaskStatus(plan.getId(), null);
}
}
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
Map<String, Object> map = new HashMap<>();
map.put("idList", checkInputList.stream().map(CheckInput::getId).collect(Collectors.toList()));
List<CheckInputSyncBo> checkInputSyncBoList = checkInputMapper.getCheckInputSyncBoList(map);
patrolDataSyncService.checkInputBoDataSync(checkInputSyncBoList);
}
});
return new CheckDto(check.getId(), unqualifiedcheckItemList);
} catch (Exception e) {
e.printStackTrace();
......@@ -692,7 +704,17 @@ public class CheckServiceImpl implements ICheckService {
patrolDataSyncService.checkInputDataSync(checkInputList);
}
});
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
Map<String, Object> map = new HashMap<>();
map.put("idList", checkInputList.stream().map(CheckInput::getId).collect(Collectors.toList()));
List<CheckInputSyncBo> checkInputSyncBoList = checkInputMapper.getCheckInputSyncBoList(map);
patrolDataSyncService.checkInputBoDataSync(checkInputSyncBoList);
}
});
return checkDto;
} catch (Exception e) {
e.printStackTrace();
......
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.bo.RoleBo;
import com.yeejoin.amos.boot.biz.common.service.impl.WorkflowExcuteServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckInputMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.LatentDangerFlowRecordMapper;
......@@ -45,6 +46,7 @@ import com.yeejoin.amos.patrol.business.param.LatentDangerPatrolItemParam;
import com.yeejoin.amos.patrol.business.param.LatentDangerPatrolParam;
import com.yeejoin.amos.patrol.business.param.PageParam;
import com.yeejoin.amos.patrol.business.service.intfc.ILatentDangerService;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.business.service.intfc.IRiskJudgmentTaskService;
import com.yeejoin.amos.patrol.business.util.CommonResponse;
import com.yeejoin.amos.patrol.business.util.CommonResponseUtil;
......@@ -73,10 +75,7 @@ import com.yeejoin.amos.patrol.core.async.AsyncTask;
import com.yeejoin.amos.patrol.core.common.request.LatentDangerResultPushSpcRequest;
import com.yeejoin.amos.patrol.core.common.response.DangerListResponse;
import com.yeejoin.amos.patrol.core.util.StringUtil;
import com.yeejoin.amos.patrol.dao.entity.Check;
import com.yeejoin.amos.patrol.dao.entity.CheckShot;
import com.yeejoin.amos.patrol.dao.entity.InputItem;
import com.yeejoin.amos.patrol.dao.entity.PointClassify;
import com.yeejoin.amos.patrol.dao.entity.*;
import com.yeejoin.amos.patrol.exception.YeeException;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.mqtt.WebMqttComponent;
......@@ -92,6 +91,8 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -181,6 +182,9 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
@Autowired
private WorkflowExcuteServiceImpl workflowExecuteService;
@Autowired
private IPatrolDataSyncService patrolDataSyncService;
private static final String permissionType = "SUBMENU";
private static final String acctivePermissionType = "activitiItem";
......@@ -386,6 +390,17 @@ public class LatentDangerServiceImpl implements ILatentDangerService {
private void updateCheckInputDangerState(Long id, int code) {
latentDangerMapper.updateCheckInputDangerState(id, code);
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
Map<String, Object> map = new HashMap<>();
map.put("id", id);
List<CheckInputSyncBo> checkInputSyncBoList = checkInputMapper.getCheckInputSyncBoList(map);
patrolDataSyncService.checkInputBoDataSync(checkInputSyncBoList);
}
});
}
private String buildLocalHost() {
......
package com.yeejoin.amos.patrol.business.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.common.enums.PatrolDataSyncTopicEnum;
......@@ -15,7 +16,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@Async
......@@ -32,12 +35,16 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
public void checkDataSync(Check check) {
if (check != null) {
try {
webMqttComponent.publish(PatrolDataSyncTopicEnum.CHECK.getTopic(), JSONObject.toJSONString(check));
String message = buildSyncMessage(PatrolDataSyncTopicEnum.CHECK.getTopic(), check);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
String isOk = check.getIsOk();
long taskDetailId = check.getPlanTaskDetailId();
List<PlanTaskDetail> planTaskDetailList = planTaskDetailDao.findAllByIdAndStatus(taskDetailId, isOk);
if (CollectionUtils.isNotEmpty(planTaskDetailList)) {
planTaskDetailList.forEach(x -> webMqttComponent.publish(PatrolDataSyncTopicEnum.PLAN_TASK_DETAIL.getTopic(), JSONObject.toJSONString(x)));
planTaskDetailList.forEach(x -> {
String detailMessage = buildSyncMessage(PatrolDataSyncTopicEnum.PLAN_TASK_DETAIL.getTopic(), x);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), detailMessage);
});
}
} catch (Exception e) {
log.error("站端与中心级巡检数据【check或planTaskDetail】同步推送失败-----------" + e.getMessage());
......@@ -46,10 +53,36 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
}
@Override
public void checkDataSync(List<Check> checkList) {
if (CollectionUtils.isNotEmpty(checkList)) {
try {
checkList.forEach(check -> {
String message = buildSyncMessage(PatrolDataSyncTopicEnum.CHECK.getTopic(), check);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
String isOk = check.getIsOk();
long taskDetailId = check.getPlanTaskDetailId();
List<PlanTaskDetail> planTaskDetailList = planTaskDetailDao.findAllByIdAndStatus(taskDetailId, isOk);
if (CollectionUtils.isNotEmpty(planTaskDetailList)) {
planTaskDetailList.forEach(x -> {
String detailMessage = buildSyncMessage(PatrolDataSyncTopicEnum.PLAN_TASK_DETAIL.getTopic(), x);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), detailMessage);
});
}
});
} catch (Exception e) {
log.error("站端与中心级巡检数据【check或planTaskDetail】同步推送失败-----------" + e.getMessage());
}
}
}
@Override
public void checkInputDataSync(List<CheckInput> checkInputList) {
try {
if (CollectionUtils.isNotEmpty(checkInputList)) {
checkInputList.forEach(x -> webMqttComponent.publish(PatrolDataSyncTopicEnum.CHECK_INPUT.getTopic(), JSONObject.toJSONString(x)));
checkInputList.forEach(x -> {
String message = buildSyncMessage(PatrolDataSyncTopicEnum.CHECK_INPUT.getTopic(), x);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
});
}
} catch (Exception e) {
log.error("站端与中心级巡检数据【checkInput】同步推送失败-----------" + e.getMessage());
......@@ -60,10 +93,46 @@ public class PatrolDataSyncServiceImpl implements IPatrolDataSyncService {
public void checkShotDataSync(List<CheckShot> checkShotList) {
try {
if (CollectionUtils.isNotEmpty(checkShotList)) {
checkShotList.forEach(x -> webMqttComponent.publish(PatrolDataSyncTopicEnum.CHECK_SHOT.getTopic(), JSONObject.toJSONString(x)));
checkShotList.forEach(x -> {
String message = buildSyncMessage(PatrolDataSyncTopicEnum.CHECK_SHOT.getTopic(), x);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
});
}
} catch (Exception e) {
log.error("站端与中心级巡检数据【checkShot】同步推送失败-----------" + e.getMessage());
}
}
@Override
public void checkInputBoDataSync(CheckInputSyncBo checkInputSyncBo) {
try {
if (checkInputSyncBo != null) {
String message = buildSyncMessage(PatrolDataSyncTopicEnum.CHECK_INPUT_BO.getTopic(), checkInputSyncBo);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
}
} catch (Exception e) {
log.error("站端与中心级巡检数据【CheckInputSyncBo】同步推送失败-----------" + e.getMessage());
}
}
@Override
public void checkInputBoDataSync(List<CheckInputSyncBo> checkInputSyncBoList) {
try {
if (CollectionUtils.isNotEmpty(checkInputSyncBoList)) {
checkInputSyncBoList.forEach(x -> {
String message = buildSyncMessage(PatrolDataSyncTopicEnum.CHECK_INPUT_BO.getTopic(), x);
webMqttComponent.publish(PatrolDataSyncTopicEnum.EQM_PATROL_CREATED.getTopic(), message);
});
}
} catch (Exception e) {
log.error("站端与中心级巡检数据【CheckInputSyncBo】同步推送失败-----------" + e.getMessage());
}
}
public String buildSyncMessage(String topic, Object object) {
Map<String, Object> map = new HashMap<>();
map.put("topic", topic);
map.put("data", object);
return JSONObject.toJSONString(map);
}
}
package com.yeejoin.amos.patrol.business.service.intfc;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.dao.entity.Check;
import com.yeejoin.amos.patrol.dao.entity.CheckInput;
import com.yeejoin.amos.patrol.dao.entity.CheckShot;
......@@ -17,7 +18,13 @@ public interface IPatrolDataSyncService {
void checkDataSync(Check check);
void checkDataSync(List<Check> checkList);
void checkInputDataSync(List<CheckInput> checkInputList);
void checkShotDataSync(List<CheckShot> checkShotList);
void checkInputBoDataSync(CheckInputSyncBo checkInputSyncBo);
void checkInputBoDataSync(List<CheckInputSyncBo> checkInputSyncBoList);
}
......@@ -3,12 +3,11 @@ package com.yeejoin.amos.patrol.quartz;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.MessageModel;
import com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo;
import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dao.mapper.*;
import com.yeejoin.amos.patrol.business.dao.mapper.CheckInputMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.MsgMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper;
import com.yeejoin.amos.patrol.business.dao.repository.*;
......@@ -16,6 +15,7 @@ import com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import com.yeejoin.amos.patrol.business.param.MsgConfigParam;
import com.yeejoin.amos.patrol.business.service.intfc.IMessageService;
import com.yeejoin.amos.patrol.business.service.intfc.IPatrolDataSyncService;
import com.yeejoin.amos.patrol.business.util.DateUtil;
import com.yeejoin.amos.patrol.business.util.Toke;
import com.yeejoin.amos.patrol.common.enums.*;
......@@ -23,7 +23,6 @@ import com.yeejoin.amos.patrol.core.async.AsyncTask;
import com.yeejoin.amos.patrol.dao.entity.*;
import com.yeejoin.amos.patrol.feign.RemoteSecurityService;
import com.yeejoin.amos.patrol.mqtt.WebMqttComponent;
import org.apache.commons.collections.CollectionUtils;
import org.quartz.Job;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -31,6 +30,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
......@@ -51,9 +52,6 @@ public class JobService implements IJobService {
private IPlanTaskDao iPlanTaskDao;
@Autowired
private IPlanDao iPlanDao;
@Autowired
private IPlanTaskDetailDao iPlanTaskDetailDao;
@Autowired
......@@ -81,7 +79,11 @@ public class JobService implements IJobService {
private ITaskFeedbackDao taskFeedbackDao;
@Autowired
private CheckMapper checkMapper;
private IPatrolDataSyncService patrolDataSyncService;
@Autowired
private CheckInputMapper checkInputMapper;
@Autowired
private RemoteSecurityService remoteSecurityService;
......@@ -91,7 +93,6 @@ public class JobService implements IJobService {
private WebMqttComponent webMqttComponent;
@Autowired
JcsFeignClient jcsFeignClient;
......@@ -190,10 +191,9 @@ public class JobService implements IJobService {
private void updatePlanTaskStatus(PlanTask planTask, int status) {
planTask.setFinishStatus(status);
iPlanTaskDao.save(planTask);
List<PlanTaskDetail> planTaskDetails = iPlanTaskDetailDao.findAllByTaskNoAndStatus(planTask.getId(),PlanTaskDetailStatusEnum.NOTSTARTED.getValue());
List<PlanTaskDetail> planTaskDetails = iPlanTaskDetailDao.findAllByTaskNoAndStatus(planTask.getId(), PlanTaskDetailStatusEnum.NOTSTARTED.getValue());
if (!planTaskDetails.isEmpty()) {
planTaskDetails.stream()
.forEach(action -> {
planTaskDetails.stream().forEach(action -> {
action.setIsFinish(PlanTaskDetailIsFinishEnum.OVERTIME.getValue());
action.setStatus(PlanTaskDetailStatusEnum.OMISSION.getValue());
iPlanTaskDetailDao.saveAndFlush(action);
......@@ -204,8 +204,8 @@ public class JobService implements IJobService {
}
}
private void updateTaskStatus(Plan plan){
Toke toke= remoteSecurityService.getServerToken();
private void updateTaskStatus(Plan plan) {
Toke toke = remoteSecurityService.getServerToken();
RequestContext.setToken(toke.getToke());
RequestContext.setProduct(toke.getProduct());
RequestContext.setAppKey(toke.getAppKey());
......@@ -224,120 +224,74 @@ public class JobService implements IJobService {
* @param planTask
*/
private void createOmissionCheckRecord(PlanTask planTask) {
List<PlanTaskPointInputItemBo> planTaskPointInputItems = planTaskMapper
.getPlanTaskPointInputItemByPlanTaskId(planTask.getId(),PlanTaskDetailStatusEnum.OMISSION.getValue());
List<PlanTaskPointInputItemBo> planTaskPointInputItems = planTaskMapper.getPlanTaskPointInputItemByPlanTaskId(planTask.getId(), PlanTaskDetailStatusEnum.OMISSION.getValue());
Map<Long, Check> checkMap = new HashMap<>();
Set<Long> checkIds = new HashSet<Long>();
Map<String,String> deptMap =new HashMap<>();
//Toke toke= remoteSecurityService.getServerToken();
//查询用户名字
//修改巡检p_plan_task orgcode为执行人的org_coed -- add by wujunkai 20201216
String userIds="";
Map<String, String> deptMap = new HashMap<>();
StringBuffer deptName = new StringBuffer();
StringBuffer deptId = new StringBuffer();
StringBuffer userName = new StringBuffer();
if(planTask.getUserDept().indexOf(",")>0){
if (planTask.getUserDept().indexOf(",") > 0) {
List<String> ids = Arrays.asList(planTask.getUserId().split(","));
List<String> depts = Arrays.asList(planTask.getUserDept().split(","));
depts.stream().forEach(dept->{
deptMap.put(dept.substring(0,dept.indexOf("@")),dept.substring(dept.indexOf("@")+1));
deptId.append(dept.substring(dept.indexOf("@")+1)).append(",");
depts.stream().forEach(dept -> {
deptMap.put(dept.substring(0, dept.indexOf("@")), dept.substring(dept.indexOf("@") + 1));
deptId.append(dept.substring(dept.indexOf("@") + 1)).append(",");
});
Set<String> departmentOrgCode= new HashSet<>();
for (String key:deptMap.keySet()) {
Set<String> departmentOrgCode = new HashSet<>();
for (String key : deptMap.keySet()) {
departmentOrgCode.add(deptMap.get(key));
}
StringBuffer deptIds = new StringBuffer();
Iterator it = departmentOrgCode.iterator();
while(it.hasNext()){
while (it.hasNext()) {
deptIds.append(it.next()).append(",");
}
// for (int j = 0; j < ids.size(); j++) {
String realNames="";
// List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(),
// toke.getProduct(), toke.getAppKey(), deptIds.toString().substring(0,deptIds.toString().length()-1));
// List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(),
// toke.getProduct(), toke.getAppKey(), planTask.getUserId());
FeignClientResult<List<Map<String, Object>>> agencyUserModelsDate= jcsFeignClient.selectByAmosOrgIdDeptList(planTask.getUserId());
String realNames = "";
FeignClientResult<List<Map<String, Object>>> agencyUserModelsDate = jcsFeignClient.selectByAmosOrgIdDeptList(planTask.getUserId());
List<Map<String, Object>> agencyUserModels = agencyUserModelsDate.getResult();
FeignClientResult<List<Map<String, Object>>> departmentModeldate= jcsFeignClient.selectByIdDeptList(deptIds.toString().substring(0,deptIds.toString().length()-1));
FeignClientResult<List<Map<String, Object>>> departmentModeldate = jcsFeignClient.selectByIdDeptList(deptIds.toString().substring(0, deptIds.toString().length() - 1));
List<Map<String, Object>> departmentModels = departmentModeldate.getResult();
if(!agencyUserModels.isEmpty()){
realNames = agencyUserModels.stream().map(map->map.get("bizOrgName").toString()).collect(Collectors.joining(","));
if (!agencyUserModels.isEmpty()) {
realNames = agencyUserModels.stream().map(map -> map.get("bizOrgName").toString()).collect(Collectors.joining(","));
userName.append(realNames);
}
if(!departmentModels.isEmpty()){
String departmentName = departmentModels.stream().map(map->map.get("bizOrgName").toString()).collect(Collectors.joining(","));
if (!departmentModels.isEmpty()) {
String departmentName = departmentModels.stream().map(map -> map.get("bizOrgName").toString()).collect(Collectors.joining(","));
deptName.append(departmentName);
};
// }
}else{
String realNames="";
deptId.append(planTask.getUserDept().substring(planTask.getUserDept().indexOf("@")+1)).append(",");
deptMap.put(planTask.getUserDept().substring(0,planTask.getUserDept().indexOf("@")),planTask.getUserDept().substring(planTask.getUserDept().indexOf("@")+1));
// List<DepartmentModel> departmentModel = remoteSecurityService.getlistDepartmentByDeptIds(
// toke.getToke(), toke.getProduct(), toke.getAppKey(), deptMap.get(planTask.getUserId()));
}
} else {
String realNames = "";
deptId.append(planTask.getUserDept().substring(planTask.getUserDept().indexOf("@") + 1)).append(",");
deptMap.put(planTask.getUserDept().substring(0, planTask.getUserDept().indexOf("@")), planTask.getUserDept().substring(planTask.getUserDept().indexOf("@") + 1));
FeignClientResult<List<Map<String, Object>>> departmentModeldate= jcsFeignClient.selectByIdDeptList( deptMap.get(planTask.getUserId()));
FeignClientResult<List<Map<String, Object>>> departmentModeldate = jcsFeignClient.selectByIdDeptList(deptMap.get(planTask.getUserId()));
List<Map<String, Object>> departmentModel = departmentModeldate.getResult();
if(departmentModel.size()>0){
departmentModel.stream().forEach(model->{
if (departmentModel.size() > 0) {
departmentModel.stream().forEach(model -> {
deptName.append(model.get("bizOrgName").toString());
});
}else{
} else {
deptName.append("其他").append(",");
}
// List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(),
// planTask.getUserId());
FeignClientResult<List<Map<String, Object>>> agencyUserModelsDate= jcsFeignClient.selectByAmosOrgIdDeptList(planTask.getUserId());
FeignClientResult<List<Map<String, Object>>> agencyUserModelsDate = jcsFeignClient.selectByAmosOrgIdDeptList(planTask.getUserId());
List<Map<String, Object>> agencyUserModels = agencyUserModelsDate.getResult();
if(!agencyUserModels.isEmpty()){
realNames = agencyUserModels.stream().map(map->map.get("bizOrgName").toString()).collect(Collectors.joining(","));
if (!agencyUserModels.isEmpty()) {
realNames = agencyUserModels.stream().map(map -> map.get("bizOrgName").toString()).collect(Collectors.joining(","));
}
userName.append(realNames);
}
//查询部门名称
// String depId="";
// String depName="";
/**
* 对部门查询有问题需要修改
if(iPlanDao.existsById(planTask.getPlanId())){
Plan plan = iPlanDao.findById(planTask.getPlanId()).get();
DepartmentModel departmentModel = remoteSecurityService.getDepartmentByDeptId(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getDeptId());
depId = plan.getDeptId();
depName = departmentModel.getDepartmentName();
} */
for(PlanTaskPointInputItemBo arg:planTaskPointInputItems){
List<Check> checkList = new ArrayList<>();
List<Long> checkInputIdList = new ArrayList<>();
for (PlanTaskPointInputItemBo arg : planTaskPointInputItems) {
Check check = new Check();
if (checkMap.get(arg.getPointId()) == null) {
check.setOrgCode(arg.getOrgCode());
check.setUserId(planTask.getUserId());
......@@ -347,7 +301,7 @@ public class JobService implements IJobService {
} else {
check.setUserName(userName.toString());
}
check.setDepId(deptId.toString().substring(0,deptId.length()-1));
check.setDepId(deptId.toString().substring(0, deptId.length() - 1));
check.setDepName(deptName.toString());
check.setPointId(arg.getPointId());
......@@ -364,6 +318,7 @@ public class JobService implements IJobService {
check.setCheckTime(arg.getEndTime());
check.setIsOk(CheckStatusEnum.OMISSION.getCode());
check = iCheckDao.saveAndFlush(check);
checkList.add(check);
checkMap.put(arg.getPointId(), check);
checkIds.add(check.getId());
} else {
......@@ -380,7 +335,8 @@ public class JobService implements IJobService {
checkInput.setInputName(arg.getInputName());
checkInput.setPointClassifyId(arg.getClassifyId());
checkInput.setPointClassifyName(arg.getClassifyName());
iCheckInputDao.saveAndFlush(checkInput);
CheckInput checkInput1 = iCheckInputDao.saveAndFlush(checkInput);
checkInputIdList.add(checkInput1.getId());
}
//漏检修改APP待办通知状态不展示
......@@ -388,7 +344,7 @@ public class JobService implements IJobService {
plan.setId(planTask.getPlanId());
try {
updateTaskStatus(plan);
}catch (InnerInvokException e){
} catch (InnerInvokException e) {
log.error("待办消息不存在");
}
......@@ -399,27 +355,9 @@ public class JobService implements IJobService {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String[] ids = usrIds.split(",");
for (String userId : usrIds.split(",")) {
// Map<String,AgencyUserModel> agencyUserModelMap = remoteSecurityService.getUsersMap(toke.getToke(),toke.getProduct(),toke.getAppKey(), Collections.singleton(userIds));
// List<Map<String, String>> idOrgCodeList = new ArrayList<>();
// for(Map.Entry<String, AgencyUserModel> entry : agencyUserModelMap.entrySet()){
// String id = entry.getKey();
// AgencyUserModel agencyUserModel = entry.getValue();
// StringBuffer agencyUserOrgcode = new StringBuffer();
// agencyUserModel.getCompanys().forEach(companyModel -> {
// agencyUserOrgcode.append(companyModel.getOrgCode()).append(",");
// });
// Map<String,String> map = new HashMap<>();
// map.put(id,agencyUserOrgcode.toString().substring(0,agencyUserOrgcode.length()-1));
// }
// Map<String, String> userIdOrgCodeMap = new HashMap<>(ids.length);
// if (!CollectionUtils.isEmpty(idOrgCodeList)) {
// userIdOrgCodeMap = idOrgCodeList.stream().collect(Collectors.toMap(x-> String.valueOf(x.get(
// "id")), x->x.get("org_code")));
// }
if (ObjectUtils.isEmpty(userId)) {
continue;
}
// planTaskMapper.reformStatistics(userId, sdf.format(new Date()), planTask.getOrgCode());
planTaskMapper.reformStatistics(userId, sdf.format(new Date()), planTask.getOrgCode());
}
......@@ -438,187 +376,23 @@ public class JobService implements IJobService {
//数字换流站页面刷新
try {
webMqttComponent.publish(patrolTopic, "");
}catch (Exception e){
log.error("数字换流站页面推送失败-----------"+e.getMessage());
}
}
// private void createOmissionCheckRecord(PlanTask planTask) {
// List<PlanTaskPointInputItemBo> planTaskPointInputItems = planTaskMapper
// .getPlanTaskPointInputItemByPlanTaskId(planTask.getId(),PlanTaskDetailStatusEnum.OMISSION.getValue());
// Map<Long, Check> checkMap = new HashMap<>();
// Set<Long> checkIds = new HashSet<Long>();
// Map<String,String> deptMap =new HashMap<>();
// Toke toke= remoteSecurityService.getServerToken();
// //查询用户名字
//
// //修改巡检p_plan_task orgcode为执行人的org_coed -- add by wujunkai 20201216
// String userIds="";
// StringBuffer deptName = new StringBuffer();
// StringBuffer deptId = new StringBuffer();
// StringBuffer userName = new StringBuffer();
// if(planTask.getUserDept().indexOf(",")>0){
// List<String> ids = Arrays.asList(planTask.getUserId().split(","));
// List<String> depts = Arrays.asList(planTask.getUserDept().split(","));
// depts.stream().forEach(dept->{
// deptMap.put(dept.substring(0,dept.indexOf("@")),dept.substring(dept.indexOf("@")+1));
// deptId.append(dept.substring(dept.indexOf("@")+1)).append(",");
// });
// Set<String> departmentOrgCode= new HashSet<>();
// for (String key:deptMap.keySet()) {
// departmentOrgCode.add(deptMap.get(key));
// }
// StringBuffer deptIds = new StringBuffer();
// Iterator it = departmentOrgCode.iterator();
// while(it.hasNext()){
// deptIds.append(it.next()).append(",");
// }
//
//// for (int j = 0; j < ids.size(); j++) {
// String realNames="";
// List<DepartmentModel> departmentModels = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), deptIds.toString().substring(0,deptIds.toString().length()-1));
// List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), planTask.getUserId());
// if(!agencyUserModels.isEmpty()){
// realNames = agencyUserModels.stream().map(AgencyUserModel::getRealName).collect(Collectors.joining(","));
// userName.append(realNames);
// }
// if(!departmentModels.isEmpty()){
// String departmentName = departmentModels.stream().map(DepartmentModel::getDepartmentName).collect(Collectors.joining(","));
// deptName.append(departmentName);
// };
//// }
//
// }else{
// String realNames="";
// deptId.append(planTask.getUserDept().substring(planTask.getUserDept().indexOf("@")+1)).append(",");
// deptMap.put(planTask.getUserDept().substring(0,planTask.getUserDept().indexOf("@")),planTask.getUserDept().substring(planTask.getUserDept().indexOf("@")+1));
// List<DepartmentModel> departmentModel = remoteSecurityService.getlistDepartmentByDeptIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), deptMap.get(planTask.getUserId()));
// if(departmentModel.size()>0){
// departmentModel.stream().forEach(model->{
// deptName.append(model.getDepartmentName());
// });
// }else{
// deptName.append("其他").append(",");
// }
// List<AgencyUserModel> agencyUserModels = remoteSecurityService.listUserByUserIds(toke.getToke(), toke.getProduct(), toke.getAppKey(), planTask.getUserId());
// if(!agencyUserModels.isEmpty()){
// realNames = agencyUserModels.stream().map(AgencyUserModel::getRealName).collect(Collectors.joining(","));
//// userIds = agencyUserModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.joining(","));
// }
// userName.append(realNames);
// }
//
// //查询部门名称
//// String depId="";
//// String depName="";
// /**
// * 对部门查询有问题需要修改
//
// if(iPlanDao.existsById(planTask.getPlanId())){
// Plan plan = iPlanDao.findById(planTask.getPlanId()).get();
// DepartmentModel departmentModel = remoteSecurityService.getDepartmentByDeptId(toke.getToke(), toke.getProduct(), toke.getAppKey(), plan.getDeptId());
// depId = plan.getDeptId();
// depName = departmentModel.getDepartmentName();
// } */
//
// for(PlanTaskPointInputItemBo arg:planTaskPointInputItems){
// Check check = new Check();
// if (checkMap.get(arg.getPointId()) == null) {
// check.setOrgCode(arg.getOrgCode());
// check.setUserId(planTask.getUserId());
// int len = userName.toString().indexOf(",");
// if (len != -1) {
// check.setUserName(userName.toString());
// } else {
// check.setUserName(userName.toString());
// }
// check.setDepId(deptId.toString().substring(0,deptId.length()-1));
// check.setDepName(deptName.toString());
// check.setPointId(arg.getPointId());
// check.setUploadTime(new Date());
// check.setPlanId(arg.getPlanId());
// check.setPlanTaskId(arg.getPlanTaskId());
// check.setPlanTaskDetailId(arg.getPlanTaskDetailId());
// check.setRouteId(arg.getRouteId());
// check.setCheckTime(arg.getEndTime());
// check.setIsOk(CheckStatusEnum.OMISSION.getCode());
// check = iCheckDao.saveAndFlush(check);
// checkMap.put(arg.getPointId(), check);
// checkIds.add(check.getId());
// } else {
// check = checkMap.get(arg.getPointId());
// }
// if (arg.getInputItemId() != null) {
// CheckInput checkInput = new CheckInput();
// checkInput.setCheckId(check.getId());
// checkInput.setInputId(arg.getInputItemId());
// checkInput.setIsOk(CheckStatusEnum.OMISSION.getCode());
// checkInput.setRoutePointItemId(arg.getRoutePointItemId());
// checkInput.setOrderNo(arg.getOrderNo());
// checkInput.setOrgCode(arg.getOrgCode());
// checkInput.setInputName(arg.getInputName());
// checkInput.setPointClassifyId(arg.getClassifyId());
// checkInput.setPointClassifyName(arg.getClassifyName());
// iCheckInputDao.saveAndFlush(checkInput);
// }
// }
//
// String usrIds = planTask.getUserId();
// if (!ObjectUtils.isEmpty(usrIds)) {
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
// String[] ids = usrIds.split(",");
// for (String userId : usrIds.split(",")) {
// Map<String,AgencyUserModel> agencyUserModelMap = remoteSecurityService.getUsersMap(toke.getToke(),toke.getProduct(),toke.getAppKey(), Collections.singleton(userIds));
// List<Map<String, String>> idOrgCodeList = new ArrayList<>();
// for(Map.Entry<String, AgencyUserModel> entry : agencyUserModelMap.entrySet()){
// String id = entry.getKey();
// AgencyUserModel agencyUserModel = entry.getValue();
// StringBuffer agencyUserOrgcode = new StringBuffer();
// agencyUserModel.getCompanys().forEach(companyModel -> {
// agencyUserOrgcode.append(companyModel.getOrgCode()).append(",");
// });
// Map<String,String> map = new HashMap<>();
// map.put(id,agencyUserOrgcode.toString().substring(0,agencyUserOrgcode.length()-1));
// }
// Map<String, String> userIdOrgCodeMap = new HashMap<>(ids.length);
// if (!CollectionUtils.isEmpty(idOrgCodeList)) {
// userIdOrgCodeMap = idOrgCodeList.stream().collect(Collectors.toMap(x-> String.valueOf(x.get(
// "id")), x->x.get("org_code")));
// }
// if (ObjectUtils.isEmpty(userId)) {
// continue;
// }
//// planTaskMapper.reformStatistics(userId, sdf.format(new Date()), planTask.getOrgCode());
// planTaskMapper.reformStatistics(userId, sdf.format(new Date()), userIdOrgCodeMap.get(userId));
//
// }
// }
//
// // 向3d推送数据,发送消息推送
// checkIds.forEach(checkId -> {
// try {
// asyncTask.pushCheckInfoTo3D(checkId);
// asyncTask.pushCheckMessage(checkId);
// } catch (InterruptedException e) {
// log.error(e.getMessage(), e);
// e.printStackTrace();
// }
// });
// //数字换流站页面刷新
// try {
// webMqttComponent.publish(patrolTopic, "");
// }catch (Exception e){
// log.error("数字换流站页面推送失败-----------"+e.getMessage());
// }
//
//
// }
} catch (Exception e) {
log.error("数字换流站页面推送失败-----------" + e.getMessage());
}
// 巡检站端与中心级数据同步
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() {
@Override
public void afterCommit() {
// 事物提交后业务逻辑
patrolDataSyncService.checkDataSync(checkList);
Map<String, Object> map = new HashMap<>();
map.put("idList", checkInputIdList);
List<CheckInputSyncBo> checkInputSyncBoList = checkInputMapper.getCheckInputSyncBoList(map);
patrolDataSyncService.checkInputBoDataSync(checkInputSyncBoList);
}
});
}
private void removeJob(String jobName) {
log.debug("removeJob==jobName==" + jobName);
QuartzManager.removeJob(jobName);
......@@ -657,16 +431,14 @@ public class JobService implements IJobService {
if (iTaskDao.existsById(taskId)) {
Task task = iTaskDao.findById(taskId).get();
Toke toke= remoteSecurityService.getServerToken();
Toke toke = remoteSecurityService.getServerToken();
if (XJConstant.STATUS_MONITOR_END.equals(jobType)) {
if (TaskStatusEnum.UNDERWAY.getValue() == task.getStatus()) {
task.setStatus(TaskStatusEnum.OVERTIME.getValue());
iTaskDao.saveAndFlush(task);
TaskFeedback taskFeedback = new TaskFeedback();
taskFeedback.setUserId(task.getExecutorId());
taskFeedback.setMessage("该任务在规定时间内未完成,请核实信息!任务名称: " + task.getTitle() + " 要求完成时间: "
+ DateUtil.getDateFormat(task.getFinishTime(), "yyyy-MM-dd HH:mm:ss") + " 发起人:"
+ task.getPublisherName() + " 执行人:" + task.getExecutor());
taskFeedback.setMessage("该任务在规定时间内未完成,请核实信息!任务名称: " + task.getTitle() + " 要求完成时间: " + DateUtil.getDateFormat(task.getFinishTime(), "yyyy-MM-dd HH:mm:ss") + " 发起人:" + task.getPublisherName() + " 执行人:" + task.getExecutor());
taskFeedback.setCreateDate(new Date());
taskFeedback.setUserName(task.getExecutor());
taskFeedback.setFeedbackTime(new Date());
......@@ -675,7 +447,7 @@ public class JobService implements IJobService {
taskFeedback.setMessageType(TaskStatusEnum.OVERTIME.getName());
taskFeedback = taskFeedbackDao.save(taskFeedback);
try {
asyncTask.pushTaskDetailInfoTo3D(toke.getToke(), toke.getProduct(), toke.getAppKey(),taskId); // 超时任务向3D推送
asyncTask.pushTaskDetailInfoTo3D(toke.getToke(), toke.getProduct(), toke.getAppKey(), taskId); // 超时任务向3D推送
} catch (InterruptedException e) {
// TODO Auto-generated catch block
log.error(e.getMessage(), e);
......@@ -683,7 +455,7 @@ public class JobService implements IJobService {
}
}
} else {
messageService.pushTaskMessage(toke.getToke(), toke.getProduct(), toke.getAppKey(),task);
messageService.pushTaskMessage(toke.getToke(), toke.getProduct(), toke.getAppKey(), task);
}
}
removeJob(jobName);
......@@ -704,14 +476,12 @@ public class JobService implements IJobService {
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == status) {
addJob("planTask", XJConstant.STATUS_MONITOR_START, planTask.getId(), beginTime);// 添加监控任务开始时间定时任务
}
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == status
|| PlanTaskFinishStatusEnum.UNDERWAY.getValue() == status) {
if (PlanTaskFinishStatusEnum.NOTSTARTED.getValue() == status || PlanTaskFinishStatusEnum.UNDERWAY.getValue() == status) {
addJob("planTask", XJConstant.STATUS_MONITOR_END, planTask.getId(), endTime);// 添加监控任务开始结束定时任务
}
// 查询需要推送消息提醒
List<MsgConfigParam> configParam = msgMapper.getPlanTaskMsgConfigByUserIdAndStatus(planTask.getUserId().split(","),
"True");
List<MsgConfigParam> configParam = msgMapper.getPlanTaskMsgConfigByUserIdAndStatus(planTask.getUserId().split(","), "True");
if (!configParam.isEmpty()) {
configParam.forEach(config -> {
String jobType = "";
......@@ -733,7 +503,7 @@ public class JobService implements IJobService {
}
} else {
updatePlanTaskStatus(planTask,PlanTaskFinishStatusEnum.OVERTIME.getValue());
updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue());
}
} catch (Exception e) {
log.error(e.getMessage(), e);
......@@ -757,8 +527,8 @@ public class JobService implements IJobService {
updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue());
}
} else {
Toke toke= remoteSecurityService.getServerToken();
messageService.pushPlanTaskMessage(toke.getToke(), toke.getProduct(), toke.getAppKey(),planTask, jobType);
Toke toke = remoteSecurityService.getServerToken();
messageService.pushPlanTaskMessage(toke.getToke(), toke.getProduct(), toke.getAppKey(), planTask, jobType);
}
}
removeJob(jobName);
......@@ -773,8 +543,8 @@ public class JobService implements IJobService {
public void msgJobPerform(long msgId, String jobType, String jobName) {
if (iMsgDao.existsById(msgId)) {
Msg msg = iMsgDao.findById(msgId).get();
Toke toke= remoteSecurityService.getServerToken();
messageService.pushMsgAndSave(toke.getToke(), toke.getProduct(), toke.getAppKey(),msg);
Toke toke = remoteSecurityService.getServerToken();
messageService.pushMsgAndSave(toke.getToke(), toke.getProduct(), toke.getAppKey(), msg);
}
removeJob(jobName);
}
......
......@@ -57,4 +57,91 @@
</where>
limit 1
</select>
<select id="getCheckInputSyncBoList" resultType="com.yeejoin.amos.patrol.business.bo.CheckInputSyncBo" parameterType="java.util.Map">
<![CDATA[
SELECT
ci.id,
ci.input_name,
ci.input_value,
ci.is_ok AS check_status,
ci.is_ok,
ci.check_id,
ci.create_date,
ci.danger_handle_state,
ci.input_id,
ci.order_no,
ci.point_classify_id,
ci.point_classify_name,
ci.remark,
ci.route_point_item_id,
ci.score,
ci.org_code,
cou.bzOrgCode AS biz_org_code,
cou.biz_org_name AS biz_org_name,
c.point_id,
c.point_name,
c.check_time,
pt.end_time AS `date`,
c.plan_id,
c.plan_name,
c.route_id,
c.route_name,
c.user_id,
c.user_name,
c.dep_id,
c.dep_name,
es.id AS eq_id,
es.`name` eq_name,
es.`code` eq_code,
(
SELECT
GROUP_CONCAT(ffs.`name`)
FROM
f_fire_fighting_system ffs
WHERE
find_in_set(ffs.id, es.system_id)
) AS system_name,
CONCAT(pt.id, '') AS plan_task_id,
pt.end_time AS plan_completion_time,
cou.`code` AS company_code,
es.equipment_code AS equipment_type_code,
pii.item_no AS input_code,
pp.point_no as pointCode,
wws.`code` as buildCode,
wws.full_name as buildName
FROM
p_check_input ci
LEFT JOIN p_input_item pii ON pii.id = ci.input_id
LEFT JOIN p_check c ON c.id = ci.check_id
LEFT JOIN p_point pp ON pp.id = c.point_id
LEFT JOIN p_plan_task pt ON pt.id = c.plan_task_id
LEFT JOIN p_point_classify pc ON pc.id = ci.point_classify_id
LEFT JOIN wl_equipment_specific es ON es.id = pc.equipment_id
LEFT JOIN wl_warehouse_structure wws ON wws.id = pp.risk_source_id
LEFT JOIN (
SELECT
biz_org_name,
biz_org_code bzOrgCode,
amos_org_id,
amos_org_code,
`code`
FROM
cb_org_usr
WHERE
amos_org_code <> ''
AND amos_org_code IS NOT NULL
AND biz_org_type = 'COMPANY'
) cou ON cou.amos_org_code = ci.org_code ]]>
<where>
<if test="id != null">
ci.id = #{id}
</if>
<if test="idList != null and idList.size() >0">
AND ci.id IN
<foreach collection="idList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>
\ No newline at end of file
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