Commit 8cadd31d authored by KeYong's avatar KeYong

修改bug

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