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 {
private String ownerId;
/**
* 业主单位名称
*/
private String ownerName;
/**
* 维保公司id
*/
private String companyId;
......@@ -288,6 +293,13 @@ public class Check extends BasicEntity {
this.companyName = companyName;
}
public String getOwnerName() {
return ownerName;
}
public void setOwnerName(String ownerName) {
this.ownerName = ownerName;
}
public String getOwnerId() {
return ownerId;
......
......@@ -140,4 +140,7 @@ public class AlertCalledDto extends BaseDto {
@ApiModelProperty(value = "结案说明")
private String finalReason;
@ApiModelProperty(value = "是否辅屏查询")
private String isAuxiliaryScreen;
}
......@@ -217,4 +217,8 @@ public class AlertCalled extends BaseEntity {
@ApiModelProperty(value = "响应级别")
private String responseLevel;
@TableField(exist=false)
@ApiModelProperty(value = "是否辅屏查询")
private String isAuxiliaryScreen;
}
package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.yeejoin.amos.boot.biz.common.constants.CommonConstant;
import com.yeejoin.amos.boot.module.common.api.dto.*;
......@@ -37,10 +38,6 @@ import java.util.Map;
public class OrgPersonController {
@Autowired
OrgUsrServiceImpl iOrgUsrService;
@Autowired
EmqKeeper emqKeeper;
@Value("${jcs.company.topic.delete}")
private String airportDeleteTopic;
/**
* 新增人员信息
......@@ -69,11 +66,6 @@ public class OrgPersonController {
// 删除时,只作逻辑删除
iOrgUsrService.update(new UpdateWrapper<OrgUsr>().eq("sequence_nbr", id).set("is_delete",
CommonConstant.IS_DELETE_01));
try {
emqKeeper.getMqttClient().publish(airportDeleteTopic, String.valueOf(id).getBytes(), 2, true);
} catch (Exception e) {
e.getMessage();
}
return ResponseHelper.buildResponse(null);
}
......
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.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -17,7 +18,9 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -44,6 +47,10 @@ public class OrgUsrController extends BaseController {
OrgUsrServiceImpl iOrgUsrService;
@Autowired
ESOrgUsrService eSOrgUsrService;
@Autowired
EmqKeeper emqKeeper;
@Value("${jcs.company.topic.delete}")
private String airportDeleteTopic;
/**
......@@ -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));
try {
eSOrgUsrService.deleteById(id);
emqKeeper.getMqttClient().publish(airportDeleteTopic, JSON.toJSONString(id).getBytes(), 2, false);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException();
}
return ResponseHelper.buildResponse(null);
}
......
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.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......@@ -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.mapper.LinkageUnitMapper;
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
}
});
});
List<LinkageUnitDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(linkageUnitList.getRecords()),
List<LinkageUnitDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(linkageUnitListMap),
LinkageUnitDto.class);
List<LinkageUnitDto> detaiList = resultDtoList.stream().map(item -> {
Date now = new Date();
......
......@@ -23,6 +23,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.Bean;
......@@ -35,6 +36,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author DELL
*/
@RestController
@RequestMapping(value = "/api/planTask")
@Api(tags = "计划执行api")
......@@ -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
......
......@@ -209,7 +209,6 @@ public class PointController extends AbstractBaseController {
Page<PointDto> pointList = iPointService.queryPointInfoWithItem(criterias, commonPageable, ownerId);
return CommonResponseUtil.success(pointList);
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("查询巡检点信息失败");
}
......
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.maintenance.business.param.RoutePageParam;
import com.yeejoin.amos.maintenance.business.service.intfc.IRouteService;
......@@ -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.CommonRequest;
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.Plan;
import com.yeejoin.amos.maintenance.dao.entity.Route;
import com.yeejoin.amos.maintenance.dao.entity.RoutePoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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
@RequestMapping(value = "/api/route")
......@@ -122,39 +105,8 @@ public class RouteController extends AbstractBaseController {
@ApiOperation(value = "删除巡检路线", notes = "删除巡检路线")
@DeleteMapping(value = "/deleteRoute", produces = "application/json;charset=UTF-8")
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]));
return CommonResponseUtil.success();
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("删除巡检路线失败");
}
routeService.delRouteById(routeIds.toArray(new Long[0]));
return CommonResponseUtil.success();
}
/**
......
......@@ -35,6 +35,12 @@ public class PlanTaskPointInputItemBo {
* 编号
*/
private String pointNo;
/**
* 地址
*/
private String address;
/**
* 巡检任务id
......@@ -47,6 +53,11 @@ public class PlanTaskPointInputItemBo {
private String ownerId;
/**
* 业主单位名称
*/
private String ownerName;
/**
* 单位id
*/
private String companyId;
......
......@@ -112,6 +112,9 @@ public class CheckServiceImpl implements ICheckService {
@Value("${file.url}")
private String fileUrl;
@Autowired
IRouteDao iRouteDao;
final String CHECK_UPDATE_TOPIC = "maintenance/date/update";
......@@ -138,6 +141,7 @@ public class CheckServiceImpl implements ICheckService {
//1.前置校验
this.checkCanFinishTask(mtUserSeq, planTask, recordParam.getPointId());
Point point = iPointService.queryPointById(recordParam.getPointId());
Route route = iRouteDao.findById(planTask.getRouteId()).orElseThrow(() -> new RuntimeException("路线不存在"));
Check check = new Check();
if (ObjectUtils.isEmpty(point) || ObjectUtils.isEmpty(detail)) {
throw new Exception("前置校验不通过");
......@@ -161,8 +165,10 @@ public class CheckServiceImpl implements ICheckService {
check.setUploadTime(new Date());
check.setOrgCode(recordParam.getOrgCode());
check.setUserId(mtUserSeq);
check.setOwnerId(point.getOwnerId());
check.setOwnerId(route.getOwnerId());
check.setOwnerName(route.getOwnerName());
check.setBuildingName(point.getBuildingName());
check.setAddress(point.getAddress());
check.setEquipmentName(point.getEquipmentName());
check.setPlanType(detail.get("planType").toString());
check.setUserName(personIdentity.getPersonName());
......@@ -1122,7 +1128,7 @@ public class CheckServiceImpl implements ICheckService {
if (facility.containsKey("isOk")) {
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")));
facility.put("planTypeDesc", planType != null ? planType.getName() : "其他");
}
......
......@@ -287,10 +287,11 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
//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())) {
iplanTaskDao.deleteById(plan.getPlanTaskId());
}
}
//2.5.插入planTask及planTaskDetail
insertPlanTaskAndDet(list, plan, XJConstant.SCHED_FLAG, now);
......
......@@ -76,30 +76,37 @@ public class RouteServiceImpl implements IRouteService {
@Override
@Transactional
public Route addRoute(Route route) {
public Route addRoute(Route route) {
String creatorId = route.getCreatorId();
String orgCode = route.getOrgCode();
//1.保存主表
route = iRouteDao.saveAndFlush(route);
Long rId = route.getId();
List<RoutePoint> routePoints = route.getRoutePointList();
//2.保存子表
routePoints.forEach(rp -> {
rp.setOrgCode(orgCode);
rp.setRouteId(rId);
rp.setCreatorId(creatorId);
List<RoutePointItem> routePointItems = rp.getRoutePointItem();
//2.1保存点路线关系表
rp = iRoutePointDao.saveAndFlush(rp);
Long rpId = rp.getId();
routePointItems = routePointItems.stream().filter(RoutePointItem::getIsBound).collect(Collectors.toList());
routePointItems.forEach(rpi -> {
rpi.setRoutePointId(rpId);
rpi.setCreatorId(creatorId);
iRoutePointItemDao.saveAndFlush(rpi);
});
//2.2保存点项关系表
if (!routePointItems.isEmpty()) {
iRoutePointItemDao.saveAll(routePointItems);
}
});
return route;
}
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public void delRouteById(Long[] ids) {
//0.删除路线
iRouteDao.delRouteById(Arrays.asList(ids));
......@@ -126,7 +133,7 @@ public class RouteServiceImpl implements IRouteService {
iRoutePointItemDao.delRoutePointItem(rp.getId());
iRoutePointDao.deleteById(rp.getId());
//删除p_plan_task_detail 对应点、更新p_plan_task点数量、完成数量
this.updatePlanTask(rp.getPointId(),finalRoute.getId());
this.updatePlanTask(rp.getPointId(), finalRoute.getId());
} else {
List<RoutePointItem> routePointItems = rp.getRoutePointItem();
iRoutePointDao.saveAndFlush(rp);
......@@ -156,9 +163,15 @@ public class RouteServiceImpl implements IRouteService {
}
private void updatePlanTask(long pointId, long routeId) {
//1.查询指定路线的任务
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);
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) {
PlanTask planTask = planTaskMap.get(planTaskDetail.getTaskNo());
if (1 == planTaskDetail.getIsFinish()) {
......@@ -168,9 +181,9 @@ public class RouteServiceImpl implements IRouteService {
planTask.setPointNum(planTask.getPointNum() - 1);
}
}
//更新主表完成数量,点数量
//5.更新主表完成数量,点数量
planTaskDao.saveAll(planTaskList);
//删除路线下的维保点
//6.删除路线下的维保点
planTaskDetailMapper.deleteByPointIdAndRouteId(pointId, routeId);
}
......
......@@ -202,6 +202,7 @@ public class JobService implements IJobService {
check.setBeginTime(planTask.getBeginTime());
check.setEndTime(planTask.getEndTime());
check.setBuildingName(arg.getBuildingName());
check.setAddress(arg.getAddress());
check.setUploadTime(new Date());
check.setPlanId(arg.getPlanId());
check.setPlanName(arg.getPlanName());
......@@ -212,6 +213,7 @@ public class JobService implements IJobService {
check.setRouteName(arg.getRouteName());
check.setCheckTime(arg.getEndTime());
check.setOwnerId(arg.getOwnerId());
check.setOwnerName(arg.getOwnerName());
check.setCompanyId(arg.getCompanyId());
check.setCompanyName(arg.getCompanyName());
check.setEquipmentName(arg.getEquipmentName());
......@@ -323,8 +325,7 @@ public class JobService implements IJobService {
updatePlanTaskStatus(planTask, PlanTaskFinishStatusEnum.OVERTIME.getValue());
}
} catch (Exception e) {
log.error(e.getMessage(), e);
e.printStackTrace();
log.error("任务加到定时任务或者更新失败", e);
}
}
......
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> {
@Modifying
@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);
@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 {
queryWrapper.orderByDesc("call_time");
if(null != alertCalled.getCallTimeStart() && null != alertCalled.getCallTimeEnd()) {
queryWrapper.between("call_time", alertCalled.getCallTimeStart(),
alertCalled.getCallTimeEnd().getTime());
if(!ValidationUtil.isEmpty(alertCalled.getIsAuxiliaryScreen())) {
if(!ValidationUtil.isEmpty(alertCalled.getCallTimeStart()) && !ValidationUtil.isEmpty(alertCalled.getCallTimeEnd())) {
queryWrapper.between("call_time", alertCalled.getCallTimeStart(),
alertCalled.getCallTimeEnd().getTime());
}
} else {
queryWrapper.between("call_time", DateUtils.stampToDate(System.currentTimeMillis(),DateUtils.DATE_PATTERN),
DateUtils.stampToDate(DateUtils.dateAddDays(new Date(),1).getTime(),DateUtils.DATE_PATTERN));
......
......@@ -223,4 +223,15 @@
ALTER TABLE p_check add COLUMN `end_time` datetime DEFAULT NULL COMMENT '结束时间' after `begin_time`;
</sql>
</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>
\ No newline at end of file
......@@ -393,6 +393,8 @@
temp1.buildingName,
temp1.equipmentName,
temp1.remark as riskAndManage,
temp1.address,
temp1.ownerName,
pii.`name` inputName,
temp2.*
FROM
......@@ -411,10 +413,12 @@
r.name as routeName,
p.name as pointName,
p.owner_id as ownerId,
p.owner_name as ownerName,
p.point_no as pointNo,
p.building_name as buildingName,
p.equipment_name as equipmentName,
p.remark
p.remark,
p.address
FROM
p_route_point_item prpi
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
......@@ -432,7 +436,7 @@
ptd.plan_id planId,
ptd.user_id AS userId,
ptd.org_code AS orgCode,
ptd.end_time AS endTime,
ptd.begin_time AS beginTime,
ptd.end_time AS endTime,
ptd.company_id as companyId,
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