Browse Source

feat: 新增检修区域,包含检修区域的任务将不执行

master
yinhuaiwei 7 hours ago
parent
commit
14ce490073
11 changed files with 194 additions and 97 deletions
  1. +2
    -0
      inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/domain/maintain/MaintainRegion.java
  2. +23
    -11
      inspect-main/inspect-main-task-exec/src/main/java/com/inspect/exec/controller/PatrolTaskExecController.java
  3. +23
    -14
      inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/controller/MaintainRegionController.java
  4. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/mapper/MaintainRegionMapper.java
  5. +4
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/service/IMaintainRegionService.java
  6. +26
    -3
      inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/service/impl/MaintainRegionServiceImpl.java
  7. +2
    -47
      inspect-main/inspect-main-task/src/main/java/com/inspect/taskinfo/domain/PatrolTaskInfo.java
  8. +61
    -10
      inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java
  9. +37
    -4
      inspect-main/inspect-main-task/src/main/resources/mapper/task/MaintainRegionMapper.xml
  10. +3
    -2
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskInfoMapper.xml
  11. +11
    -6
      inspect-metadata/src/main/java/com/inspect/metadata/prodevmnt/controller/BasedataDeviceController.java

+ 2
- 0
inspect-base/inspect-base-core/src/main/java/com/inspect/base/core/domain/maintain/MaintainRegion.java View File

@ -60,6 +60,8 @@ public class MaintainRegion extends BaseEntity {
name = "检修设备列表 格式:多个 ID,采用“,”分隔"
)
private String deviceList;
private String deviceNames;
@Excel(
name = "坐标框(像素点)格式:x1,y1,z1; x2,y2,z2; x3,y3,z3; x4,y4,z4"
)


+ 23
- 11
inspect-main/inspect-main-task-exec/src/main/java/com/inspect/exec/controller/PatrolTaskExecController.java View File

@ -48,6 +48,7 @@ import com.inspect.task.service.IPatrolTaskService;
import com.inspect.taskinfo.domain.PatrolTaskInfo;
import com.inspect.taskinfo.service.IPatrolTaskInfoService;
import com.inspect.taskstatus.client.FeignTaskClient;
import com.inspect.taskstatus.controller.PatrolTaskStatusController;
import com.inspect.taskstatus.domain.PatrolTaskStatus;
import com.inspect.taskstatus.service.IPatrolTaskStatusService;
@ -88,6 +89,9 @@ public class PatrolTaskExecController extends BaseController {
@Resource
private FeignTaskClient feignTaskClient;
@Resource
private PatrolTaskStatusController patrolTaskStatusController;
public PatrolTaskExecController(IPatrolTaskInfoService patrolTaskInfoService, IPatrolTaskService patrolTaskService, RedisService redisService, IPatrolTaskStatusService patrolTaskStatusService, IDBPatrolPointService dbPatrolPointService, IPatrolPresetPosService patrolPresetPosService, IPatrolPresetActionService patrolPresetActionService, IPatrolTaskExecRecordService patrolTaskExecRecordService, IPatrolTaskPointExecRecordService patrolTaskPointExecRecordService, IMaintainRegionService maintainRegionService, IPatrolPresetParamService patrolPresetParamService, ISilenceTaskPointExecRecordService silenceTaskPointExecRecordService, IEqpBookChannelService eqpBookChannelService, IPatrolResultService patrolResultService, IEqpBookService eqpBookService) {
this.patrolTaskInfoService = patrolTaskInfoService;
this.patrolTaskService = patrolTaskService;
@ -830,19 +834,28 @@ public class PatrolTaskExecController extends BaseController {
}
if (StringUtils.isNotEmpty(receiveCode)) {
log.info("定时任务--无人机-机器人任务构建, receiveCode: {}, devType: {}, devNo: {}", receiveCode, patrolTask.getDevType(), patrolTask.getDevNo());
SendTask sendTask = new SendTask();
sendTask.setReceiveCode(receiveCode);
sendTask.setSendCode(sendCode);
sendTask.setCode(patrolTask.getTaskId() + "");
sendTask.setType("41");
sendTask.setCommand("1");
String pilotTaskCmd = JSONObject.toJSONString(sendTask);
pilotTaskCmds.add(pilotTaskCmd);
// 判断任务点位是否在检修区域内
if (patrolTaskStatusController.isWithinMaintainRegion(patrolTask.getTaskCode(), patrolTask.getDevNo())) {
log.info("该任务点位在检修区域内 taskCode: {},sendCode: {}", patrolTask.getTaskCode(), patrolTask.getDevNo());
} else {
SendTask sendTask = new SendTask();
sendTask.setReceiveCode(receiveCode);
sendTask.setSendCode(sendCode);
sendTask.setCode(patrolTask.getTaskId() + "");
sendTask.setType("41");
sendTask.setCommand("1");
String pilotTaskCmd = JSONObject.toJSONString(sendTask);
pilotTaskCmds.add(pilotTaskCmd);
}
}
}
if (pilotTaskCmds.isEmpty()) {
redisService.deleteObjectOfTask(RedisConst.TASK_CURRENT_CODE, patrolTask.getTaskCode());
}
// 下发无人机-机器人任务
for(String pilotTaskCmd : pilotTaskCmds) {
for (String pilotTaskCmd : pilotTaskCmds) {
log.info("定时任务--无人机-机器人任务执行, pilotTaskCmd: {}", pilotTaskCmd);
try {
this.feignTaskClient.sendCommand(pilotTaskCmd);
@ -854,7 +867,6 @@ public class PatrolTaskExecController extends BaseController {
}
}
private void extracted(String key, String taskCode) {
log.info(Color.RED + "[EXEC] Add new task [{}]" + Color.END, key);//日志里没搜到
redisService.setCacheObjectOfTask(RedisConst.TASK_CURRENT_CODE, taskCode, key, 4L, TimeUnit.HOURS);
@ -935,7 +947,7 @@ public class PatrolTaskExecController extends BaseController {
private List<PatrolTask> filterPatrolTaskList(PatrolTask taskParam) {
List<PatrolTask> patrolTaskListEx = patrolTaskService.selectPatrolTaskList(taskParam);
if(patrolTaskListEx.isEmpty())
if (patrolTaskListEx.isEmpty())
return new ArrayList<>();
PatrolTask task = patrolTaskListEx.get(0);


+ 23
- 14
inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/controller/MaintainRegionController.java View File

@ -153,20 +153,7 @@ public class MaintainRegionController extends BaseController {
)
@PostMapping({"/remove/{lineIds}"})
public AjaxResult remove(@PathVariable Long[] lineIds) {
maintainRegionService.deleteMaintainRegionByLineIds(lineIds);
(new Thread(() -> {
logger.info("[MAINTAIN] remove maintain area to upper start");
try {
Thread.sleep(2000L);
syncMaintainRegionToUpperSystem(new MaintainRegion());
} catch (InterruptedException e) {
e.printStackTrace();
}
logger.info("[MAINTAIN] remove maintain area to upper end");
})).start();
return toAjax(1);
return toAjax(maintainRegionService.deleteMaintainRegionByLineIds(lineIds));
}
@PostMapping({"/add"})
@ -275,6 +262,11 @@ public class MaintainRegionController extends BaseController {
return toAjax(1);
}
/**
* 下发指令同步检修区域至设备
* @param maintainRegion
* @return
*/
@GetMapping({"/issue"})
public AjaxResult issueList(MaintainRegion maintainRegion) {
if (StringUtils.isNotEmpty(maintainRegion.getIds())) {
@ -645,4 +637,21 @@ public class MaintainRegionController extends BaseController {
logger.info("[MAINTAIN] SYNC maintain region to upper system jsonString: {}", jsonString);
syncDataToUpstreamService.postMessage(jsonString);
}
@PostMapping("/save")
public AjaxResult save(@RequestBody MaintainRegion maintainRegion) {
if (!maintainRegionService.checkConfigCodeUnique(maintainRegion.getConfigCode())) {
return error("新增检修区域'" + maintainRegion.getConfigCode() + "'失败,检修区域编码已存在");
}
if (StringUtils.isEmpty(maintainRegion.getEnable())) {
maintainRegion.setEnable("1");
}
if (StringUtils.isEmpty(maintainRegion.getDeviceLevel())) {
maintainRegion.setDeviceLevel("0");
}
return toAjax(maintainRegionService.insertMaintainRegionWithConfigCode(maintainRegion));
}
}

+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/mapper/MaintainRegionMapper.java View File

@ -18,4 +18,6 @@ public interface MaintainRegionMapper {
int deleteMaintainRegionByLineId(Long id);
int deleteMaintainRegionByLineIds(Long[] ids);
MaintainRegion checkConfigCodeUnique(String configCode);
}

+ 4
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/service/IMaintainRegionService.java View File

@ -16,4 +16,8 @@ public interface IMaintainRegionService {
int deleteMaintainRegionByLineIds(Long[] lineIds);
int deleteMaintainRegionByLineId(Long lineId);
boolean checkConfigCodeUnique(String configCode);
int insertMaintainRegionWithConfigCode(MaintainRegion maintainRegion);
}

+ 26
- 3
inspect-main/inspect-main-task/src/main/java/com/inspect/maintain/service/impl/MaintainRegionServiceImpl.java View File

@ -3,13 +3,12 @@ package com.inspect.maintain.service.impl;
import com.inspect.base.core.domain.maintain.MaintainRegion;
import com.inspect.maintain.mapper.MaintainRegionMapper;
import com.inspect.maintain.service.IMaintainRegionService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class MaintainRegionServiceImpl implements IMaintainRegionService {
private final MaintainRegionMapper maintainRegionMapper;
@ -42,4 +41,28 @@ public class MaintainRegionServiceImpl implements IMaintainRegionService {
public int deleteMaintainRegionByLineId(Long lineId) {
return this.maintainRegionMapper.deleteMaintainRegionByLineId(lineId);
}
@Override
public boolean checkConfigCodeUnique(String configCode) {
MaintainRegion maintainRegion = this.maintainRegionMapper.checkConfigCodeUnique(configCode);
if (maintainRegion == null) {
return true;
}
return false;
}
@Override
@Transactional(rollbackFor = Exception.class)
public int insertMaintainRegionWithConfigCode(MaintainRegion maintainRegion) {
maintainRegion.setCreateTime(new Date());
int rows = this.maintainRegionMapper.insertMaintainRegion(maintainRegion);
if (rows > 0) {
Long lineId = maintainRegion.getLineId();
maintainRegion.setConfigCode(String.valueOf(lineId));
maintainRegionMapper.updateMaintainRegion(maintainRegion);
}
return rows;
}
}

+ 2
- 47
inspect-main/inspect-main-task/src/main/java/com/inspect/taskinfo/domain/PatrolTaskInfo.java View File

@ -15,6 +15,7 @@ import org.apache.commons.lang3.builder.ToStringStyle;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class PatrolTaskInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
private Long lineId;
@ -93,55 +94,9 @@ public class PatrolTaskInfo extends BaseEntity {
private String alarmType;
private String taskType;
private String areaName;
private Long areaId;
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
private Date createTime;
@Override
public String toString() {
return "PatrolTaskInfo{" +
"lineId=" + lineId +
", lineIds='" + lineIds + '\'' +
", taskMajorId='" + taskMajorId + '\'' +
", deviceId='" + deviceId + '\'' +
", deviceName='" + deviceName + '\'' +
", componentId='" + componentId + '\'' +
", componentName='" + componentName + '\'' +
", bayId='" + bayId + '\'' +
", bayName='" + bayName + '\'' +
", mainDeviceId='" + mainDeviceId + '\'' +
", phyAssetId='" + phyAssetId + '\'' +
", presetCode='" + presetCode + '\'' +
", parentId='" + parentId + '\'' +
", ebookId='" + ebookId + '\'' +
", ebookName='" + ebookName + '\'' +
", mainDeviceName='" + mainDeviceName + '\'' +
", videoPos='" + videoPos + '\'' +
", dataType=" + dataType +
", photoUrl='" + photoUrl + '\'' +
", warnLevel='" + warnLevel + '\'' +
", videoUrl='" + videoUrl + '\'' +
", defectType='" + defectType + '\'' +
", beginTime='" + beginTime + '\'' +
", endTime='" + endTime + '\'' +
", status='" + status + '\'' +
", pointStatus='" + pointStatus + '\'' +
", suggestion='" + suggestion + '\'' +
", desc='" + desc + '\'' +
", taskName='" + taskName + '\'' +
", priority='" + priority + '\'' +
", resultContent='" + resultContent + '\'' +
", deviceCode='" + deviceCode + '\'' +
", devName='" + devName + '\'' +
", devNo='" + devNo + '\'' +
", areName='" + areName + '\'' +
", devType='" + devType + '\'' +
", phase='" + phase + '\'' +
", alarmType='" + alarmType + '\'' +
", taskType='" + taskType + '\'' +
", areaName='" + areaName + '\'' +
", createTime=" + createTime +
'}';
}
}

+ 61
- 10
inspect-main/inspect-main-task/src/main/java/com/inspect/taskstatus/controller/PatrolTaskStatusController.java View File

@ -7,6 +7,7 @@ import com.inspect.analysis.domain.ResultAnalysisSummaryDTO;
import com.inspect.analysis.service.IResultAnalysisService;
import com.inspect.base.core.constant.AlgConstants;
import com.inspect.base.core.constant.RedisConst;
import com.inspect.base.core.domain.maintain.MaintainRegion;
import com.inspect.base.core.enums.TaskStatus;
import com.inspect.base.core.enums.TaskType;
import com.inspect.base.core.utils.DateUtils;
@ -24,6 +25,7 @@ import com.inspect.calender.enums.TaskStateEnum;
import com.inspect.calender.service.TaskCalendarGenerator;
import com.inspect.common.log.annotation.Log;
import com.inspect.common.log.enums.BizType;
import com.inspect.maintain.service.IMaintainRegionService;
import com.inspect.partrolresult.service.IPatrolResultService;
import com.inspect.resultmain.domain.PatrolTaskResultMain;
import com.inspect.resultmain.service.IPatrolTaskResultMainService;
@ -32,6 +34,7 @@ import com.inspect.task.controller.PatrolTaskController;
import com.inspect.task.domain.PatrolTask;
import com.inspect.task.domain.SendTask;
import com.inspect.task.service.IPatrolTaskService;
import com.inspect.taskinfo.domain.PatrolTaskInfo;
import com.inspect.taskinfo.service.IPatrolTaskInfoService;
import com.inspect.taskstatus.client.FeignJobTaskClient;
import com.inspect.taskstatus.client.FeignTaskClient;
@ -74,6 +77,9 @@ public class PatrolTaskStatusController extends BaseController {
@Resource
private TaskCalendarGenerator taskCalendarGenerator;
@Resource
private IMaintainRegionService maintainRegionService;
public PatrolTaskStatusController(
PatrolTaskController patrolTaskController,
IPatrolTaskStatusService patrolTaskStatusService,
@ -793,14 +799,19 @@ public class PatrolTaskStatusController extends BaseController {
}
if (StringUtils.isNotEmpty(receiveCode)) {
log.info("无人机-机器人任务构建, receiveCode: {}, devType: {}, devNo: {}", receiveCode, patrolTask.getDevType(), patrolTask.getDevNo());
SendTask sendTask = new SendTask();
sendTask.setReceiveCode(receiveCode);
sendTask.setSendCode(sendCode);
sendTask.setCode(patrolTask.getTaskId() + "");
sendTask.setType("41");
sendTask.setCommand("1");
String pilotTaskCmd = JSONObject.toJSONString(sendTask);
pilotTaskCmds.add(pilotTaskCmd);
// 判断任务点位是否在检修区域内
if (isWithinMaintainRegion(patrolTask.getTaskCode(), patrolTask.getDevNo())) {
log.info("该任务点位在检修区域内 taskCode: {},sendCode: {}", patrolTask.getTaskCode(), patrolTask.getDevNo());
} else {
SendTask sendTask = new SendTask();
sendTask.setReceiveCode(receiveCode);
sendTask.setSendCode(sendCode);
sendTask.setCode(patrolTask.getTaskCode());
sendTask.setType("41");
sendTask.setCommand("1");
String pilotTaskCmd = JSONObject.toJSONString(sendTask);
pilotTaskCmds.add(pilotTaskCmd);
}
} else {
log.info("可见光任务构建, 第 {} 个, devNo: {}", i + 1, devNos[i]);
devTypeList.add(devTypes[i]);
@ -808,8 +819,10 @@ public class PatrolTaskStatusController extends BaseController {
}
}
String immediatelyExecTaskTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
redisService.setCacheObjectOfTask(RedisConst.TASK_CURRENT_CODE, patrolTask.getTaskCode(), RedisConst.TASK_CODE + patrolTask.getTaskCode() + StringUtils.AT + immediatelyExecTaskTime, 1L, TimeUnit.HOURS);
if (!(pilotTaskCmds.isEmpty() || devTypeList.isEmpty() || devNoList.isEmpty())) {
String immediatelyExecTaskTime = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS"));
redisService.setCacheObjectOfTask(RedisConst.TASK_CURRENT_CODE, patrolTask.getTaskCode(), RedisConst.TASK_CODE + patrolTask.getTaskCode() + StringUtils.AT + immediatelyExecTaskTime, 1L, TimeUnit.HOURS);
}
// 下发无人机任务
for (String pilotTaskCmd : pilotTaskCmds) {
@ -1040,4 +1053,42 @@ public class PatrolTaskStatusController extends BaseController {
return AjaxResult.success();
}
/**
* 判断任务点位是否在检修区域内
*
* @param taskCode
* @return
*/
public boolean isWithinMaintainRegion(String taskCode, String devNo) {
Date currentDate = new Date();
MaintainRegion maintainRegion = MaintainRegion.builder()
.startTime(currentDate)
.endTime(currentDate)
.enable("1")
.build();
List<MaintainRegion> maintainRegionList = maintainRegionService.selectMaintainRegionList(maintainRegion);
log.info("[TASK] MAINTAIN REGION: {}", maintainRegionList);
List<String> maintainIds = maintainRegionList.stream()
.map(MaintainRegion::getDeviceList)
.flatMap(ids -> Arrays.stream(ids.split(StringUtils.COMMA)))
.collect(Collectors.toList());
PatrolTaskInfo patrolTaskInfo = PatrolTaskInfo.builder()
.taskMajorId(taskCode)
.devNo(devNo)
.build();
List<PatrolTaskInfo> patrolTaskInfoList = patrolTaskInfoService.selectPatrolTask(patrolTaskInfo);
log.info("[TASK] PATROL TASK INFO: {}", patrolTaskInfoList);
boolean isWithin = false;
for (PatrolTaskInfo info : patrolTaskInfoList) {
final Long areaId = info.getAreaId();
if (maintainIds.contains(String.valueOf(areaId))) {
isWithin = true;
break;
}
}
return isWithin;
}
}

+ 37
- 4
inspect-main/inspect-main-task/src/main/resources/mapper/task/MaintainRegionMapper.xml View File

@ -14,6 +14,7 @@
<result property="endTime" column="end_time"/>
<result property="deviceLevel" column="device_level"/>
<result property="deviceList" column="device_list"/>
<result property="deviceNames" column="device_names"/>
<result property="coordinatePixel" column="coordinate_pixel"/>
<result property="createTime" column="create_time"/>
<result property="pointList" column="point_list"/>
@ -35,7 +36,7 @@
from maintain_region
</sql>
<select id="selectMaintainRegionList" parameterType="MaintainRegion" resultMap="MaintainRegionResult">
<select id="selectMaintainRegionList1" parameterType="MaintainRegion" resultMap="MaintainRegionResult">
<include refid="selectMaintainRegionVo"/>
<where>
<if test="stationName != null and stationName != ''">and station_name like concat('%', #{stationName},
@ -44,8 +45,35 @@
<if test="stationCode != null and stationCode != ''">and station_code = #{stationCode}</if>
<if test="configCode != null and configCode != ''">and config_code = #{configCode}</if>
<if test="enable != null and enable != ''">and enable = #{enable}</if>
<if test="startTime != null ">and start_time = #{startTime}</if>
<if test="endTime != null ">and end_time = #{endTime}</if>
<if test="startTime != null ">and start_time &gt;= #{beginTime, jdbcType=TIMESTAMP}</if>
<if test="endTime != null ">and end_time &lt;= #{endTime, jdbcType=TIMESTAMP}</if>
<if test="deviceLevel != null and deviceLevel != ''">and device_level = #{deviceLevel}</if>
<if test="deviceList != null and deviceList != ''">and device_list like concat('%',#{deviceList},'%')</if>
<if test="pointList != null and pointList != ''">and point_list like concat('%',#{pointList},'%')</if>
<if test="coordinatePixel != null and coordinatePixel != ''">and coordinate_pixel = #{coordinatePixel}</if>
</where>
ORDER BY line_id desc
</select>
<select id="selectMaintainRegionList" parameterType="MaintainRegion" resultMap="MaintainRegionResult">
SELECT
r.*,
(
SELECT GROUP_CONCAT(a.area_name ORDER BY FIND_IN_SET(a.area_id, r.device_list))
FROM basedata_area a
WHERE FIND_IN_SET(a.area_id, r.device_list)
) AS device_names
FROM maintain_region r
<where>
<if test="stationName != null and stationName != ''">and station_name like concat('%', #{stationName},
'%')
</if>
<if test="stationCode != null and stationCode != ''">and station_code = #{stationCode}</if>
<if test="configCode != null and configCode != ''">and config_code = #{configCode}</if>
<if test="enable != null and enable != ''">and enable = #{enable}</if>
<if test="startTime != null ">and start_time &lt;= #{startTime, jdbcType=TIMESTAMP}</if>
<if test="endTime != null ">and end_time &gt;= #{endTime, jdbcType=TIMESTAMP}</if>
<if test="deviceLevel != null and deviceLevel != ''">and device_level = #{deviceLevel}</if>
<if test="deviceList != null and deviceList != ''">and device_list like concat('%',#{deviceList},'%')</if>
<if test="pointList != null and pointList != ''">and point_list like concat('%',#{pointList},'%')</if>
@ -59,7 +87,12 @@
where line_id = #{lineId}
</select>
<insert id="insertMaintainRegion" parameterType="MaintainRegion">
<select id="checkConfigCodeUnique" resultType="com.inspect.base.core.domain.maintain.MaintainRegion">
<include refid="selectMaintainRegionVo"/>
where config_code = #{configCode}
</select>
<insert id="insertMaintainRegion" parameterType="MaintainRegion" useGeneratedKeys="true" keyProperty="lineId">
insert into maintain_region
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="lineId != null">line_id,</if>


+ 3
- 2
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskInfoMapper.xml View File

@ -78,13 +78,14 @@
select a.*,b.device_name as devName,
b.device_code as deviceCode,
c.area_name as areName,
c.area_id as areaId,
d.device_type_name as devType,
d.phase as phase
from patrol_task_info a
LEFT JOIN basedata_device b on a.main_device_id=b.device_id
INNER JOIN basedata_area c on b.area_id =c.area_id
INNER JOIN basedata_devicetype d on b.device_type_id=d.device_type_id
LEFT JOIN basedata_area c on b.area_id =c.area_id
LEFT JOIN basedata_devicetype d on b.device_type_id=d.device_type_id
<where>
<if test="taskMajorId != null and taskMajorId != ''">and task_major_id = #{taskMajorId}</if>
<if test="deviceId != null ">and device_id = #{deviceId}</if>


+ 11
- 6
inspect-metadata/src/main/java/com/inspect/metadata/prodevmnt/controller/BasedataDeviceController.java View File

@ -46,12 +46,7 @@ import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@Slf4j
@ -719,6 +714,16 @@ public class BasedataDeviceController extends BaseController {
return AjaxResult.success(this.mergeDeptAndEquipment(arel, maindevlist, "1"));
}
@GetMapping("/treeAreaDeviceSelectByLevel")
public AjaxResult treeAreaDeviceSelectByLevel(@RequestParam(defaultValue = "0")int deviceLevel) {
log.info("deviceLevel: {}", deviceLevel);
List<BaseDataArea> areas = this.baseDataAreaService.selectAreaList(new BaseDataArea());
log.info("areas: {}", areas);
List<TreeModule> arel = this.baseDataAreaService.buildAreaTreeAgain(areas);
log.info("arel: {}", arel);
return AjaxResult.success(arel);
}
private List<TreeModule> mergeDeptAndEquipment(List<TreeModule> mainOrgList, List<TreeModule> pointOrgList, String type) {
for (TreeModule equipmentOrg : pointOrgList) {


Loading…
Cancel
Save