Commit f96a6142 authored by KeYong's avatar KeYong

提交

parent c8659138
...@@ -52,4 +52,7 @@ public interface AmosTrainingFeignClient { ...@@ -52,4 +52,7 @@ public interface AmosTrainingFeignClient {
@GetMapping("/v1/examination/onlineExamPage?pageSize=10&pageNum=1&flag=online&examinationName=") @GetMapping("/v1/examination/onlineExamPage?pageSize=10&pageNum=1&flag=online&examinationName=")
ResponseModel<PageInfo> getExamStatisticsList(); ResponseModel<PageInfo> getExamStatisticsList();
@RequestMapping(value = "/studyPlan/userId/list", method = RequestMethod.GET)
ResponseModel<List<String>> getUserIdList();
} }
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Getter
@AllArgsConstructor
public enum WaterResourceTypeEnum {
消火栓("hydrant", "消火栓"),
消防水鹤("crane", "消防水鹤"),
消防水池("pool", "消防水池"),
天然水源("natural", "天然水源"),
消防水箱("waterTank", "消防水箱"),
工业水池("industryPool", "工业水池");
private String code;
private String name;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public static List<Map<String, String>> getEnumList() {
return Arrays.stream(WaterResourceTypeEnum.values()).map(e -> {
Map<String, String> map = new HashMap<>();
map.put("code", e.getCode());
map.put("name", e.getName());
return map;
}).collect(Collectors.toList());
}
}
...@@ -13,4 +13,8 @@ public interface FireResourceSupervisionMapper extends BaseMapper<OrgUsr> { ...@@ -13,4 +13,8 @@ public interface FireResourceSupervisionMapper extends BaseMapper<OrgUsr> {
List<Map<String, Object>> selectPersonnelStats(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> selectPersonnelStats(@Param("bizOrgCode") String bizOrgCode);
Long selectTodayAttendance(@Param("bizOrgCode") String bizOrgCode); Long selectTodayAttendance(@Param("bizOrgCode") String bizOrgCode);
List<String> getZzPersonNum();
List<String> getYwPersonNum();
} }
...@@ -27,4 +27,30 @@ ...@@ -27,4 +27,30 @@
AND cs.org_code like concat(#{bizOrgCode}, '%') AND cs.org_code like concat(#{bizOrgCode}, '%')
</select> </select>
<select id="getZzPersonNum" resultType="Map">
SELECT
u.amos_org_id AS zzFireNum
FROM
cb_org_usr u
LEFT JOIN cb_dynamic_form_instance dfi ON dfi.instance_id = u.sequence_nbr
WHERE
u.is_delete = FALSE
AND u.amos_org_id IS NOT NULL
AND dfi.field_value = 1601
AND dfi.field_code = 'peopleType'
</select>
<select id="getYwPersonNum" resultType="Map">
SELECT
u.amos_org_id AS ywNum
FROM
cb_org_usr u
LEFT JOIN cb_dynamic_form_instance dfi ON dfi.instance_id = u.sequence_nbr
WHERE
u.is_delete = FALSE
AND u.amos_org_id IS NOT NULL
AND dfi.field_value = 1602
AND dfi.field_code = 'peopleType'
</select>
</mapper> </mapper>
...@@ -214,4 +214,26 @@ public class DCenterController extends AbstractBaseController { ...@@ -214,4 +214,26 @@ public class DCenterController extends AbstractBaseController {
return CommonResponseUtil.success(fireFightingSystemService.getFireWaterStatics(bizOrgCode)); return CommonResponseUtil.success(fireFightingSystemService.getFireWaterStatics(bizOrgCode));
} }
@GetMapping("/water/info")
@ApiOperation(value = "消防水源信息饼图统计")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getFireWaterInfo() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemService.getFireWaterInfo(bizOrgCode));
}
@GetMapping("/water/info/page")
@ApiOperation(value = "消防水源信息分页列表")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getWaterInfoPage(CommonPageable commonPageable) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
return CommonResponseUtil.success(fireFightingSystemService.getWaterInfoPage(page, bizOrgCode));
}
} }
...@@ -688,4 +688,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -688,4 +688,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map<String, Object> selectEquipmentSpecificStats(@Param("bizOrgCode") String bizOrgCode); Map<String, Object> selectEquipmentSpecificStats(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> selectCarStats(@Param("bizOrgCode") String bizOrgCode); Map<String, Object> selectCarStats(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getFireWaterInfo(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getWaterInfoPage(Page page, String bizOrgCode);
} }
...@@ -302,6 +302,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -302,6 +302,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<Map<String, Object>> getSystemRunningInfoList(); List<Map<String, Object>> getSystemRunningInfoList();
Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode); Page<FireFightingSystemDto> fireSysRunStatusPage(Page<Map<String, Object>> page, String bizOrgCode);
List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode(); List<OrgMenuDto> systemAndEquipmentTreeByBziOrgCode();
Map<String, Object> getSystemDetailByCode(String systemCode); Map<String, Object> getSystemDetailByCode(String systemCode);
...@@ -319,4 +320,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -319,4 +320,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getFireWaterStatics(String bizOrgCode); Map<String, Object> getFireWaterStatics(String bizOrgCode);
Map<String, Object> getFireWaterInfo(String bizOrgCode);
Page<Map<String, Object>> getWaterInfoPage(Page<Map<String, Object>> page, String bizOrgCode);
} }
...@@ -2472,4 +2472,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2472,4 +2472,14 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return map; return map;
} }
@Override
public Map<String, Object> getFireWaterInfo(String bizOrgCode) {
Map<String, Object> resultMap = fireFightingSystemMapper.getFireWaterInfo(bizOrgCode);
return resultMap;
}
@Override
public Page<Map<String, Object>> getWaterInfoPage(Page<Map<String, Object>> page, String bizOrgCode) {
return fireFightingSystemMapper.getWaterInfoPage(page, bizOrgCode);
}
} }
...@@ -211,7 +211,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -211,7 +211,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
return detail; return detail;
} }
ManufacturerInfo info = manufacturerInfoMapper.selectById(detail.getManufacturerId()); ManufacturerInfo info = manufacturerInfoMapper.selectById(detail.getManufacturerId());
detail.setManufacturerName(info.getName()); detail.setManufacturerName(ObjectUtils.isEmpty(info) ? "" : info.getName());
return Optional.ofNullable(detail).orElse(detail); return Optional.ofNullable(detail).orElse(detail);
} }
......
package com.yeejoin.amos.boot.module.jcs.biz.service.impl; package com.yeejoin.amos.boot.module.jcs.biz.service.impl;
import com.yeejoin.amos.boot.module.common.api.feign.AmosTrainingFeignClient;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.jcs.api.mapper.FireResourceSupervisionMapper; import com.yeejoin.amos.boot.module.jcs.api.mapper.FireResourceSupervisionMapper;
import com.yeejoin.amos.boot.module.jcs.api.service.IFireResourceSupervisionService; import com.yeejoin.amos.boot.module.jcs.api.service.IFireResourceSupervisionService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
...@@ -11,6 +15,7 @@ import java.util.HashMap; ...@@ -11,6 +15,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.stream.Collectors;
@Service @Service
public class FireResourceSupervisionServiceImpl implements IFireResourceSupervisionService { public class FireResourceSupervisionServiceImpl implements IFireResourceSupervisionService {
...@@ -18,6 +23,9 @@ public class FireResourceSupervisionServiceImpl implements IFireResourceSupervis ...@@ -18,6 +23,9 @@ public class FireResourceSupervisionServiceImpl implements IFireResourceSupervis
@Autowired @Autowired
private FireResourceSupervisionMapper fireResourceSupervisionMapper; private FireResourceSupervisionMapper fireResourceSupervisionMapper;
@Autowired
private AmosTrainingFeignClient examFeign;
/** /**
* 获取人员统计信息 * 获取人员统计信息
* *
...@@ -37,7 +45,6 @@ public class FireResourceSupervisionServiceImpl implements IFireResourceSupervis ...@@ -37,7 +45,6 @@ public class FireResourceSupervisionServiceImpl implements IFireResourceSupervis
long totalCount = Long.parseLong(map.get("totalCount").toString()); long totalCount = Long.parseLong(map.get("totalCount").toString());
long certifiedCount = Long.parseLong(map.get("certifiedCount").toString()); long certifiedCount = Long.parseLong(map.get("certifiedCount").toString());
Map<String, Number> stats = getStringNumberMap(certifiedCount, totalCount, attendanceCount);
String key; String key;
switch (peopleType.toString()) { switch (peopleType.toString()) {
...@@ -50,19 +57,43 @@ public class FireResourceSupervisionServiceImpl implements IFireResourceSupervis ...@@ -50,19 +57,43 @@ public class FireResourceSupervisionServiceImpl implements IFireResourceSupervis
default: default:
continue; continue;
} }
Map<String, Number> stats = getStringNumberMap(certifiedCount, totalCount, attendanceCount, key);
result.put(key, stats); result.put(key, stats);
} }
return result; return result;
} }
private Map<String, Number> getStringNumberMap(long certifiedCount, long totalCount, Long attendanceCount) { private Map<String, Number> getStringNumberMap(long certifiedCount, long totalCount, Long attendanceCount, String key) {
Map<String, Number> stats = new HashMap<>(); Map<String, Number> stats = new HashMap<>();
stats.put("totalCount", totalCount); stats.put("totalCount", totalCount);
stats.put("certifiedRate", calculateRate(certifiedCount, totalCount)); stats.put("certifiedRate", calculateRate(certifiedCount, totalCount));
stats.put("attendanceRate", calculateRate(attendanceCount, totalCount)); stats.put("attendanceRate", calculateRate(attendanceCount, totalCount));
stats.put("monthStudyRate", BigDecimal.ZERO); ResponseModel<List<String>> response = null;
try {
response = examFeign.getUserIdList();
} catch (Exception e) {
e.printStackTrace();
}
if (0 < response.getResult().size()) {
BigDecimal ratePercent;
if ("operationStats".equals(key)) {
List<String> ywNum = fireResourceSupervisionMapper.getYwPersonNum();
List<String> result = ywNum.stream().filter(response.getResult()::contains).collect(Collectors.toList());
BigDecimal total = new BigDecimal(String.valueOf(ywNum.size()));
BigDecimal zzExamCount = new BigDecimal(String.valueOf(result.size()));
ratePercent = zzExamCount.divide(total, 2, BigDecimal.ROUND_HALF_UP);
} else {
List<String> zzNum = fireResourceSupervisionMapper.getZzPersonNum();
List<String> result = zzNum.stream().filter(response.getResult()::contains).collect(Collectors.toList());
BigDecimal total = new BigDecimal(String.valueOf(zzNum.size()));
BigDecimal zzExamCount = new BigDecimal(String.valueOf(result.size()));
ratePercent = zzExamCount.divide(total, 2, BigDecimal.ROUND_HALF_UP);
}
stats.put("monthStudyRate", ratePercent);
} else {
stats.put("monthStudyRate", BigDecimal.ZERO);
}
return stats; return stats;
} }
......
...@@ -5960,4 +5960,108 @@ ...@@ -5960,4 +5960,108 @@
WHERE WHERE
wc.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%') wc.biz_org_code LIKE CONCAT(#{bizOrgCode}, '%')
</select> </select>
<select id="getFireWaterInfo" resultType="Map">
select
(select
count(sequence_nbr)
from
cb_water_resource
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS total,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
resource_type = 'hydrant'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS hydrant,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
resource_type = 'crane'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS crane,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
resource_type = 'pool'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS pool,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
resource_type = 'natural'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS `natural`,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
resource_type = 'waterTank'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS waterTank,
(select
count(sequence_nbr)
from
cb_water_resource
<where>
resource_type = 'industryPool'
<if test="bizOrgCode != null and bizOrgCode != ''">
AND biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
) AS industryPool
</select>
<select id="getWaterInfoPage" resultType="Map">
select
sequence_nbr AS id,
biz_org_name AS bizOrgName,
resource_type_name AS typeName,
name,
CASE
water_status
WHEN '0' THEN
'green'
WHEN '1' THEN
'yellow'
ELSE
'red'
END AS statusCode
from
cb_water_resource
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
</select>
</mapper> </mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment