Commit 7852d225 authored by kongfm's avatar kongfm

Merge branches 'developer' and 'developer' of 172.16.10.76:moa/amos-boot-biz into developer

parents 11fd085f f1162917
...@@ -224,6 +224,11 @@ public class Check extends BasicEntity { ...@@ -224,6 +224,11 @@ public class Check extends BasicEntity {
private String ownerId; private String ownerId;
/** /**
* 业主单位名称
*/
private String ownerName;
/**
* 维保公司id * 维保公司id
*/ */
private String companyId; private String companyId;
...@@ -288,6 +293,13 @@ public class Check extends BasicEntity { ...@@ -288,6 +293,13 @@ public class Check extends BasicEntity {
this.companyName = companyName; this.companyName = companyName;
} }
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getOwnerId() { public String getOwnerId() {
return ownerId; return ownerId;
......
...@@ -140,4 +140,7 @@ public class AlertCalledDto extends BaseDto { ...@@ -140,4 +140,7 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "结案说明") @ApiModelProperty(value = "结案说明")
private String finalReason; private String finalReason;
@ApiModelProperty(value = "是否辅屏查询")
private String isAuxiliaryScreen;
} }
...@@ -217,4 +217,8 @@ public class AlertCalled extends BaseEntity { ...@@ -217,4 +217,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "响应级别") @ApiModelProperty(value = "响应级别")
private String responseLevel; private String responseLevel;
@TableField(exist=false)
@ApiModelProperty(value = "是否辅屏查询")
private String isAuxiliaryScreen;
} }
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant; import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.*; import com.yeejoin.amos.boot.module.common.api.dto.*;
...@@ -37,10 +38,6 @@ import java.util.Map; ...@@ -37,10 +38,6 @@ import java.util.Map;
public class OrgPersonController { public class OrgPersonController {
@Autowired @Autowired
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired
EmqKeeper emqKeeper;
@Value("${jcs.company.topic.delete}")
private String airportDeleteTopic;
/** /**
* 新增人员信息 * 新增人员信息
...@@ -69,11 +66,6 @@ public class OrgPersonController { ...@@ -69,11 +66,6 @@ public class OrgPersonController {
// 删除时,只作逻辑删除 // 删除时,只作逻辑删除
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete",
CommonConstant.IS_DELETE_01)); CommonConstant.IS_DELETE_01));
try {
emqKeeper.getMqttClient().publish(airportDeleteTopic, String.valueOf(id).getBytes(), 2, true);
} catch (Exception e) {
e.getMessage();
}
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
......
package com.yeejoin.amos.boot.module.common.biz.controller; package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
...@@ -17,7 +18,9 @@ import io.swagger.annotations.Api; ...@@ -17,7 +18,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
...@@ -44,6 +47,10 @@ public class OrgUsrController extends BaseController { ...@@ -44,6 +47,10 @@ public class OrgUsrController extends BaseController {
OrgUsrServiceImpl iOrgUsrService; OrgUsrServiceImpl iOrgUsrService;
@Autowired @Autowired
ESOrgUsrService eSOrgUsrService; ESOrgUsrService eSOrgUsrService;
@Autowired
EmqKeeper emqKeeper;
@Value("${jcs.company.topic.delete}")
private String airportDeleteTopic;
/** /**
...@@ -74,12 +81,11 @@ public class OrgUsrController extends BaseController { ...@@ -74,12 +81,11 @@ public class OrgUsrController extends BaseController {
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", CommonConstant.IS_DELETE_01)); iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete", CommonConstant.IS_DELETE_01));
try { try {
eSOrgUsrService.deleteById(id); eSOrgUsrService.deleteById(id);
emqKeeper.getMqttClient().publish(airportDeleteTopic, JSON.toJSONString(id).getBytes(), 2, false);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new RuntimeException(); throw new RuntimeException();
} }
return ResponseHelper.buildResponse(null); return ResponseHelper.buildResponse(null);
} }
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
...@@ -39,6 +21,22 @@ import com.yeejoin.amos.boot.module.common.api.entity.LinkageUnit; ...@@ -39,6 +21,22 @@ import com.yeejoin.amos.boot.module.common.api.entity.LinkageUnit;
import com.yeejoin.amos.boot.module.common.api.entity.SourceFile; import com.yeejoin.amos.boot.module.common.api.entity.SourceFile;
import com.yeejoin.amos.boot.module.common.api.mapper.LinkageUnitMapper; import com.yeejoin.amos.boot.module.common.api.mapper.LinkageUnitMapper;
import com.yeejoin.amos.boot.module.common.api.service.ILinkageUnitService; import com.yeejoin.amos.boot.module.common.api.service.ILinkageUnitService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/** /**
* 联动单位服务实现类 * 联动单位服务实现类
...@@ -90,7 +88,7 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU ...@@ -90,7 +88,7 @@ public class LinkageUnitServiceImpl extends BaseService<LinkageUnitDto, LinkageU
} }
}); });
}); });
List<LinkageUnitDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(linkageUnitList.getRecords()), List<LinkageUnitDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(linkageUnitListMap),
LinkageUnitDto.class); LinkageUnitDto.class);
List<LinkageUnitDto> detaiList = resultDtoList.stream().map(item -> { List<LinkageUnitDto> detaiList = resultDtoList.stream().map(item -> {
Date now = new Date(); Date now = new Date();
......
...@@ -23,6 +23,7 @@ import org.slf4j.Logger; ...@@ -23,6 +23,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
...@@ -35,6 +36,9 @@ import java.util.HashMap; ...@@ -35,6 +36,9 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* @author DELL
*/
@RestController @RestController
@RequestMapping(value = "/api/planTask") @RequestMapping(value = "/api/planTask")
@Api(tags = "计划执行api") @Api(tags = "计划执行api")
...@@ -155,23 +159,6 @@ public class PlanTaskController extends AbstractBaseController { ...@@ -155,23 +159,6 @@ public class PlanTaskController extends AbstractBaseController {
} }
/** /**
* 定时查询任务状态
*
* @return
*/
@ApiOperation(value = "定时执行任务表生成", notes = "定时执行任务表生成")
@RequestMapping(value = "/queryOmission", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public CommonResponse pushCarData() {
try {
planTaskService.taskExecution(null);
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure();
}
}
/**
* 模拟定时任务调起服务 * 模拟定时任务调起服务
* *
* @return * @return
......
...@@ -209,7 +209,6 @@ public class PointController extends AbstractBaseController { ...@@ -209,7 +209,6 @@ public class PointController extends AbstractBaseController {
Page<PointDto> pointList = iPointService.queryPointInfoWithItem(criterias, commonPageable, ownerId); Page<PointDto> pointList = iPointService.queryPointInfoWithItem(criterias, commonPageable, ownerId);
return CommonResponseUtil.success(pointList); return CommonResponseUtil.success(pointList);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e); log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点信息失败"); return CommonResponseUtil.failure("查询巡检点信息失败");
} }
......
package com.yeejoin.amos.maintenance.business.controller; package com.yeejoin.amos.maintenance.business.controller;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.yeejoin.amos.maintenance.core.framework.PersonIdentify;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.maintenance.business.param.RoutePageParam; import com.yeejoin.amos.maintenance.business.param.RoutePageParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IRouteService; import com.yeejoin.amos.maintenance.business.service.intfc.IRouteService;
...@@ -35,14 +9,23 @@ import com.yeejoin.amos.maintenance.business.util.RoutePageParamUtil; ...@@ -35,14 +9,23 @@ import com.yeejoin.amos.maintenance.business.util.RoutePageParamUtil;
import com.yeejoin.amos.maintenance.core.common.request.CommonPageable; import com.yeejoin.amos.maintenance.core.common.request.CommonPageable;
import com.yeejoin.amos.maintenance.core.common.request.CommonRequest; import com.yeejoin.amos.maintenance.core.common.request.CommonRequest;
import com.yeejoin.amos.maintenance.core.common.request.RoutePointInputItemRequest; import com.yeejoin.amos.maintenance.core.common.request.RoutePointInputItemRequest;
import com.yeejoin.amos.maintenance.core.framework.PersonIdentify;
import com.yeejoin.amos.maintenance.dao.entity.InputItem; import com.yeejoin.amos.maintenance.dao.entity.InputItem;
import com.yeejoin.amos.maintenance.dao.entity.Plan;
import com.yeejoin.amos.maintenance.dao.entity.Route; import com.yeejoin.amos.maintenance.dao.entity.Route;
import com.yeejoin.amos.maintenance.dao.entity.RoutePoint; import com.yeejoin.amos.maintenance.dao.entity.RoutePoint;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.*;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping(value = "/api/route") @RequestMapping(value = "/api/route")
...@@ -122,39 +105,8 @@ public class RouteController extends AbstractBaseController { ...@@ -122,39 +105,8 @@ public class RouteController extends AbstractBaseController {
@ApiOperation(value = "删除巡检路线", notes = "删除巡检路线") @ApiOperation(value = "删除巡检路线", notes = "删除巡检路线")
@DeleteMapping(value = "/deleteRoute", produces = "application/json;charset=UTF-8") @DeleteMapping(value = "/deleteRoute", produces = "application/json;charset=UTF-8")
public CommonResponse deleteRoute(@ApiParam(value = "巡检路线ID", required = false) @RequestParam List<Long> routeIds) { public CommonResponse deleteRoute(@ApiParam(value = "巡检路线ID", required = false) @RequestParam List<Long> routeIds) {
try {
//校验1:线路上有点时返回删除失败
Map<Long, String> idNameMap = new HashMap<>();
for (long id : routeIds) {
int routePointCount = routeService.countRoutePoint(id);
if (routePointCount > 0) {
Route route = routeService.queryRouteById(id);
idNameMap.put(id, route.getName());
}
}
if (idNameMap.size() > 0) {
return CommonResponseUtil.failure(idNameMap, "删除路线失败:路线上已设置巡检点");
}
//校验2:计划在使用,删除失败
idNameMap.clear();
for (long id : routeIds) {
int routePointCount = routeService.countRoutePoint(id);
if (routePointCount > 0) {
List<Plan> planList = routeService.queryPlanByRouteId(id);
if (planList != null && planList.size() > 0) {
idNameMap.put(id, planList.get(0).getName());
}
}
}
if (idNameMap.size() > 0) {
return CommonResponseUtil.failure(idNameMap, "删除路线失败:计划在使用");
}
routeService.delRouteById(routeIds.toArray(new Long[0])); routeService.delRouteById(routeIds.toArray(new Long[0]));
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("删除巡检路线失败");
}
} }
/** /**
......
...@@ -36,6 +36,12 @@ public class PlanTaskPointInputItemBo { ...@@ -36,6 +36,12 @@ public class PlanTaskPointInputItemBo {
*/ */
private String pointNo; private String pointNo;
/**
* 地址
*/
private String address;
/** /**
* 巡检任务id * 巡检任务id
*/ */
...@@ -47,6 +53,11 @@ public class PlanTaskPointInputItemBo { ...@@ -47,6 +53,11 @@ public class PlanTaskPointInputItemBo {
private String ownerId; private String ownerId;
/** /**
* 业主单位名称
*/
private String ownerName;
/**
* 单位id * 单位id
*/ */
private String companyId; private String companyId;
......
...@@ -112,6 +112,9 @@ public class CheckServiceImpl implements ICheckService { ...@@ -112,6 +112,9 @@ public class CheckServiceImpl implements ICheckService {
@Value("${file.url}") @Value("${file.url}")
private String fileUrl; private String fileUrl;
@Autowired
IRouteDao iRouteDao;
final String CHECK_UPDATE_TOPIC = "maintenance/date/update"; final String CHECK_UPDATE_TOPIC = "maintenance/date/update";
...@@ -138,6 +141,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -138,6 +141,7 @@ public class CheckServiceImpl implements ICheckService {
//1.前置校验 //1.前置校验
this.checkCanFinishTask(mtUserSeq, planTask, recordParam.getPointId()); this.checkCanFinishTask(mtUserSeq, planTask, recordParam.getPointId());
Point point = iPointService.queryPointById(recordParam.getPointId()); Point point = iPointService.queryPointById(recordParam.getPointId());
Route route = iRouteDao.findById(planTask.getRouteId()).orElseThrow(() -> new RuntimeException("路线不存在"));
Check check = new Check(); Check check = new Check();
if (ObjectUtils.isEmpty(point) || ObjectUtils.isEmpty(detail)) { if (ObjectUtils.isEmpty(point) || ObjectUtils.isEmpty(detail)) {
throw new Exception("前置校验不通过"); throw new Exception("前置校验不通过");
...@@ -161,8 +165,10 @@ public class CheckServiceImpl implements ICheckService { ...@@ -161,8 +165,10 @@ public class CheckServiceImpl implements ICheckService {
check.setUploadTime(new Date()); check.setUploadTime(new Date());
check.setOrgCode(recordParam.getOrgCode()); check.setOrgCode(recordParam.getOrgCode());
check.setUserId(mtUserSeq); check.setUserId(mtUserSeq);
check.setOwnerId(point.getOwnerId()); check.setOwnerId(route.getOwnerId());
check.setOwnerName(route.getOwnerName());
check.setBuildingName(point.getBuildingName()); check.setBuildingName(point.getBuildingName());
check.setAddress(point.getAddress());
check.setEquipmentName(point.getEquipmentName()); check.setEquipmentName(point.getEquipmentName());
check.setPlanType(detail.get("planType").toString()); check.setPlanType(detail.get("planType").toString());
check.setUserName(personIdentity.getPersonName()); check.setUserName(personIdentity.getPersonName());
...@@ -1122,7 +1128,7 @@ public class CheckServiceImpl implements ICheckService { ...@@ -1122,7 +1128,7 @@ public class CheckServiceImpl implements ICheckService {
if (facility.containsKey("isOk")) { if (facility.containsKey("isOk")) {
facility.put("isOkDesc", CheckStatusEnum.getEnum(String.valueOf(facility.get("isOk"))).getName()); facility.put("isOkDesc", CheckStatusEnum.getEnum(String.valueOf(facility.get("isOk"))).getName());
} }
if(facility.containsKey("planType")){ if (facility.containsKey("planType")) {
PlanTypeEnum planType = PlanTypeEnum.getEnumByCode(String.valueOf(facility.get("planType"))); PlanTypeEnum planType = PlanTypeEnum.getEnumByCode(String.valueOf(facility.get("planType")));
facility.put("planTypeDesc", planType != null ? planType.getName() : "其他"); facility.put("planTypeDesc", planType != null ? planType.getName() : "其他");
} }
......
...@@ -287,10 +287,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService { ...@@ -287,10 +287,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
} }
//2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑) //2.4.删除今天可能重做生成的数据(计划重做后进行了计划的编辑)
if (iplanTaskDao.findById(plan.getPlanTaskId()) != null && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES) if (iplanTaskDao.findById(plan.getPlanTaskId()).isPresent() && plan.getFirstFlag() == XJConstant.PLAN_FIRST_STATUS_YES) {
if (iplanTaskDao.existsById(plan.getPlanTaskId())) { if (iplanTaskDao.existsById(plan.getPlanTaskId())) {
iplanTaskDao.deleteById(plan.getPlanTaskId()); iplanTaskDao.deleteById(plan.getPlanTaskId());
} }
}
//2.5.插入planTask及planTaskDetail //2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now); insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
......
...@@ -79,27 +79,34 @@ public class RouteServiceImpl implements IRouteService { ...@@ -79,27 +79,34 @@ public class RouteServiceImpl implements IRouteService {
public Route addRoute(Route route) { public Route addRoute(Route route) {
String creatorId = route.getCreatorId(); String creatorId = route.getCreatorId();
String orgCode = route.getOrgCode(); String orgCode = route.getOrgCode();
//1.保存主表
route = iRouteDao.saveAndFlush(route); route = iRouteDao.saveAndFlush(route);
Long rId = route.getId(); Long rId = route.getId();
List<RoutePoint> routePoints = route.getRoutePointList(); List<RoutePoint> routePoints = route.getRoutePointList();
//2.保存子表
routePoints.forEach(rp -> { routePoints.forEach(rp -> {
rp.setOrgCode(orgCode); rp.setOrgCode(orgCode);
rp.setRouteId(rId); rp.setRouteId(rId);
rp.setCreatorId(creatorId); rp.setCreatorId(creatorId);
List<RoutePointItem> routePointItems = rp.getRoutePointItem(); List<RoutePointItem> routePointItems = rp.getRoutePointItem();
//2.1保存点路线关系表
rp = iRoutePointDao.saveAndFlush(rp); rp = iRoutePointDao.saveAndFlush(rp);
Long rpId = rp.getId(); Long rpId = rp.getId();
routePointItems = routePointItems.stream().filter(RoutePointItem::getIsBound).collect(Collectors.toList());
routePointItems.forEach(rpi -> { routePointItems.forEach(rpi -> {
rpi.setRoutePointId(rpId); rpi.setRoutePointId(rpId);
rpi.setCreatorId(creatorId); rpi.setCreatorId(creatorId);
iRoutePointItemDao.saveAndFlush(rpi);
}); });
//2.2保存点项关系表
if (!routePointItems.isEmpty()) {
iRoutePointItemDao.saveAll(routePointItems);
}
}); });
return route; return route;
} }
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void delRouteById(Long[] ids) { public void delRouteById(Long[] ids) {
//0.删除路线 //0.删除路线
iRouteDao.delRouteById(Arrays.asList(ids)); iRouteDao.delRouteById(Arrays.asList(ids));
...@@ -126,7 +133,7 @@ public class RouteServiceImpl implements IRouteService { ...@@ -126,7 +133,7 @@ public class RouteServiceImpl implements IRouteService {
iRoutePointItemDao.delRoutePointItem(rp.getId()); iRoutePointItemDao.delRoutePointItem(rp.getId());
iRoutePointDao.deleteById(rp.getId()); iRoutePointDao.deleteById(rp.getId());
//删除p_plan_task_detail 对应点、更新p_plan_task点数量、完成数量 //删除p_plan_task_detail 对应点、更新p_plan_task点数量、完成数量
this.updatePlanTask(rp.getPointId(),finalRoute.getId()); this.updatePlanTask(rp.getPointId(), finalRoute.getId());
} else { } else {
List<RoutePointItem> routePointItems = rp.getRoutePointItem(); List<RoutePointItem> routePointItems = rp.getRoutePointItem();
iRoutePointDao.saveAndFlush(rp); iRoutePointDao.saveAndFlush(rp);
...@@ -156,9 +163,15 @@ public class RouteServiceImpl implements IRouteService { ...@@ -156,9 +163,15 @@ public class RouteServiceImpl implements IRouteService {
} }
private void updatePlanTask(long pointId, long routeId) { private void updatePlanTask(long pointId, long routeId) {
//1.查询指定路线的任务
List<PlanTask> planTaskList = planTaskDao.findByRouteId(routeId); List<PlanTask> planTaskList = planTaskDao.findByRouteId(routeId);
Map<Long, PlanTask> planTaskMap = planTaskList.stream().collect(Collectors.toMap(BasicEntity::getId, Function.identity()));
//2.查询指定的点
List<PlanTaskDetail> planTaskDetailList = iPlanTaskDetailDao.findByPointId(pointId); List<PlanTaskDetail> planTaskDetailList = iPlanTaskDetailDao.findByPointId(pointId);
Map<Long,PlanTask> planTaskMap = planTaskList.stream().collect(Collectors.toMap(BasicEntity::getId, Function.identity())); //3.过滤指定父任务id的执行数据
planTaskDetailList = planTaskDetailList.stream().filter(e ->
planTaskList.stream().map(BasicEntity::getId).collect(Collectors.toList()).contains(e.getTaskNo())).collect(Collectors.toList());
//4.更新任务主表点的数量及完成数量
for (PlanTaskDetail planTaskDetail : planTaskDetailList) { for (PlanTaskDetail planTaskDetail : planTaskDetailList) {
PlanTask planTask = planTaskMap.get(planTaskDetail.getTaskNo()); PlanTask planTask = planTaskMap.get(planTaskDetail.getTaskNo());
if (1 == planTaskDetail.getIsFinish()) { if (1 == planTaskDetail.getIsFinish()) {
...@@ -168,9 +181,9 @@ public class RouteServiceImpl implements IRouteService { ...@@ -168,9 +181,9 @@ public class RouteServiceImpl implements IRouteService {
planTask.setPointNum(planTask.getPointNum() - 1); planTask.setPointNum(planTask.getPointNum() - 1);
} }
} }
//更新主表完成数量,点数量 //5.更新主表完成数量,点数量
planTaskDao.saveAll(planTaskList); planTaskDao.saveAll(planTaskList);
//删除路线下的维保点 //6.删除路线下的维保点
planTaskDetailMapper.deleteByPointIdAndRouteId(pointId, routeId); planTaskDetailMapper.deleteByPointIdAndRouteId(pointId, routeId);
} }
......
...@@ -202,6 +202,7 @@ public class JobService implements IJobService { ...@@ -202,6 +202,7 @@ public class JobService implements IJobService {
check.setBeginTime(planTask.getBeginTime()); check.setBeginTime(planTask.getBeginTime());
check.setEndTime(planTask.getEndTime()); check.setEndTime(planTask.getEndTime());
check.setBuildingName(arg.getBuildingName()); check.setBuildingName(arg.getBuildingName());
check.setAddress(arg.getAddress());
check.setUploadTime(new Date()); check.setUploadTime(new Date());
check.setPlanId(arg.getPlanId()); check.setPlanId(arg.getPlanId());
check.setPlanName(arg.getPlanName()); check.setPlanName(arg.getPlanName());
...@@ -212,6 +213,7 @@ public class JobService implements IJobService { ...@@ -212,6 +213,7 @@ public class JobService implements IJobService {
check.setRouteName(arg.getRouteName()); check.setRouteName(arg.getRouteName());
check.setCheckTime(arg.getEndTime()); check.setCheckTime(arg.getEndTime());
check.setOwnerId(arg.getOwnerId()); check.setOwnerId(arg.getOwnerId());
check.setOwnerName(arg.getOwnerName());
check.setCompanyId(arg.getCompanyId()); check.setCompanyId(arg.getCompanyId());
check.setCompanyName(arg.getCompanyName()); check.setCompanyName(arg.getCompanyName());
check.setEquipmentName(arg.getEquipmentName()); check.setEquipmentName(arg.getEquipmentName());
...@@ -323,8 +325,7 @@ public class JobService implements IJobService { ...@@ -323,8 +325,7 @@ public class JobService implements IJobService {
updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue()); updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue());
} }
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage(), e); log.error("任务加到定时任务或者更新失败", e);
e.printStackTrace();
} }
} }
......
package com.yeejoin.amos.maintenance.task;
import com.yeejoin.amos.maintenance.business.service.intfc.IPlanTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* @author DELL
*/
@Component
@EnableScheduling
public class PlanTaskJob {
@Autowired
private IPlanTaskService planTaskService;
/**
* 定时查询任务状态
*/
@Scheduled(cron = "${jobs.cron}")
public void scheduleJob() {
planTaskService.taskExecution(null);
}
}
...@@ -39,7 +39,7 @@ public interface IPointDao extends BaseDao<Point, Long> { ...@@ -39,7 +39,7 @@ public interface IPointDao extends BaseDao<Point, Long> {
@Modifying @Modifying
@Transactional @Transactional
@Query(value = "UPDATE p_point SET is_delete = 1 WHERE point_no IN (?1)", nativeQuery = true) @Query(value = "UPDATE p_point SET is_delete = 1 WHERE point_no = (?1)", nativeQuery = true)
void delPointByPointNo(Long id); void delPointByPointNo(Long id);
@Query(value = "SELECT id FROM p_point p WHERE is_delete = 0 AND p.point_no = (?1)", nativeQuery = true) @Query(value = "SELECT id FROM p_point p WHERE is_delete = 0 AND p.point_no = (?1)", nativeQuery = true)
......
...@@ -270,9 +270,11 @@ public class AlertCalledController extends BaseController { ...@@ -270,9 +270,11 @@ public class AlertCalledController extends BaseController {
queryWrapper.orderByDesc("call_time"); queryWrapper.orderByDesc("call_time");
if(null != alertCalled.getCallTimeStart() && null != alertCalled.getCallTimeEnd()) { if(!ValidationUtil.isEmpty(alertCalled.getIsAuxiliaryScreen())) {
if(!ValidationUtil.isEmpty(alertCalled.getCallTimeStart()) && !ValidationUtil.isEmpty(alertCalled.getCallTimeEnd())) {
queryWrapper.between("call_time", alertCalled.getCallTimeStart(), queryWrapper.between("call_time", alertCalled.getCallTimeStart(),
alertCalled.getCallTimeEnd().getTime()); alertCalled.getCallTimeEnd().getTime());
}
} else { } else {
queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN), queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN)); DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
......
...@@ -223,4 +223,15 @@ ...@@ -223,4 +223,15 @@
ALTER TABLE p_check add COLUMN `end_time` datetime DEFAULT NULL COMMENT '结束时间' after `begin_time`; ALTER TABLE p_check add COLUMN `end_time` datetime DEFAULT NULL COMMENT '结束时间' after `begin_time`;
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="suhuiguang" id="1630291249911-4">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="p_check" columnName="owner_name"/>
</not>
</preConditions>
<comment>p_check add COLUMN owner_name '业主单位名称'</comment>
<sql>
ALTER TABLE p_check add COLUMN `owner_name` varchar(255) DEFAULT NULL COMMENT '业主单位名称' after `owner_id`;
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -393,6 +393,8 @@ ...@@ -393,6 +393,8 @@
temp1.buildingName, temp1.buildingName,
temp1.equipmentName, temp1.equipmentName,
temp1.remark as riskAndManage, temp1.remark as riskAndManage,
temp1.address,
temp1.ownerName,
pii.`name` inputName, pii.`name` inputName,
temp2.* temp2.*
FROM FROM
...@@ -411,10 +413,12 @@ ...@@ -411,10 +413,12 @@
r.name as routeName, r.name as routeName,
p.name as pointName, p.name as pointName,
p.owner_id as ownerId, p.owner_id as ownerId,
p.owner_name as ownerName,
p.point_no as pointNo, p.point_no as pointNo,
p.building_name as buildingName, p.building_name as buildingName,
p.equipment_name as equipmentName, p.equipment_name as equipmentName,
p.remark p.remark,
p.address
FROM FROM
p_route_point_item prpi p_route_point_item prpi
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
...@@ -432,7 +436,7 @@ ...@@ -432,7 +436,7 @@
ptd.plan_id planId, ptd.plan_id planId,
ptd.user_id AS userId, ptd.user_id AS userId,
ptd.org_code AS orgCode, ptd.org_code AS orgCode,
ptd.end_time AS endTime, ptd.begin_time AS beginTime,
ptd.end_time AS endTime, ptd.end_time AS endTime,
ptd.company_id as companyId, ptd.company_id as companyId,
ptd.company_name as companyName, ptd.company_name as companyName,
......
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