Commit edd06982 authored by wanghui's avatar wanghui

指令流查询接口

parent 40d548b9
package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyPlanService;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil2;
import com.yeejoin.amos.fas.core.util.ResponseModel;
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.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping("/api/instructions")
@Api(tags = "指令流查询API")
public class InstructionsController {
@Autowired
IContingencyPlanService iContingencyPlanService;
/**
* 指令流查询API
*/
@Permission
@ApiOperation(value = "指令流查询API", notes = "指令流查询API")
@GetMapping(value = "/{code}", produces = "application/json;charset=UTF-8")
public ResponseModel createPlan(@PathVariable(value = "code") String code) {
if (StringUtils.isEmpty(code)) {
return CommonResponseUtil2.failure("参数有误");
}
return CommonResponseUtil2.success(iContingencyPlanService.getBatchNoByCode(code));
}
}
......@@ -85,4 +85,10 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo>
EquipmentSpecific getSpecificById(@Param("id") Long id);
Long getIndexByIndexId(@Param("indexId") Long indexId);
String getIdByCode(@Param("code") String code);
String getEquipId(@Param("id") String id);
String getBatchNoByEquipId(@Param("equipId") String equipId);
}
......@@ -269,6 +269,30 @@ public class ContingencyPlanServiceImpl implements IContingencyPlanService {
return list;
}
@Override
public List<HashMap<String, Object>> getBatchNoByCode(String code) {
List<HashMap<String, Object>> list = new ArrayList<>();
String idByCode = equipmentSpecificMapper.getIdByCode(code);
if (StringUtils.isEmpty(idByCode)) {
return list;
}
String equipId = equipmentSpecificMapper.getEquipId(idByCode);
if (StringUtils.isEmpty(equipId)) {
return list;
}
String batchNoByEquipId = equipmentSpecificMapper.getBatchNoByEquipId(equipId);
if (StringUtils.isEmpty(batchNoByEquipId)) {
return list;
}
List<ContingencyPlanInstance> instancesList = repository.queryForCategory(batchNoByEquipId, "MESSAGE");
instancesList.forEach(contingencyPlanInstance -> {
HashMap<String, Object> map = new HashMap<>();
map.put("crateDate", contingencyPlanInstance.getCreateDate());
map.put("content", contingencyPlanInstance.getContent());
list.add(map);
});
return list;
}
//启动状态校验
public ReserveEnum runCheck(ContingencyPlanParamVo vo) throws Exception {
......
......@@ -129,6 +129,8 @@ public interface IContingencyPlanService {
List<HashMap<String, Object>> getRecordList(String batchNo);
List<HashMap<String, Object>> getBatchNoByCode(String code);
Page recordListByPage(Page page, Long planId, String planName, List<Long> classifyId, Date startTimeLeft, Date startTimeRight, Integer executionType, Integer planPattern);
AtomicBoolean planReset();
......
......@@ -271,4 +271,23 @@
WHERE wesi.id=#{indexId}
limit 1
</select>
<select id="getIdByCode" resultType="java.lang.String">
select id from wl_equipment_specific where code = #{code,jdbcType=VARCHAR} limit 1
</select>
<select id="getEquipId" resultType="java.lang.String">
select equipment_id from f_equipment_fire_equipment where fire_equipment_id = #{id,jdbcType=VARCHAR} limit 1
</select>
<select id="getBatchNoByEquipId" resultType="java.lang.String">
SELECT
batch_no
FROM
c_plan_operation_record
WHERE
plan_id = ( SELECT plan_id FROM c_plan_equipment WHERE fire_equipment_id = #{equipId,jdbcType=VARCHAR} LIMIT 1 )
ORDER BY create_date DESC
LIMIT 1
</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