Commit 0da3d898 authored by KeYong's avatar KeYong

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

parents bc23b698 fc38528c
......@@ -147,4 +147,5 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> companyUserTreeByUserAndType(Map<String, Object> param);
List<OrgUsr> companyUserTreeByUserAndTypeALL(@Param("bizorgcode") String bizorgcode);
List<Map<String, Object>> getFireProtectionAndMaintenance();
}
......@@ -51,4 +51,6 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> {
Page<WaterResourceDto> pageByDefect(Page<WaterResourceDto> page, @Param("nameOrCode") String nameOrCode, @Param("bizOrgCode") String bizOrgCode, @Param("systemName") String systemName);
Map<String, Object> getWaterResourceInfoList(@Param("map") Map<String, Object> map);
Map<String, Object> getResourcesCount();
}
......@@ -7,6 +7,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
import java.util.List;
import java.util.Map;
/**
* 接口类
......@@ -36,4 +37,5 @@ public interface IWaterResourceService {
* */
WaterResourceDto selectBySequenceNbr(Long id);
Map<String, Object> getResourcesCount();
}
......@@ -233,4 +233,49 @@
</if>
) AS fireWaterTank
</select>
<select id="getResourcesCount" resultType="java.util.Map">
SELECT
( SELECT COUNT( DISTINCT cwr.sequence_nbr ) FROM cb_water_resource cwr WHERE cwr.is_delete = 1 AND cwr.resource_type = 'hydrant' ) AS hydrant,
( SELECT COUNT( DISTINCT cwr.sequence_nbr ) FROM cb_water_resource cwr WHERE cwr.is_delete = 1 AND cwr.resource_type = 'pool' ) AS pool,
( SELECT COUNT( DISTINCT cwr.sequence_nbr ) FROM cb_water_resource cwr WHERE cwr.is_delete = 1 AND cwr.resource_type = 'waterTank' ) AS waterTank,
(
SELECT
count( * ) AS total
FROM
(
SELECT
ou.biz_org_name,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
cb_org_usr ou
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.is_delete = '0'
GROUP BY
ou.sequence_nbr
) a
WHERE
a.peopleType = '1601'
) fire,
(
SELECT
count( * ) AS total
FROM
(
SELECT
ou.biz_org_name,
IFNULL( MAX( CASE WHEN cfi.field_code = 'peopleType' THEN field_value END ), '' ) AS peopleType
FROM
cb_org_usr ou
LEFT JOIN cb_dynamic_form_instance cfi ON ou.sequence_nbr = cfi.instance_id
WHERE
ou.is_delete = '0'
GROUP BY
ou.sequence_nbr
) a
WHERE
a.peopleType = '1602'
) run
</select>
</mapper>
......@@ -836,6 +836,69 @@ public class DateUtils {
return dates;
}
public static List<Map<String, String>> getWeeksMapInterval(String date){
List<Map<String, String>> dates = new ArrayList<>();
String year = date.substring(0,4);
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM");
Date date1 = null;
try {
date1 = dateFormat.parse(date);
} catch (ParseException e) {
System.out.println("获取当前月自然周,日期格式转换错误!11");
e.printStackTrace();
}
Calendar calendar = new GregorianCalendar();
calendar.setTime(date1);
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
int count = 0;
for (int i = 1; i <= days; i++) {
DateFormat dateFormat1 = new SimpleDateFormat("yyyy-MM-dd");
Date date2 = null;
try {
date2 = dateFormat1.parse(date + "-" + i);
} catch (ParseException e) {
System.out.println("获取当前月自然周,日期格式转换错误!22");
e.printStackTrace();
}
calendar.clear();
calendar.setTime(date2);
int k = new Integer(calendar.get(Calendar.DAY_OF_WEEK));
int startDay = 0;
int endDay = 0;
// 若当天是周日
if (k == 1) {
count++;
if (i - 6 <= 1) {
startDay = 1;
} else {
startDay = i - 6;
}
endDay = i;
}
// 若是本月最好一天,且不是周日
if (k != 1 && i == days) {
count++;
startDay = i - k + 2;
endDay = i;
}
if(startDay != 0 && endDay != 0){
String s = year + "第" + getWeekOfYear(date2) + "周" + "(" + date.substring(5) + "月" + startDay +
"日至" + date.substring(5) + "月" + endDay + "日" +")";
String weekStart = year + "-"+ date.substring(5) +"-" +startDay +" 00:00:00";
String weekEnd = year + "-"+ date.substring(5) +"-" +endDay +" 23:59:59";
HashMap<String, String> map = new HashMap<>();
map.put("name",s);
map.put("weekStart",weekStart);
map.put("weekEnd",weekEnd);
dates.add(map);
}
}
return dates;
}
/**
* 获取一年的第几周
*
......
......@@ -317,6 +317,11 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
return waterResourceDto;
}
@Override
public Map<String, Object> getResourcesCount() {
return waterResourceMapper.getResourcesCount();
}
public List<WaterResourceTypeDto> getWaterResourceTypeList(Boolean isDelete) {
return waterResourceMapper.getWaterResourceTypeList(isDelete);
}
......@@ -541,4 +546,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
});
return list;
}
}
......@@ -18,7 +18,7 @@ public interface EmergencyMapper extends BaseMapper{
* @param bizOrgCode
* @return
*/
Map<String, Object> selectEmergencyMaterials(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> selectEmergencyMaterials();
/**
* 应急物资详情
......@@ -65,4 +65,19 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> selectAlarmAnalysisCount(@Param("bizOrgCode") String bizOrgCode, @Param("startDate")String startDate, @Param("endDate")String endDate);
Map<String, Object> getSystemAndCarCount();
List<String> selectSystemCodes(@Param("systemType") String systemType);
List<Map<String, Object>> selectFireCannonAlarmAnalysisPie(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("list") List<String> codes);
List<Map<String, Object>> waterSystemAlarmAnalysisPie(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("list") List<String> codes);
List<Map<String, Object>> waterSystemAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
List<Map<String, Object>> fireCannonSystemAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
}
......@@ -22,7 +22,7 @@ public interface IEmergencyService {
*/
List<Map<String, Object>> getCAFSWaterTankInfo(String bizOrgCode);
Map<String, Object> emergencyMaterials(String bizOrgCode);
Map<String, Object> emergencyMaterials();
Page<Map<String, Object>> emergencyMaterialsDetails(Page<Map<String, Object>> page, String bizOrgCode);
......@@ -37,4 +37,16 @@ public interface IEmergencyService {
List<Map<String, Object>> selectAlarmAnalysis(String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate);
Map<String, Object> systemAndCar();
List<Map<String, Object>> selectFireCannonAlarmAnalysisPie(String startDate, String endDate, String systemType);
List<Map<String, Object>> waterSystemAlarmAnalysisPie(String startDate, String endDate, String systemType);
List<Map<String, Object>> waterSystemAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType);
List<Map<String, Object>> fireCannonSystemAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType);
}
......@@ -6,6 +6,7 @@ import com.yeejoin.equipmanage.service.IEmergencyService;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
......@@ -59,8 +60,8 @@ public class EmergencyServiceImpl implements IEmergencyService {
}
@Override
public Map<String, Object> emergencyMaterials(String bizOrgCode) {
return emergencyMapper.selectEmergencyMaterials(bizOrgCode);
public Map<String, Object> emergencyMaterials() {
return emergencyMapper.selectEmergencyMaterials();
}
@Override
......@@ -97,4 +98,48 @@ public class EmergencyServiceImpl implements IEmergencyService {
public List<Map<String, Object>> selectAlarmAnalysisCount(String bizOrgCode, String startDate, String endDate) {
return emergencyMapper.selectAlarmAnalysisCount(bizOrgCode, startDate, endDate);
}
@Override
public Map<String, Object> systemAndCar() {
return emergencyMapper.getSystemAndCarCount();
}
@Override
public List<Map<String, Object>> selectFireCannonAlarmAnalysisPie(String startDate, String endDate, String systemType) {
List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.selectFireCannonAlarmAnalysisPie(startDate, endDate, strings);
}
return null;
}
@Override
public List<Map<String, Object>> waterSystemAlarmAnalysisPie(String startDate, String endDate, String systemType) {
List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.waterSystemAlarmAnalysisPie(startDate, endDate, strings);
}
return null;
}
@Override
public List<Map<String, Object>> waterSystemAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType) {
List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.waterSystemAlarmAnalysis(startDate, endDate, dataType, date, strings);
}
return null;
}
@Override
public List<Map<String, Object>> fireCannonSystemAlarmAnalysis(String startDate, String endDate, String dataType, String date, String systemType) {
List<String> strings = emergencyMapper.selectSystemCodes(systemType);
if (!CollectionUtils.isEmpty(strings)) {
return emergencyMapper.fireCannonSystemAlarmAnalysis(startDate, endDate, dataType, date, strings);
}
return null;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -68,4 +67,18 @@ public class EquipmentController extends BaseController {
public ResponseModel getWaterResourceList(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode) {
return ResponseHelper.buildResponse(equipmentService.getWaterResourceInfoList(bizOrgCode));
}
/**
* 获取驻站消防员和运维人员数量
* @param
* @returnP
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/resources/count", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "消防资源部分数据-四横八纵", notes = "消防资源部分数据-四横八纵")
public ResponseModel<Map<String, Object>> getResourcesCount() {
Map<String, Object> map = equipmentService.getResourcesCount();
return ResponseHelper.buildResponse(map);
}
}
......@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceTypeDto;
import com.yeejoin.amos.boot.module.common.api.entity.MaintenanceCompany;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.MaintenanceCompanyMapper;
import com.yeejoin.amos.boot.module.common.biz.service.impl.OrgUsrServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceServiceImpl;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -145,4 +146,8 @@ public class EquipmentServiceImpl {
public List<Map<String, Object>> getWaterResourceInfoList(String bizOrgCode){
return waterResourceServiceImpl.getWaterResourceInfoList(bizOrgCode);
}
public Map<String, Object> getResourcesCount() {
return waterResourceServiceImpl.getResourcesCount();
}
}
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