Commit 53a10a5f authored by kongfm's avatar kongfm

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

parents 6182e195 cc72759d
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author fengwang
* @date 2021-11-01.
*/
@Data
@ApiModel(value = "性能指标详情返回vo实体", description = "性能指标详情返回vo实体")
public class EquipmentIndexDto {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "值")
private String value;
@ApiModelProperty(value = "equipment_id")
private String equipmentId;
@ApiModelProperty(value = "性能指标名称")
private String perfQuotaName;
@ApiModelProperty(value = "性能指标id")
private String perfQuotaDefinitionId;
@ApiModelProperty(value = "数量单位名称")
private String unitName;
@ApiModelProperty(value = "否物联指标")
private Integer isIot;
@ApiModelProperty(value = "物联指标")
private String typeName;
@ApiModelProperty(value = "物联指标ID")
private String typeCode;
@ApiModelProperty(value = "分类名称")
private String groupName;
@ApiModelProperty(value = "指标原始id,从iot平台接口获取")
private String indexId;
@ApiModelProperty(value = "性能指标")
private String perfQuotaStr;
@ApiModelProperty(value = "是否是核心参数")
private Boolean isImportentParameter;
@ApiModelProperty(value = "排序")
private Integer sortNum;
@ApiModelProperty(value = "類型")
private Integer type;
@ApiModelProperty(value = "物联nameKey")
private String nameKey;
@ApiModelProperty(value = "创建日期")
private Date createDate;
@ApiModelProperty(value = "更新日期")
private Date updateDate;
}
package com.yeejoin.amos.boot.module.common.api.dto;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
/**
* @author litw
* @date 2021-11-02.
*/
@Data
public class PerfQuotaIotDTO {
@ApiModelProperty(value = "分页 ")
Page<EquipmentIndexDto> page;
/**
* 分组id
*/
private String groupName;
/**
* 装备id
*/
private Long equipmentId;
}
...@@ -105,11 +105,11 @@ public class WaterResourceDto extends BaseDto { ...@@ -105,11 +105,11 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "实景图") @ApiModelProperty(value = "实景图")
private String realityImg; private String realityImg;
@ExcelProperty(value = "联系人姓名", index = 41) @ExcelProperty(value = "联系人姓名", index = 38)
@ApiModelProperty(value = "联系人姓名") @ApiModelProperty(value = "联系人姓名")
private String contactUser; private String contactUser;
@ExcelProperty(value = "联系人电话", index = 42) @ExcelProperty(value = "联系人电话", index =39)
@ApiModelProperty(value = "联系人电话") @ApiModelProperty(value = "联系人电话")
private String contactPhone; private String contactPhone;
...@@ -289,15 +289,16 @@ public class WaterResourceDto extends BaseDto { ...@@ -289,15 +289,16 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "停车数量(个)") @ApiModelProperty(value = "停车数量(个)")
private Integer parkingNum; private Integer parkingNum;
@ExcelProperty(value = "储水量容积", index = 38) // 物联参数改为动态加载,原先字段作废,字段做隐藏
@ExcelIgnore
@ApiModelProperty(value = "储水量容积物联编码") @ApiModelProperty(value = "储水量容积物联编码")
private String iotWaterStorage; private String iotWaterStorage;
@ExcelProperty(value = "流量", index = 39) @ExcelIgnore
@ApiModelProperty(value = "流量物联编码") @ApiModelProperty(value = "流量物联编码")
private String iotFlowRate; private String iotFlowRate;
@ExcelProperty(value = "状态", index = 40) @ExcelIgnore
@ApiModelProperty(value = "状态物联编码") @ApiModelProperty(value = "状态物联编码")
private String iotStatus; private String iotStatus;
...@@ -308,7 +309,7 @@ public class WaterResourceDto extends BaseDto { ...@@ -308,7 +309,7 @@ public class WaterResourceDto extends BaseDto {
@ExcelIgnore @ExcelIgnore
@ApiModelProperty(value = "物联参数") @ApiModelProperty(value = "物联参数")
private WaterResourceIotDto waterResourceIotDto; private Map<String,Object> waterResourceIotDto;
@ExcelIgnore @ExcelIgnore
@ApiModelProperty("设施定义id") @ApiModelProperty("设施定义id")
...@@ -339,13 +340,14 @@ public class WaterResourceDto extends BaseDto { ...@@ -339,13 +340,14 @@ public class WaterResourceDto extends BaseDto {
@ApiModelProperty(value = "经度") @ApiModelProperty(value = "经度")
@ExcelProperty(value = "经度", index = 43) @ExcelProperty(value = "经度", index = 40)
private Double longitude; private Double longitude;
@ApiModelProperty(value = "纬度") @ApiModelProperty(value = "纬度")
@ExcelProperty(value = "纬度", index = 44) @ExcelProperty(value = "纬度", index = 41)
private Double latitude; private Double latitude;
@ExcelIgnore
@ApiModelProperty(value = "附件") @ApiModelProperty(value = "附件")
@TableField(exist = false) @TableField(exist = false)
private Map<String, List<AttachmentDto>> attachments; private Map<String, List<AttachmentDto>> attachments;
......
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author ltw
* @date 2021-11-02.
*/
@Data
public class WaterResourceDyDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "表单key")
private String key;
@ApiModelProperty(value = "表单名称")
private String label;
@ApiModelProperty(value = "表单类型")
private String type;
@ApiModelProperty(value = "是否一行显示")
private Boolean block;
@ApiModelProperty(value = "是否隱藏")
private Boolean hide;
@ApiModelProperty(value = "表单值")
private String data;
public WaterResourceDyDto() {
}
}
package com.yeejoin.amos.boot.module.common.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 消防水源物联参数
*
* @author litw
* @date 2021-11-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="WaterResourceIndexDto", description="消防水源物联参数")
public class WaterResourceIndexDto extends BaseDto {
private static final long serialVersionUID = 1L;
private Long id;
@ApiModelProperty(value = "指标拥有者ID:关联装备定义ID")
private Long equipmentId;
@ApiModelProperty(value = "消防水源id")
private Long waterId;
@ApiModelProperty(value = "名称")
private String name;
private String nameKey;
@ApiModelProperty(value = "指标值")
private String perfValue;
}
package com.yeejoin.amos.boot.module.common.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 消防水源物联参数
*
* @author litw
* @date 2021-11-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("cb_water_resource_index")
public class WaterResourceIndex extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 指标拥有者ID:关联装备定义ID
*/
@TableField("equipment_id")
private Long equipmentId;
/**
* 消防水源id
*/
@TableField("water_id")
private Long waterId;
/**
* 名称
*/
@TableField("name")
private String name;
/**
*
*/
@TableField("name_key")
private String nameKey;
/**
* 指标值
*/
@TableField("perf_value")
private String perfValue;
}
package com.yeejoin.amos.boot.module.common.api.feign; package com.yeejoin.amos.boot.module.common.api.feign;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.EquipmentIndexDto;
import com.yeejoin.amos.boot.module.common.api.dto.PerfQuotaIotDTO;
import com.yeejoin.amos.boot.module.common.api.dto.VideoDto; import com.yeejoin.amos.boot.module.common.api.dto.VideoDto;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -304,4 +307,12 @@ public interface EquipFeignClient { ...@@ -304,4 +307,12 @@ public interface EquipFeignClient {
*/ */
@RequestMapping(value = "/confirmAlarm/getMonitorEvent", method = RequestMethod.GET) @RequestMapping(value = "/confirmAlarm/getMonitorEvent", method = RequestMethod.GET)
ResponseModel<Map<String, Object>> getMonitorEvent(); ResponseModel<Map<String, Object>> getMonitorEvent();
/**
* 装备定义性能参数列表分页查询
*
* @return
*/
@RequestMapping(value = "/perf-quota/listAll", method = RequestMethod.POST)
ResponseModel<List<EquipmentIndexDto>> getEquipmentIndexDto(@RequestBody PerfQuotaIotDTO perfQuotaIotDTO);
} }
package com.yeejoin.amos.boot.module.common.api.mapper;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 消防水源物联参数 Mapper 接口
*
* @author litw
* @date 2021-11-02
*/
public interface WaterResourceIndexMapper extends BaseMapper<WaterResourceIndex> {
}
package com.yeejoin.amos.boot.module.common.api.service;
/**
* 消防水源物联参数接口类
*
* @author litw
* @date 2021-11-02
*/
public interface IWaterResourceIndexService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceIndexMapper">
</mapper>
package com.yeejoin.amos.boot.module.jcs.api.service;
/**
* 消防水源物联参数接口类
*
* @author litw
* @date 2021-11-02
*/
public interface IWaterResourceIndexService {
}
...@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.common.biz.controller; ...@@ -3,7 +3,9 @@ package com.yeejoin.amos.boot.module.common.biz.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mysql.cj.x.protobuf.MysqlxDatatypes; import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant; import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
...@@ -20,6 +22,9 @@ import io.swagger.annotations.ApiOperation; ...@@ -20,6 +22,9 @@ import io.swagger.annotations.ApiOperation;
import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanMap;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.checkerframework.checker.units.qual.K;
import org.openxmlformats.schemas.drawingml.x2006.chart.STRadarStyle;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -65,6 +70,10 @@ public class WaterResourceController extends BaseController { ...@@ -65,6 +70,10 @@ public class WaterResourceController extends BaseController {
WaterResourceIotServiceImpl waterResourceIotService; WaterResourceIotServiceImpl waterResourceIotService;
@Autowired @Autowired
SourceFileServiceImpl sourceFileService; SourceFileServiceImpl sourceFileService;
@Autowired
EquipFeignClient equipFeignClient;
@Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
/** /**
* 新增 * 新增
...@@ -146,11 +155,17 @@ public class WaterResourceController extends BaseController { ...@@ -146,11 +155,17 @@ public class WaterResourceController extends BaseController {
break; break;
} }
// 新增物联信息 // 新增物联信息
if (model.getIsIot()) { if (null != model.getWaterResourceIotDto() && model.getWaterResourceIotDto().size()>0) {
WaterResourceIotDto waterResourceIotDto = model.getWaterResourceIotDto(); Map<String,Object> map = model.getWaterResourceIotDto();
waterResourceIotDto.setResourceType(model.getResourceType()); List<WaterResourceIndex> list = new ArrayList<>();
waterResourceIotDto.setResourceId(model.getSequenceNbr()); for (Map.Entry<String, Object> entry : map.entrySet()) {
waterResourceIotService.createWithModel(waterResourceIotDto); WaterResourceIndex waterResourceIndex1 = new WaterResourceIndex();
waterResourceIndex1.setNameKey(entry.getKey());
waterResourceIndex1.setWaterId(model.getSequenceNbr());
waterResourceIndex1.setPerfValue(entry.getValue().toString());
list.add(waterResourceIndex1);
}
waterResourceIndexServiceImpl.saveBatch(list);
} }
} else { } else {
waterResourceServiceImpl.createWithModel(model); waterResourceServiceImpl.createWithModel(model);
...@@ -161,6 +176,47 @@ public class WaterResourceController extends BaseController { ...@@ -161,6 +176,47 @@ public class WaterResourceController extends BaseController {
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/**
* 获取关联装备定义物联参数字段
*
* @param equipmentId 设备定义id
* @return 返回结果
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getIotField")
@ApiOperation(httpMethod = "GET", value = "获取关联装备定义物联参数字段", notes = "获取关联装备定义物联参数字段")
public ResponseModel<Object> getIotField(Long equipmentId) {
PerfQuotaIotDTO perfQuotaIotDTO = new PerfQuotaIotDTO();
Page<EquipmentIndexDto> page = new Page<>();
page.setCurrent(1);
page.setSize(100);
perfQuotaIotDTO.setEquipmentId(equipmentId);
perfQuotaIotDTO.setGroupName("");
perfQuotaIotDTO.setPage(page);
ResponseModel<List<EquipmentIndexDto>> equipmentIndexDto = equipFeignClient.getEquipmentIndexDto(perfQuotaIotDTO);
if(equipmentIndexDto.getResult().size() == 0) {
return ResponseHelper.buildResponse(null);
}
List<EquipmentIndexDto> result = equipmentIndexDto.getResult();
List<EquipmentIndexDto> list = result.stream().filter(e-> 1== e.getIsIot()).collect(Collectors.toList());
List<WaterResourceDyDto> listWater = new LinkedList<>();
list.stream().forEach(e-> {
WaterResourceDyDto dyDto = new WaterResourceDyDto();
dyDto.setKey(e.getPerfQuotaDefinitionId());
dyDto.setBlock(false);
dyDto.setLabel(e.getPerfQuotaName());
dyDto.setType("input");
dyDto.setHide(false);
listWater.add(dyDto);
});
return ResponseHelper.buildResponse(listWater);
}
/** /**
* 根据sequenceNbr更新 * 根据sequenceNbr更新
* *
...@@ -235,12 +291,26 @@ public class WaterResourceController extends BaseController { ...@@ -235,12 +291,26 @@ public class WaterResourceController extends BaseController {
} }
} }
// 更新物联信息 // 更新物联信息
if (model.getIsIot() != null){ if (null != model.getWaterResourceIotDto() && model.getWaterResourceIotDto().size() > 0){
if (model.getIsIot()) { Map<String,Object> map = model.getWaterResourceIotDto();
WaterResourceIotDto waterResourceIotDto = model.getWaterResourceIotDto(); List<WaterResourceIndex> list = new ArrayList<>();
waterResourceIotDto.setResourceId(sequenceNbr); for (Map.Entry<String, Object> entry : map.entrySet()) {
waterResourceIotService.updateWithModel(waterResourceIotDto); LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WaterResourceIndex::getNameKey,entry.getKey());
queryWrapper.eq(WaterResourceIndex::getWaterId,model.getSequenceNbr());
WaterResourceIndex waterResourceIndex = waterResourceIndexServiceImpl.getOne(queryWrapper);
if(waterResourceIndex != null) {
waterResourceIndex.setPerfValue(entry.getValue().toString());
list.add(waterResourceIndex);
} else {
WaterResourceIndex waterResourceIndex1 = new WaterResourceIndex();
waterResourceIndex1.setNameKey(entry.getKey());
waterResourceIndex1.setWaterId(model.getSequenceNbr());
waterResourceIndex1.setPerfValue(entry.getValue().toString());
list.add(waterResourceIndex1);
}
} }
waterResourceIndexServiceImpl.saveOrUpdateBatch(list);
} }
return ResponseHelper.buildResponse(waterResourceDto); return ResponseHelper.buildResponse(waterResourceDto);
} }
...@@ -342,14 +412,15 @@ public class WaterResourceController extends BaseController { ...@@ -342,14 +412,15 @@ public class WaterResourceController extends BaseController {
waterResourceDto.setSequenceNbr(sequenceNbr); waterResourceDto.setSequenceNbr(sequenceNbr);
waterResourceDto.setIsDelete(isDelete); waterResourceDto.setIsDelete(isDelete);
// 查询物联参数 // 查询物联参数
if (waterResourceDto.getIsIot()) { LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
WaterResourceIot waterResourceIot = waterResourceIotService.getOne(new QueryWrapper<WaterResourceIot>().eq( queryWrapper.eq(WaterResourceIndex::getWaterId,waterResourceDto.getSequenceNbr());
"resource_id", sequenceNbr)); List<WaterResourceIndex> list = waterResourceIndexServiceImpl.list(queryWrapper);
WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto(); if(list.size()>0) {
if (!ValidationUtil.isEmpty(waterResourceIot)) { Map<String,Object> map = new HashMap<>();
BeanUtils.copyProperties(waterResourceIot, waterResourceIotDto); list.stream().forEach(e->{
} map.put(e.getNameKey(),e.getPerfValue());
waterResourceDto.setWaterResourceIotDto(waterResourceIotDto); });
waterResourceDto.setWaterResourceIotDto(map);
} }
return ResponseHelper.buildResponse(waterResourceDto); return ResponseHelper.buildResponse(waterResourceDto);
} }
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.common.biz.service.impl.WaterResourceIndexServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceIndexDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 消防水源物联参数
*
* @author litw
* @date 2021-11-02
*/
@RestController
@Api(tags = "消防水源物联参数Api")
@RequestMapping(value = "/water-resource-index")
public class WaterResourceIndexController extends BaseController {
@Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
/**
* 新增消防水源物联参数
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增消防水源物联参数", notes = "新增消防水源物联参数")
public ResponseModel<WaterResourceIndexDto> save(@RequestBody WaterResourceIndexDto model) {
model = waterResourceIndexServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新消防水源物联参数", notes = "根据sequenceNbr更新消防水源物联参数")
public ResponseModel<WaterResourceIndexDto> updateBySequenceNbrWaterResourceIndex(@RequestBody WaterResourceIndexDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除消防水源物联参数", notes = "根据sequenceNbr删除消防水源物联参数")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个消防水源物联参数", notes = "根据sequenceNbr查询单个消防水源物联参数")
public ResponseModel<WaterResourceIndexDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "消防水源物联参数分页查询", notes = "消防水源物联参数分页查询")
public ResponseModel<Page<WaterResourceIndexDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<WaterResourceIndexDto> page = new Page<WaterResourceIndexDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.queryForWaterResourceIndexPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "消防水源物联参数列表全部数据查询", notes = "消防水源物联参数列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<WaterResourceIndexDto>> selectForList() {
return ResponseHelper.buildResponse(waterResourceIndexServiceImpl.queryForWaterResourceIndexList());
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceIndexMapper;
import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceIndexService;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceIndexDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 消防水源物联参数服务实现类
*
* @author litw
* @date 2021-11-02
*/
@Service
public class WaterResourceIndexServiceImpl extends BaseService<WaterResourceIndexDto,WaterResourceIndex,WaterResourceIndexMapper> implements IWaterResourceIndexService {
/**
* 分页查询
*/
public Page<WaterResourceIndexDto> queryForWaterResourceIndexPage(Page<WaterResourceIndexDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<WaterResourceIndexDto> queryForWaterResourceIndexList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.common.biz.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.constants.BizConstant; import com.yeejoin.amos.boot.biz.common.constants.BizConstant;
...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto; ...@@ -19,6 +20,7 @@ import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceZhDto;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResource; import com.yeejoin.amos.boot.module.common.api.entity.WaterResource;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceCrane;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceHydrant;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIndex;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIot; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceIot;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceNatural; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourceNatural;
import com.yeejoin.amos.boot.module.common.api.entity.WaterResourcePool; import com.yeejoin.amos.boot.module.common.api.entity.WaterResourcePool;
...@@ -35,7 +37,9 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -35,7 +37,9 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Optional; import java.util.Optional;
/** /**
...@@ -59,6 +63,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -59,6 +63,8 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
WaterResourceIotServiceImpl waterResourceIotService; WaterResourceIotServiceImpl waterResourceIotService;
@Resource @Resource
WaterResourceMapper waterResourceMapper; WaterResourceMapper waterResourceMapper;
@Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
/** /**
* 分页查询 * 分页查询
...@@ -154,14 +160,14 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -154,14 +160,14 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
break; break;
} }
// 新增物联信息 // 新增物联信息
if (model.getIsIot()) { // if (model.getIsIot()) {
WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto(); // WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto();
BeanUtils.copyProperties(model, waterResourceIotDto); // BeanUtils.copyProperties(model, waterResourceIotDto);
waterResourceIotDto.setSequenceNbr(null); // waterResourceIotDto.setSequenceNbr(null);
waterResourceIotDto.setResourceType(model.getResourceType()); // waterResourceIotDto.setResourceType(model.getResourceType());
waterResourceIotDto.setResourceId(model.getSequenceNbr()); // waterResourceIotDto.setResourceId(model.getSequenceNbr());
waterResourceIotService.createWithModel(waterResourceIotDto); // waterResourceIotService.createWithModel(waterResourceIotDto);
} // }
} else { } else {
createWithModel(model); createWithModel(model);
} }
...@@ -234,12 +240,15 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -234,12 +240,15 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceDto.setSequenceNbr(sequenceNbr); waterResourceDto.setSequenceNbr(sequenceNbr);
waterResourceDto.setIsDelete(isDelete); waterResourceDto.setIsDelete(isDelete);
// 查询物联参数 // 查询物联参数
if (waterResourceDto.getIsIot()) { LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
WaterResourceIot waterResourceIot = waterResourceIotService.getOne(new QueryWrapper<WaterResourceIot>().eq( queryWrapper.eq(WaterResourceIndex::getWaterId,waterResourceDto.getSequenceNbr());
"resource_id", sequenceNbr)); List<WaterResourceIndex> list = waterResourceIndexServiceImpl.list(queryWrapper);
WaterResourceIotDto waterResourceIotDto = new WaterResourceIotDto(); if(list.size()>0) {
BeanUtils.copyProperties(waterResourceIot, waterResourceIotDto); Map<String,Object> map = new HashMap<>();
waterResourceDto.setWaterResourceIotDto(waterResourceIotDto); list.stream().forEach(e->{
map.put(e.getNameKey(),e.getPerfValue());
});
waterResourceDto.setWaterResourceIotDto(map);
} }
return waterResourceDto; return waterResourceDto;
} }
......
...@@ -343,6 +343,8 @@ public class AlertCalledController extends BaseController { ...@@ -343,6 +343,8 @@ public class AlertCalledController extends BaseController {
throw new RuntimeException("系统异常"); throw new RuntimeException("系统异常");
} }
}); });
queryWrapper.or().eq("sequence_nbr",alertCalled.getFatherAlert());
return queryWrapper; return queryWrapper;
} }
......
...@@ -328,12 +328,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal ...@@ -328,12 +328,13 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto, AlertCal
ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto); ruleAlertCalledService.fireAlertCalledRule(alertCalledObjsDto);
// 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化 // 通知实战指挥页面发送mqtt 默认发送 String 类型 0, 新警情 1 警情状态变化
emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true); emqKeeper.getMqttClient().publish(topic, "0".getBytes(), RuleConfig.DEFAULT_QOS, true);
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
} }
/**
* 同步保存ES
*/
eSAlertCalledService.saveAlertCalledToES(alertCalled);
return alertCalledObjsDto; return alertCalledObjsDto;
} catch (Exception e) { } catch (Exception e) {
......
...@@ -81,6 +81,7 @@ public class ESAlertCalledService { ...@@ -81,6 +81,7 @@ public class ESAlertCalledService {
Date date=new Date(currentTime); Date date=new Date(currentTime);
wrapper.ge("call_time", date); wrapper.ge("call_time", date);
wrapper.isNull("father_alert");
List<AlertCalled> alertCalleds = alertCalledService.list(wrapper); List<AlertCalled> alertCalleds = alertCalledService.list(wrapper);
if (!ValidationUtil.isEmpty(alertCalleds)) if (!ValidationUtil.isEmpty(alertCalleds))
......
...@@ -2059,7 +2059,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD ...@@ -2059,7 +2059,6 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl())); latentDanger.setPhotoUrls(Joiner.on(",").join(latentDangerDto.getPhotoUrl()));
} }
this.updateById(latentDanger); this.updateById(latentDanger);
DangerExecuteSubmitDto executeSubmitDto = new DangerExecuteSubmitDto(); DangerExecuteSubmitDto executeSubmitDto = new DangerExecuteSubmitDto();
LatentDangerExecuteParam executeParam = new LatentDangerExecuteParam(); LatentDangerExecuteParam executeParam = new LatentDangerExecuteParam();
if (ValidationUtil.isEmpty(executeType) || if (ValidationUtil.isEmpty(executeType) ||
......
...@@ -13,6 +13,7 @@ import com.yeejoin.amos.latentdanger.business.param.JPushTypeEnum; ...@@ -13,6 +13,7 @@ import com.yeejoin.amos.latentdanger.business.param.JPushTypeEnum;
import com.yeejoin.amos.latentdanger.business.param.PushMsgParam; import com.yeejoin.amos.latentdanger.business.param.PushMsgParam;
import com.yeejoin.amos.latentdanger.business.util.DateUtil; import com.yeejoin.amos.latentdanger.business.util.DateUtil;
import com.yeejoin.amos.latentdanger.business.util.Toke; import com.yeejoin.amos.latentdanger.business.util.Toke;
import com.yeejoin.amos.latentdanger.common.enums.LatentDangerState;
import com.yeejoin.amos.latentdanger.common.enums.MsgSubscribeEnum; import com.yeejoin.amos.latentdanger.common.enums.MsgSubscribeEnum;
import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger; import com.yeejoin.amos.latentdanger.dao.entity.LatentDanger;
import com.yeejoin.amos.latentdanger.dao.entity.Msg; import com.yeejoin.amos.latentdanger.dao.entity.Msg;
...@@ -166,12 +167,10 @@ public class AsyncTask { ...@@ -166,12 +167,10 @@ public class AsyncTask {
RequestContext.setProduct(requestContextModel.getProduct()); RequestContext.setProduct(requestContextModel.getProduct());
RequestContext.setAppKey(requestContextModel.getAppKey()); RequestContext.setAppKey(requestContextModel.getAppKey());
MessageModel model = new MessageModel(); MessageModel model = new MessageModel();
model.setTitle(latentDanger.getDangerName()); String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s;推送时间:%s",
String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s", latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName(), DateUtil.date2LongStr(new Date()));
latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName());
model.setBody(body); model.setBody(body);
model.setIsSendApp(true); getMessageModel(model, latentDanger);
model.setMsgType(msgType);
try { try {
List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult(); List<RoleModel> result = Privilege.roleClient.queryRoleList(roleName, null).getResult();
if (result.size() > 0) { if (result.size() > 0) {
...@@ -179,7 +178,6 @@ public class AsyncTask { ...@@ -179,7 +178,6 @@ public class AsyncTask {
List<String> userIds = userModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList()); List<String> userIds = userModels.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
model.setRecivers(userIds); model.setRecivers(userIds);
} }
model.setRelationId(String.valueOf(latentDanger.getId()));
Systemctl.messageClient.create(model); Systemctl.messageClient.create(model);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -195,19 +193,38 @@ public class AsyncTask { ...@@ -195,19 +193,38 @@ public class AsyncTask {
RequestContext.setProduct(requestContextModel.getProduct()); RequestContext.setProduct(requestContextModel.getProduct());
RequestContext.setAppKey(requestContextModel.getAppKey()); RequestContext.setAppKey(requestContextModel.getAppKey());
MessageModel model = new MessageModel(); MessageModel model = new MessageModel();
model.setTitle(latentDanger.getDangerName()); String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s;推送时间:%s",
String body = String.format("隐患名称:%s;隐患级别:%s;治理方式:%s, 推送时间:%s",
latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName(), DateUtil.date2LongStr(new Date())); latentDanger.getDangerName(), latentDanger.getDangerLevelName(), latentDanger.getReformTypeName(), DateUtil.date2LongStr(new Date()));
model.setBody(body); model.setBody(body);
model.setIsSendWeb(true); model.setIsSendWeb(true);
model.setIsSendApp(true);
model.setMsgType(msgType);
model.setRecivers(userIds); model.setRecivers(userIds);
getMessageModel(model, latentDanger);
try { try {
model.setRelationId(String.valueOf(latentDanger.getId()));
Systemctl.messageClient.create(model); Systemctl.messageClient.create(model);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
private MessageModel getMessageModel(MessageModel model, LatentDanger latentDanger) {
String type = null;
latentDanger.getDangerState();
LatentDangerState.SupervisionDangerStateEnum stateEnum =
LatentDangerState.SupervisionDangerStateEnum.getEnumByCode(latentDanger.getDangerState());
if (!ValidationUtil.isEmpty(stateEnum)) {
if (stateEnum.getProcessState().equals("1")) {
type = "1";
} else if (stateEnum.getProcessState().equals("4")) {
type = "2";
}
}
if (!ValidationUtil.isEmpty(type)){
model.getExtras().put("type", type);
}
model.setTitle(latentDanger.getDangerName());
model.setIsSendApp(true);
model.setMsgType(msgType);
model.setRelationId(String.valueOf(latentDanger.getId()));
return model;
}
} }
...@@ -327,7 +327,7 @@ public class AsyncTask { ...@@ -327,7 +327,7 @@ public class AsyncTask {
model.setMsgType(msgType); model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId())); model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(userIds); model.setRecivers(userIds);
// remoteSecurityService.addMessage(requestContextModel, model); remoteSecurityService.addMessage(requestContextModel, model);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -355,7 +355,7 @@ public class AsyncTask { ...@@ -355,7 +355,7 @@ public class AsyncTask {
model.setMsgType(msgType); model.setMsgType(msgType);
model.setRelationId(String.valueOf(plan.getId())); model.setRelationId(String.valueOf(plan.getId()));
model.setRecivers(recivers); model.setRecivers(recivers);
// remoteSecurityService.addMessage(requestContextModel, model); remoteSecurityService.addMessage(requestContextModel, model);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -2022,6 +2022,29 @@ ...@@ -2022,6 +2022,29 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="litw" id="2021-11-03-01">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="cb_water_resource_index"/>
</not>
</preConditions>
<comment>create table cb_water_resource_index</comment>
<sql>
CREATE TABLE `cb_water_resource_index` (
`sequence_nbr` bigint(20) NOT NULL,
`equipment_id` bigint(20) NULL COMMENT '指标拥有者ID:关联装备定义ID',
`water_id` bigint(20) NOT NULL COMMENT '消防水源id',
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '名称',
`name_key` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT null,
`perf_value` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '指标值',
`rec_user_id` bigint(20) NOT NULL COMMENT '更新人id',
`rec_user_name` varchar(30) NOT NULL COMMENT '更新人名称',
`rec_date` datetime NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`is_delete` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除(0:未删除,1:已删除)',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) COMMENT = '消防水源物联参数' ;
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
......
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