forked from xxhjsb/wit-park-backend
巡检执法、风险、隐患列表改为分页,首页统计修改
parent
db3073a249
commit
deadb74a66
|
@ -1,20 +1,16 @@
|
|||
package com.hbt.safety.supervision.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.common.core.domain.R;
|
||||
import com.hbt.safety.supervision.pojo.HiddenDanger;
|
||||
import com.hbt.safety.supervision.service.IHiddenDangerService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.hbt.common.core.web.controller.BaseController;
|
||||
import com.hbt.common.core.web.domain.AjaxResult;
|
||||
import com.hbt.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 隐患Controller
|
||||
|
@ -31,15 +27,17 @@ public class HiddenDangerController extends BaseController
|
|||
|
||||
/**
|
||||
* 查询隐患列表
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
@ApiOperation("查询隐患列表")
|
||||
@GetMapping("/list")
|
||||
public String list()
|
||||
public R<PageInfo<HiddenDanger>> list(@RequestParam(value = "currentPage") int currentPage, @RequestParam(value = "pageSize") int pageSize)
|
||||
{
|
||||
startPage();
|
||||
List<HiddenDanger> list = hiddenDangerService.selectHiddenDangerList();
|
||||
TableDataInfo tableDataInfo = getDataTable(list);
|
||||
return JSONObject.toJSONString(tableDataInfo);
|
||||
PageInfo<HiddenDanger> pageInfo = hiddenDangerService.selectHiddenDangerList(currentPage, pageSize);
|
||||
return R.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,20 +1,16 @@
|
|||
package com.hbt.safety.supervision.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.common.core.domain.R;
|
||||
import com.hbt.safety.supervision.pojo.LawEnforcementInspection;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.hbt.safety.supervision.service.ILawEnforcementInspectionService;
|
||||
import com.hbt.common.core.web.controller.BaseController;
|
||||
import com.hbt.common.core.web.domain.AjaxResult;
|
||||
import com.hbt.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 执法巡查Controller
|
||||
|
@ -31,14 +27,17 @@ public class LawEnforcementInspectionController extends BaseController
|
|||
|
||||
/**
|
||||
* 查询执法巡查列表
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
@ApiOperation("查询执法巡查列表")
|
||||
@GetMapping("/list")
|
||||
public String list()
|
||||
public R<PageInfo<LawEnforcementInspection>> list(@RequestParam(value = "currentPage") int currentPage, @RequestParam(value = "pageSize") int pageSize)
|
||||
{
|
||||
List<LawEnforcementInspection> list = lawEnforcementInspectionService.selectLawEnforcementInspectionList();
|
||||
TableDataInfo tableDataInfo = getDataTable(list);
|
||||
return JSONObject.toJSONString(tableDataInfo);
|
||||
PageInfo<LawEnforcementInspection> pageInfo = lawEnforcementInspectionService.selectLawEnforcementInspectionList(currentPage, pageSize);
|
||||
return R.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,16 +1,13 @@
|
|||
package com.hbt.safety.supervision.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.common.core.domain.R;
|
||||
import com.hbt.safety.supervision.pojo.Risk;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.hbt.safety.supervision.service.IRiskService;
|
||||
import com.hbt.common.core.web.controller.BaseController;
|
||||
import com.hbt.common.core.web.domain.AjaxResult;
|
||||
|
@ -30,13 +27,17 @@ public class RiskController extends BaseController
|
|||
|
||||
/**
|
||||
* 查询风险列表
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
@ApiOperation("查询风险列表")
|
||||
@GetMapping("/list")
|
||||
public String list()
|
||||
public R<PageInfo<Risk>> list(@RequestParam(value = "currentPage") int currentPage, @RequestParam(value = "pageSize") int pageSize)
|
||||
{
|
||||
List<Risk> list = riskService.selectRiskList();
|
||||
return JSONObject.toJSONString(list);
|
||||
PageInfo<Risk> pageInfo = riskService.selectRiskList(currentPage, pageSize);
|
||||
return R.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import com.hbt.safety.supervision.pojo.EnterpriseInformation;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
|
||||
/**
|
||||
* 企业信息Mapper接口
|
||||
|
@ -71,7 +72,7 @@ public interface EnterpriseInformationMapper
|
|||
*
|
||||
* @return 统计信息
|
||||
*/
|
||||
List<Map<Object, Object>> enterpriseStatistics();
|
||||
List<EnterpriseInformation> enterpriseStatistics();
|
||||
|
||||
/**
|
||||
* 获取在管企业数量
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.hbt.safety.supervision.pojo.HiddenDanger;
|
|||
* 上报隐患Mapper接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface EscalateHiddenDangerMapper
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.hbt.safety.supervision.pojo.EscalateRisk;
|
|||
* 上报风险Mapper接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface EscalateRiskMapper
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.hbt.safety.supervision.pojo.HazardousOperation;
|
|||
* 危险作业Mapper接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface HazardousOperationMapper
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
* 隐患Mapper接口
|
||||
*
|
||||
* @author hbt
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface HiddenDangerMapper
|
||||
{
|
||||
|
|
|
@ -10,7 +10,6 @@ import com.hbt.safety.supervision.pojo.vo.LawEnforcementInspectionVo;
|
|||
* 执法巡查Mapper接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface LawEnforcementInspectionMapper
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
|||
* 重大危险源Mapper接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface MajorHazardSourcesMapper
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.hbt.safety.supervision.pojo.Person;
|
|||
* 人员信息Mapper接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface PersonMapper {
|
||||
/**
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.hbt.safety.supervision.pojo.RiskArea;
|
|||
* 风险区域Mapper接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface RiskAreaMapper
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.apache.ibatis.annotations.Param;
|
|||
* 风险Mapper接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Mapper
|
||||
public interface RiskMapper
|
||||
|
@ -69,7 +68,7 @@ public interface RiskMapper
|
|||
*
|
||||
* @return 返回值
|
||||
*/
|
||||
List<Map<Object, Object>> riskStatistics();
|
||||
List<Risk> riskStatistics();
|
||||
|
||||
/**
|
||||
* 查询风险列表
|
||||
|
|
|
@ -9,7 +9,6 @@ import lombok.Data;
|
|||
* 企业信息对象 enterprise_information
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
|
|
|
@ -8,7 +8,6 @@ import lombok.Data;
|
|||
* 上报隐患对象 escalate_hidden_danger
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Data
|
||||
public class EscalateHiddenDanger extends BaseEntity
|
||||
|
|
|
@ -8,7 +8,6 @@ import lombok.Data;
|
|||
* 上报风险对象 escalate_risk
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Data
|
||||
public class EscalateRisk extends BaseEntity
|
||||
|
|
|
@ -9,7 +9,6 @@ import lombok.Data;
|
|||
* 危险作业对象 hazardous_operation
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
|
|
|
@ -9,7 +9,6 @@ import lombok.Data;
|
|||
* 隐患对象 hidden_danger
|
||||
*
|
||||
* @author hbt
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
|
|
|
@ -9,7 +9,6 @@ import lombok.Data;
|
|||
* 重大危险源对象 major_hazard_sources
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
|
|
|
@ -7,7 +7,6 @@ import lombok.Data;
|
|||
* 人员信息对象 person
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Data
|
||||
public class Person extends BaseEntity
|
||||
|
|
|
@ -9,7 +9,6 @@ import lombok.Data;
|
|||
* 风险对象 risk
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
|
|
|
@ -8,7 +8,6 @@ import lombok.Data;
|
|||
* 风险区域对象 risk_area
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Data
|
||||
public class RiskArea extends BaseEntity
|
||||
|
|
|
@ -1,14 +1,21 @@
|
|||
package com.hbt.safety.supervision.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 统计数据vo
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class StatisticsVo {
|
||||
|
||||
private int classify; // 分类
|
||||
|
||||
private int count; // 数量
|
||||
|
||||
public StatisticsVo(int classify, int count) {
|
||||
this.classify = classify;
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.hbt.safety.supervision.pojo.EnterpriseInformation;
|
|||
* 企业信息Service接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IEnterpriseInformationService
|
||||
{
|
||||
|
|
|
@ -9,7 +9,6 @@ import com.hbt.safety.supervision.pojo.HiddenDanger;
|
|||
* 上报隐患Service接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IEscalateHiddenDangerService
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.hbt.safety.supervision.pojo.EscalateRisk;
|
|||
* 上报风险Service接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IEscalateRiskService
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.hbt.safety.supervision.pojo.HazardousOperation;
|
|||
* 危险作业Service接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IHazardousOperationService
|
||||
{
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package com.hbt.safety.supervision.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.safety.supervision.pojo.HiddenDanger;
|
||||
|
||||
/**
|
||||
* 隐患Service接口
|
||||
*
|
||||
* @author hbt
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IHiddenDangerService
|
||||
{
|
||||
|
@ -23,9 +21,11 @@ public interface IHiddenDangerService
|
|||
/**
|
||||
* 查询隐患列表
|
||||
*
|
||||
* @return 隐患集合
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
List<HiddenDanger> selectHiddenDangerList();
|
||||
PageInfo<HiddenDanger> selectHiddenDangerList(int currentPage, int pageSize);
|
||||
|
||||
/**
|
||||
* 新增隐患
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
package com.hbt.safety.supervision.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.safety.supervision.pojo.LawEnforcementInspection;
|
||||
|
||||
/**
|
||||
* 执法巡查Service接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface ILawEnforcementInspectionService
|
||||
{
|
||||
|
@ -23,9 +22,11 @@ public interface ILawEnforcementInspectionService
|
|||
/**
|
||||
* 查询执法巡查列表
|
||||
*
|
||||
* @return 执法巡查集合
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
List<LawEnforcementInspection> selectLawEnforcementInspectionList();
|
||||
PageInfo<LawEnforcementInspection> selectLawEnforcementInspectionList(int currentPage, int pageSize);
|
||||
|
||||
/**
|
||||
* 新增执法巡查
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
|||
* 重大危险源Service接口
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IMajorHazardSourcesService
|
||||
{
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.hbt.safety.supervision.pojo.Person;
|
|||
* 人员信息Service接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IPersonService
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.hbt.safety.supervision.pojo.RiskArea;
|
|||
* 风险区域Service接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IRiskAreaService
|
||||
{
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
package com.hbt.safety.supervision.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.safety.supervision.pojo.Risk;
|
||||
|
||||
/**
|
||||
* 风险Service接口
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
public interface IRiskService
|
||||
{
|
||||
|
@ -23,9 +21,11 @@ public interface IRiskService
|
|||
/**
|
||||
* 查询风险列表
|
||||
*
|
||||
* @return 风险集合
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
List<Risk> selectRiskList();
|
||||
PageInfo<Risk> selectRiskList(int currentPage, int pageSize);
|
||||
|
||||
/**
|
||||
* 新增风险
|
||||
|
|
|
@ -3,23 +3,30 @@ package com.hbt.safety.supervision.service.impl;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hbt.safety.supervision.mapper.EnterpriseInformationMapper;
|
||||
import com.hbt.safety.supervision.pojo.EnterpriseInformation;
|
||||
import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
import com.hbt.safety.supervision.service.IEnterpriseInformationService;
|
||||
import com.hbt.safety.supervision.mapper.PersonMapper;
|
||||
import com.hbt.safety.supervision.util.StatisticsResultUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 企业信息Service业务层处理
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class EnterpriseInformationServiceImpl implements IEnterpriseInformationService {
|
||||
|
||||
/** 企业分类 */
|
||||
private static final int ENTERPRISE_CLASSIFY = 3;
|
||||
@Autowired
|
||||
private EnterpriseInformationMapper enterpriseInformationMapper;
|
||||
|
||||
|
@ -100,18 +107,28 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS
|
|||
public String enterpriseStatistics() {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
// 企业分类及数量
|
||||
List<Map<Object, Object>> list = enterpriseInformationMapper.enterpriseStatistics();
|
||||
// 在管企业数量
|
||||
int enterpriseCount = enterpriseInformationMapper.getEnterpriseCount();
|
||||
// 企业员工数
|
||||
int personCount = personMapper.getPersonCount();
|
||||
List<EnterpriseInformation> list = enterpriseInformationMapper.enterpriseStatistics();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
map.put("enterpriseClassification", StatisticsResultUtil.defaultResultStatistics(ENTERPRISE_CLASSIFY));
|
||||
map.put("enterpriseCount", 0);
|
||||
map.put("personCount", 0);
|
||||
map.put("carCount", 0);
|
||||
} else {
|
||||
Map<Integer, Long> enterpriseMap = list.stream()
|
||||
.collect(Collectors.groupingBy(EnterpriseInformation :: getType, Collectors.counting()));
|
||||
// 在管企业数量
|
||||
int enterpriseCount = enterpriseInformationMapper.getEnterpriseCount();
|
||||
// 企业员工数
|
||||
int personCount = personMapper.getPersonCount();
|
||||
|
||||
// 等级车辆数
|
||||
int carCount = enterpriseInformationMapper.getCarCount();
|
||||
map.put("enterpriseClassification", StatisticsResultUtil.resultStatistics(ENTERPRISE_CLASSIFY, enterpriseMap));
|
||||
map.put("enterpriseCount", enterpriseCount);
|
||||
map.put("personCount", personCount);
|
||||
map.put("carCount", carCount);
|
||||
}
|
||||
|
||||
// 等级车辆数
|
||||
int carCount = enterpriseInformationMapper.getCarCount();
|
||||
map.put("enterpriseClassification", list);
|
||||
map.put("enterpriseCount", enterpriseCount);
|
||||
map.put("personCount", personCount);
|
||||
map.put("carCount", carCount);
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import org.springframework.stereotype.Service;
|
|||
* 上报隐患Service业务层处理
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class EscalateHiddenDangerServiceImpl implements IEscalateHiddenDangerService
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.hbt.safety.supervision.service.IEscalateRiskService;
|
|||
* 上报风险Service业务层处理
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class EscalateRiskServiceImpl implements IEscalateRiskService
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.hbt.safety.supervision.pojo.HazardousOperation;
|
|||
import com.hbt.safety.supervision.pojo.vo.DateVo;
|
||||
import com.hbt.safety.supervision.pojo.vo.HazardousOperationWeekDateVo;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
import com.hbt.safety.supervision.util.StatisticsResultUtil;
|
||||
import com.hbt.safety.supervision.util.YearWeeksUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -19,11 +20,13 @@ import com.hbt.safety.supervision.service.IHazardousOperationService;
|
|||
* 危险作业Service业务层处理
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class HazardousOperationServiceImpl implements IHazardousOperationService
|
||||
{
|
||||
|
||||
/** 危险作业类型 */
|
||||
private static final int OPRATION_TYPE = 9;
|
||||
@Autowired
|
||||
private HazardousOperationMapper hazardousOperationMapper;
|
||||
|
||||
|
@ -113,42 +116,39 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
// 查询危险作业信息
|
||||
List<HazardousOperation> list = hazardousOperationMapper.selectHazardousOperations();
|
||||
if (list == null) {
|
||||
return "";
|
||||
map.put("operationTypeList", StatisticsResultUtil.defaultResultStatistics(OPRATION_TYPE));
|
||||
map.put("underwayHazardousOperation",0);
|
||||
map.put("underwayEnterprise", 0);
|
||||
map.put("toBeStarted", 0);
|
||||
map.put("historyHazardousOperation", 0);
|
||||
} else {
|
||||
Map<Integer, Long> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(HazardousOperation::getOperationType, Collectors.counting()));
|
||||
map.put("operationTypeList", StatisticsResultUtil.resultStatistics(OPRATION_TYPE, typeList));
|
||||
|
||||
// 进行中的危险作业
|
||||
List<HazardousOperation> hazardousOperations = list.stream()
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) <= 0
|
||||
&& s.getOperationEnd().compareTo(dateNowStr) >= 0)
|
||||
.collect(Collectors.toList());
|
||||
map.put("underwayHazardousOperation", hazardousOperations.size());
|
||||
|
||||
// 进行危险作业企业
|
||||
int underwayEnterprise =hazardousOperations.stream()
|
||||
.collect(Collectors.groupingBy(HazardousOperation :: getEnterpriseId)).keySet().size();
|
||||
map.put("underwayEnterprise", underwayEnterprise);
|
||||
|
||||
// 待开始危险作业
|
||||
int toBeStarted = (int) list.stream()
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) > 0).count();
|
||||
map.put("toBeStarted", toBeStarted);
|
||||
|
||||
// 历史危险作业
|
||||
int historyHazardousOperation = (int) list.stream()
|
||||
.filter(s -> s.getOperationEnd().compareTo(dateNowStr) < 0).count();
|
||||
map.put("historyHazardousOperation", historyHazardousOperation);
|
||||
}
|
||||
Map<Object, List<HazardousOperation>> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(HazardousOperation::getOperationType));
|
||||
// 组装类型统计数据
|
||||
List<StatisticsVo> operationTypeList = new ArrayList<>();
|
||||
for(Object key : typeList.keySet()) {
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setClassify(Integer.parseInt(key.toString()));
|
||||
statisticsVo.setCount(typeList.get(key).size());
|
||||
operationTypeList.add(statisticsVo);
|
||||
}
|
||||
map.put("operationTypeList", JSONObject.toJSONString(operationTypeList));
|
||||
|
||||
// 进行中的危险作业
|
||||
List<HazardousOperation> hazardousOperations = list.stream()
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) <= 0 &&s.getOperationEnd().compareTo(dateNowStr) >= 0)
|
||||
.collect(Collectors.toList());
|
||||
map.put("underwayHazardousOperation", hazardousOperations.size());
|
||||
|
||||
// 进行危险作业企业
|
||||
int underwayEnterprise = hazardousOperations.stream().collect(
|
||||
Collectors.collectingAndThen(
|
||||
Collectors.toCollection(() -> new TreeSet<>
|
||||
(Comparator.comparing(HazardousOperation :: getEnterpriseId))), ArrayList:: new)).size();
|
||||
map.put("underwayEnterprise", underwayEnterprise);
|
||||
|
||||
// 待开始危险作业
|
||||
int toBeStarted = (int) list.stream()
|
||||
.filter(s -> s.getOperationStart().compareTo(dateNowStr) > 0).count();
|
||||
map.put("toBeStarted", toBeStarted);
|
||||
|
||||
// 历史危险作业
|
||||
int historyHazardousOperation = (int) list.stream()
|
||||
.filter(s -> s.getOperationEnd().compareTo(dateNowStr) < 0).count();
|
||||
map.put("historyHazardousOperation", historyHazardousOperation);
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,14 +5,18 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.safety.supervision.mapper.HiddenDangerMapper;
|
||||
import com.hbt.safety.supervision.pojo.HiddenDanger;
|
||||
import com.hbt.safety.supervision.pojo.vo.DateVo;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
import com.hbt.safety.supervision.service.IHiddenDangerService;
|
||||
import com.hbt.safety.supervision.util.StatisticsResultUtil;
|
||||
import com.hbt.safety.supervision.util.YearWeeksUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 隐患Service业务层处理
|
||||
|
@ -22,6 +26,8 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class HiddenDangerServiceImpl implements IHiddenDangerService
|
||||
{
|
||||
/** 隐患治理状态 */
|
||||
private static final int HIDDENDANGER_STATUS = 4;
|
||||
@Autowired
|
||||
private HiddenDangerMapper hiddenDangerMapper;
|
||||
|
||||
|
@ -40,12 +46,16 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService
|
|||
/**
|
||||
* 查询隐患列表
|
||||
*
|
||||
* @return 隐患
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
@Override
|
||||
public List<HiddenDanger> selectHiddenDangerList()
|
||||
public PageInfo<HiddenDanger> selectHiddenDangerList(int currentPage, int pageSize)
|
||||
{
|
||||
return hiddenDangerMapper.selectHiddenDangerList();
|
||||
PageHelper.startPage(currentPage, pageSize);
|
||||
List<HiddenDanger> list = hiddenDangerMapper.selectHiddenDangerList();
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,20 +113,13 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService
|
|||
Map<String, Object> map = new HashMap<>();
|
||||
|
||||
List<HiddenDanger> list = hiddenDangerMapper.selectHiddenDangers();
|
||||
if (list == null) {
|
||||
return "";
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
map.put("hiddenDangerList", StatisticsResultUtil.defaultResultStatistics(HIDDENDANGER_STATUS));
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
Map<Object, List<HiddenDanger>> hiddenDangerMap = list.stream()
|
||||
.collect(Collectors.groupingBy(HiddenDanger::getReformStatus));
|
||||
// 组装隐患状态统计数据
|
||||
List<StatisticsVo> hiddenDangerList = new ArrayList<>();
|
||||
for(Object key : hiddenDangerMap.keySet()) {
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setClassify(Integer.parseInt(key.toString()));
|
||||
statisticsVo.setCount(hiddenDangerMap.get(key).size());
|
||||
hiddenDangerList.add(statisticsVo);
|
||||
}
|
||||
map.put("hiddenDangerList", JSONObject.toJSONString(hiddenDangerList));
|
||||
Map<Integer, Long> hiddenDangerMap = list.stream()
|
||||
.collect(Collectors.groupingBy(HiddenDanger::getReformStatus, Collectors.counting()));
|
||||
map.put("hiddenDangerList", StatisticsResultUtil.resultStatistics(HIDDENDANGER_STATUS, hiddenDangerMap));
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.safety.supervision.mapper.EscalateHiddenDangerMapper;
|
||||
import com.hbt.safety.supervision.mapper.EscalateRiskMapper;
|
||||
import com.hbt.safety.supervision.mapper.LawEnforcementInspectionMapper;
|
||||
|
@ -19,7 +21,6 @@ import com.hbt.safety.supervision.service.ILawEnforcementInspectionService;
|
|||
* 执法巡查Service业务层处理
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class LawEnforcementInspectionServiceImpl implements ILawEnforcementInspectionService
|
||||
|
@ -48,12 +49,16 @@ public class LawEnforcementInspectionServiceImpl implements ILawEnforcementInspe
|
|||
/**
|
||||
* 查询执法巡查列表
|
||||
*
|
||||
* @return 执法巡查
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
@Override
|
||||
public List<LawEnforcementInspection> selectLawEnforcementInspectionList()
|
||||
public PageInfo<LawEnforcementInspection> selectLawEnforcementInspectionList(int currentPage, int pageSize)
|
||||
{
|
||||
return lawEnforcementInspectionMapper.selectLawEnforcementInspectionList();
|
||||
PageHelper.startPage(currentPage, pageSize);
|
||||
List<LawEnforcementInspection> list = lawEnforcementInspectionMapper.selectLawEnforcementInspectionList();
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -9,19 +9,22 @@ import com.alibaba.fastjson.JSONObject;
|
|||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
import com.hbt.safety.supervision.service.IMajorHazardSourcesService;
|
||||
import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
||||
import com.hbt.safety.supervision.util.StatisticsResultUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hbt.safety.supervision.mapper.MajorHazardSourcesMapper;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 重大危险源Service业务层处理
|
||||
*
|
||||
* @author zhangyu
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class MajorHazardSourcesServiceImpl implements IMajorHazardSourcesService
|
||||
{
|
||||
|
||||
private static final int DANGER_LEVEL = 4;
|
||||
@Autowired
|
||||
private MajorHazardSourcesMapper majorHazardSourcesMapper;
|
||||
|
||||
|
@ -104,34 +107,27 @@ public class MajorHazardSourcesServiceImpl implements IMajorHazardSourcesService
|
|||
|
||||
// 查询重大危险源信息
|
||||
List<MajorHazardSources> list = majorHazardSourcesMapper.majorHazardSourcesStatistics();
|
||||
if (list == null) {
|
||||
return "";
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
// 返回默认值
|
||||
map.put("dangerLevelList", StatisticsResultUtil.defaultResultStatistics(DANGER_LEVEL));
|
||||
map.put("productionUnit", 0);
|
||||
map.put("storageCell", 0);
|
||||
} else {
|
||||
// 根据风险等级分组
|
||||
Map<Integer, Long> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(MajorHazardSources::getDangerLevel, Collectors.counting()));
|
||||
map.put("dangerLevelList", StatisticsResultUtil.resultStatistics(DANGER_LEVEL, typeList));
|
||||
// 获取生产单元数量
|
||||
int productionUnit = (int) list.stream()
|
||||
.filter(s -> s.getUnitType() == 0).count();
|
||||
map.put("productionUnit", productionUnit);
|
||||
|
||||
// 获取存储单元数量
|
||||
int storageCell = (int) list.stream()
|
||||
.filter(s -> s.getUnitType() == 0).count();
|
||||
map.put("storageCell", storageCell);
|
||||
}
|
||||
|
||||
// 根据风险等级分组
|
||||
Map<Object, List<MajorHazardSources>> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(MajorHazardSources::getDangerLevel));
|
||||
|
||||
// 组装风险等级统计数据
|
||||
List<StatisticsVo> dangerLevelList = new ArrayList<>();
|
||||
for(Object key : typeList.keySet()) {
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setClassify(Integer.parseInt(key.toString()));
|
||||
statisticsVo.setCount(typeList.get(key).size());
|
||||
dangerLevelList.add(statisticsVo);
|
||||
}
|
||||
map.put("dangerLevelList", JSONObject.toJSONString(dangerLevelList));
|
||||
|
||||
// 获取生产单元数量
|
||||
int productionUnit = (int) list.stream()
|
||||
.filter(s -> s.getUnitType() == 0).count();
|
||||
map.put("productionUnit", productionUnit);
|
||||
|
||||
// 获取存储单元数量
|
||||
int storageCell = (int) list.stream()
|
||||
.filter(s -> s.getUnitType() == 0).count();
|
||||
map.put("storageCell", storageCell);
|
||||
|
||||
return JSONObject.toJSONString(map);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,7 +12,6 @@ import com.hbt.safety.supervision.service.IPersonService;
|
|||
* 人员信息Service业务层处理
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class PersonServiceImpl implements IPersonService
|
||||
|
|
|
@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
|
|||
* 风险区域Service业务层处理
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class RiskAreaServiceImpl implements IRiskAreaService
|
||||
|
|
|
@ -4,23 +4,28 @@ import java.util.*;
|
|||
import java.util.stream.Collectors;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hbt.safety.supervision.mapper.RiskMapper;
|
||||
import com.hbt.safety.supervision.pojo.Risk;
|
||||
import com.hbt.safety.supervision.pojo.vo.DateVo;
|
||||
import com.hbt.safety.supervision.service.IRiskService;
|
||||
import com.hbt.safety.supervision.util.StatisticsResultUtil;
|
||||
import com.hbt.safety.supervision.util.YearWeeksUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
/**
|
||||
* 风险Service业务层处理
|
||||
*
|
||||
* @author 张雨
|
||||
* @date 2023-02-14
|
||||
*/
|
||||
@Service
|
||||
public class RiskServiceImpl implements IRiskService
|
||||
{
|
||||
/** 风险等级 */
|
||||
private static final int RISK_LEVEL = 4;
|
||||
@Autowired
|
||||
private RiskMapper riskMapper;
|
||||
|
||||
|
@ -37,14 +42,18 @@ public class RiskServiceImpl implements IRiskService
|
|||
}
|
||||
|
||||
/**
|
||||
* 查询风险列表
|
||||
* 查询执法巡查列表
|
||||
*
|
||||
* @return 风险
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 每页条数
|
||||
* @return 返回值
|
||||
*/
|
||||
@Override
|
||||
public List<Risk> selectRiskList()
|
||||
public PageInfo<Risk> selectRiskList(int currentPage, int pageSize)
|
||||
{
|
||||
return riskMapper.selectRiskList();
|
||||
PageHelper.startPage(currentPage, pageSize);
|
||||
List<Risk> list = riskMapper.selectRiskList();
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -96,8 +105,13 @@ public class RiskServiceImpl implements IRiskService
|
|||
}
|
||||
|
||||
public String riskStatistics() {
|
||||
List<Map<Object, Object>> map = riskMapper.riskStatistics();
|
||||
return JSONObject.toJSONString(map);
|
||||
List<Risk> list = riskMapper.riskStatistics();
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return StatisticsResultUtil.defaultResultStatistics(RISK_LEVEL);
|
||||
}
|
||||
Map<Integer, Long> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(Risk :: getLevel, Collectors.counting()));
|
||||
return StatisticsResultUtil.resultStatistics(RISK_LEVEL, typeList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package com.hbt.safety.supervision.util;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class StatisticsResultUtil {
|
||||
|
||||
public static String defaultResultStatistics(int count) {
|
||||
List<StatisticsVo> list = new ArrayList<>();
|
||||
for (int i = 1; i <= count; i++) {
|
||||
StatisticsVo statisticsVo = new StatisticsVo(i, 0);
|
||||
list.add(statisticsVo);
|
||||
}
|
||||
return JSONObject.toJSONString(list);
|
||||
}
|
||||
|
||||
public static String resultStatistics(int count, Map<Integer, Long> map) {
|
||||
List<StatisticsVo> list = new ArrayList<>();
|
||||
// 组装数据数据
|
||||
for (int i =1; i <= count; i ++) {
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setClassify(i);
|
||||
statisticsVo.setCount(map.getOrDefault(i, 0L).intValue());
|
||||
list.add(statisticsVo);
|
||||
}
|
||||
return JSONObject.toJSONString(list);
|
||||
}
|
||||
}
|
|
@ -101,8 +101,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
select from enterprise_information
|
||||
</select>
|
||||
|
||||
<select id="enterpriseStatistics" resultType="java.util.Map">
|
||||
select type as classify, count(id) as count from enterprise_information group by type
|
||||
<select id="enterpriseStatistics" resultType="EnterpriseInformation">
|
||||
select type from enterprise_information
|
||||
</select>
|
||||
|
||||
<select id="getEnterpriseCount" resultType="Integer">
|
||||
|
|
|
@ -13,7 +13,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectLawEnforcementInspectionVo">
|
||||
select distinct(a.id) id, a.inspection_date, a.inspection_date, a.person person, a.name name,
|
||||
select distinct(a.id) id, a.inspection_date inspectionDate, a.person person, a.name name,
|
||||
b.hidden_danger_id hiddenDangerId,
|
||||
c.risk_id riskId
|
||||
from law_enforcement_inspection as a
|
||||
|
|
|
@ -103,8 +103,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="riskStatistics" resultType="java.util.Map">
|
||||
select level as level, count(id) as num from risk group by level
|
||||
<select id="riskStatistics" resultType="Risk">
|
||||
select level from risk
|
||||
</select>
|
||||
|
||||
<select id="selectRisks" resultType="com.hbt.safety.supervision.pojo.Risk">
|
||||
|
|
Loading…
Reference in New Issue