Commit df91cddd authored by KeYong's avatar KeYong

提交设备管理后台

parent 490a13b7
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.service.ICarService;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
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 java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: CarStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/26 15:17
*/
@RestController
@Api(tags = "消防车统计Api")
@RequestMapping(value = "/center/car", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Slf4j
public class CarStatisticController extends AbstractBaseController {
@Autowired
@Lazy
ICarService iCarService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/used/info", method = RequestMethod.GET)
@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 = "获取车辆用途统计信息")
public List<Map<String, Object>> getCarTypeInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarTypeInfo(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取车辆分类统计信息", notes = "获取车辆分类统计信息")
public List<Map<String, Object>> getCarInfo(@RequestParam(required = false) String bizOrgCode) {
return iCarService.getCarTypeStatistic(bizOrgCode);
}
}
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;
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.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
* @title: CarStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/26 15:17
*/
@RestController
@Api(tags = "消防系统统计Api")
@RequestMapping(value = "/center/system", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Slf4j
public class SystemStatisticController extends AbstractBaseController {
@Autowired
FireFightingSystemMapper fireFightingSystemMapper;
@Autowired
IotFeign iotFeign;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/status", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取系统状态统计信息", notes = "获取系统状态统计信息")
public ResponseModel getSystemInfo(@RequestParam(required = false) String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.getCenterEquipState(bizOrgCode);
BigDecimal normal = new BigDecimal(String.valueOf(map.get("normalNum")));
BigDecimal total = new BigDecimal(String.valueOf(map.get("total")));
map.put("abs", normal.divide(total,2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
return CommonResponseUtil.success(map);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/alarm/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取系统告警统计信息", notes = "获取系统告警统计信息")
public ResponseModel getAbnormalSystemInfo(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> list = fireFightingSystemMapper.getAbnormalSystemInfo(bizOrgCode);
return CommonResponseUtil.success(list);
}
@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,
@RequestParam(required = false) String systemType, @RequestParam(required = false) String systemState,
@RequestParam(required = false) String stateOrder, @RequestParam(required = false) String alarmEquips) {
if (commonPageable.getPageNumber() == 0) {
commonPageable.setPageNumber(1);
}
Page page = new Page<>(commonPageable.getPageNumber(), commonPageable.getPageSize());
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getSystemInfoPage(page, bizOrgCode, systemType, systemState, stateOrder, alarmEquips);
return CommonResponseUtil.success(page1);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@RequestMapping(value = "/iot/statistic", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取物联信息", notes = "获取物联信息")
public ResponseModel getIotInfo(@RequestParam(required = false) String bizOrgCode) {
Map<String, Object> map = fireFightingSystemMapper.getIotInfo(bizOrgCode);
return CommonResponseUtil.success(map);
}
}
......@@ -44,4 +44,10 @@ public interface CarPropertyMapper extends BaseMapper<CarProperty> {
List<Map<String, String>> getTankAndFireCarNum(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, String>> carListByPage(@Param("page")Page<Car> page, @Param("dto") Car car);
Map<String, Object> getCarUsedInfo(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getCarTypeInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getCarTypeStatistic(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -351,6 +351,24 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getWaterInfoBySuper(Page page, @Param("bizOrgCode") String bizOrgCode);
/**
* 获取水源信息
*
* @param bizOrgCode
* @return
*/
Page<Map<String, Object>> getWaterInfoList(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("stationOrder") String stationOrder, @Param("stateOrder") String stateOrder);
/**
* 水源信息统计
*
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> getWaterInfoBySuper(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getWaterInfoByBizOrgName(@Param("bizOrgCode") String bizOrgCode);
/**
* CAFS水箱和CAFS泡沫罐信息
* @param page
* @param bizOrgCode
......@@ -733,4 +751,17 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("equipmentCode") String equipmentCode);
Map<String, Object> getEquipStats(@Param("bizOrgCode") String bizOrgCode, @Param("list") List<String> list);
Map<String, Object> getCenterEquipState(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getAbnormalSystemInfo(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> getSystemInfoPage(Page page, @Param("bizOrgCode") String bizOrgCode,
@Param("systemType") String systemType,
@Param("systemState") String systemState,
@Param("stateOrder") String stateOrder,
@Param("alarmEquips") String alarmEquips);
Map<String, Object> getIotInfo(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -217,4 +217,10 @@ public interface ICarService extends IService<Car> {
List<Map<String, String>> getTankAndFireCarNum(String bizOrgCode);
Page<Map<String, String>> carListByPage(Car car, Page<Car> objectPage);
List<Map<String, Object>> getCarUsedInfo(String bizOrgCode);
List<Map<String, Object>> getCarTypeInfo(String bizOrgCode);
List<Map<String, Object>> getCarTypeStatistic(String bizOrgCode);
}
......@@ -1850,6 +1850,46 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
return carPropertyMapper.carListByPage(page, car);
}
@Override
public List<Map<String, Object>> getCarUsedInfo(String bizOrgCode) {
Map<String, Object> map = carPropertyMapper.getCarUsedInfo(bizOrgCode);
List<Map<String, Object>> res = new ArrayList<>();
Map<String, Object> m1 = new HashMap();
m1.put("name", "自购");
m1.put("value", map.get("zg"));
m1.put("key", "zg");
res.add(m1);
Map<String, Object> m2 = new HashMap();
m2.put("name", "租赁");
m2.put("value", map.get("zl"));
m2.put("key", "zl");
res.add(m2);
return res;
}
@Override
public List<Map<String, Object>> getCarTypeInfo(String bizOrgCode) {
Map<String, Object> map = carPropertyMapper.getCarTypeInfo(bizOrgCode);
List<Map<String, Object>> resList = new ArrayList<>();
Map<String, Object> m1 = new HashMap();
m1.put("name", "举高");
m1.put("value", map.get("jg"));
m1.put("key", "jg");
resList.add(m1);
Map<String, Object> m2 = new HashMap();
m2.put("name", "非举高");
m2.put("value", map.get("fjg"));
m2.put("key", "fjg");
resList.add(m2);
return resList;
}
@Override
public List<Map<String, Object>> getCarTypeStatistic(String bizOrgCode) {
List<Map<String, Object>> list = carPropertyMapper.getCarTypeStatistic(bizOrgCode);
return list;
}
class LossParams {
private Long carId;
......
package com.yeejoin;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.equipmanage.listener.CarIotListener;
import com.yeejoin.equipmanage.listener.CarIotNewListener;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -15,22 +14,18 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.core.env.Environment;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.StandardEnvironment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.SecureRandom;
import java.util.Collections;
......
......@@ -174,4 +174,41 @@
ORDER BY wc.equip_status DESC
</where>
</select>
<select id="getCarUsedInfo" resultType="Map">
SELECT
( SELECT COUNT( 1 ) FROM wl_car WHERE use_type = '自购' ) AS zg,
( SELECT COUNT( 1 ) FROM wl_car WHERE use_type = '租赁' ) AS zl
</select>
<select id="getCarTypeInfo" resultType="Map">
SELECT
d.jg AS jg,
ABS(d.total - d.jg) AS fjg
FROM
(
SELECT
IFNULL( SUM( IF ( we.code LIKE CONCAT( '210102', '%' ), 1, 0 ) ), 0 ) AS jg,
count( 1 ) AS total
FROM
wl_car c
LEFT JOIN wl_equipment we ON we.id = c.equipment_id
) d
</select>
<select id="getCarTypeStatistic" resultType="Map">
SELECT
we.code AS `key`,
we.name AS `name`,
IF(COUNT(1) = 0, NULL, COUNT(1)) AS total
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 we.code
</select>
</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