Commit 8cadd31d authored by KeYong's avatar KeYong

修改bug

parent f8a802c3
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.fas.business.bo.BindPointBo; import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.BindRegionBo; import com.yeejoin.amos.fas.business.bo.BindRegionBo;
import com.yeejoin.amos.fas.business.feign.JcsFeign;
import com.yeejoin.amos.fas.business.param.RetrieveParams; import com.yeejoin.amos.fas.business.param.RetrieveParams;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService; import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService; import com.yeejoin.amos.fas.business.service.intfc.IRocketMQService;
...@@ -12,6 +14,7 @@ import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum; ...@@ -12,6 +14,7 @@ import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.config.Permission; import com.yeejoin.amos.fas.config.Permission;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil; import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.core.util.ResponseModel;
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;
...@@ -32,9 +35,13 @@ public class View3dController extends BaseController { ...@@ -32,9 +35,13 @@ public class View3dController extends BaseController {
@Autowired @Autowired
private IRiskSourceService riskSourceService; private IRiskSourceService riskSourceService;
@Autowired @Autowired
private IView3dService view3dService; private IView3dService view3dService;
@Autowired
JcsFeign jcsFeign;
@Permission @Permission
@ApiOperation(httpMethod = "POST", value = "点3d坐标设置", notes = "按照点类型3d坐标设置" ) @ApiOperation(httpMethod = "POST", value = "点3d坐标设置", notes = "按照点类型3d坐标设置" )
@PostMapping(value = "/point/bind",produces = "application/json;charset=UTF-8") @PostMapping(value = "/point/bind",produces = "application/json;charset=UTF-8")
...@@ -106,19 +113,26 @@ public class View3dController extends BaseController { ...@@ -106,19 +113,26 @@ public class View3dController extends BaseController {
@Permission @Permission
@ApiOperation(value = "一周安全指数趋势查询", notes = "一周安全指数趋势查询") @ApiOperation(value = "一周安全指数趋势查询", notes = "一周安全指数趋势查询")
@GetMapping(value = "safetyIndex/week") @GetMapping(value = "safetyIndex/week")
public CommonResponse safetyIndexWeek(String type,Long pointId) { public CommonResponse safetyIndexWeek(@RequestParam(required = false) String type, @RequestParam(required = false) Long pointId) {
ReginParams reginParams =getSelectedOrgInfo(); return CommonResponseUtil.success(view3dService.getSafetyIndexWeek(""));
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.getSafetyIndexWeek(orgCode));
} }
@Permission @Permission
@ApiOperation(value = "今日安全指数查询",notes = "按照日期查询安全指数及分类数据") @ApiOperation(value = "今日安全指数查询",notes = "按照日期查询安全指数及分类数据")
@GetMapping(value = "/statistics/safetyIndex") @GetMapping(value = "/statistics/safetyIndex")
public CommonResponse getSafetyIndexInfoByDate(@RequestParam(name = "date",required = false) String date){ public CommonResponse getSafetyIndexInfoByDate(@RequestParam(name = "date",required = false) String date){
ReginParams reginParams =getSelectedOrgInfo(); ResponseModel responseModel = null;
String orgCode = this.getOrgCode(reginParams); try {
return CommonResponseUtil.success(view3dService.getSafetyIndexInfoByDate(orgCode,date)); responseModel = jcsFeign.getBizByAmos();
} catch (Exception e) {
e.printStackTrace();
}
String bizOrgCode = "";
if (responseModel != null && "SUCCESS".equals(responseModel.getDevMessage())) {
String resStr = JSON.toJSONString(responseModel.getResult()).replace("\"","");
bizOrgCode = "null".equalsIgnoreCase(resStr) ? null : resStr;
}
return CommonResponseUtil.success(view3dService.getSafetyIndexInfoByDate(bizOrgCode, date));
} }
@Permission @Permission
...@@ -144,17 +158,37 @@ public class View3dController extends BaseController { ...@@ -144,17 +158,37 @@ public class View3dController extends BaseController {
@ApiOperation(value = "今日巡检统计接口",notes = "今日巡检统计接口") @ApiOperation(value = "今日巡检统计接口",notes = "今日巡检统计接口")
@GetMapping(value = "statistics/check") @GetMapping(value = "statistics/check")
public CommonResponse getStatisticsCheck(){ public CommonResponse getStatisticsCheck(){
ReginParams reginParams =getSelectedOrgInfo(); ResponseModel responseModel = null;
String orgCode = this.getOrgCode(reginParams); try {
return CommonResponseUtil.success(view3dService.getStatisticsCheck(orgCode)); responseModel = jcsFeign.getBizByAmos();
} catch (Exception e) {
e.printStackTrace();
}
String bizOrgCode = "";
if (responseModel != null && "SUCCESS".equals(responseModel.getDevMessage())) {
String resStr = JSON.toJSONString(responseModel.getResult()).replace("\"","");
bizOrgCode = "null".equalsIgnoreCase(resStr) ? null : resStr;
}
return CommonResponseUtil.success(view3dService.getStatisticsCheck(bizOrgCode));
} }
@ApiOperation(value = "异常显示最新5条",notes = "异常显示最新5条") @ApiOperation(value = "异常显示最新5条",notes = "异常显示最新5条")
@GetMapping(value = "safetyExecute/list/{type}") @GetMapping(value = "safetyExecute/list/{type}")
public CommonResponse getSafetyExecuteListTop5(@PathVariable("type")String type){ public CommonResponse getSafetyExecuteListTop5(@PathVariable("type")String type){
ReginParams reginParams =getSelectedOrgInfo(); // ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams); // String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.getSafetyExecuteListTop5(type,orgCode)); ResponseModel responseModel = null;
try {
responseModel = jcsFeign.getBizByAmos();
} catch (Exception e) {
e.printStackTrace();
}
String bizOrgCode = "";
if (responseModel != null && "SUCCESS".equals(responseModel.getDevMessage())) {
String resStr = JSON.toJSONString(responseModel.getResult()).replace("\"","");
bizOrgCode = "null".equalsIgnoreCase(resStr) ? null : resStr;
}
return CommonResponseUtil.success(view3dService.getSafetyExecuteListTop5(type, bizOrgCode));
} }
@Permission @Permission
......
...@@ -95,7 +95,7 @@ public interface View3dMapper extends BaseMapper { ...@@ -95,7 +95,7 @@ public interface View3dMapper extends BaseMapper {
* @param orgCode * @param orgCode
* @return * @return
*/ */
List<HashMap<String, Object>> getStatisticsCheck(String orgCode); List<HashMap<String, Object>> getStatisticsCheck(@Param("orgCode") String orgCode);
/** /**
* 风险异常显示最新5条 * 风险异常显示最新5条
...@@ -111,7 +111,7 @@ public interface View3dMapper extends BaseMapper { ...@@ -111,7 +111,7 @@ public interface View3dMapper extends BaseMapper {
* @param orgCode * @param orgCode
* @return * @return
*/ */
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode); List<SafetyExecuteBo> getCheckErrorTop5(@Param("orgCode") String orgCode);
/** /**
* 火灾告警最新5条 * 火灾告警最新5条
......
...@@ -43,4 +43,7 @@ public interface JcsFeign { ...@@ -43,4 +43,7 @@ public interface JcsFeign {
@RequestMapping(value = "/jcs/org-person/person/img/{id}", method = RequestMethod.GET,consumes = "application/json") @RequestMapping(value = "/jcs/org-person/person/img/{id}", method = RequestMethod.GET,consumes = "application/json")
ResponseModel getPersonImage(@PathVariable String id); ResponseModel getPersonImage(@PathVariable String id);
@RequestMapping(value = "/jcs/org-usr/getBizByAmos", method = RequestMethod.GET,consumes = "application/json")
ResponseModel getBizByAmos();
} }
...@@ -247,33 +247,38 @@ public class View3dServiceImpl implements IView3dService { ...@@ -247,33 +247,38 @@ public class View3dServiceImpl implements IView3dService {
if (!StringUtil.isNotEmpty(date)) { if (!StringUtil.isNotEmpty(date)) {
date = DateUtil.getDateFormat(new Date(), DateUtil.DATE_DEFAULT_FORMAT); date = DateUtil.getDateFormat(new Date(), DateUtil.DATE_DEFAULT_FORMAT);
} }
Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode, 0L); // Optional<RiskSource> optional = iRiskSourceDao.findByOrgCodeAndParentId(orgCode, 0L);
TodaySafetyIndexVo vo = new TodaySafetyIndexVo(); TodaySafetyIndexVo vo = new TodaySafetyIndexVo();
if (optional.isPresent()) { //1.按照等级进行转换rpn为分数-机构 // 统计巡检异常数量(不合格、漏检)-日期+机构
RiskSource riskSource = optional.get(); Long checkExceptionNum = this.getCheckExceptionNum(orgCode, date);
double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn()); vo.setCheckExceptionNum(checkExceptionNum);
vo.setSafetyIndex(safetyIndex); // 统计故障数量-日期+机构
//2.统计风险上升异常数量(风险点)-日期+机构 vo.setFireExceptionNum(getFireExceptionNum(orgCode, date));
Long upperNum = this.getRiskUpperNum(orgCode, date); // if (optional.isPresent()) { //1.按照等级进行转换rpn为分数-机构
vo.setRiskExceptionNum(upperNum); // RiskSource riskSource = optional.get();
//3.统计巡检异常数量(不合格、漏检)-日期+机构 // double safetyIndex = this.changeRpnToSafetyIndex(riskSource.getRpn());
Long checkExceptionNum = this.getCheckExceptionNum(orgCode, date); // vo.setSafetyIndex(safetyIndex);
vo.setCheckExceptionNum(checkExceptionNum); // //2.统计风险上升异常数量(风险点)-日期+机构
//4.统计故障数量-日期+机构 // Long upperNum = this.getRiskUpperNum(orgCode, date);
vo.setFireExceptionNum(getFireExceptionNum(orgCode, date)); // vo.setRiskExceptionNum(upperNum);
//5.安全值提示 // //3.统计巡检异常数量(不合格、漏检)-日期+机构
if (riskSource.getRiskLevelId() != null) { // Long checkExceptionNum = this.getCheckExceptionNum(orgCode, date);
Optional<RiskLevel> opt = iRiskLevelDao.findById(riskSource.getRiskLevelId()); // vo.setCheckExceptionNum(checkExceptionNum);
if (opt.isPresent()) { // //4.统计故障数量-日期+机构
Integer level = opt.get().getLevel(); // vo.setFireExceptionNum(getFireExceptionNum(orgCode, date));
String tips = RiskSourceLevelEum.getTipsByLevel(String.valueOf(level)); // //5.安全值提示
vo.setSafetyTips(tips); // if (riskSource.getRiskLevelId() != null) {
vo.setLevel(level); // Optional<RiskLevel> opt = iRiskLevelDao.findById(riskSource.getRiskLevelId());
} // if (opt.isPresent()) {
} // Integer level = opt.get().getLevel();
} else { // String tips = RiskSourceLevelEum.getTipsByLevel(String.valueOf(level));
throw new YeeException("机构:" + orgCode + " 不存在"); // vo.setSafetyTips(tips);
} // vo.setLevel(level);
// }
// }
// } else {
// throw new YeeException("机构:" + orgCode + " 不存在");
// }
return vo; return vo;
} }
...@@ -446,8 +451,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -446,8 +451,8 @@ public class View3dServiceImpl implements IView3dService {
public List<SafetyExecuteBo> getSafetyExecuteListTop5(String type, String orgCode) { public List<SafetyExecuteBo> getSafetyExecuteListTop5(String type, String orgCode) {
StatisticsErrorTypeEum.risk.getCode(); StatisticsErrorTypeEum.risk.getCode();
switch (type) { switch (type) {
case "risk"://风险异常 // case "risk"://风险异常
return view3dMapper.getRiskErrorTop5(orgCode); // return view3dMapper.getRiskErrorTop5(orgCode);
case "check"://巡检异常 case "check"://巡检异常
return view3dMapper.getCheckErrorTop5(orgCode); return view3dMapper.getCheckErrorTop5(orgCode);
case "fire"://火灾告警 case "fire"://火灾告警
......
...@@ -43,11 +43,11 @@ ...@@ -43,11 +43,11 @@
p_check pc p_check pc
WHERE WHERE
DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date} DATE_FORMAT(pc.check_time, '%Y-%m-%d') = #{date}
AND ( <if test="orgCode != null and orgCode != ''">
pc.org_code = #{orgCode} AND (pc.org_code = #{orgCode} OR pc.org_code LIKE CONCAT(#{orgCode}, '%')
OR pc.org_code LIKE CONCAT(#{orgCode}, '-%') )
) </if>
AND pc.`is_ok` = '2' AND pc.`is_ok` = '2'
</select> </select>
<select id="countFireException" resultType="long"> <select id="countFireException" resultType="long">
...@@ -57,7 +57,9 @@ ...@@ -57,7 +57,9 @@
wl_equipment_specific_alarm a wl_equipment_specific_alarm a
WHERE WHERE
status = 1 status = 1
AND org_code = #{orgCode} <if test="orgCode != null and orgCode != ''">
AND biz_org_code = #{orgCode}
</if>
AND type = 'BREAKDOWN' AND type = 'BREAKDOWN'
AND date_format(a.update_date, '%Y-%m-%d') = #{date} AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select> </select>
...@@ -137,8 +139,11 @@ ...@@ -137,8 +139,11 @@
select select
is_ok as type,count(1) as value is_ok as type,count(1) as value
from p_check a from p_check a
where (a.org_code like CONCAT(#{orgCode},'-%') OR a.org_code = #{orgCode}) where
and TO_DAYS(a.check_time) = TO_DAYS(CURRENT_DATE) TO_DAYS(a.check_time) = TO_DAYS(CURRENT_DATE)
<if test="orgCode != null and orgCode != ''">
AND (a.org_code like CONCAT(#{orgCode},'%') OR a.org_code = #{orgCode})
</if>
GROUP BY a.is_ok GROUP BY a.is_ok
]]> ]]>
</select> </select>
...@@ -161,7 +166,9 @@ ...@@ -161,7 +166,9 @@
left join p_point I ON I.id = p.point_id left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3') where p.is_ok IN ('2', '3')
AND I.is_delete = 0 AND I.is_delete = 0
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'-%') ) <if test="orgCode != null and orgCode != ''">
AND (p.org_code = #{orgCode} OR p.org_code like CONCAT(#{orgCode},'%') )
</if>
ORDER BY p.check_time desc ORDER BY p.check_time desc
limit 0,5 limit 0,5
</select> </select>
......
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