Commit b9fe2a7c authored by KeYong's avatar KeYong

更新系统、水池接口

parent 999f2f1f
package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.utils.CommonPageable;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.mapper.CarMapper;
import com.yeejoin.equipmanage.service.ICarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -13,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
......@@ -35,16 +40,19 @@ public class CarStatisticController extends AbstractBaseController {
@Lazy
ICarService iCarService;
@Autowired
CarMapper carMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/used/info", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆用途统计信息", notes = "获取车辆用途统计信息")
@ApiOperation(httpMethod = "GET", value = "获取车辆归属权统计信息", notes = "获取车辆归属权统计信息")
public List<Map<String, Object>> getCarUsedInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarUsedInfo(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/type/info", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆用途统计信息", notes = "获取车辆用途统计信息")
@ApiOperation(httpMethod = "GET", value = "获取车辆装备类别统计信息", notes = "获取车辆装备类别统计信息")
public List<Map<String, Object>> getCarTypeInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarTypeInfo(bizOrgCode);
}
......@@ -55,4 +63,29 @@ public class CarStatisticController extends AbstractBaseController {
public List<Map<String, Object>> getCarInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarTypeStatistic(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆分页", notes = "获取车辆分页")
public ResponseModel getCarInfoPage(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String carNum) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> page1 = carMapper.getCarInfoPage(page, bizOrgCode, carNum);
return CommonResponseUtil.success(page1);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/station/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆分页", notes = "获取车辆分页")
public ResponseModel getStationCarInfoPage(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> page1 = carMapper.getStationCarInfoPage(page, bizOrgCode);
return CommonResponseUtil.success(page1);
}
}
......@@ -58,16 +58,16 @@ public class PoolStatisticController {
Map<String, List<Map<String, Object>>> pool = getPoolInfo(poolList);
poolMap.put("poolName", "消防水池");
poolMap.put("poolTotal", poolList.size());
poolMap.put("poolLow", pool.get("low"));
poolMap.put("poolHigh", pool.get("high"));
poolMap.put("poolNormal", pool.get("normal"));
poolMap.put("poolLow", pool.get("low").size());
poolMap.put("poolHigh", pool.get("high").size());
poolMap.put("poolNormal", pool.get("normal").size());
poolMap.put("poolAbs", new BigDecimal(pool.get("normal").size()).divide(new BigDecimal(poolList.size()),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
Map<String, List<Map<String, Object>>> industry = getPoolInfo(industryPoolList);
poolMap.put("industryName", "工业水池");
poolMap.put("industryTotal", industry.size());
poolMap.put("industryLow", pool.get("low"));
poolMap.put("industryHigh", pool.get("high"));
poolMap.put("industryNormal", pool.get("normal"));
poolMap.put("industryTotal", industryPoolList.size());
poolMap.put("industryLow", industry.get("low").size());
poolMap.put("industryHigh", industry.get("high").size());
poolMap.put("industryNormal", industry.get("normal").size());
poolMap.put("industryAbs", new BigDecimal(industry.get("normal").size()).divide(new BigDecimal(industryPoolList.size()),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
return CommonResponseUtil.success(poolMap);
}
......@@ -79,21 +79,20 @@ public class PoolStatisticController {
List<Map<String, Object>> normalList = new ArrayList<>();
if (!CollectionUtils.isEmpty(infoList)) {
for (Map<String, Object> m : infoList) {
Map<String, Object> map = new HashMap<>();
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
if (IndexStatusEnum.LOW.getKey().equals(String.valueOf(transResult.get("status")))) {
lowList.add(map);
lowList.add(m);
} else if (IndexStatusEnum.HIGH.getKey().equals(String.valueOf(transResult.get("status")))) {
highList.add(map);
highList.add(m);
} else {
normalList.add(map);
normalList.add(m);
}
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
normalList.add(map);
normalList.add(m);
}
}
}
......@@ -126,11 +125,11 @@ public class PoolStatisticController {
BigDecimal divide = new BigDecimal(100);
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume"))).multiply(new BigDecimal(String.valueOf(transResult.get("abs")))).divide(divide, 0, RoundingMode.HALF_UP);
m.put("volume", bigDecimal + "m³");
m.put("levelAbs", transResult.get("abs") + "%)");
m.put("levelAbs", transResult.get("abs") + "%");
} else if (String.valueOf(transResult.get("abs")).equals("100") && String.valueOf(transResult.get("status")).equals("1")) {
BigDecimal bigDecimal = new BigDecimal(String.valueOf(m.get("volume")));
m.put("volume", bigDecimal + "m³");
m.put("levelAbs", transResult.get("abs") + "%)");
m.put("levelAbs", transResult.get("abs") + "%");
} else {
m.put("levelAbs", transResult.get("abs"));
}
......@@ -154,15 +153,15 @@ public class PoolStatisticController {
m.put("nowLevel", transResult.get("nowValue"));
if (StringUtil.isNotEmpty(IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))))) {
if (IndexStatusEnum.LOW.getKey().equals(String.valueOf(transResult.get("status")))) {
abNormalList.add(map);
abNormalList.add(m);
} else if (IndexStatusEnum.HIGH.getKey().equals(String.valueOf(transResult.get("status")))) {
abNormalList.add(map);
abNormalList.add(m);
} else {
normalList.add(map);
normalList.add(m);
}
m.put("levelStatus", IndexStatusEnum.getEnumByKey(String.valueOf(transResult.get("status"))).getDescribe1());
} else {
normalList.add(map);
normalList.add(m);
}
}
}
......
package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.utils.CommonPageable;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.ResponseUtils;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
......@@ -27,12 +19,8 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import static org.typroject.tyboot.core.foundation.context.RequestContext.*;
/**
* @author keyong
......@@ -66,7 +54,7 @@ public class SystemStatisticController extends AbstractBaseController {
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/alarm/statistic", method = RequestMethod.GET)
@RequestMapping(value = "/alarm/panel", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取系统告警统计信息", notes = "获取系统告警统计信息")
public ResponseModel getAbnormalSystemInfo(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> list = fireFightingSystemMapper.getAbnormalSystemInfo(bizOrgCode);
......@@ -76,7 +64,7 @@ public class SystemStatisticController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/page", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取水池信息", notes = "获取水池信息")
public ResponseModel getWaterInfo(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode,
public ResponseModel getSystemPage(CommonPageable commonPageable, @RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String systemType, @RequestParam(required = false) String systemState,
@RequestParam(required = false) String stateOrder, @RequestParam(required = false) String alarmEquips) {
if (commonPageable.getPageNumber() == 0) {
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.equipmanage.common.datasync.entity.FireVehicle;
import com.yeejoin.equipmanage.common.dto.CarFusionDto;
import com.yeejoin.equipmanage.common.entity.Car;
......@@ -92,4 +93,8 @@ public interface CarMapper extends BaseMapper<Car> {
void updateStatusByIds(List<String> carIds, String status);
@Update("update wl_car set latitude = #{latitude} , longitude = #{longitude} where iot_code = #{iotCode}")
void updateCarLocationByIotCode(String iotCode,Double latitude,Double longitude);
Page<Map<String, Object>> getCarInfoPage(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("carNum") String carNum);
Page<Map<String, Object>> getStationCarInfoPage(Page page, @Param("bizOrgCode") String bizOrgCode);
}
......@@ -725,4 +725,53 @@
#{carId}
</foreach>
</update>
<select id="getCarInfoPage" resultType="Map">
SELECT
d.*,
ABS(d.fireCar - d.jgxfc) AS fjgxfc
FROM (
SELECT
wc.`biz_org_name`,
count(1) AS fireCar,
SUM(IF(wc.use_type='自购', 1, 0)) AS zgCar,
SUM(IF(wc.use_type='租赁', 1, 0)) AS zlCar,
IFNULL( SUM(IF(we.code LIKE CONCAT( '210102', '%' ), 1, 0 ) ), 0 ) AS jgxfc,
IFNULL( SUM(IF(we.code LIKE CONCAT( '2103', '%' ), 1, 0 ) ), 0 ) AS jgjqr
FROM `wl_car` wc
LEFT JOIN wl_equipment we ON we.id = wc.equipment_id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wc.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
</where>
GROUP BY wc.biz_org_code
) d
<if test="carNum!=null and carNum !='' and carNum=1">
ORDER BY d.fireCar DESC
</if>
<if test="carNum!=null and carNum !='' and carNum=0">
ORDER BY d.fireCar ASC
</if>
</select>
<select id="getStationCarInfoPage" resultType="Map">
SELECT
d.*
FROM (
SELECT
wc.id AS id,
wc.`biz_org_name` AS station,
we.`name` AS type,
wc.`name` AS `name`,
wc.use_type AS propertyType
FROM `wl_car` wc
LEFT JOIN wl_equipment we ON we.id = wc.equipment_id
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
wc.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
</where>
) d
</select>
</mapper>
......@@ -5150,7 +5150,7 @@
<if test="stationOrder!=null and stationOrder!=''">
ORDER BY CONVERT(bizOrgName USING gbk) ASC
</if>
<if test="stationOrder = null OR stationOrder =''">
<if test="stationOrder = null or stationOrder =''">
ORDER BY CONVERT(bizOrgName USING gbk) DESC
</if>
</select>
......@@ -6961,23 +6961,23 @@
</if>
) d
<where>
<if test="systemState!=null and systemState!='' and systemState ='1'">
<if test="systemState!=null and systemState!='' and systemState =='1'">
d.value <![CDATA[>]]> 0
</if>
<if test="systemState!=null and systemState!='' and systemState ='1'">
<if test="systemState!=null and systemState!='' and systemState =='0'">
d.value <![CDATA[<]]> 0
</if>
</where>
<if test="stateOrder!=null and stateOrder!='' and stateOrder=1">
<if test="stateOrder!=null and stateOrder!='' and stateOrder==1">
ORDER BY d.value DESC,
</if>
<if test="stateOrder!=null and stateOrder!='' and stateOrder=0">
<if test="stateOrder!=null and stateOrder!='' and stateOrder==0">
ORDER BY d.value ASC,
</if>
<if test="alarmEquips!=null and alarmEquips!='' and alarmEquips=1">
<if test="alarmEquips!=null and alarmEquips!='' and alarmEquips==1">
d.equips DESC
</if>
<if test="alarmEquips!=null and alarmEquips!='' and alarmEquips=0">
<if test="alarmEquips!=null and alarmEquips!='' and alarmEquips==0">
d.equips ASC
</if>
</select>
......@@ -6987,8 +6987,8 @@
*
FROM
(
(SELECT count( DISTINCT wei.name_key ) FROM wl_equipment_index wei WHERE wei.is_iot = 1) AS indexNum,
(SELECT count( 1 ) FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1
(SELECT count( DISTINCT wei.name_key ) AS indexNum FROM wl_equipment_index wei WHERE wei.is_iot = 1) AS indexNum,
(SELECT count( 1 ) AS equipNum FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND es.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
......
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