41cb87d6749d744ddd4e21d1aa47bb363cf5678b..9ca0dc6e7833715b875cc9b6b91d5c497b2bae8b
2023-08-30 zf
Merge branch 'master' of https://sinanoaq.cn:8888/r/hazar...
zf
9ca0dc 对比 | 目录
2023-08-30 zf
检查统计
464fe4 对比 | 目录
2023-08-04 zf
调正时间格式
89dbae 对比 | 目录
2023-08-04 zf
bug修改
869edb 对比 | 目录
2023-08-04 zf
bug修改
145d00 对比 | 目录
已修改23个文件
已添加10个文件
969 ■■■■■ 文件已修改
src/main/java/com/gk/hotwork/Controller/LoginController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/SafetyInspectionStatisticCotroller.java 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/UserController.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/Do/CompanyInspectionCountDO.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/Do/CompanyStatisticInspectionDO.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/Do/StatisticCompanyCount.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/Do/SubordinateOrganizationInfoDO.java 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/SafetySelfInspectionDO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/Utils/Constants.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/dto/resp/AreaInspectionCountRespDTO.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/dto/resp/CompanyInspectionCountRespDTO.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Domain/query/CountQuery.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/CompanyInfoMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/InspectionHiddenDangerMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/SafetySelfInspectionMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/InspectionHiddenDangerMapper.xml 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetySelfInspectionMapper.xml 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/CompanyService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/InspectionHiddenDangerService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/SafetyInspectionStatisticService.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/SafetySelfInspectionService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/CompanyServiceImpl.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/InspectionHiddenDangerServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionStatisticServiceImpl.java 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java 37 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-dev.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application-prod.yml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/gk/hotwork/Controller/LoginController.java
@@ -9,11 +9,8 @@
import com.gk.hotwork.Config.Oauth2.IRedisService;
import com.gk.hotwork.Config.Oauth2.OauthRole;
import com.gk.hotwork.Config.Oauth2.RedisKeyEnum;
import com.gk.hotwork.Domain.AuthorizationInfo;
import com.gk.hotwork.Domain.ExamScoreInfo;
import com.gk.hotwork.Domain.*;
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.UserFace;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.CommonUtil;
import com.gk.hotwork.Domain.Utils.Msg;
import com.gk.hotwork.Domain.Vo.ExamScoreVo;
@@ -48,6 +45,9 @@
    ExamScoreService examScoreService;
    @Autowired
    UserFaceService userFaceService;
    @Autowired
    CompanyService companyService;
    @Value("${host}")
    private String host;
    @Value("${workname}")
@@ -118,6 +118,14 @@
            UserFace userFace = userFaceService.selectByUserId(user.getId());
            if (userFace != null)
                user.setCode(userFace.getCode());
            if(user.getCompanyid() != null){
                CompanyInfo companyInfo = companyService.getById(user.getId());
                if(companyInfo != null){
                    user.setProvince(companyInfo.getProvince());
                    user.setCity(companyInfo.getCity());
                    user.setCounty(companyInfo.getArea());
                }
            }
            msg.setResult(user);
        } catch (Exception e) {
            e.printStackTrace();
src/main/java/com/gk/hotwork/Controller/SafetyInspectionStatisticCotroller.java
对比新文件
@@ -0,0 +1,58 @@
package com.gk.hotwork.Controller;
import com.alibaba.fastjson.JSONObject;
import com.gk.hotwork.Controller.Base.BaseController;
import com.gk.hotwork.Domain.Utils.Msg;
import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionRespDTO;
import com.gk.hotwork.Domain.query.CountQuery;
import com.gk.hotwork.Service.SafetyInspectionStatisticService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/22
 * @time: 15:28
 */
@Api(tags = "自查清单_统计")
@RestController
@RequestMapping("/statistic")
public class SafetyInspectionStatisticCotroller extends BaseController {
    @Autowired
    private SafetyInspectionStatisticService statisticService;
    @ApiOperation("/统计")
    @PostMapping("/getCountByArea")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "province",value = "省"),
            @ApiImplicitParam(name = "city",value = "市"),
            @ApiImplicitParam(name = "area",value = "县"),
            @ApiImplicitParam(name = "startTime",value = "开始时间"),
            @ApiImplicitParam(name = "endTime",value = "结束时间")
    })
    public Msg getCountByArea(@RequestBody CountQuery query) {
        Msg msg = statisticService.getCountByArea(query,getUser());
        return msg;
    }
    @ApiOperation("/未检查公司")
    @PostMapping("/getUnCheckCompany")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "province",value = "省"),
            @ApiImplicitParam(name = "city",value = "市"),
            @ApiImplicitParam(name = "area",value = "县"),
            @ApiImplicitParam(name = "startTime",value = "开始时间"),
            @ApiImplicitParam(name = "endTime",value = "结束时间")
    })
    public Msg getUnCheckCompany(@RequestBody CountQuery query) {
        Msg msg = statisticService.getUnCheckCompany(query);
        return msg;
    }
}
src/main/java/com/gk/hotwork/Controller/UserController.java
@@ -201,9 +201,12 @@
            @ApiImplicitParam(name = "company",value = "单位名称"),
            @ApiImplicitParam(name = "realname",value = "姓名"),
            @ApiImplicitParam(name = "idcard",value = "身份证号"),
            @ApiImplicitParam(name = "province",value = "省"),
            @ApiImplicitParam(name = "city",value = "市"),
            @ApiImplicitParam(name = "county",value = "县"),
    })
    public Msg getSuperviseUserInfo(@RequestParam(defaultValue = "0") Integer pageIndex, @RequestParam(defaultValue = "10") Integer pageSize, String sort,String order,
                                  String username,String company,String realname, String idcard){
                                  String username,String company,String realname, String idcard, String province,String city,String county){
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("success");
@@ -226,16 +229,29 @@
        if (StringUtils.isNotBlank(idcard)){
            condition.put("idcard",idcard.trim());
        }
        if (StringUtils.isNotBlank(province)){
            condition.put("province",province.trim());
        if(StringUtils.isNotBlank(userInfoCurrent.getProvince())){
            condition.put("province", userInfoCurrent.getProvince());
            if(StringUtils.isNotBlank(city)){
                condition.put("city", city);
            }
            if(StringUtils.isNotBlank(county)){
                condition.put("county", county);
            }
        }else {
            if(StringUtils.isNotBlank(userInfoCurrent.getProvince())){
                condition.put("province", userInfoCurrent.getProvince());
            }
            if(StringUtils.isNotBlank(userInfoCurrent.getCity())){
                condition.put("city", userInfoCurrent.getCity());
            }
            if(StringUtils.isNotBlank(userInfoCurrent.getCounty())){
                condition.put("county", userInfoCurrent.getCounty());
            }
        }
        if(StringUtils.isNotBlank(userInfoCurrent.getCity())){
            condition.put("city", userInfoCurrent.getCity());
        }
        if(StringUtils.isNotBlank(userInfoCurrent.getCounty())){
            condition.put("county", userInfoCurrent.getCounty());
        }
        pageInfo.setCondition(condition);
        userService.selectSuperviseUserDataGrid(pageInfo);
@@ -2685,9 +2701,6 @@
    /**
     * 获取监管辖区内的企业
     */
    /**
     * 获取专家用户列表
     */
    @GetMapping("/company/list")
    @ApiOperation(value = "获取监管辖区企业数据",response = Msg.class)
src/main/java/com/gk/hotwork/Domain/Do/CompanyInspectionCountDO.java
对比新文件
@@ -0,0 +1,33 @@
package com.gk.hotwork.Domain.Do;
import io.swagger.models.auth.In;
import lombok.Data;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/24
 * @time: 14:27
 */
@Data
public class CompanyInspectionCountDO {
    private Long companyId;
    //检查总数
    private int checkTotal;
    //未整改总数
    private int sUnReTotal;
    //整改总数
    private int sReTotal;
    //隐患总数
    private int sHdTotal;
    //一般总数
    private int sSaTotal;
    //重大总数
    private int sMaTotal;
    //一般整改总数
    private int sSaReTotal;
    //重大整改总数
    private int sMaReTotal;
}
src/main/java/com/gk/hotwork/Domain/Do/CompanyStatisticInspectionDO.java
对比新文件
@@ -0,0 +1,20 @@
package com.gk.hotwork.Domain.Do;
import lombok.Data;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/25
 * @time: 15:11
 */
@Data
public class CompanyStatisticInspectionDO {
    private int checkCompanyCount;
    private int endTotal;
    private int toDoTotal;
    private int checkTotal;
    private int hdTotal;
    private int unRectifyTotal;
    private int rectifyTotal;
}
src/main/java/com/gk/hotwork/Domain/Do/StatisticCompanyCount.java
对比新文件
@@ -0,0 +1,20 @@
package com.gk.hotwork.Domain.Do;
import lombok.Data;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/25
 * @time: 11:01
 */
@Data
public class StatisticCompanyCount {
    private String province;
    private String city;
    private String area;
    private Integer count;
}
src/main/java/com/gk/hotwork/Domain/Do/SubordinateOrganizationInfoDO.java
对比新文件
@@ -0,0 +1,42 @@
package com.gk.hotwork.Domain.Do;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/24
 * @time: 16:36
 */
public class SubordinateOrganizationInfoDO {
    //省
    private String Province;
    //市
    private String city;
    //区县
    private String area;
    public String getProvince() {
        return Province;
    }
    public void setProvince(String province) {
        Province = province;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getArea() {
        return area;
    }
    public void setArea(String area) {
        this.area = area;
    }
}
src/main/java/com/gk/hotwork/Domain/SafetySelfInspection.java
@@ -60,8 +60,7 @@
    private Date inspectionStartTime;
    /** 检查结束时间   **/
    @TableField(exist = false)
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date inspectionEndTime;
    /** 检查项集合   **/
@@ -102,6 +101,7 @@
    //检查标识 2自查,1监管检查
    private Byte flag;
    /**
     * 隐患总数
     */
src/main/java/com/gk/hotwork/Domain/SafetySelfInspectionDO.java
@@ -57,7 +57,7 @@
    private Date inspectionStartTime;
    /** 检查结束时间   **/
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date inspectionEndTime;
    /** 主键id  id **/
src/main/java/com/gk/hotwork/Domain/Utils/Constants.java
@@ -30,7 +30,7 @@
    /**
     * 非过滤URL **,
     */
    public static final String FILTER_EXCLUDE_PATH = "/,/v2/api-docs,/swagger-resources/**,/swagger-ui.html,/webjars/**,/auth/**,/api/**,/error,/upload/**,/dbback/**,/push/**,/register/add,/companyList,/departmentList,/districtByName,/district,/pwd-change";
    public static final String FILTER_EXCLUDE_PATH = "/,/v2/api-docs,/swagger-resources/**,/swagger-ui.html,/webjars/**,/auth/**,/api/**,/error,/upload/**,/dbback/**,/push/**,/register/add,/companyList,/departmentList,/districtByName,/district,/pwd-change,/uploadfile/**";
    /**
     * 登录授权类型
src/main/java/com/gk/hotwork/Domain/dto/resp/AreaInspectionCountRespDTO.java
对比新文件
@@ -0,0 +1,63 @@
package com.gk.hotwork.Domain.dto.resp;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/22
 * @time: 15:59
 */
@Data
public class AreaInspectionCountRespDTO {
    /**
     * 地区名称
     */
    private String province;
    private String city;
    private String area;
    /**
     * 企业总数
     */
    private int companyTotal;
    /**
     * 创建自查清单企业数
     */
    private int checkCompanyCount;
    /**
     * 自查清单总数
     */
    private int checkTotal;
    /**
     * 未结单
     */
    private int toDoTotal;
    /**
     * 结单数据
     */
    private int endTotal;
    /**
     * 未自查企业
     */
    private int unCheckCompanyCount;
    /**
     * 隐患总数
     */
    private int hdTotal;
    /**
     * 未整改数量
     */
    private int unRectifyTotal;
    /**
     * 已整改数量
     */
    private int rectifyTotal;
    /**
     * 整改率
     */
    private BigDecimal rectifyRate;
}
src/main/java/com/gk/hotwork/Domain/dto/resp/CompanyInspectionCountRespDTO.java
对比新文件
@@ -0,0 +1,43 @@
package com.gk.hotwork.Domain.dto.resp;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/24
 * @time: 10:14
 */
@Data
public class CompanyInspectionCountRespDTO {
    private Long companyId;
    private String companyName;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm" , timezone = "GMT+8")
    private Date lastTime;
    //检查总数
    private int checkTotal;
    //未整改总数
    private int sUnReTotal;
    //整改总数
    private int sReTotal;
    //隐患总数
    private int sHdTotal;
    //一般总数
    private int sSaTotal;
    //重大总数
    private int sMaTotal;
    //一般整改总数
    private int sSaReTotal;
    //重大整改总数
    private int sMaReTotal;
    //整改率
    private BigDecimal rectifyRate;
}
src/main/java/com/gk/hotwork/Domain/query/CountQuery.java
对比新文件
@@ -0,0 +1,31 @@
package com.gk.hotwork.Domain.query;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.models.auth.In;
import lombok.Data;
import java.util.Date;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/22
 * @time: 15:42
 */
@Data
public class CountQuery {
    private String province;
    private String city;
    private String area;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date startTime;
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date endTime;
    private Integer pageIndex;
    private Integer pageSize;
}
src/main/java/com/gk/hotwork/Mapper/CompanyInfoMapper.java
@@ -3,7 +3,9 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gk.hotwork.Domain.CompanyInfo;
import com.gk.hotwork.Domain.Do.StatisticCompanyCount;
import com.gk.hotwork.Domain.query.CompanyQuery;
import com.gk.hotwork.Domain.query.CountQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -23,4 +25,9 @@
    List<CompanyInfo> selectCompanyList(@Param("query") CompanyQuery query);
    List<CompanyInfo> selectCompanyList(Page<CompanyInfo> page,@Param("query") CompanyQuery query);
    Integer getCountByArea(@Param("params")Map<String,Object> params);
    List<CompanyInfo> getUncheckCompanyByArea(Page<CompanyInfo> page,@Param("query") CountQuery query);
}
src/main/java/com/gk/hotwork/Mapper/InspectionHiddenDangerMapper.java
@@ -3,9 +3,11 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gk.hotwork.Domain.Do.CompanyInspectionCountDO;
import com.gk.hotwork.Domain.InspectionHiddenDanger;
import com.gk.hotwork.Domain.SafetySelfInspection;
import com.gk.hotwork.Domain.SafetySelfInspectionDO;
import com.gk.hotwork.Domain.query.CountQuery;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
@@ -27,4 +29,6 @@
    IPage<SafetySelfInspectionDO> selectPages(Page<SafetySelfInspection> page, @Param("params") Map<String, Object> params);
    List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId);
    List<CompanyInspectionCountDO> getStatisticHiddenDanger(@Param("query") CountQuery query);
}
src/main/java/com/gk/hotwork/Mapper/SafetyInspectionItemMapper.java
@@ -19,7 +19,7 @@
    SafetyInspectionItem getById(@Param("id")Long id);
    void updateSafetyInspectionItem(@Param("param") SafetyInspectionItem param);
    void updateSafetyInspectionItem(@Param("item") SafetyInspectionItem item);
    IPage<SafetyInspectionItem> selectCPages(Page<SafetyInspectionItem> page,@Param("params") Map<String, Object> params);
}
src/main/java/com/gk/hotwork/Mapper/SafetySelfInspectionMapper.java
@@ -3,9 +3,12 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gk.hotwork.Domain.Do.CompanyStatisticInspectionDO;
import com.gk.hotwork.Domain.SafetySelfInspection;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Map;
@Repository
@@ -14,4 +17,5 @@
    IPage<SafetySelfInspection> selectPages(@Param("page") Page<SafetySelfInspection> page,@Param("params") Map<String, Object> params);
    CompanyStatisticInspectionDO companyStatisticInspection(@Param("params") Map<String, Object> params);
}
src/main/java/com/gk/hotwork/Mapper/mybatis/CompanyInfoMapper.xml
@@ -150,4 +150,62 @@
      </if>
    </where>
  </select>
  <select id="getCountByArea" resultType="java.lang.Integer">
    SELECT count(*) FROM company
    where isdel = 0
    <if test="params.province != null and params.province !=''">
      and province = #{params.province}
    </if>
    <if test="params.city != null and params.city !=''">
      and city = #{params.city}
    </if>
    <if test="params.area != null and params.area !=''">
      and area = #{params.area}
    </if>
  </select>
  <select id="getUncheckCompanyByArea"  resultType="com.gk.hotwork.Domain.CompanyInfo">
    SELECT
      c1.*
    FROM
      company c1
    WHERE
      c1.isdel = 0
      <if test="query.province != null and query.province !=''">
        and c1.province = #{query.province}
      </if>
      <if test="query.city != null and query.city !=''">
        and c1.city = #{query.city}
      </if>
      <if test="query.area != null and query.area !=''">
        and c1.area = #{query.area}
      </if>
      AND c1.id NOT IN (
      SELECT
        s.checked_company_id
      FROM
        safety_self_inspection s
          INNER JOIN company c ON c.id = s.checked_company_id
      WHERE
        s.valid_flag = 1
        AND s.flag = 2
        <if test="query.province != null and query.province !=''">
          and c.province = #{query.province}
        </if>
        <if test="query.city != null and query.city !=''">
          and c.city = #{query.city}
        </if>
        <if test="query.area != null and query.area !=''">
          and c.area = #{query.area}
        </if>
        <if test="query.startTime != null" >
          and s.inspection_time <![CDATA[ >= ]]> #{query.startTime}
        </if>
        <if test="query.endTime != null" >
          and s.inspection_time <![CDATA[ <= ]]> #{query.endTime}
        </if>
      GROUP BY
        s.checked_company_id
    )
  </select>
</mapper>
src/main/java/com/gk/hotwork/Mapper/mybatis/InspectionHiddenDangerMapper.xml
@@ -3,6 +3,7 @@
<mapper namespace="com.gk.hotwork.Mapper.InspectionHiddenDangerMapper" >
     <update id="delByInspectionItemId">
       update inspection_hidden_danger set valid_flag = 0 , update_time = #{inspectionHiddenDanger.updateTime},update_by = #{inspectionHiddenDanger.updateBy}
        where self_inspection_item_id = #{inspectionHiddenDanger.selfInspectionItemId}
     </update>
    <update id="delByIds">
@@ -77,7 +78,7 @@
        <if test="params.area != null and params.area != ''" >
            and co.area = #{params.area}
        </if>
        ORDER BY l.create_time
        ORDER BY l.create_time desc
    </select>
    <select id="inspectionHdangerlist" resultType="com.gk.hotwork.Domain.InspectionHiddenDanger">
        SELECT
@@ -103,5 +104,56 @@
        and h.self_inspection_id = #{selfInspectionId}
    </select>
    <select id="getStatisticHiddenDanger" resultType="com.gk.hotwork.Domain.Do.CompanyInspectionCountDO">
        select
            l.checked_company_id as companyId,
            count(l.id) as checkTotal,
            sum(l.unRectifyTotal) as sUnReTotal,
            sum(l.reTotal) as sReTotal,
            sum(l.hdTocal) as sHdTotal,
            sum(l.saTotal) as sSaTotal,
            sum(l.maTotal) as sMaTotal,
            sum(l.saReTotal) as sSaReTotal,
            sum(l.maReTotal) as sMaReTotal
        from (
                 SELECT
                     s.id,
                     s.checked_company_id,
                     t.*
                 FROM
                     safety_self_inspection s
                         INner JOIN company c on s.checked_company_id = c.id
                         LEFT JOIN (
                         SELECT
                             h.self_Inspection_id,
                             count( h.`status` = - 1 OR NULL ) unRectifyTotal,
                             count( h.`status` = 1 OR NULL ) reTotal,
                             count( h.`status` ) hdTocal,
                             count( h.LEVEL = 1 OR NULL ) saTotal,
                             count( h.LEVEL = 2 OR NULL ) maTotal,
                             count( h.LEVEL = 1 AND h.`status` = 1 OR NULL ) saReTotal,
                             count( h.LEVEL = 2 AND h.`status` = 1 OR NULL ) maReTotal
                         FROM
                             inspection_hidden_danger h
                         WHERE
                             h.valid_flag = 1
                         GROUP BY
                             h.self_Inspection_id
                     ) t ON t.self_Inspection_id = s.id
                 WHERE
                        s.valid_flag = 1
                        and s.flag = 2
                    <if test="query.startTime != null" >
                        and s.inspection_time <![CDATA[ >= ]]> #{query.startTime}
                    </if>
                    <if test="query.endTime != null" >
                        and s.inspection_time <![CDATA[ <= ]]> #{query.endTime}
                    </if>
                    <if test="query.area != null and query.area != ''" >
                        and c.area = #{query.area}
                    </if>
             ) l
        GROUP BY l.checked_company_id
    </select>
</mapper>
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetyInspectionItemMapper.xml
@@ -12,6 +12,7 @@
    <result column="element_a" property="elementA" jdbcType="BIGINT" />
    <result column="element_b" property="elementB" jdbcType="BIGINT" />
    <result column="element_c" property="elementC" jdbcType="BIGINT" />
    <result column="standardization_requirements" property="standardizationRequirements" jdbcType="VARCHAR" />
    <result column="enterprise_standard" property="enterpriseStandard" jdbcType="VARCHAR" />
    <result column="review_method" property="reviewMethod" jdbcType="VARCHAR" />
@@ -67,4 +68,94 @@
    where a.valid_flag = 1 and a.id= #{id}
  </select>
    <update id="updateBatch">
        <foreach collection="itemList" item="item" index="index" open="" close="" separator=";">
            update safety_inspection_item
            set
            <trim prefix="" suffix="" suffixOverrides=",">
                <if test="item.validFlag != null">
                    valid_flag = #{item.validFlag},
                </if>
                <if test="item.createTime != null and item.createTime != '' ">
                    create_time = #{item.createTime},
                </if>
                <if test="item.createBy != null and item.createBy != '' ">
                    create_by = #{item.createBy},
                </if>
                <if test="item.updateTime != null and item.updateTime != '' ">
                    update_time = #{item.updateTime},
                </if>
                <if test="item.updateBy != null and item.updateBy != '' ">
                    update_by = #{item.updateBy},
                </if>
                <if test="item.elementA != null">
                    element_a = #{item.elementA},
                </if>
                <if test="item.elementB != null">
                    element_b = #{item.elementB},
                </if>
                <if test="item.elementC != null">
                    element_c = #{item.elementC},
                </if>
                <if test="item.standardizationRequirements != null and item.standardizationRequirements != '' ">
                    standardization_requirements = #{item.standardizationRequirements},
                </if>
                <if test="item.enterpriseStandard != null and item.enterpriseStandard != '' ">
                    enterprise_standard = #{item.enterpriseStandard},
                </if>
                <if test="item.reviewMethod != null and item.reviewMethod != '' ">
                    review_method = #{item.reviewMethod},
                </if>
                <if test="item.veto != null and item.veto != '' ">
                    veto = #{item.veto},
                </if>
            </trim>
            where id=#{item.id}
        </foreach>
    </update>
    <update id="updateSafetyInspectionItem">
        update safety_inspection_item
        <trim prefix="set" suffix="" suffixOverrides=",">
            <if test="item.validFlag != null">
                valid_flag = #{item.validFlag},
            </if>
            <if test="item.createTime != null">
                create_time = #{item.createTime},
            </if>
            <if test="item.createBy != null and item.createBy != '' ">
                create_by = #{item.createBy},
            </if>
            <if test="item.updateTime != null">
                update_time = #{item.updateTime},
            </if>
            <if test="item.updateBy != null and item.updateBy != '' ">
                update_by = #{item.updateBy},
            </if>
            <if test="item.elementA != null">
                element_a = #{item.elementA},
            </if>
            <if test="item.elementB != null">
                element_b = #{item.elementB},
            </if>
            <if test="item.elementC != null">
                element_c = #{item.elementC},
            </if>
            <if test="item.standardizationRequirements != null and item.standardizationRequirements != '' ">
                standardization_requirements = #{item.standardizationRequirements},
            </if>
            <if test="item.enterpriseStandard != null and item.enterpriseStandard != '' ">
                enterprise_standard = #{item.enterpriseStandard},
            </if>
            <if test="item.reviewMethod != null and item.reviewMethod != '' ">
                review_method = #{item.reviewMethod},
            </if>
            <if test="item.veto != null and item.veto != '' ">
                veto = #{item.veto},
            </if>
        </trim>
        where id=#{item.id}
    </update>
</mapper>
src/main/java/com/gk/hotwork/Mapper/mybatis/SafetySelfInspectionMapper.xml
@@ -62,5 +62,61 @@
    </if>
    order by a.create_time desc
  </select>
  <select id="companyStatisticInspection" resultType="com.gk.hotwork.Domain.Do.CompanyStatisticInspectionDO">
    SELECT
      count( 1 ) checkCompanyCount,
      sum( l.endCount ) endTotal,
      sum( l.toDoCount ) toDoTotal,
      sum( l.checkCount ) checkTotal,
      sum( l.unRectifyCount ) unRectifyTotal,
      sum( l.rectifyCount ) rectifyTotal,
      sum( l.hdCount ) AS hdTotal
    FROM
      (
        SELECT
          s.checked_company_id,
          count( s.`status` = 2 OR NULL ) endCount,
          count( s.`status` = 1 OR NULL ) toDoCount,
          count( 1 ) AS checkCount,
          sum( t.unRectify ) AS unRectifyCount,
          sum( t.rectify ) AS rectifyCount,
          sum( t.hd ) AS hdCount
        FROM
          safety_self_inspection s
            INNER JOIN company c ON c.id = s.checked_company_id
            LEFT JOIN (
            SELECT
              h.self_Inspection_id,
              count( h.`status` = - 1 OR NULL ) unRectify,
              count( h.`status` = 1 OR NULL ) rectify,
              count( 1 ) hd
            FROM
              inspection_hidden_danger h
            WHERE
              h.valid_flag = 1
            GROUP BY
              h.self_Inspection_id
          ) t ON t.self_Inspection_id = s.id
        WHERE
          s.valid_flag = 1
          AND s.flag = 2
          <if test="params.startTime != null" >
            and s.inspection_time <![CDATA[ >= ]]> #{params.startTime}
          </if>
          <if test="params.endTime != null " >
            and s.inspection_time <![CDATA[ <= ]]> #{params.endTime}
          </if>
          <if test="params.province != null and params.province != ''" >
            and c.province = #{params.province}
          </if>
          <if test="params.city != null and params.city != ''" >
            and c.city = #{params.city}
          </if>
          <if test="params.area != null and params.area != ''" >
            and c.area = #{params.area}
          </if>
        GROUP BY
          s.checked_company_id
      ) l
  </select>
</mapper>
src/main/java/com/gk/hotwork/Mapper/mybatis/UserInfoMapper.xml
@@ -263,7 +263,7 @@
        and user.realname like concat ('%',#{record.realname,jdbcType=VARCHAR},'%')
      </if>
      <if test="record.company != null and record.company !=''">
        and user.company like concat ('%',#{record.company,jdbcType=VARCHAR},'%')
        and user.company like concat ('%',#{record.company},'%')
      </if>
      <if test="record.job != null and record.job !=''">
        and user.job like concat ('%',#{record.job,jdbcType=VARCHAR},'%')
src/main/java/com/gk/hotwork/Service/CompanyService.java
@@ -1,11 +1,16 @@
package com.gk.hotwork.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gk.hotwork.Domain.CompanyInfo;
import com.gk.hotwork.Domain.Do.StatisticCompanyCount;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.PageInfo;
import com.gk.hotwork.Domain.query.CountQuery;
import io.swagger.models.auth.In;
import java.util.List;
import java.util.Map;
public interface CompanyService extends IService<CompanyInfo> {
@@ -22,4 +27,9 @@
    boolean isMain(String company);
    List<CompanyInfo> selectCompanyList(String companyName, UserInfo user);
    Integer getCountByArea(Map<String,Object> params);
    Page<CompanyInfo> getUncheckCompanyByArea(CountQuery query);
    Page<CompanyInfo> getByArea(CountQuery query);
}
src/main/java/com/gk/hotwork/Service/InspectionHiddenDangerService.java
@@ -3,10 +3,12 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gk.hotwork.Domain.Do.CompanyInspectionCountDO;
import com.gk.hotwork.Domain.InspectionHiddenDanger;
import com.gk.hotwork.Domain.SafetySelfInspection;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.PageInfo;
import com.gk.hotwork.Domain.query.CountQuery;
import java.util.List;
import java.util.Map;
@@ -30,4 +32,6 @@
    IPage selectPage(Page<SafetySelfInspection> page, Map<String, Object> filter, UserInfo user);
    List<InspectionHiddenDanger> inspectionHdangerlist(Long selfInspectionId);
    List<CompanyInspectionCountDO> getStatisticHiddenDanger(CountQuery query);
}
src/main/java/com/gk/hotwork/Service/SafetyInspectionStatisticService.java
对比新文件
@@ -0,0 +1,18 @@
package com.gk.hotwork.Service;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.Msg;
import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionRespDTO;
import com.gk.hotwork.Domain.query.CountQuery;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/22
 * @time: 15:41
 */
public interface SafetyInspectionStatisticService {
    Msg getCountByArea(CountQuery query, UserInfo user);
    Msg getUnCheckCompany(CountQuery query);
}
src/main/java/com/gk/hotwork/Service/SafetySelfInspectionService.java
@@ -4,11 +4,13 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gk.hotwork.Domain.AttachmentInfo;
import com.gk.hotwork.Domain.Do.CompanyStatisticInspectionDO;
import com.gk.hotwork.Domain.SafetySelfInspection;
import com.gk.hotwork.Domain.SafetySelfInspectionItem;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.dto.resp.SafetySelfInspectionRespDTO;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -54,4 +56,8 @@
    void addItemExpert(List<SafetySelfInspectionItem> itemList, UserInfo user);
    void addCheckAttachment(List<AttachmentInfo> attachmentList, UserInfo user);
    Date selectLastTimeByCompanyId(Long id,Date startTime,Date endTime);
    CompanyStatisticInspectionDO companyStatisticInspection(Map<String,Object> params);
}
src/main/java/com/gk/hotwork/Service/ServiceImpl/CompanyServiceImpl.java
@@ -5,12 +5,15 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.CompanyInfo;
import com.gk.hotwork.Domain.Do.StatisticCompanyCount;
import com.gk.hotwork.Domain.UserInfo;
import com.gk.hotwork.Domain.Utils.PageInfo;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Domain.query.CompanyQuery;
import com.gk.hotwork.Domain.query.CountQuery;
import com.gk.hotwork.Mapper.CompanyInfoMapper;
import com.gk.hotwork.Service.CompanyService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -98,5 +101,29 @@
        return companyInfos;
    }
    @Override
    public Integer getCountByArea(Map<String,Object> params) {
        return companyInfoMapper.getCountByArea(params);
    }
    @Override
    public Page<CompanyInfo> getUncheckCompanyByArea(CountQuery query){
        Page<CompanyInfo> page = new Page<>(query.getPageIndex(),query.getPageSize());
        List<CompanyInfo> companyInfos = companyInfoMapper.getUncheckCompanyByArea(page,query);
        page.setRecords(companyInfos);
        return page;
    }
    @Override
    public Page<CompanyInfo> getByArea(CountQuery query){
       Page<CompanyInfo> page = new Page<>(query.getPageIndex(),query.getPageSize());
       CompanyQuery companyQuery = new CompanyQuery();
       companyQuery.setArea(query.getArea());
       List<CompanyInfo> companyInfos = companyInfoMapper.selectCompanyList(page,companyQuery);
       page.setRecords(companyInfos);
       return page;
    }
}
src/main/java/com/gk/hotwork/Service/ServiceImpl/InspectionHiddenDangerServiceImpl.java
@@ -5,11 +5,13 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.*;
import com.gk.hotwork.Domain.Do.CompanyInspectionCountDO;
import com.gk.hotwork.Domain.Do.SafetySelfInspectionItemQualifiedCountDO;
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.Utils.PageInfo;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Domain.dto.resp.InspectionHiddenDangerRespDTO;
import com.gk.hotwork.Domain.query.CountQuery;
import com.gk.hotwork.Mapper.InspectionExpertMapper;
import com.gk.hotwork.Mapper.InspectionHiddenDangerMapper;
import com.gk.hotwork.Service.AttachmentInfoService;
@@ -157,6 +159,17 @@
    }
    /**
     * 统计
     * @param query
     * @return
     */
    @Override
    public List<CompanyInspectionCountDO> getStatisticHiddenDanger(CountQuery query) {
        return inspectionHiddenDangerMapper.getStatisticHiddenDanger(query);
    }
    private void modrequiredVerification(InspectionHiddenDanger inspectionHiddenDanger){
        if(inspectionHiddenDanger.getId() == null){
            throw new BusinessException("隐患主键不可为空");
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionItemImpl.java
@@ -289,7 +289,7 @@
        if (param.getElementB() == null) throw new BusinessException("请选择B级要素");
        //如果有三级要素则不创建标准
        List<ElementManagement> elementList = elementManagementService.getElementByParentId(param.getElementB());
        if(elementList.size() > 0){
        if(param.getElementC() == null && elementList.size() > 0){
            throw new BusinessException("请先删除三级要素");
        }
        if(StringUtils.isBlank(param.getStandardizationRequirements())) throw new BusinessException("请填写标准化要求");
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetyInspectionStatisticServiceImpl.java
对比新文件
@@ -0,0 +1,197 @@
package com.gk.hotwork.Service.ServiceImpl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gk.hotwork.Domain.*;
import com.gk.hotwork.Domain.Do.CompanyInspectionCountDO;
import com.gk.hotwork.Domain.Do.CompanyStatisticInspectionDO;
import com.gk.hotwork.Domain.Do.SubordinateOrganizationInfoDO;
import com.gk.hotwork.Domain.Utils.BeanUtils;
import com.gk.hotwork.Domain.Utils.Msg;
import com.gk.hotwork.Domain.Utils.StringUtils;
import com.gk.hotwork.Domain.dto.resp.AreaInspectionCountRespDTO;
import com.gk.hotwork.Domain.dto.resp.CompanyInspectionCountRespDTO;
import com.gk.hotwork.Domain.query.CountQuery;
import com.gk.hotwork.Service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @email 1603559716@qq.com
 * @author: zf
 * @date: 2023/8/22
 * @time: 15:41
 */
@Service
public class SafetyInspectionStatisticServiceImpl implements SafetyInspectionStatisticService {
    private final static String province = "新疆维吾尔自治区";
    @Autowired
    private DistrictService districtService;
    @Autowired
    private CompanyService companyService;
    @Autowired
    private InspectionHiddenDangerService hiddenDangerService;
    @Autowired
    private SafetySelfInspectionService selfInspectionService;
    @Override
    public Msg getCountByArea(CountQuery query, UserInfo user) {
        List<SubordinateOrganizationInfoDO> organizationInfos = null;
        Integer type = user.getType();
        //如果传来的区县级不为空,则表明是到县级
        if(StringUtils.isNotBlank(query.getArea())){
            return getAreaDataCount(query);
        }
        //如果传来市级不为空
        if(StringUtils.isNotBlank(query.getCity())){
            List<DistrictInfo>  districtInfos = districtService.selectDistrictByName("3", query.getCity(), "2");
            organizationInfos = districtInfos.stream().map((districtInfo)->{
                SubordinateOrganizationInfoDO organizationInfoDO = new SubordinateOrganizationInfoDO();
                organizationInfoDO.setProvince(province);
                organizationInfoDO.setCity(query.getCity());
                organizationInfoDO.setArea(districtInfo.getName());
                return organizationInfoDO;
            }).collect(Collectors.toList());
        }else {
            //管理员
            if(type.equals(1)){
                List<DistrictInfo> districtInfos = districtService.selectDistrictByName("2", province, "1");
                organizationInfos = districtInfos.stream().map((districtInfo)->{
                    SubordinateOrganizationInfoDO organizationInfoDO = new SubordinateOrganizationInfoDO();
                    organizationInfoDO.setProvince(province);
                    organizationInfoDO.setCity(districtInfo.getName());
                    return organizationInfoDO;
                }).collect(Collectors.toList());
            }
            //监护人员
            if(type.equals(2)){
                //属于县级
                if(StringUtils.isNotBlank(user.getCounty())){
                    query.setArea(user.getCounty());
                    return getAreaDataCount(query);
                }
                //属于市级
                if(StringUtils.isNotBlank(user.getCity())){
                    List<DistrictInfo> districtInfos = districtService.selectDistrictByName("3", user.getCity(), "2");
                    organizationInfos = districtInfos.stream().map((districtInfo)->{
                        SubordinateOrganizationInfoDO organizationInfoDO = new SubordinateOrganizationInfoDO();
                        organizationInfoDO.setProvince(user.getProvince());
                        organizationInfoDO.setCity(user.getCity());
                        organizationInfoDO.setArea(districtInfo.getName());
                        return organizationInfoDO;
                    }).collect(Collectors.toList());
                }
                //属于省级
                if(StringUtils.isNotBlank(user.getProvince())){
                    List<DistrictInfo> districtInfos = districtService.selectDistrictByName("2", user.getProvince(), "1");
                    organizationInfos = districtInfos.stream().map((districtInfo)->{
                        SubordinateOrganizationInfoDO organizationInfoDO = new SubordinateOrganizationInfoDO();
                        organizationInfoDO.setProvince(user.getProvince());
                        organizationInfoDO.setCity(districtInfo.getName());
                        return organizationInfoDO;
                    }).collect(Collectors.toList());
                }
            }
        }
        List<AreaInspectionCountRespDTO> list = getDataCountSelfCheckInfo(query,organizationInfos);
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setResult("查询成功");
        msg.setResult(list);
        return msg;
    }
    @Override
    public Msg getUnCheckCompany(CountQuery query) {
        Page<CompanyInfo> uncheckCompanyByArea = companyService.getUncheckCompanyByArea(query);
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setResult("查询成功");
        msg.setResult(uncheckCompanyByArea);
        return msg;
    }
    private List<AreaInspectionCountRespDTO> getDataCountSelfCheckInfo(CountQuery query, List<SubordinateOrganizationInfoDO> organizationInfos) {
        List<AreaInspectionCountRespDTO> respDTOList = new ArrayList<>();
        for (SubordinateOrganizationInfoDO organizationInfo : organizationInfos) {
            AreaInspectionCountRespDTO areaInspectionCountRespDTO = new AreaInspectionCountRespDTO();
            //统计检查企业数量以及清单数量等
            Map<String,Object> map = new HashMap<>();
            map.put("startTime",query.getStartTime());
            map.put("endTime",query.getEndTime());
            map.put("province",organizationInfo.getProvince());
            map.put("city",organizationInfo.getCity());
            map.put("area",organizationInfo.getArea());
            CompanyStatisticInspectionDO companyStatisticInspection = selfInspectionService.companyStatisticInspection(map);
            BeanUtils.copyProperties(companyStatisticInspection,areaInspectionCountRespDTO);
            areaInspectionCountRespDTO.setProvince(organizationInfo.getProvince());
            areaInspectionCountRespDTO.setCity(organizationInfo.getCity());
            areaInspectionCountRespDTO.setArea(organizationInfo.getArea());
            areaInspectionCountRespDTO.setRectifyRate(areaInspectionCountRespDTO.getHdTotal() == 0 ? new BigDecimal(0).setScale(2,BigDecimal.ROUND_HALF_UP) : new BigDecimal(areaInspectionCountRespDTO.getRectifyTotal()).divide(new BigDecimal(areaInspectionCountRespDTO.getHdTotal()), 2, BigDecimal.ROUND_HALF_UP));
            //统计公司总数量
            int companyCount = companyService.getCountByArea(map);
            areaInspectionCountRespDTO.setCompanyTotal(companyService.getCountByArea(map));
            areaInspectionCountRespDTO.setUnCheckCompanyCount(companyCount-areaInspectionCountRespDTO.getCheckCompanyCount());
            respDTOList.add(areaInspectionCountRespDTO);
        }
        return respDTOList;
    }
    private Msg getAreaDataCount(CountQuery query) {
        if(query.getPageIndex() == null){
            query.setPageIndex(1);
        }
        if(query.getPageSize() == null){
            query.setPageSize(10);
        }
        //获取该地区所有企业隐患统计
        List<CompanyInspectionCountDO> statisticHiddenDangerList = hiddenDangerService.getStatisticHiddenDanger(query);
        //获取相关企业
        Page<CompanyInfo> companyInfoPage = companyService.getByArea(query);
        List<CompanyInspectionCountRespDTO> list = new ArrayList<>();
        for (CompanyInfo companyInfo : companyInfoPage.getRecords()) {
            CompanyInspectionCountRespDTO inspectionCountRespDTO = new CompanyInspectionCountRespDTO();
            List<CompanyInspectionCountDO> collect = statisticHiddenDangerList
                    .stream()
                    .filter(statistic -> statistic.getCompanyId().equals(companyInfo.getId()))
                    .collect(Collectors.toList());
            if(collect.size() > 0){
                CompanyInspectionCountDO companyInspectionCountDO = collect.get(0);
                BeanUtils.copyProperties(companyInspectionCountDO,inspectionCountRespDTO);
                inspectionCountRespDTO.setRectifyRate(companyInspectionCountDO.getSHdTotal() == 0 ? new BigDecimal(0).setScale(2,BigDecimal.ROUND_HALF_UP) : new BigDecimal(companyInspectionCountDO.getSReTotal()).divide(new BigDecimal(companyInspectionCountDO.getSHdTotal()), 2, BigDecimal.ROUND_HALF_UP));
            }else {
                inspectionCountRespDTO.setCheckTotal(0);
                inspectionCountRespDTO.setSHdTotal(0);
                inspectionCountRespDTO.setSMaTotal(0);
                inspectionCountRespDTO.setSMaReTotal(0);
                inspectionCountRespDTO.setSReTotal(0);
                inspectionCountRespDTO.setSUnReTotal(0);
                inspectionCountRespDTO.setSSaTotal(0);
                inspectionCountRespDTO.setSSaReTotal(0);
                inspectionCountRespDTO.setRectifyRate(new BigDecimal(0).setScale(2,BigDecimal.ROUND_HALF_UP));
                inspectionCountRespDTO.setCompanyId(companyInfo.getId());
            }
            inspectionCountRespDTO.setCompanyName(companyInfo.getCompany());
            inspectionCountRespDTO.setLastTime(selfInspectionService.selectLastTimeByCompanyId(companyInfo.getId(),query.getStartTime(),query.getEndTime()));
            list.add(inspectionCountRespDTO);
        }
        Page<CompanyInspectionCountRespDTO> page = new Page<>();
        BeanUtils.copyProperties(companyInfoPage,page);
        page.setRecords(list);
        Msg msg = new Msg();
        msg.setCode("200");
        msg.setMessage("查询成功");
        msg.setResult(page);
        return msg;
    }
}
src/main/java/com/gk/hotwork/Service/ServiceImpl/SafetySelfInspectionImpl.java
@@ -5,6 +5,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gk.hotwork.Domain.*;
import com.gk.hotwork.Domain.Do.CompanyStatisticInspectionDO;
import com.gk.hotwork.Domain.Do.SafetySelfInspectionItemQualifiedCountDO;
import com.gk.hotwork.Domain.Exception.BusinessException;
import com.gk.hotwork.Domain.Utils.BeanUtils;
@@ -421,7 +422,11 @@
        if (CollectionUtils.isNotEmpty(elementTreeList)) {
            for (ElementTree elementA : elementTreeList) {
                List<SafetySelfInspectionItem> selectElementList = itemList.stream().filter(item -> item.getElementA().equals(elementA.getValue())).collect(Collectors.toList());
                List<SafetySelfInspectionItem> selectElementList = itemList
                        .stream()
                        .filter(item -> item.getElementA() != null &&
                        item.getElementA().equals(elementA.getValue()))
                        .collect(Collectors.toList());
                if (CollectionUtils.isNotEmpty(selectElementList)) {
                    SafetySelfInspectionElementRespDTO elementARespDTO = new SafetySelfInspectionElementRespDTO();
                    elementARespDTO.setElementId(elementA.getValue());
@@ -449,7 +454,9 @@
                                //无三级要素过滤出二级要素检查内容
                                List<SafetySelfInspectionItem> sItemList = itemList
                                        .stream()
                                        .filter(item -> item.getElementC() == null && item.getElementB().equals(stree.getValue()))
                                        .filter(item -> item.getElementC() == null
                                                && item.getElementB() != null
                                                && item.getElementB().equals(stree.getValue()))
                                        .collect(Collectors.toList());
                                //填充检查项
                                elementBRespDTO.setItemList(assemblyDeduction(sItemList));
@@ -624,7 +631,7 @@
            //否决 合格--删除扣分记录
            safetySelfInspectionItemDeductionMapper.delBySafetySelfInspectionItemId(param.getId(),username,date);
            //删除隐患
            dangerService.delByInspectionItemId(param.getSafetyInspectionItemId(),user);
            dangerService.delByInspectionItemId(param.getId(),user);
            //删除附件
            attachmentInfoService.deleteByBusinessId(param.getId());
        }else{
@@ -724,6 +731,7 @@
        safetySelfInspection.setStatus(2);
        safetySelfInspection.setUpdateTime(date);
        safetySelfInspection.setUpdateBy(username);
        safetySelfInspection.setInspectionEndTime(new Date());
        safetySelfInspectionMapper.updateById(safetySelfInspection);
    }
@@ -747,6 +755,29 @@
        attachmentInfoService.updateBusinessIdBatch(attachmentList);
    }
    @Override
    public Date selectLastTimeByCompanyId(Long companyId,Date startTime,Date endTime) {
        SafetySelfInspection inspection = safetySelfInspectionMapper.selectOne(new LambdaQueryWrapper<SafetySelfInspection>()
                 .eq(SafetySelfInspection::getValidFlag,1)
                .eq(SafetySelfInspection::getFlag, 2)
                .eq(SafetySelfInspection::getCheckedCompanyId, companyId)
                .ge(startTime != null,SafetySelfInspection::getInspectionTime,startTime)
                .le(endTime != null,SafetySelfInspection::getInspectionTime,endTime)
                .orderByDesc(SafetySelfInspection::getInspectionTime)
                .last("limit 1"));
        if(inspection != null){
            return inspection.getInspectionTime();
        }
       return null;
    }
    @Override
    public CompanyStatisticInspectionDO companyStatisticInspection(Map<String, Object> params) {
        return safetySelfInspectionMapper.companyStatisticInspection(params);
    }
    private void requiredAttachmentVerification(List<AttachmentInfo> attachmentList) {
        if(CollectionUtils.isEmpty(attachmentList)){
            throw new BusinessException("附件信息为空");
src/main/resources/application-dev.yml
@@ -131,4 +131,4 @@
# swagger生产环境中禁止显示
swagger:
  show: false
  show: true
src/main/resources/application-prod.yml
@@ -2,7 +2,7 @@
server:
  tomcat:
    uri-encoding: UTF-8
    basedir: /
    basedir: /home/ecs-shanghai/temp
  port: 8006
  servlet:
    context-path: /