zhangf
2024-05-08 0414ddb0b2b3a7199ae6181a770f97ac140dbd73
spi统计
已修改20个文件
已添加7个文件
593 ■■■■■ 文件已修改
emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/EmergencyRpcAPi.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/model/dto/resp/EmergencySuppliesInfoRPCRespDTO.java 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-rpc-provider/src/main/java/com/gkhy/safePlatform/emergency/rpc/provider/EmergencyRpcProvider.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInfoRespDTO.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInfoRepository.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencySuppliesService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInfoServiceImpl.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-service/src/main/resources/config/mapper/emergency/EmergencySuppliesInfoMapper.xml 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-rpc-api/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/api/IncidentManageRpcAPi.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-rpc-api/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/api/model/dto/resp/AccidentCountByGradeRPCRespDTO.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-rpc-api/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/api/model/dto/resp/IncidentStatisticCountRPCRespDTO.java 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-rpc-provider/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/provider/IncidentManageRpcProvider.java 58 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentCountController.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentStatisticCountDO.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentCountByGradeRespDTO.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentStatisticDTO.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentReportInfoRepository.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentCountService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentReportService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentReportInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentReportInfoServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentCountServiceImpl.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
safePlatfrom-out-web/src/main/resources/config/application.yaml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/EmergencyRpcAPi.java
@@ -56,5 +56,7 @@
    ResultVO<List<StatisticsDepLevelMonthEexcuteRPCRespDTO>> getExecuteCountByDeptIdsAndMonth(EmergencyExecuteCountRPCReq query);
    // RPC接口--6、传入部门ID,指定年份 ,查询部门以及子级部门演练数据 并按部门等级,月份,统计演练次数
    ResultVO<List<StatisticsDepLevelYearExecuteRPCRespDTO>> getExecuteCountByDeptIdsAndYear(EmergencyExecuteCountRPCReq query);
    ResultVO<List<EmergencySuppliesInfoRPCRespDTO>> getEmergencySupplies();
}
emergency/emergency-rpc-api/src/main/java/com/gkhy/safePlatform/emergency/rpc/api/model/dto/resp/EmergencySuppliesInfoRPCRespDTO.java
对比新文件
@@ -0,0 +1,89 @@
package com.gkhy.safePlatform.emergency.rpc.api.model.dto.resp;
public class EmergencySuppliesInfoRPCRespDTO {
    private Long id;
    private String name;
    private String number;
    private Long departmentId;
    private String classification;
    private String classificationName;
    private String place;
    private Integer count;
    private String departmentName;
    public String getDepartmentName() {
        return departmentName;
    }
    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }
    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 String getNumber() {
        return number;
    }
    public void setNumber(String number) {
        this.number = number;
    }
    public Long getDepartmentId() {
        return departmentId;
    }
    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }
    public String getClassification() {
        return classification;
    }
    public void setClassification(String classification) {
        this.classification = classification;
    }
    public String getPlace() {
        return place;
    }
    public void setPlace(String place) {
        this.place = place;
    }
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public String getClassificationName() {
        return classificationName;
    }
    public void setClassificationName(String classificationName) {
        this.classificationName = classificationName;
    }
}
emergency/emergency-rpc-provider/src/main/java/com/gkhy/safePlatform/emergency/rpc/provider/EmergencyRpcProvider.java
@@ -27,6 +27,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@DubboService
public class EmergencyRpcProvider implements EmergencyRpcAPi {
@@ -314,5 +315,27 @@
        return result;
    }
    @Override
    public ResultVO<List<EmergencySuppliesInfoRPCRespDTO>> getEmergencySupplies() {
        ResultVO<List<EmergencySuppliesInfoRPCRespDTO>> result = new ResultVO<>(ResultCodes.OK);
        try{
            List<EmergencySuppliesInfoRespDTO> emergencySupplies = emergencySuppliesService.getEmergencySupplies();
            List<EmergencySuppliesInfoRPCRespDTO> collect = emergencySupplies.stream().map(es -> {
                EmergencySuppliesInfoRPCRespDTO emergencySuppliesInfoRPCRespDTO = new EmergencySuppliesInfoRPCRespDTO();
                BeanUtils.copyProperties(es, emergencySuppliesInfoRPCRespDTO);
                return emergencySuppliesInfoRPCRespDTO;
            }).collect(Collectors.toList());
            result.setData(collect);
        }catch (EmergencyException e){
            result.setCode(e.getCode());
            result.setMsg(e.getMessage());
        }catch (Exception e) {
            e.printStackTrace();
            result.setCode(EmergencyResultCodes.ERROR.getCode());
            result.setMsg(EmergencyResultCodes.ERROR.getDesc());
        }
        return result;
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/model/dto/resp/EmergencySuppliesInfoRespDTO.java
对比新文件
@@ -0,0 +1,86 @@
package com.gkhy.safePlatform.emergency.model.dto.resp;
public class EmergencySuppliesInfoRespDTO {
    private Long id;
    private String name;
    private String number;
    private Long departmentId;
    private String classification;
    private String classificationName;
    private String place;
    private Integer count;
    private String departmentName;
    public String getDepartmentName() {
        return departmentName;
    }
    public void setDepartmentName(String departmentName) {
        this.departmentName = departmentName;
    }
    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 String getNumber() {
        return number;
    }
    public void setNumber(String number) {
        this.number = number;
    }
    public Long getDepartmentId() {
        return departmentId;
    }
    public void setDepartmentId(Long departmentId) {
        this.departmentId = departmentId;
    }
    public String getClassification() {
        return classification;
    }
    public void setClassification(String classification) {
        this.classification = classification;
    }
    public String getPlace() {
        return place;
    }
    public void setPlace(String place) {
        this.place = place;
    }
    public Integer getCount() {
        return count;
    }
    public void setCount(Integer count) {
        this.count = count;
    }
    public String getClassificationName() {
        return classificationName;
    }
    public void setClassificationName(String classificationName) {
        this.classificationName = classificationName;
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/repository/EmergencySuppliesInfoRepository.java
@@ -31,4 +31,7 @@
    List<EmergencySuppliesInfo> listCountByIds(@Param("ids")List<Long> ids,@Param("delFlag") Byte delFlag,@Param("status") Byte status);
    List<EmergencySuppliesInfo> getAllEmergencySupplies();
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/EmergencySuppliesService.java
@@ -5,10 +5,7 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.emergency.model.dto.req.EmergencySuppliesReqDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesDetailRespDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesPageRespDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesRespDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.EmergencySuppliesTypeRespDTO;
import com.gkhy.safePlatform.emergency.model.dto.resp.*;
import com.gkhy.safePlatform.emergency.query.EmergencySuppliesQuery;
import java.util.List;
@@ -31,4 +28,6 @@
    List<EmergencySuppliesTypeRespDTO> emergencySuppliesList(ContextCacheUser currentUser);
    List<EmergencySuppliesRespDTO> listCountByIds(ContextCacheUser currentUser, List<Long> ids);
    List<EmergencySuppliesInfoRespDTO> getEmergencySupplies();
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/EmergencySuppliesInfoService.java
@@ -28,4 +28,6 @@
    List<EmergencySuppliesInfo> listByNoConditions();
    List<EmergencySuppliesInfo> listCountByIds(List<Long> ids);
    List<EmergencySuppliesInfo> getAllEmergencySupplies();
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/baseService/impl/EmergencySuppliesInfoServiceImpl.java
@@ -19,6 +19,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
@Service("emergencySuppliesInfoService")
@@ -71,5 +72,8 @@
        return baseMapper.listCountByIds(ids, (byte) 0,EmergencySuppliesStatusEnum.STATUS_ONE.getCode());
    }
    @Override
    public List<EmergencySuppliesInfo> getAllEmergencySupplies() {
        return baseMapper.getAllEmergencySupplies();
    }
}
emergency/emergency-service/src/main/java/com/gkhy/safePlatform/emergency/service/impl/EmergencySuppliesServiceImpl.java
@@ -281,4 +281,23 @@
            throw new EmergencyException(EmergencyResultCodes.SUPPLIES_ENUM_STATUS_NOT_EXIST);
        }
    }
    public List<EmergencySuppliesInfoRespDTO> getEmergencySupplies(){
        List<EmergencySuppliesInfo> allEmergencySupplies = emergencySuppliesInfoService.getAllEmergencySupplies();
        List<EmergencySuppliesInfoRespDTO> collect = allEmergencySupplies.stream().map(es -> {
            EmergencySuppliesInfoRespDTO e = new EmergencySuppliesInfoRespDTO();
            BeanUtils.copyProperties(es,e);
            e.setClassificationName(EmergencySuppliesClassificationEnum.getByCode(es.getClassification()).getValue());
            ResultVO<DepInfoRPCRespDTO> rpcResult = accountDepartmentService.getDepInfoByDepId(es.getDepartmentId());
            if (rpcResult != null && rpcResult.getCode().equals(ResultCodes.OK.getCode())) {
                if (rpcResult.getData() != null) {
                    DepInfoRPCRespDTO dep = (DepInfoRPCRespDTO) rpcResult.getData();
                    e.setDepartmentName(dep.getDepName());
                }
            }
            return e;
        }).collect(Collectors.toList());
        return collect;
    }
}
emergency/emergency-service/src/main/resources/config/mapper/emergency/EmergencySuppliesInfoMapper.xml
@@ -173,5 +173,19 @@
            #{id}
        </foreach>
    </select>
    <select id="getAllEmergencySupplies" resultType="com.gkhy.safePlatform.emergency.entity.EmergencySuppliesInfo">
        select id,
               name,
               number,
               model,
               count,
               classification,
               place,
               use_explain,
               department_id
        from emergency_supplies
        where del_flag = 0
    </select>
</mapper>
incident-manage/incident-manage-rpc-api/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/api/IncidentManageRpcAPi.java
@@ -3,9 +3,7 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.req.IncidentManageCountRPCReq;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.IncidentManageRPCResp;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.StatisticsDepLevelMonthAccidentRPCRespDTO;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.StatisticsDeptLevelYearAccidentRPCRespDTO;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.*;
import java.util.List;
@@ -27,4 +25,7 @@
    ResultVO<List<StatisticsDepLevelMonthAccidentRPCRespDTO>> getAccidentCountByDeptIdsAndMonth(IncidentManageCountRPCReq query);
    // RPC接口--4、传入部门ID,指定年份 ,查询部门以及子级部门演练数据 并按部门等级,月份,统计演练次数
    ResultVO<List<StatisticsDeptLevelYearAccidentRPCRespDTO>> getAccidentCountByDeptIdsAndYear(IncidentManageCountRPCReq query);
    ResultVO<List<IncidentStatisticCountRPCRespDTO>> getAccidentCountByGradeAndTime(IncidentManageCountRPCReq query);
    ResultVO<AccidentCountByGradeRPCRespDTO> getSpiAccidentCountByGradeAndTime(IncidentManageCountRPCReq query);
}
incident-manage/incident-manage-rpc-api/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/api/model/dto/resp/AccidentCountByGradeRPCRespDTO.java
对比新文件
@@ -0,0 +1,50 @@
package com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp;
public class AccidentCountByGradeRPCRespDTO {
    private int accidentOne;
    private int accidentTwo;
    private int accidentThree;
    private int accidentFour;
    private int accidentTotal;
    public int getAccidentOne() {
        return accidentOne;
    }
    public void setAccidentOne(int accidentOne) {
        this.accidentOne = accidentOne;
    }
    public int getAccidentTwo() {
        return accidentTwo;
    }
    public void setAccidentTwo(int accidentTwo) {
        this.accidentTwo = accidentTwo;
    }
    public int getAccidentThree() {
        return accidentThree;
    }
    public void setAccidentThree(int accidentThree) {
        this.accidentThree = accidentThree;
    }
    public int getAccidentFour() {
        return accidentFour;
    }
    public void setAccidentFour(int accidentFour) {
        this.accidentFour = accidentFour;
    }
    public int getAccidentTotal() {
        return accidentTotal;
    }
    public void setAccidentTotal(int accidentTotal) {
        this.accidentTotal = accidentTotal;
    }
}
incident-manage/incident-manage-rpc-api/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/api/model/dto/resp/IncidentStatisticCountRPCRespDTO.java
对比新文件
@@ -0,0 +1,25 @@
package com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp;
public class IncidentStatisticCountRPCRespDTO {
    private String accidentGrade;
    private int count;
    public String getAccidentGrade() {
        return accidentGrade;
    }
    public void setAccidentGrade(String accidentGrade) {
        this.accidentGrade = accidentGrade;
    }
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }
}
incident-manage/incident-manage-rpc-provider/src/main/java/com/gkhy/safePlatform/incidentManage/rpc/provider/IncidentManageRpcProvider.java
@@ -2,24 +2,21 @@
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
import com.gkhy.safePlatform.incidentManage.exception.AccidentException;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentLevelResultCountRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.StatisticsDepLevelMonthAccidentRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.StatisticsDeptLevelYearAccidentRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.*;
import com.gkhy.safePlatform.incidentManage.query.IncidentManageCountQuery;
import com.gkhy.safePlatform.incidentManage.rpc.api.IncidentManageRpcAPi;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.req.IncidentManageCountRPCReq;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.AccidentLevelResultCountRPCRespDTO;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.IncidentManageRPCResp;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.StatisticsDepLevelMonthAccidentRPCRespDTO;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.StatisticsDeptLevelYearAccidentRPCRespDTO;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.resp.*;
import com.gkhy.safePlatform.incidentManage.service.AccidentCountService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
@@ -182,4 +179,51 @@
        }
        return result;
    }
    @Override
    public ResultVO<List<IncidentStatisticCountRPCRespDTO>> getAccidentCountByGradeAndTime(IncidentManageCountRPCReq query){
        ResultVO<List<IncidentStatisticCountRPCRespDTO>> result = new ResultVO<>(ResultCodes.OK);
        try{
            List<AccidentStatisticDTO> countByAccidentGradeList = accidentCountService.getCountByAccidentGrade(query.getYear(), query.getMonth());
            List<IncidentStatisticCountRPCRespDTO> statisticCountRPCRespDTOList = new ArrayList<>();
            for(AccidentStatisticDTO accidentStatisticDTO:countByAccidentGradeList){
                IncidentStatisticCountRPCRespDTO accidentRPCRespDTO = new IncidentStatisticCountRPCRespDTO();
                accidentRPCRespDTO.setAccidentGrade(accidentStatisticDTO.getAccidentGrade());
                accidentRPCRespDTO.setCount(accidentStatisticDTO.getCount());
                statisticCountRPCRespDTOList.add(accidentRPCRespDTO);
            }
            result.setData(statisticCountRPCRespDTOList);
        }catch (AccidentException e){
            result.setCode(e.getCode());
            result.setMsg(e.getMessage());
        }catch (BusinessException e){
            result.setCode(e.getCode());
            result.setMsg(e.getMessage());
        }catch (Exception e) {
            result.setCode(AccidentResultCodes.ERROR.getCode());
            result.setMsg(AccidentResultCodes.ERROR.getDesc());
        }
        return result;
    }
    @Override
    public ResultVO<AccidentCountByGradeRPCRespDTO> getSpiAccidentCountByGradeAndTime(IncidentManageCountRPCReq query){
        ResultVO<AccidentCountByGradeRPCRespDTO> result = new ResultVO<>(ResultCodes.OK);
        try{
            AccidentCountByGradeRespDTO accidentCountByGradeRespDTO = accidentCountService.getSpiAccidentCountByAccidentGrade(query.getYear(), query.getMonth());
            AccidentCountByGradeRPCRespDTO accidentRPCRespDTO = new AccidentCountByGradeRPCRespDTO();
            BeanUtils.copyProperties(accidentCountByGradeRespDTO, accidentRPCRespDTO);
            result.setData(accidentRPCRespDTO);
        }catch (AccidentException e){
            result.setCode(e.getCode());
            result.setMsg(e.getMessage());
        }catch (BusinessException e){
            result.setCode(e.getCode());
            result.setMsg(e.getMessage());
        }catch (Exception e) {
            result.setCode(AccidentResultCodes.ERROR.getCode());
            result.setMsg(AccidentResultCodes.ERROR.getDesc());
        }
        return result;
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/controller/AccidentCountController.java
@@ -1,7 +1,9 @@
package com.gkhy.safePlatform.incidentManage.controller;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportCountRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentStatisticDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.StatisticsDepLevelMonthAccidentRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.StatisticsDeptLevelYearAccidentRespDTO;
import com.gkhy.safePlatform.incidentManage.query.AccidentReportCountQuery;
@@ -63,4 +65,12 @@
    public List<StatisticsDeptLevelYearAccidentRespDTO> getCountByDeptIdsAndYear(@RequestBody IncidentManageCountQuery query){
        return accidentCountService.getCountByDeptIdsAndYear(query);
    }
    /**
     * 事故统计,根据事故级别统计
     */
    @RequestMapping(value = "/accidentGrade/count",method = RequestMethod.GET)
    public ResultVO getCountByAccidentGrade(Integer year, Integer month){
        return new ResultVO<>(ResultCodes.OK,accidentCountService.getCountByAccidentGrade(year, month));
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/entity/AccidentStatisticCountDO.java
对比新文件
@@ -0,0 +1,24 @@
package com.gkhy.safePlatform.incidentManage.entity;
public class AccidentStatisticCountDO {
    private Byte accidentGrade;
    private int count;
    public Byte getAccidentGrade() {
        return accidentGrade;
    }
    public void setAccidentGrade(Byte accidentGrade) {
        this.accidentGrade = accidentGrade;
    }
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentCountByGradeRespDTO.java
对比新文件
@@ -0,0 +1,50 @@
package com.gkhy.safePlatform.incidentManage.model.dto.resp;
public class AccidentCountByGradeRespDTO {
    private int accidentOne;
    private int accidentTwo;
    private int accidentThree;
    private int accidentFour;
    private int accidentTotal;
    public int getAccidentOne() {
        return accidentOne;
    }
    public void setAccidentOne(int accidentOne) {
        this.accidentOne = accidentOne;
    }
    public int getAccidentTwo() {
        return accidentTwo;
    }
    public void setAccidentTwo(int accidentTwo) {
        this.accidentTwo = accidentTwo;
    }
    public int getAccidentThree() {
        return accidentThree;
    }
    public void setAccidentThree(int accidentThree) {
        this.accidentThree = accidentThree;
    }
    public int getAccidentFour() {
        return accidentFour;
    }
    public void setAccidentFour(int accidentFour) {
        this.accidentFour = accidentFour;
    }
    public int getAccidentTotal() {
        return accidentTotal;
    }
    public void setAccidentTotal(int accidentTotal) {
        this.accidentTotal = accidentTotal;
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/model/dto/resp/AccidentStatisticDTO.java
对比新文件
@@ -0,0 +1,23 @@
package com.gkhy.safePlatform.incidentManage.model.dto.resp;
public class AccidentStatisticDTO {
    private String accidentGrade;
    private int count;
    public String getAccidentGrade() {
        return accidentGrade;
    }
    public void setAccidentGrade(String accidentGrade) {
        this.accidentGrade = accidentGrade;
    }
    public int getCount() {
        return count;
    }
    public void setCount(int count) {
        this.count = count;
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/repository/AccidentReportInfoRepository.java
@@ -32,4 +32,6 @@
    List<AccidentResultCountDO> getAccidentCountByDeptIdsAndTime(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("deptIds")List<Long> deptIds);
    List<AccidentResultCountDO> getAccidentCountByDeptIdAndTime(@Param("startTime")String startTime, @Param("endTime")String endTime, @Param("deptId")Long deptId);
    List<AccidentStatisticCountDO> getCountByAccidentGrade(@Param("year")Integer year, @Param("month")Integer month);
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentCountService.java
@@ -2,9 +2,7 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportCountRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.StatisticsDepLevelMonthAccidentRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.StatisticsDeptLevelYearAccidentRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.*;
import com.gkhy.safePlatform.incidentManage.query.AccidentReportCountQuery;
import com.gkhy.safePlatform.incidentManage.query.IncidentManageCountQuery;
import com.gkhy.safePlatform.incidentManage.rpc.api.model.dto.req.IncidentManageCountRPCReq;
@@ -31,4 +29,6 @@
    List<StatisticsDeptLevelYearAccidentRespDTO> getCountByDeptIdsAndYear(IncidentManageCountQuery query);
    List<StatisticsDepLevelMonthAccidentRespDTO> getCountByDeptIdsAndMonth(IncidentManageCountQuery query);
    List<AccidentStatisticDTO> getCountByAccidentGrade(Integer year, Integer month);
    AccidentCountByGradeRespDTO getSpiAccidentCountByAccidentGrade(Integer year, Integer month);
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/AccidentReportService.java
@@ -6,6 +6,7 @@
import com.gkhy.safePlatform.incidentManage.model.dto.req.AccidentReportReqDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportDetailRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentReportPageRespDTO;
import com.gkhy.safePlatform.incidentManage.model.dto.resp.AccidentStatisticDTO;
import com.gkhy.safePlatform.incidentManage.query.AccidentReportQuery;
import java.util.List;
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/AccidentReportInfoService.java
@@ -30,4 +30,6 @@
    List<AccidentResultCountDO> getAccidentCountByDeptIdsAndTime(String startTime, String endTime, List<Long> deptIds);
    List<AccidentResultCountDO> getAccidentCountByDeptIdAndTime(String startTime, String endTime, Long deptId);
    List<AccidentStatisticCountDO> getCountByAccidentGrade(Integer year, Integer month);
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/baseService/impl/AccidentReportInfoServiceImpl.java
@@ -77,4 +77,9 @@
        return accidentReportInfoRepository.getAccidentCountByDeptIdAndTime(startTime,endTime,deptId);
    }
    @Override
    public List<AccidentStatisticCountDO> getCountByAccidentGrade(Integer year, Integer month) {
        return accidentReportInfoRepository.getCountByAccidentGrade(year,month);
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentCountServiceImpl.java
@@ -2,6 +2,7 @@
import com.gkhy.safePlatform.account.rpc.apimodel.AccountDepartmentService;
import com.gkhy.safePlatform.account.rpc.apimodel.model.resp.DepInfoRPCRespDTO;
import com.gkhy.safePlatform.commons.enums.E;
import com.gkhy.safePlatform.commons.enums.ResultCodes;
import com.gkhy.safePlatform.commons.exception.BusinessException;
import com.gkhy.safePlatform.commons.utils.BeanCopyUtils;
@@ -9,6 +10,7 @@
import com.gkhy.safePlatform.commons.vo.ResultVO;
import com.gkhy.safePlatform.commons.vo.SearchResultVO;
import com.gkhy.safePlatform.incidentManage.entity.*;
import com.gkhy.safePlatform.incidentManage.enums.AccidentReportGradeEnum;
import com.gkhy.safePlatform.incidentManage.enums.AccidentReportLevelEnum;
import com.gkhy.safePlatform.incidentManage.enums.AccidentResultCodes;
import com.gkhy.safePlatform.incidentManage.enums.DepartmentLevelEnum;
@@ -30,6 +32,7 @@
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@@ -558,4 +561,55 @@
        }
        return respDTOList;
    }
    /**
     * 统计数据
     */
    @Override
    public List<AccidentStatisticDTO> getCountByAccidentGrade(Integer year, Integer month) {
        if(null == year && null != month){
            throw new BusinessException(ResultCodes.CLIENT_PARAM_ERROR,"年份不可为空");
        }
        if(null == year && null == month) {
            year = LocalDate.now().getYear();
        }
        List<AccidentStatisticDTO> accidentStatisticDTOList = new ArrayList<>();
        List<AccidentStatisticCountDO> countByAccidentGrades = accidentReportInfoService.getCountByAccidentGrade(year, month);
        for (AccidentReportGradeEnum gradeEnum : AccidentReportGradeEnum.values()) {
            AccidentStatisticDTO accidentStatisticDTO = new AccidentStatisticDTO();
            accidentStatisticDTO.setAccidentGrade(gradeEnum.getValue());
            List<AccidentStatisticCountDO> collect = countByAccidentGrades.stream().filter(c -> c.getAccidentGrade().equals(gradeEnum.getCode())).collect(Collectors.toList());
            accidentStatisticDTO.setCount(collect.size()>0 ? collect.get(0).getCount() : 0);
            accidentStatisticDTOList.add(accidentStatisticDTO);
        }
        return accidentStatisticDTOList;
    }
    /**
     * 统计数据
     */
    @Override
    public AccidentCountByGradeRespDTO getSpiAccidentCountByAccidentGrade(Integer year, Integer month) {
        List<AccidentStatisticCountDO> countByAccidentGrades = accidentReportInfoService.getCountByAccidentGrade(year, month);
        AccidentCountByGradeRespDTO accidentCountByGradeRespDTO = new AccidentCountByGradeRespDTO();
        int total = 0;
        for (AccidentStatisticCountDO countByAccidentGrade : countByAccidentGrades) {
            if(countByAccidentGrade.getAccidentGrade().equals(AccidentReportGradeEnum.GRADE_ONE.getCode())){
                accidentCountByGradeRespDTO.setAccidentOne(countByAccidentGrade.getCount());
            }
            if(countByAccidentGrade.getAccidentGrade().equals(AccidentReportGradeEnum.GRADE_TWO.getCode())){
                accidentCountByGradeRespDTO.setAccidentTwo(countByAccidentGrade.getCount());
            }
            if(countByAccidentGrade.getAccidentGrade().equals(AccidentReportGradeEnum.GRADE_THREE.getCode())){
                accidentCountByGradeRespDTO.setAccidentThree(countByAccidentGrade.getCount());
            }
            if(countByAccidentGrade.getAccidentGrade().equals(AccidentReportGradeEnum.GRADE_FOUR.getCode())){
                accidentCountByGradeRespDTO.setAccidentFour(countByAccidentGrade.getCount());
            }
            total += countByAccidentGrade.getCount();
        }
        return accidentCountByGradeRespDTO;
    }
}
incident-manage/incident-manage-service/src/main/java/com/gkhy/safePlatform/incidentManage/service/impl/AccidentReportServiceImpl.java
@@ -31,6 +31,8 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -331,4 +333,6 @@
        }
    }
}
incident-manage/incident-manage-service/src/main/resources/config/mapper/incidentManage/AccidentReportInfoMapper.xml
@@ -327,4 +327,23 @@
        DATE_FORMAT( a.gmt_create, '%Y-%m' ),
        DATE_FORMAT( a.gmt_create, '%m' )
    </select>
    <select id="getCountByAccidentGrade" resultType="com.gkhy.safePlatform.incidentManage.entity.AccidentStatisticCountDO">
        SELECT
            a.accident_grade,
            count( id ) count
        FROM
            accident_report a
        WHERE
            a.del_flag = 0
        <if test="year != null">
            AND YEAR ( a.gmt_create ) = #{year}
        </if>
        <if test="month != null">
            AND MONTH ( a.gmt_create ) = #{month}
        </if>
        GROUP BY
            a.accident_grade
    </select>
</mapper>
safePlatfrom-out-web/src/main/resources/config/application.yaml
@@ -4,7 +4,7 @@
  profiles:
    #active: uat
#### dev out-dev  test  uat  online-uat guotai-demo
     active: guotai-prod
     active: dev
#    active: online-uat   线上预发环境
#    active: dev  本地开发环境
#    active: out-dev  外包对接环境