Commit 647a3d5f authored by suhuiguang's avatar suhuiguang

1.修改报错

parent 84111b74
package com.yeejoin.amos.fas.common.enums;
/**
* @author suhg
*/
public enum StatisticsErrorTypeEum {
/**
* 风险异常
*/
risk("risk", "风险异常"),
/**
* 巡检异常
*/
patrol("patrol", "巡检异常"),
/**
* 设备故障
*/
equip("equip", "设备故障"),
/**
* 火灾告警
*/
fire("fire", "火灾告警");
/**
* 编号
*/
private String code;
/**
* 名称
*/
private String name;
StatisticsErrorTypeEum(String code, String name) {
this.code = code;
this.name = name;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.business.bo;
/**
* @author suhg
*/
public class RiskPointRpnChangeBo {
private Long id;
private String name;
private Long riskLevelId;
private String changeDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getRiskLevelId() {
return riskLevelId;
}
public void setRiskLevelId(Long riskLevelId) {
this.riskLevelId = riskLevelId;
}
public String getChangeDate() {
return changeDate;
}
public void setChangeDate(String changeDate) {
this.changeDate = changeDate;
}
}
...@@ -83,6 +83,8 @@ public class View3dController extends BaseController { ...@@ -83,6 +83,8 @@ public class View3dController extends BaseController {
@ApiOperation(value = "今日安全指数详情",notes = "risk-风险异常,check-巡检异常,equipProblem-设备故障") @ApiOperation(value = "今日安全指数详情",notes = "risk-风险异常,check-巡检异常,equipProblem-设备故障")
@GetMapping(value = "/safetyIndex/detail/{type}") @GetMapping(value = "/safetyIndex/detail/{type}")
public CommonResponse getSafetyIndexDetail(@PathVariable String type){ public CommonResponse getSafetyIndexDetail(@PathVariable String type){
return CommonResponseUtil.success(view3dService.getSafetyIndexDetail(type)); ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
return CommonResponseUtil.success(view3dService.getSafetyIndexDetail(type,orgCode));
} }
} }
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.dao.mapper; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse; import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
...@@ -24,4 +26,11 @@ public interface View3dMapper extends BaseMapper{ ...@@ -24,4 +26,11 @@ public interface View3dMapper extends BaseMapper{
* @return Long * @return Long
*/ */
Long countCheckException(Map<String,Object> param); Long countCheckException(Map<String,Object> param);
/**
* 今日安全指数详情
* @param params orgCode,date
* @return list
*/
List<RiskPointRpnChangeBo> getAllErrorRiskPoint(Map<String, Object> params);
} }
...@@ -3,30 +3,31 @@ package com.yeejoin.amos.fas.business.service.impl; ...@@ -3,30 +3,31 @@ package com.yeejoin.amos.fas.business.service.impl;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.google.common.collect.Lists;
import com.sun.xml.internal.bind.v2.TODO;
import com.yeejoin.amos.fas.business.bo.BindPointBo; import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo;
import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper; import com.yeejoin.amos.fas.business.dao.mapper.PatrolMapper;
import com.yeejoin.amos.fas.business.dao.repository.*; import com.yeejoin.amos.fas.business.dao.repository.*;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService; import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.business.vo.ErrorContentVo;
import com.yeejoin.amos.fas.business.vo.SafetyIndexDetailVo; import com.yeejoin.amos.fas.business.vo.SafetyIndexDetailVo;
import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo; import com.yeejoin.amos.fas.business.vo.TodaySafetyIndexVo;
import com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum; import com.yeejoin.amos.fas.common.enums.RpnChangeTypeEum;
import com.yeejoin.amos.fas.common.enums.StatisticsErrorTypeEum;
import com.yeejoin.amos.fas.core.common.request.DateUtil; import com.yeejoin.amos.fas.core.common.request.DateUtil;
import com.yeejoin.amos.fas.core.util.*; import com.yeejoin.amos.fas.core.util.*;
import com.yeejoin.amos.fas.dao.entity.*; import com.yeejoin.amos.fas.dao.entity.*;
import com.yeejoin.amos.fas.exception.YeeException; import com.yeejoin.amos.fas.exception.YeeException;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper; import com.yeejoin.amos.fas.business.dao.mapper.View3dMapper;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum; import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse; import com.yeejoin.amos.fas.core.common.response.RegionTreeResponse;
import com.yeejoin.amos.fas.core.util.CommonResponse; import com.yeejoin.amos.fas.core.util.CommonResponse;
...@@ -56,6 +57,8 @@ public class View3dServiceImpl implements IView3dService { ...@@ -56,6 +57,8 @@ public class View3dServiceImpl implements IView3dService {
private IWaterResourceDao iWaterResourceDao; private IWaterResourceDao iWaterResourceDao;
@Autowired @Autowired
private PatrolMapper patrolMapper; private PatrolMapper patrolMapper;
@Autowired
private IRiskLevelDao iRiskLevelDao;
...@@ -206,8 +209,34 @@ public class View3dServiceImpl implements IView3dService { ...@@ -206,8 +209,34 @@ public class View3dServiceImpl implements IView3dService {
} }
@Override @Override
public List<SafetyIndexDetailVo> getSafetyIndexDetail(String type) { public List<SafetyIndexDetailVo> getSafetyIndexDetail(String type,String orgCode) {
return null; List<SafetyIndexDetailVo> resultList = Lists.newArrayList();
String dateStr = DateUtil.getDateFormat(new Date(),DateUtil.DATE_DEFAULT_FORMAT);
if(StatisticsErrorTypeEum.risk.getCode().equals(type)){
//1.按照日期+机构,查询出所有风险点
Map<String,Object> params = new HashMap<>();
params.put("orgCode",orgCode);
params.put("date",dateStr);
List<RiskPointRpnChangeBo> risks = view3dMapper.getAllErrorRiskPoint(params);
//2.按照 风险等级id进行分组,加工数据
Map<Long,List<RiskPointRpnChangeBo>> map = risks.stream().collect(Collectors.groupingBy(RiskPointRpnChangeBo::getRiskLevelId));
List<RiskLevel> riskLevelList = iRiskLevelDao.findAll();
Map<Long,String> riskLevelMap = riskLevelList.stream().collect(Collectors.toMap(RiskLevel::getId,RiskLevel::getName));
map.forEach((k,v)->{
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(Long.toString(k));
safetyIndexDetailVo.setTypeName(riskLevelMap.get(k));
List<ErrorContentVo> errorContentVoList = new ArrayList<>();
BeanUtils.copyProperties(v,errorContentVoList);
safetyIndexDetailVo.setContent(errorContentVoList);
resultList.add(safetyIndexDetailVo);
});
} else if(StatisticsErrorTypeEum.patrol.getCode().equals(type)){
} else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){
}
return resultList;
} }
private Long getCheckExceptionNum(String orgCode, String date) { private Long getCheckExceptionNum(String orgCode, String date) {
......
...@@ -48,5 +48,5 @@ public interface IView3dService { ...@@ -48,5 +48,5 @@ public interface IView3dService {
* @param type 详情类型 * @param type 详情类型
* @return list * @return list
*/ */
List<SafetyIndexDetailVo> getSafetyIndexDetail(String type); List<SafetyIndexDetailVo> getSafetyIndexDetail(String type,String orgCode);
} }
...@@ -66,4 +66,19 @@ ...@@ -66,4 +66,19 @@
) pt ) pt
where #{date} BETWEEN pt.begin_date and pt.end_date where #{date} BETWEEN pt.begin_date and pt.end_date
</select> </select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
SELECT
b.id,
a.`name`,
a.risk_level_id as riskLevelId,
b.create_date as changeDate
FROM
f_risk_source a,
f_rpn_change_log b
WHERE
b.risk_source_id = a.id
AND b.type = '0'
and a.org_code = #{orgCode}
and DATE_FORMAT(b.create_date,'%Y-%m-%d') = #{date}
</select>
</mapper> </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