Commit 09e9ff5a authored by jianqian's avatar jianqian

新增

parent 25af9768
package com.dcit.danger.controller;
import com.dcit.common.enums.ResultEnum;
import com.dcit.common.utils.ResultVOUtil;
import com.dcit.common.vo.ResultVO;
import com.dcit.danger.dto.AlarmInfoDTO;
import com.dcit.danger.dto.query.AccidentQuery;
import com.dcit.danger.dto.query.AlarmInfoQuery;
import com.dcit.danger.exception.IOCException;
import com.dcit.danger.model.AccidentStatistics;
import com.dcit.danger.service.AccidentStatisticsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
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 java.util.HashMap;
import java.util.List;
import java.util.Map;
@Api(value="事故信息API")
@RestController
@RequestMapping("accidentInfo")
@Slf4j
public class AccidentStatisticsController {
@Autowired
private AccidentStatisticsService accidentStatisticsService;
@ApiOperation(value = "查询预警列表")
@PostMapping("/getAccidentInfoList")
public ResultVO<Object> selectListByEnterpriseId(@RequestBody AccidentQuery accidentQuery) {
ModelMap modelMap = new ModelMap();
try {
PageHelper.offsetPage(accidentQuery.getPage(), accidentQuery.getSize());
List<AccidentStatistics> dtoList = accidentStatisticsService.selectListByEnterpriseId(accidentQuery.getEnterpriseId(), accidentQuery.getFromdate());
PageInfo<AccidentStatistics> pageInfoList = new PageInfo<AccidentStatistics>(dtoList);
modelMap.addAttribute("pageData", pageInfoList.getList());
modelMap.addAttribute("total", pageInfoList.getTotal());
} catch (Exception e) {
e.printStackTrace();
log.error("【查询报警列表】操作出错,error={}", e.getMessage());
throw new IOCException(ResultEnum.OPERATION_FAIL);
}
return ResultVOUtil.success(modelMap);
}
}
...@@ -124,4 +124,26 @@ public class AlarmInfoController { ...@@ -124,4 +124,26 @@ public class AlarmInfoController {
return ResultVOUtil.success(); return ResultVOUtil.success();
} }
@ApiOperation(value = "按年查询预警列表")
@PostMapping("/selectInfoByEnterpriseId")
public ResultVO<Object> selectInfoByEnterpriseId(@RequestBody AlarmInfoQuery alarmInfoQuery){
ModelMap modelMap = new ModelMap();
try {
PageHelper.offsetPage(alarmInfoQuery.getPage(), alarmInfoQuery.getSize());
List<AlarmInfo> dtoList = alarmInfoService.selectInfoByEnterpriseId(alarmInfoQuery.getEnterpriseId(),alarmInfoQuery.getFromdate());
PageInfo<AlarmInfo> pageInfoList = new PageInfo<AlarmInfo>(dtoList);
modelMap.addAttribute("pageData", pageInfoList.getList());
modelMap.addAttribute("total", pageInfoList.getTotal());
} catch (Exception e) {
e.printStackTrace();
log.error("【查询报警列表】操作出错,error={}",e.getMessage());
throw new IOCException(ResultEnum.OPERATION_FAIL);
}
return ResultVOUtil.success(modelMap);
}
} }
...@@ -246,9 +246,14 @@ public class DataStatisticsController { ...@@ -246,9 +246,14 @@ public class DataStatisticsController {
//监控 //监控
SafetyDeviceInfoExample safetyDeviceInfoExample = new SafetyDeviceInfoExample(); SafetyDeviceInfoExample safetyDeviceInfoExample = new SafetyDeviceInfoExample();
com.dcit.danger.model.SafetyDeviceInfoExample.Criteria safetyDeviceCriteria = safetyDeviceInfoExample.createCriteria(); com.dcit.danger.model.SafetyDeviceInfoExample.Criteria safetyDeviceCriteria = safetyDeviceInfoExample.createCriteria();
safetyDeviceCriteria.andDataTypeEqualTo("1").andIsDelEqualTo("0"); safetyDeviceCriteria.andIsDelEqualTo("0");
safetyDeviceCriteria.andEnterpriseIdIn(strlist); safetyDeviceCriteria.andEnterpriseIdIn(strlist);
//所有设备
List<SafetyDeviceInfo> allList = safetyDeviceInfoService.selectByExample(safetyDeviceInfoExample);
safetyDeviceCriteria.andDataTypeEqualTo("1");
//监控设备
List<SafetyDeviceInfo> cameraList = safetyDeviceInfoService.selectByExample(safetyDeviceInfoExample); List<SafetyDeviceInfo> cameraList = safetyDeviceInfoService.selectByExample(safetyDeviceInfoExample);
//隐患 //隐患
THiddenTroubleExample tHiddenTroubleExample = new THiddenTroubleExample(); THiddenTroubleExample tHiddenTroubleExample = new THiddenTroubleExample();
tHiddenTroubleExample.createCriteria().andEnterpriseIdIn(strlist); tHiddenTroubleExample.createCriteria().andEnterpriseIdIn(strlist);
...@@ -266,6 +271,7 @@ public class DataStatisticsController { ...@@ -266,6 +271,7 @@ public class DataStatisticsController {
map.put("troubleList",troubleList); map.put("troubleList",troubleList);
map.put("goodsList",goodsList); map.put("goodsList",goodsList);
map.put("harmPlace",harmPlace); map.put("harmPlace",harmPlace);
map.put("allList",allList);
return ResultVOUtil.success(map); return ResultVOUtil.success(map);
} }
......
...@@ -23,4 +23,6 @@ public interface AccidentStatisticsMapper { ...@@ -23,4 +23,6 @@ public interface AccidentStatisticsMapper {
List<Map<String,Object>> selectByYear(@Param("enterpriseId")String enterpriseId, List<Map<String,Object>> selectByYear(@Param("enterpriseId")String enterpriseId,
@Param("fromdate")String fromdate); @Param("fromdate")String fromdate);
List<AccidentStatistics> selectListByEnterpriseId(@Param("enterpriseId")String enterpriseId,
@Param("fromdate")String fromdate);
} }
\ No newline at end of file
...@@ -35,4 +35,7 @@ public interface AlarmInfoMapper { ...@@ -35,4 +35,7 @@ public interface AlarmInfoMapper {
List<Map<String,Object>> selectByYear(@Param("enterpriseId")String enterpriseId, List<Map<String,Object>> selectByYear(@Param("enterpriseId")String enterpriseId,
@Param("fromdate")String fromdate); @Param("fromdate")String fromdate);
List<AlarmInfo> selectInfoByEnterpriseId(@Param("enterpriseId")String enterpriseId,
@Param("fromdate")String fromdate);
} }
\ No newline at end of file
package com.dcit.danger.dto.query;
import com.dcit.common.page.PageBasic;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper=true)
public class AccidentQuery extends PageBasic{
private String enterpriseId;
private String fromdate;
}
...@@ -12,4 +12,6 @@ public class AlarmInfoQuery extends PageBasic{ ...@@ -12,4 +12,6 @@ public class AlarmInfoQuery extends PageBasic{
private String enterpriseId; private String enterpriseId;
private String alarmStatus; private String alarmStatus;
private String fromdate;
} }
package com.dcit.danger.model; package com.dcit.danger.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date; import java.util.Date;
public class AccidentStatistics { public class AccidentStatistics {
...@@ -14,9 +16,9 @@ public class AccidentStatistics { ...@@ -14,9 +16,9 @@ public class AccidentStatistics {
private String accidentReason; private String accidentReason;
private Integer month; private Integer month;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date accidentTime; private Date accidentTime;
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createTime; private Date createTime;
private String accidentText; private String accidentText;
......
...@@ -2,6 +2,8 @@ package com.dcit.danger.model; ...@@ -2,6 +2,8 @@ package com.dcit.danger.model;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
...@@ -47,6 +49,7 @@ public class AlarmInfo implements Serializable { ...@@ -47,6 +49,7 @@ public class AlarmInfo implements Serializable {
/** /**
* 报警时间 * 报警时间
*/ */
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date alarmTime; private Date alarmTime;
/** /**
......
package com.dcit.danger.service; package com.dcit.danger.service;
import com.dcit.danger.model.AccidentStatistics;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
...@@ -8,4 +9,6 @@ import java.util.Map; ...@@ -8,4 +9,6 @@ import java.util.Map;
public interface AccidentStatisticsService { public interface AccidentStatisticsService {
Map<String,Object> selectByYear(String enterpriseId, String fromdate); Map<String,Object> selectByYear(String enterpriseId, String fromdate);
List<AccidentStatistics> selectListByEnterpriseId (String enterpriseId, String fromdate);
} }
...@@ -35,4 +35,6 @@ public interface AlarmInfoService { ...@@ -35,4 +35,6 @@ public interface AlarmInfoService {
Map<String,Object> selectAlarmByYear(String enterpriseId, String fromdate ); Map<String,Object> selectAlarmByYear(String enterpriseId, String fromdate );
List<AlarmInfo> selectInfoByEnterpriseId(String enterpriseId, String fromdate );
} }
package com.dcit.danger.service.impl; package com.dcit.danger.service.impl;
import com.dcit.danger.dao.AccidentStatisticsMapper; import com.dcit.danger.dao.AccidentStatisticsMapper;
import com.dcit.danger.model.AccidentStatistics;
import com.dcit.danger.service.AccidentStatisticsService; import com.dcit.danger.service.AccidentStatisticsService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,4 +30,9 @@ public class AccidentStatisticsServiceImpl implements AccidentStatisticsService{ ...@@ -29,4 +30,9 @@ public class AccidentStatisticsServiceImpl implements AccidentStatisticsService{
map.put("totalNum",totalNum); map.put("totalNum",totalNum);
return map; return map;
} }
@Override
public List<AccidentStatistics> selectListByEnterpriseId(String enterpriseId, String fromdate){
List<AccidentStatistics> list = accidentStatisticsMapper.selectListByEnterpriseId(enterpriseId,fromdate);
return list;
}
} }
...@@ -108,4 +108,10 @@ public class AlarmInfoServiceImpl implements AlarmInfoService{ ...@@ -108,4 +108,10 @@ public class AlarmInfoServiceImpl implements AlarmInfoService{
map.put("num",num); map.put("num",num);
return map; return map;
} }
@Override
public List<AlarmInfo> selectInfoByEnterpriseId(String enterpriseId, String fromdate){
return alarmInfoMapper.selectInfoByEnterpriseId(enterpriseId,fromdate);
}
} }
...@@ -164,4 +164,11 @@ ...@@ -164,4 +164,11 @@
GROUP BY `month` GROUP BY `month`
ORDER BY `month` ORDER BY `month`
</select> </select>
<select id="selectListByEnterpriseId" resultType="com.dcit.danger.model.AccidentStatistics">
SELECT accident_text AS accidentText,accident_level AS accidentLevel ,accident_reason AS accidentReason,
IFNULL(accident_time,"") AS accidentTime,IFNULL(create_time,"") AS createTime FROM accident_statistics
WHERE enterprise_id =#{enterpriseId}
and accident_time like concat('%',#{fromdate},'%')
ORDER BY `create_time`
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -424,4 +424,12 @@ ...@@ -424,4 +424,12 @@
GROUP BY `alarm_month` GROUP BY `alarm_month`
ORDER BY `alarm_month` ORDER BY `alarm_month`
</select> </select>
<select id="selectInfoByEnterpriseId" resultType="com.dcit.danger.model.AlarmInfo" >
SELECT a.`alarm_info` AS alarmInfo,a.alarm_type AS alarmType,a.report_value as reportValue,
a.alarm_time as alarmTime, d.device_name as remarks FROM t_alarm_info a
LEFT JOIN safety_device_info d on d.id = a.device_id
WHERE a.enterprise_id =#{enterpriseId}
and a.alarm_time like concat('%',#{fromdate},'%')
ORDER BY a.`alarm_time`
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -1564,6 +1564,9 @@ ...@@ -1564,6 +1564,9 @@
e.province_id provinceId, e.province_id provinceId,
e.city_id cityId, e.city_id cityId,
e.county_id countyId, e.county_id countyId,
e.province_name provinceName,
e.city_name cityName,
e.county_name countyName,
e.authorize_file authorizeFile, e.authorize_file authorizeFile,
e.authorize_file_original_name authorizeFileOriginalName, e.authorize_file_original_name authorizeFileOriginalName,
e.regulation_big_type regulationBigType, e.regulation_big_type regulationBigType,
......
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