Browse Source

Merge remote-tracking branch 'origin/lingshan_master' into lingshan_master

master
wxz 2 years ago
parent
commit
ec5ab68022
  1. 37
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPlaceOrgStatistics.java
  2. 1
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PlaceOrgByTypeResultDTO.java
  3. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java
  4. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPlaceOrgDao.java
  5. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPlacePatrolRecordDao.java
  6. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlaceOrgService.java
  7. 21
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java
  8. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java
  9. 53
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml
  10. 9
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml

37
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/IcPlaceOrgStatistics.java

@ -0,0 +1,37 @@
package com.epmet.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @author yan Lu
* @description 灵山大屏安全生产企业统计
* @create 2023/5/30 15:15
*/
@Data
public class IcPlaceOrgStatistics implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 重点企业总数量
*/
private Integer securityCount;
/**
* 安全巡查次数
*/
private Integer inspectionsCount;
/**
* 存在隐患数量
*/
private Integer dangerCount;
/**
* 排除隐患数量
*/
private Integer removeCount;
}

1
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/lingshan/PlaceOrgByTypeResultDTO.java

@ -12,6 +12,7 @@ import java.io.Serializable;
@Data
public class PlaceOrgByTypeResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 类型名称
*/

21
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcPlaceOrgController.java

@ -21,6 +21,7 @@ import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.IcPlaceOrgStatistics;
import com.epmet.dto.form.AddPlaceOrgFormDTO;
import com.epmet.dto.form.EditPlaceOrgFormDTO;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
@ -105,10 +106,13 @@ public class IcPlaceOrgController {
return new Result<GetListPlaceOrgResultDTO>().ok(placeOrgService.getList(formDTO));
}
/**
* 根据生产企业类型分类统计企业数量
*
* @return
* @return null
* @throws
* @description 根据生产企业类型分类统计企业数量
* @author yan Lu
* @date 2023/5/30 15:21
*/
@GetMapping("getPlaceOrgByType")
public Result<List<PlaceOrgByTypeResultDTO>> getPlaceOrgByType(@RequestParam("orgId") String orgId,
@ -117,5 +121,16 @@ public class IcPlaceOrgController {
return new Result().ok(placeOrgService.getPlaceOrgByType(orgId, orgType, dictType));
}
/**
* @description 灵山大屏统计安全生产企业个类型统计数量
* @author yan Lu
* @date 2023/5/30 15:21
*/
@GetMapping("countPlaceOrgByDangerType")
public Result<IcPlaceOrgStatistics> countPlaceOrgByDangerType(@RequestParam("orgId") String orgId,
@RequestParam("orgType") String orgType) {
return new Result<IcPlaceOrgStatistics>().ok(placeOrgService.countPlaceOrgByDangerType(orgId, orgType));
}
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPlaceOrgDao.java

@ -18,6 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.IcPlaceOrgStatistics;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
import com.epmet.dto.result.PlaceOrgDetailResultDTO;
import com.epmet.dto.result.lingshan.PlaceOrgByTypeResultDTO;
@ -42,5 +43,7 @@ public interface IcPlaceOrgDao extends BaseDao<IcPlaceOrgEntity> {
**/
List<PlaceOrgDetailResultDTO> getList(GetListPlaceOrgFormDTO formDTO);
List<PlaceOrgByTypeResultDTO> getPlaceOrgByType(@Param("orgPath") String orgPath);
List<PlaceOrgByTypeResultDTO> getPlaceOrgByType(@Param("orgId")String orgId,@Param("orgType")String orgType);
IcPlaceOrgStatistics countPlaceOrgByDangerType(@Param("orgId")String orgId,@Param("orgType")String orgType);
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/IcPlacePatrolRecordDao.java

@ -38,5 +38,5 @@ public interface IcPlacePatrolRecordDao extends BaseDao<IcPlacePatrolRecordEntit
List<PlacePatrolRecordDetailResultDTO> getList(GetListPlacePatrolRecordFormDTO dto);
List<PlaceOrgByTypeResultDTO> getPlacePatrolRecordByType(@Param("orgPath") String orgPath);
List<PlaceOrgByTypeResultDTO> getPlacePatrolRecordByType(@Param("orgId")String orgId,@Param("orgType")String orgType);
}

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcPlaceOrgService.java

@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.IcPlaceOrgStatistics;
import com.epmet.dto.form.AddPlaceOrgFormDTO;
import com.epmet.dto.form.EditPlaceOrgFormDTO;
import com.epmet.dto.form.GetListPlaceOrgFormDTO;
@ -67,4 +68,6 @@ public interface IcPlaceOrgService extends BaseService<IcPlaceOrgEntity> {
GetListPlaceOrgResultDTO getList(GetListPlaceOrgFormDTO formDTO);
List<PlaceOrgByTypeResultDTO> getPlaceOrgByType(String orgId, String orgType, String dictType);
IcPlaceOrgStatistics countPlaceOrgByDangerType(String orgId, String orgType);
}

21
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlaceOrgServiceImpl.java

@ -29,12 +29,10 @@ import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.OrgInfoConstant;
import com.epmet.dao.IcPlaceOrgDao;
import com.epmet.dto.IcPlaceOrgStatistics;
import com.epmet.dto.SysDictDataDTO;
import com.epmet.dto.form.AddPlaceOrgFormDTO;
import com.epmet.dto.form.EditPlaceOrgFormDTO;
@ -186,12 +184,11 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl<IcPlaceOrgDao, IcPlac
@Override
public List<PlaceOrgByTypeResultDTO> getPlaceOrgByType(String orgId, String orgType, String dictType) {
String orgPath = getOrgPath(orgId, orgType);
//获取字典
List<SysDictDataDTO> dtos = epmetAdminOpenFeignClient.dictDataList(dictType).getData();
//转换查询参数
Map<String, String> dtoMaps = dtos.stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel));
List<PlaceOrgByTypeResultDTO> resDto = baseDao.getPlaceOrgByType(orgPath);
List<PlaceOrgByTypeResultDTO> resDto = baseDao.getPlaceOrgByType(orgId, orgType);
for (PlaceOrgByTypeResultDTO dto : resDto) {
dto.setDictLabel(dtoMaps.get(dto.getDictValue()));
}
@ -213,17 +210,9 @@ public class IcPlaceOrgServiceImpl extends BaseServiceImpl<IcPlaceOrgDao, IcPlac
return resDto;
}
/**
* @deprecationg 获取orgPath
*/
private String getOrgPath(String orgId, String orgType) {
if (OrgInfoConstant.AGENCY.equals(orgType)) { // 行政组织
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
return PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids());
} else {// 网格
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(orgId);
return PidUtils.convertPid2OrgIdPath(gridInfo.getId(), gridInfo.getPids());
}
@Override
public IcPlaceOrgStatistics countPlaceOrgByDangerType(String orgId, String orgType) {
return baseDao.countPlaceOrgByDangerType(orgId, orgType);
}
}

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcPlacePatrolRecordServiceImpl.java

@ -279,7 +279,7 @@ public class IcPlacePatrolRecordServiceImpl extends BaseServiceImpl<IcPlacePatro
List<SysDictDataDTO> dtos = epmetAdminOpenFeignClient.dictDataList(dictType).getData();
//转换查询参数
Map<String, String> dtoMaps = dtos.stream().collect(Collectors.toMap(SysDictDataDTO::getDictValue, SysDictDataDTO::getDictLabel));
List<PlaceOrgByTypeResultDTO> resDto = baseDao.getPlacePatrolRecordByType(getOrgPath(orgId, orgType));
List<PlaceOrgByTypeResultDTO> resDto = baseDao.getPlacePatrolRecordByType(orgId, orgType);
for (PlaceOrgByTypeResultDTO dto : resDto) {
dto.setDictLabel(dtoMaps.get(dto.getDictValue()));
}

53
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlaceOrgDao.xml

@ -63,11 +63,60 @@
ic_place_org p
<where>
p.DEL_FLAG = 0
<if test="null != orgPath and orgPath != ''">
AND p.PIDS LIKE concat(#{orgPath},'%')
<if test="null != orgType and orgType !=''">
<if test="null != orgId and orgId != '' and orgType == 'agancy'">
AND p.agency_id = #{orgId}
</if>
<if test="null != orgId and orgId != '' and orgType == 'grid'">
AND p.grid_id = #{orgId}
</if>
</if>
</where>
GROUP BY p.NINE_PLACE_VAL
</select>
<select id="countPlaceOrgByDangerType" resultType="com.epmet.dto.IcPlaceOrgStatistics">
SELECT
pp.pidCount AS securityCount,
rr.ridCount AS inspectionsCount,
rr.dangerCount AS dangerCount,
rr.removeCount AS removeCount
FROM
(
SELECT
sum(case when p.security_flag = 1 then 1 else 0 end) as pidCount
from ic_place_org p
<where>
p.DEL_FLAG = 0
<if test="null != orgType and orgType !=''">
<if test="null != orgId and orgId != '' and orgType == 'agancy'">
AND p.agency_id = #{orgId}
</if>
<if test="null != orgId and orgId != '' and orgType == 'grid'">
AND p.grid_id = #{orgId}
</if>
</if>
</where>
) pp,
(
SELECT
count(r.id) as ridCount,
sum(case when r.FIRST_RESULT = 1 then 1 else 0 end) as dangerCount,
sum(case when r.FINAL_RESULT = 0 then 1 else 0 end) as removeCount
FROM
ic_place_patrol_record r
<where>
r.DEL_FLAG = 0
<if test="null != orgType and orgType !=''">
<if test="null != orgId and orgId != '' and orgType == 'agancy'">
AND r.agency_id = #{orgId}
</if>
<if test="null != orgId and orgId != '' and orgType == 'grid'">
AND r.grid_id = #{orgId}
</if>
</if>
</where>
) rr
</select>
</mapper>

9
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcPlacePatrolRecordDao.xml

@ -66,8 +66,13 @@
ic_place_patrol_record r
<where>
r.DEL_FLAG = 0
<if test="null != orgPath and orgPath != ''">
AND r.PIDS LIKE concat(#{orgPath},'%')
<if test="null != orgType and orgType !=''">
<if test="null != orgId and orgId != '' and orgType == 'agancy'">
AND r.agency_id = #{orgId}
</if>
<if test="null != orgId and orgId != '' and orgType == 'grid'">
AND r.grid_id = #{orgId}
</if>
</if>
</where>
GROUP BY r.DANGER_TYPE

Loading…
Cancel
Save