Commit 6289a319 authored by suhuiguang's avatar suhuiguang

Merge branch 'develop_ccs' of http://172.16.10.76/moa/amos-boot-biz into develop_ccs

parents 20c516fb eef8883b
...@@ -47,7 +47,7 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> { ...@@ -47,7 +47,7 @@ public interface WaterResourceMapper extends BaseMapper<WaterResource> {
*/ */
Page<WaterResourceDto> getWaterResourcePageByParams(Page<WaterResourceDto> page, String name, String resourceType, Page<WaterResourceDto> getWaterResourcePageByParams(Page<WaterResourceDto> page, String name, String resourceType,
ArrayList<Long> belongBuildingId, Long belongFightingSystemId, ArrayList<Long> belongBuildingId, Long belongFightingSystemId,
Long sequenceNbr, String equipId,String bizOrgCode); Long sequenceNbr, String equipId,String bizOrgCode, String equipCateGoryCode);
Map<String, Object> getWaterTypeByBizOrgCode(String bizOrgCode); List<Map<String, Object>> getWaterTypeByBizOrgCode(String bizOrgCode);
} }
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
select * from cb_water_resource where is_delete = 1 select * from cb_water_resource where is_delete = 1
<if test="sequenceNbr != null and sequenceNbr != ''">and sequence_nbr = #{sequenceNbr}</if> <if test="sequenceNbr != null and sequenceNbr != ''">and sequence_nbr = #{sequenceNbr}</if>
<if test="resourceType != null and resourceType != ''">and resource_type = #{resourceType}</if> <if test="resourceType != null and resourceType != ''">and resource_type = #{resourceType}</if>
<if test="equipCateGoryCode != null and equipCateGoryCode != ''">and equip_category_code = #{equipCateGoryCode}</if>
<if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if> <if test="equipId != null and equipId != ''">and equip_id = #{equipId}</if>
<if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if> <if test="name != null and name != ''">and name like concat('%', #{name}, '%')</if>
<if test="belongFightingSystemId != null"> <if test="belongFightingSystemId != null">
...@@ -152,15 +153,15 @@ ...@@ -152,15 +153,15 @@
</select> </select>
<select id="getWaterTypeByBizOrgCode" resultType="map"> <select id="getWaterTypeByBizOrgCode" resultType="map">
SELECT SELECT
equip_category_code, equip_category_code type,
COUNT(sequence_nbr) as num COUNT(sequence_nbr) as num
FROM FROM
cb_water_resource cb_water_resource
WHERE WHERE
is_delete = 0 is_delete = 1
<if test="bizOrgCode != null and bizOrgCode != ''">AND biz_org_code like concat( #{bizOrgCode}, '%')</if> <if test="bizOrgCode != null and bizOrgCode != ''">AND biz_org_code like concat( #{bizOrgCode}, '%')</if>
GROUP BY GROUP BY
equip_category_code equip_category_code
......
package com.yeejoin.equipmanage.common.entity; package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity; import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
...@@ -130,10 +131,10 @@ public class Video extends BaseEntity { ...@@ -130,10 +131,10 @@ public class Video extends BaseEntity {
private String belongAreaId; private String belongAreaId;
@ApiModelProperty(value = "机构编码") @ApiModelProperty(value = "机构编码")
@TableField(value = "biz_org_code") @TableField(value = "biz_org_code", updateStrategy = FieldStrategy.IGNORED)
private String bizOrgCode; private String bizOrgCode;
@ApiModelProperty(value = "机构/部门名称") @ApiModelProperty(value = "机构/部门名称")
@TableField(value = "biz_org_name") @TableField(value = "biz_org_name", updateStrategy = FieldStrategy.IGNORED)
private String bizOrgName; private String bizOrgName;
} }
...@@ -48,6 +48,19 @@ public class WarehouseStructure extends BaseEntity { ...@@ -48,6 +48,19 @@ public class WarehouseStructure extends BaseEntity {
@ApiModelProperty(value = "仓库ID") @ApiModelProperty(value = "仓库ID")
private Long warehouseId; private Long warehouseId;
//新加
@ApiModelProperty(value = "机构/部门名称")
@TableField("biz_org_name")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
@TableField("biz_org_code")
private String bizOrgCode;
private String remark; private String remark;
@ApiModelProperty(value = "预控系统中的ID字段") @ApiModelProperty(value = "预控系统中的ID字段")
......
...@@ -63,6 +63,12 @@ public class BuildingVideoListVO { ...@@ -63,6 +63,12 @@ public class BuildingVideoListVO {
* id列表 * id列表
*/ */
@ApiModelProperty("机构编码") @ApiModelProperty("机构编码")
private String bizOrgCode;
/**
* id列表
*/
@ApiModelProperty("机构编码")
private List<String> bizOrgCodeList; private List<String> bizOrgCodeList;
/** /**
......
...@@ -471,14 +471,15 @@ public class WaterResourceController extends BaseController { ...@@ -471,14 +471,15 @@ public class WaterResourceController extends BaseController {
Long belongFightingSystemId, Long sequenceNbr, Long belongFightingSystemId, Long sequenceNbr,
String resourceType, String resourceType,
String classifyId, String classifyId,
String bizOrgCode) { String bizOrgCode,
String equipCateGoryCode) {
Page<WaterResourceDto> page = new Page<>(); Page<WaterResourceDto> page = new Page<>();
page.setCurrent(pageNum); page.setCurrent(pageNum);
page.setSize(pageSize); page.setSize(pageSize);
/*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/ /*bug 2913 更换保存方式 存储到公共附件表 chenzhao 2021-10-18 start*/
Page<WaterResourceDto> waterResourceDtoPage = waterResourceServiceImpl.queryForWaterResourcePage(page, name, resourceType, Page<WaterResourceDto> waterResourceDtoPage = waterResourceServiceImpl.queryForWaterResourcePage(page, name, resourceType,
belongBuildingId, belongFightingSystemId, sequenceNbr, classifyId,bizOrgCode); belongBuildingId, belongFightingSystemId, sequenceNbr, classifyId,bizOrgCode, equipCateGoryCode);
List<WaterResourceDto> records = waterResourceDtoPage.getRecords(); List<WaterResourceDto> records = waterResourceDtoPage.getRecords();
records.forEach(i->{ records.forEach(i->{
Map<String, List<AttachmentDto>> attachments = sourceFileService.getAttachments(i.getSequenceNbr()); Map<String, List<AttachmentDto>> attachments = sourceFileService.getAttachments(i.getSequenceNbr());
......
package com.yeejoin.amos.boot.module.common.biz.service.impl; package com.yeejoin.amos.boot.module.common.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import javax.annotation.Resource;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
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;
...@@ -31,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -31,6 +9,7 @@ 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;
import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils; import com.yeejoin.amos.boot.biz.common.utils.EnumsUtils;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.module.common.api.dto.RequestData; import com.yeejoin.amos.boot.module.common.api.dto.RequestData;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto; import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceCraneDto;
import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto; import com.yeejoin.amos.boot.module.common.api.dto.WaterResourceDto;
...@@ -49,6 +28,24 @@ import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum; ...@@ -49,6 +28,24 @@ import com.yeejoin.amos.boot.module.common.api.enums.WaterResourceTypeEnum;
import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient; import com.yeejoin.amos.boot.module.common.api.feign.EquipFeignClient;
import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper; import com.yeejoin.amos.boot.module.common.api.mapper.WaterResourceMapper;
import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceService; import com.yeejoin.amos.boot.module.common.api.service.IWaterResourceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
/** /**
* 服务实现类 * 服务实现类
...@@ -73,11 +70,12 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -73,11 +70,12 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
WaterResourceMapper waterResourceMapper; WaterResourceMapper waterResourceMapper;
@Autowired @Autowired
WaterResourceIndexServiceImpl waterResourceIndexServiceImpl; WaterResourceIndexServiceImpl waterResourceIndexServiceImpl;
@Autowired @Autowired
DataDictionaryServiceImpl dataDictionaryService; DataDictionaryServiceImpl dataDictionaryService;
@Autowired @Autowired
EquipFeignClient equipFeignClient; EquipFeignClient equipFeignClient;
/** /**
* 分页查询 * 分页查询
*/ */
...@@ -88,9 +86,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -88,9 +86,10 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
@Condition(Operator.eq) Long belongFightingSystemId, @Condition(Operator.eq) Long belongFightingSystemId,
@Condition(Operator.eq) Long sequenceNbr, @Condition(Operator.eq) Long sequenceNbr,
String equipId, String equipId,
String bizOrgCode) { String bizOrgCode,
String equipCateGoryCode) {
return this.waterResourceMapper.getWaterResourcePageByParams(page, name, resourceType, belongBuildingId, return this.waterResourceMapper.getWaterResourcePageByParams(page, name, resourceType, belongBuildingId,
belongFightingSystemId, sequenceNbr, equipId,bizOrgCode); belongFightingSystemId, sequenceNbr, equipId, bizOrgCode, equipCateGoryCode);
} }
/** /**
...@@ -190,9 +189,9 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -190,9 +189,9 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
/** /**
* 导出列表 * 导出列表
*/ */
public List<WaterResourceDto> exportToExcel(Boolean isDelete,String name, public List<WaterResourceDto> exportToExcel(Boolean isDelete, String name,
String resourceType) { String resourceType) {
return waterResourceMapper.exportToExcel(isDelete,name,resourceType); return waterResourceMapper.exportToExcel(isDelete, name, resourceType);
} }
@Override @Override
...@@ -218,24 +217,24 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -218,24 +217,24 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceDto.setRealityImgList(JSONArray.parseArray(waterResourceDto.getRealityImg(), Object.class)); waterResourceDto.setRealityImgList(JSONArray.parseArray(waterResourceDto.getRealityImg(), Object.class));
waterResourceDto.setOrientationImgList(JSONArray.parseArray(waterResourceDto.getOrientationImg())); waterResourceDto.setOrientationImgList(JSONArray.parseArray(waterResourceDto.getOrientationImg()));
if(ValidationUtil.isEmpty(waterResourceDto.getContactUser())) { if (ValidationUtil.isEmpty(waterResourceDto.getContactUser())) {
waterResourceDto.setContactUser(""); waterResourceDto.setContactUser("");
} }
if(ValidationUtil.isEmpty(waterResourceDto.getContactPhone())) { if (ValidationUtil.isEmpty(waterResourceDto.getContactPhone())) {
waterResourceDto.setContactPhone(""); waterResourceDto.setContactPhone("");
} }
if(ValidationUtil.isEmpty(waterResourceDto.getManagementUnit())) { if (ValidationUtil.isEmpty(waterResourceDto.getManagementUnit())) {
waterResourceDto.setManagementUnit(""); waterResourceDto.setManagementUnit("");
} }
if(ValidationUtil.isEmpty(waterResourceDto.getSection())) { if (ValidationUtil.isEmpty(waterResourceDto.getSection())) {
waterResourceDto.setSection(""); waterResourceDto.setSection("");
} }
if(ValidationUtil.isEmpty(waterResourceDto.getWaterSupplyName())) { if (ValidationUtil.isEmpty(waterResourceDto.getWaterSupplyName())) {
waterResourceDto.setWaterSupplyName(""); waterResourceDto.setWaterSupplyName("");
} }
...@@ -249,7 +248,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -249,7 +248,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceHydrantService.getOne(new QueryWrapper<WaterResourceHydrant>().eq( waterResourceHydrantService.getOne(new QueryWrapper<WaterResourceHydrant>().eq(
"resource_id", "resource_id",
sequenceNbr)); sequenceNbr));
if(null != waterResourceHydrant) { if (null != waterResourceHydrant) {
BeanUtils.copyProperties(waterResourceHydrant, waterResourceDto); BeanUtils.copyProperties(waterResourceHydrant, waterResourceDto);
} }
break; break;
...@@ -257,7 +256,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -257,7 +256,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
WaterResourceCrane waterResourceCrane = WaterResourceCrane waterResourceCrane =
waterResourceCraneService.getOne(new QueryWrapper<WaterResourceCrane>().eq("resource_id", waterResourceCraneService.getOne(new QueryWrapper<WaterResourceCrane>().eq("resource_id",
sequenceNbr)); sequenceNbr));
if(null != waterResourceCrane) { if (null != waterResourceCrane) {
BeanUtils.copyProperties(waterResourceCrane, waterResourceDto); BeanUtils.copyProperties(waterResourceCrane, waterResourceDto);
} }
break; break;
...@@ -266,7 +265,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -266,7 +265,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceNaturalService.getOne(new QueryWrapper<WaterResourceNatural>().eq( waterResourceNaturalService.getOne(new QueryWrapper<WaterResourceNatural>().eq(
"resource_id", "resource_id",
sequenceNbr)); sequenceNbr));
if(null != waterResourceNatural) { if (null != waterResourceNatural) {
BeanUtils.copyProperties(waterResourceNatural, waterResourceDto); BeanUtils.copyProperties(waterResourceNatural, waterResourceDto);
} }
...@@ -275,7 +274,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -275,7 +274,7 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
WaterResourcePool waterResourcePool = WaterResourcePool waterResourcePool =
waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id", waterResourcePoolService.getOne(new QueryWrapper<WaterResourcePool>().eq("resource_id",
sequenceNbr)); sequenceNbr));
if(null != waterResourcePool) { if (null != waterResourcePool) {
BeanUtils.copyProperties(waterResourcePool, waterResourceDto); BeanUtils.copyProperties(waterResourcePool, waterResourceDto);
} }
break; break;
...@@ -285,12 +284,12 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -285,12 +284,12 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
waterResourceDto.setIsDelete(isDelete); waterResourceDto.setIsDelete(isDelete);
// 查询物联参数 // 查询物联参数
LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<WaterResourceIndex> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(WaterResourceIndex::getWaterId,waterResourceDto.getSequenceNbr()); queryWrapper.eq(WaterResourceIndex::getWaterId, waterResourceDto.getSequenceNbr());
List<WaterResourceIndex> list = waterResourceIndexServiceImpl.list(queryWrapper); List<WaterResourceIndex> list = waterResourceIndexServiceImpl.list(queryWrapper);
if(list.size()>0) { if (list.size() > 0) {
Map<String,Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
list.stream().forEach(e->{ list.stream().forEach(e -> {
map.put(e.getNameKey(),e.getPerfValue()); map.put(e.getNameKey(), e.getPerfValue());
}); });
waterResourceDto.setWaterResourceIotDto(map); waterResourceDto.setWaterResourceIotDto(map);
} }
...@@ -328,69 +327,110 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -328,69 +327,110 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
return result; return result;
} }
public List<Menu> getwaterResourceTypeTree(String bizOrgCode) throws Exception { public List<Menu> getwaterResourceTypeTree(String bizOrgCode) throws Exception {
List<Menu> list = new ArrayList<>(); List<Menu> list = new ArrayList<>();
ResponseModel <Object> response= equipFeignClient.list(); ResponseModel<Object> response = equipFeignClient.list();
if(response.getStatus() != 200) { if (response.getStatus() != 200) {
return null; return null;
} }
Object resultObject = response.getResult(); Object resultObject = response.getResult();
JSONArray childrenArray = null; JSONArray childrenArray = null;
JSONArray waterTypeDetailArray = null; JSONArray waterTypeDetailArray = null;
JSONObject waterTypeDetailJson=null; JSONObject waterTypeDetailJson = null;
JSONArray resultArray = JSONArray.parseArray(JSONArray.toJSONString(resultObject)); JSONArray resultArray = JSONArray.parseArray(JSONArray.toJSONString(resultObject));
for (Object obj : resultArray) { for (Object obj : resultArray) {
JSONObject detailJsonObject= JSONObject.parseObject(JSONObject.toJSONString(obj)); JSONObject detailJsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj));
String codeString = detailJsonObject.getString("code"); String codeString = detailJsonObject.getString("code");
if(codeString.equals("90000000")) { if (codeString.equals("90000000")) {
childrenArray = detailJsonObject.getJSONArray("children"); childrenArray = detailJsonObject.getJSONArray("children");
break; break;
} }
} }
if(childrenArray!=null && childrenArray.size()>0) { if (childrenArray != null && childrenArray.size() > 0) {
for (Object childObject : childrenArray) { for (Object childObject : childrenArray) {
JSONObject detailChildJsonObject= JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject detailChildJsonObject = JSONObject.parseObject(JSONObject.toJSONString(childObject));
String codeStr = detailChildJsonObject.getString("code"); String codeStr = detailChildJsonObject.getString("code");
if(codeStr.equals("93000000")) { if (codeStr.equals("93000000")) {
waterTypeDetailArray=detailChildJsonObject.getJSONArray("children"); waterTypeDetailArray = detailChildJsonObject.getJSONArray("children");
break; break;
} }
} }
} }
if(waterTypeDetailArray!=null && waterTypeDetailArray.size()>0) { if (waterTypeDetailArray != null && waterTypeDetailArray.size() > 0) {
for (Object childObject : waterTypeDetailArray) { for (Object childObject : waterTypeDetailArray) {
JSONObject waterTypeDetail= JSONObject.parseObject(JSONObject.toJSONString(childObject)); JSONObject waterTypeDetail = JSONObject.parseObject(JSONObject.toJSONString(childObject));
String codeStr = waterTypeDetail.getString("code"); String codeStr = waterTypeDetail.getString("code");
if(codeStr.equals("93060000")) { if (codeStr.equals("93060000")) {
waterTypeDetailJson = waterTypeDetail; waterTypeDetailJson = waterTypeDetail;
break; break;
} }
} }
} }
if(waterTypeDetailJson!=null) { if (waterTypeDetailJson != null) {
Map<String, Object> map= waterResourceMapper.getWaterTypeByBizOrgCode(bizOrgCode); List<Map<String, Object>> mapList = waterResourceMapper.getWaterTypeByBizOrgCode(bizOrgCode);
int num=0; Map<String, Object> map = new HashMap<>();
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children"); for (Map<String, Object> m : mapList) {
JSONArray array = new JSONArray(); String key = "";
for (Object childObject : waterTypeDetailChildrenArray) { String value = "";
for(Map.Entry<String,Object> entry : m.entrySet()) {
JSONObject detail= JSONObject.parseObject(JSONObject.toJSONString(childObject)); if(entry.getKey().equals("num")) {
String codeStr = detail.getString("code"); value = entry.getValue().toString();
if(map!=null && map.containsKey(codeStr)) { }
num=num+Integer.parseInt( map.get("codeStr").toString()); if(entry.getKey().equals("type")) {
detail.put("num", Integer.parseInt( map.get("codeStr").toString())); key = entry.getValue().toString();
}else { }
detail.put("num", 0); }
} map.put(key,value);
Menu menu = new Menu(Long.valueOf(detail.get("id").toString()) ,detail.get("name").toString(),null,Integer.parseInt(detail.get("num").toString())); }
int num = 0;
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children");
JSONArray array = new JSONArray();
for (Object childObject : waterTypeDetailChildrenArray) {
JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(childObject));
String codeStr = detail.getString("code");
if(map!=null && map.containsKey(codeStr)) {
num=num+Integer.parseInt( map.get(codeStr).toString());
detail.put("num", Integer.parseInt( map.get(codeStr).toString()));
}else {
detail.put("num", 0);
}
// if ("93060100".equals(codeStr) && map.containsKey("pool")
// ) {
// num = num + Integer.parseInt(map.get("pool").toString());
// detail.put("num", Integer.parseInt(map.get("pool").toString()));
// }
//
// if (
// "93060200".equals(codeStr) && map.containsKey("crane")
// ) {
// num = num + Integer.parseInt(map.get("crane").toString());
// detail.put("num", Integer.parseInt(map.get("crane").toString()));
// }
//
// if (
// "93060300".equals(codeStr) && map.containsKey("natural")
// ) {
// num = num + Integer.parseInt(map.get("natural").toString());
// detail.put("num", Integer.parseInt(map.get("natural").toString()));
// }
//
// if (
// "93060400".equals(codeStr) && map.containsKey("hydrant")
// ) {
// num = num + Integer.parseInt(map.get("hydrant").toString());
// detail.put("num", Integer.parseInt(map.get("hydrant").toString()));
// }
Menu menu = new Menu(Long.valueOf(detail.get("code").toString()), detail.get("name").toString(), null, Integer.parseInt(detail.containsKey("num") ? detail.get("num").toString() : "0" ));
list.add(menu); list.add(menu);
// if (detail.get("children").toString().length() == 2) { // if (detail.get("children").toString().length() == 2) {
// detail.put("children",null); // detail.put("children",null);
// } // }
// array.add(detail); // array.add(detail);
} }
// waterTypeDetailJson.remove("children"); // waterTypeDetailJson.remove("children");
// if(array.size() == 0) { // if(array.size() == 0) {
// waterTypeDetailJson.put("children", null); // waterTypeDetailJson.put("children", null);
...@@ -398,62 +438,63 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate ...@@ -398,62 +438,63 @@ public class WaterResourceServiceImpl extends BaseService<WaterResourceDto, Wate
// waterTypeDetailJson.put("children", array); // waterTypeDetailJson.put("children", array);
// } // }
// waterTypeDetailJson.put("num", num); // waterTypeDetailJson.put("num", num);
} }
return list; return list;
} }
public Object getwaterResourceType() throws Exception {
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>(); public Object getwaterResourceType() throws Exception {
ResponseModel <Object> response= equipFeignClient.list(); List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
if(response.getStatus() != 200) { ResponseModel<Object> response = equipFeignClient.list();
return null; if (response.getStatus() != 200) {
} return null;
Object resultObject = response.getResult(); }
JSONArray childrenArray = null; Object resultObject = response.getResult();
JSONArray waterTypeDetailArray = null; JSONArray childrenArray = null;
JSONObject waterTypeDetailJson=null; JSONArray waterTypeDetailArray = null;
JSONArray resultArray = JSONArray.parseArray(JSONArray.toJSONString(resultObject)); JSONObject waterTypeDetailJson = null;
for (Object obj : resultArray) { JSONArray resultArray = JSONArray.parseArray(JSONArray.toJSONString(resultObject));
JSONObject detailJsonObject= JSONObject.parseObject(JSONObject.toJSONString(obj)); for (Object obj : resultArray) {
String codeString = detailJsonObject.getString("code"); JSONObject detailJsonObject = JSONObject.parseObject(JSONObject.toJSONString(obj));
if(codeString.equals("90000000")) { String codeString = detailJsonObject.getString("code");
childrenArray = detailJsonObject.getJSONArray("children"); if (codeString.equals("90000000")) {
break; childrenArray = detailJsonObject.getJSONArray("children");
} break;
} }
if(childrenArray!=null && childrenArray.size()>0) { }
for (Object childObject : childrenArray) { if (childrenArray != null && childrenArray.size() > 0) {
JSONObject detailChildJsonObject= JSONObject.parseObject(JSONObject.toJSONString(childObject)); for (Object childObject : childrenArray) {
String codeStr = detailChildJsonObject.getString("code"); JSONObject detailChildJsonObject = JSONObject.parseObject(JSONObject.toJSONString(childObject));
if(codeStr.equals("93000000")) { String codeStr = detailChildJsonObject.getString("code");
waterTypeDetailArray=detailChildJsonObject.getJSONArray("children"); if (codeStr.equals("93000000")) {
break; waterTypeDetailArray = detailChildJsonObject.getJSONArray("children");
} break;
} }
}
}
if(waterTypeDetailArray!=null && waterTypeDetailArray.size()>0) { }
for (Object childObject : waterTypeDetailArray) { if (waterTypeDetailArray != null && waterTypeDetailArray.size() > 0) {
JSONObject waterTypeDetail= JSONObject.parseObject(JSONObject.toJSONString(childObject)); for (Object childObject : waterTypeDetailArray) {
String codeStr = waterTypeDetail.getString("code"); JSONObject waterTypeDetail = JSONObject.parseObject(JSONObject.toJSONString(childObject));
if(codeStr.equals("93060000")) { String codeStr = waterTypeDetail.getString("code");
waterTypeDetailJson = waterTypeDetail; if (codeStr.equals("93060000")) {
break; waterTypeDetailJson = waterTypeDetail;
} break;
} }
} }
if(waterTypeDetailJson!=null) { }
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children"); if (waterTypeDetailJson != null) {
JSONArray waterTypeDetailChildrenArray = waterTypeDetailJson.getJSONArray("children");
for (Object childObject : waterTypeDetailChildrenArray) {
Map<String, Object> map = new LinkedHashMap<>(); for (Object childObject : waterTypeDetailChildrenArray) {
JSONObject detail= JSONObject.parseObject(JSONObject.toJSONString(childObject)); Map<String, Object> map = new LinkedHashMap<>();
String codeStr = detail.getString("code"); JSONObject detail = JSONObject.parseObject(JSONObject.toJSONString(childObject));
String name = detail.getString("name"); String codeStr = detail.getString("code");
map.put("code", codeStr); String name = detail.getString("name");
map.put("name", name); map.put("code", codeStr);
list.add(map); map.put("name", name);
} list.add(map);
} }
return list; }
} return list;
}
} }
...@@ -219,8 +219,8 @@ public class BuildingController extends AbstractBaseController { ...@@ -219,8 +219,8 @@ public class BuildingController extends AbstractBaseController {
@GetMapping(value = "/getEveryCount") @GetMapping(value = "/getEveryCount")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询建筑画布下装备") @ApiOperation(value = "查询建筑画布下装备")
public Map<String, Object> getEveryCount(@RequestParam Long id, @RequestParam String groupType) { public Map<String, Object> getEveryCount(@RequestParam Long id, @RequestParam String groupType, @RequestParam(required = false) String bizOrgCode) {
return buildService.getEveryCount(id, groupType); return buildService.getEveryCount(id, groupType, bizOrgCode);
} }
@GetMapping(value = "/getChildrenNotIsRiskList") @GetMapping(value = "/getChildrenNotIsRiskList")
...@@ -285,8 +285,8 @@ public class BuildingController extends AbstractBaseController { ...@@ -285,8 +285,8 @@ public class BuildingController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("公司消防建筑树") @ApiOperation("公司消防建筑树")
@GetMapping(value = "/companyBuildingTree") @GetMapping(value = "/companyBuildingTree")
public List<BuildingTreeVo> getCompanyBuildingTree() { public List<BuildingTreeVo> getCompanyBuildingTree(@RequestParam(required = false) String authKey) {
return buildService.getCompanyBuildingTree(); return buildService.getCompanyBuildingTree(authKey);
} }
} }
...@@ -251,6 +251,16 @@ public class CarController extends AbstractBaseController { ...@@ -251,6 +251,16 @@ public class CarController extends AbstractBaseController {
} }
} }
@Async
public void refreshCount(List<Car> list) {
list.forEach(i->{
iCarService.refreshStaData();
try {
fireFightingSystemServiceImpl.refreshCarTypeAndCount(i.getBizOrgCode());
} catch (Exception e) {
}
});
}
/** /**
* 根据iotCode查询 * 根据iotCode查询
...@@ -310,7 +320,7 @@ public class CarController extends AbstractBaseController { ...@@ -310,7 +320,7 @@ public class CarController extends AbstractBaseController {
// carInstance = iCarService.saveCar(getUserInfo(), carInstance, carInfo, carpList); // carInstance = iCarService.saveCar(getUserInfo(), carInstance, carInfo, carpList);
// saveFile(carInstance);视频图片文件后期统一处理 // saveFile(carInstance);视频图片文件后期统一处理
EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig); EquipmentSpecificSerivceImpl.registerMqttTopic(car.getIotCode(), equipmentIotMqttReceiveConfig);
Car car1= iCarService.updateOneById(car); Car car1= iCarService.updateOneById(car);
refreshCount(car.getBizOrgCode()); refreshCount(car.getBizOrgCode());
return car1; return car1;
} }
...@@ -1085,8 +1095,13 @@ public class CarController extends AbstractBaseController { ...@@ -1085,8 +1095,13 @@ public class CarController extends AbstractBaseController {
} }
} }
} }
}); });
return iCarService.removeOneByIds(idList); boolean flag = iCarService.removeOneByIds(idList);
if(flag) {
refreshCount(cars) ;
}
return flag;
} }
/** /**
......
...@@ -99,7 +99,6 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -99,7 +99,6 @@ public class EquipmentDetailController extends AbstractBaseController {
@ApiOperation(httpMethod = "POST", value = "新增", notes = "新增") @ApiOperation(httpMethod = "POST", value = "新增", notes = "新增")
public EquipmentDetail saveEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDetail equipmentDetail) { public EquipmentDetail saveEquipmentDetail(HttpServletRequest request, @RequestBody EquipmentDetail equipmentDetail) {
EquipmentDetail detail= iEquipmentDetailService.saveOne(equipmentDetail); EquipmentDetail detail= iEquipmentDetailService.saveOne(equipmentDetail);
equipmentSpecificSerivce.refreshStaData();
return detail; return detail;
} }
...@@ -107,7 +106,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -107,7 +106,7 @@ public class EquipmentDetailController extends AbstractBaseController {
public void refreshCount(String bizOrgCode) { public void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData(); equipmentSpecificSerivce.refreshStaData();
try { try {
fireFightingSystemServiceImpl.refreshCarTypeAndCount(bizOrgCode); fireFightingSystemServiceImpl.refreshEquipmentTypeAndCount(bizOrgCode);
} catch (Exception e) { } catch (Exception e) {
} }
...@@ -156,7 +155,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -156,7 +155,7 @@ public class EquipmentDetailController extends AbstractBaseController {
if (syncSwitch) { if (syncSwitch) {
equipmentSpecificSerivce.equipSpecificDataSync(equipmentId); equipmentSpecificSerivce.equipSpecificDataSync(equipmentId);
} }
equipmentSpecificSerivce.refreshStaData(); refreshCount(vo.getBizOrgCode());
return date; return date;
} }
...@@ -264,7 +263,7 @@ public class EquipmentDetailController extends AbstractBaseController { ...@@ -264,7 +263,7 @@ public class EquipmentDetailController extends AbstractBaseController {
if (syncSwitch) { if (syncSwitch) {
equipmentSpecificSerivce.equipSpecificDataSync(bean.getEquipmentId()); equipmentSpecificSerivce.equipSpecificDataSync(bean.getEquipmentId());
} }
equipmentSpecificSerivce.refreshStaData(); refreshCount(vo.getBizOrgCode());
return equipmentDate; return equipmentDate;
} }
......
...@@ -177,6 +177,14 @@ public class WarehouseStructureController extends AbstractBaseController { ...@@ -177,6 +177,14 @@ public class WarehouseStructureController extends AbstractBaseController {
return iWarehouseStructureService.tree(id); return iWarehouseStructureService.tree(id);
} }
@RequestMapping(value = "/gettree/{id}", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "树查询", notes = "树查询")
public List<WarehouseStructure> gettree(@PathVariable Long id,String bizOrgCode) {
return iWarehouseStructureService.gettree(id,bizOrgCode);
}
/** /**
* 批量删除 * 批量删除
* *
......
...@@ -144,4 +144,20 @@ public interface BuildingMapper extends BaseMapper<Building> { ...@@ -144,4 +144,20 @@ public interface BuildingMapper extends BaseMapper<Building> {
* @return * @return
*/ */
List<BuildingTreeAndEquipVO> getSonBuildingTree2(); List<BuildingTreeAndEquipVO> getSonBuildingTree2();
/**
* 获取房间楼层数量
* @param type 类型
* @param bizOrgCode code
* @return 数量
*/
Long getCountByTypeCode(String type, String bizOrgCode);
/**
* 根据code获取装备数量
* @param bizOrgCode code
* @return 数量
*/
Long getEquipCount(String bizOrgCode);
} }
...@@ -30,7 +30,7 @@ public class BuildFloorPage implements PageOperation { ...@@ -30,7 +30,7 @@ public class BuildFloorPage implements PageOperation {
Map<String, Object> instanceIdMap = (Map<String, Object>) instanceId; Map<String, Object> instanceIdMap = (Map<String, Object>) instanceId;
instanceIdMap.put("equipmentTotal", builldService.getEveryCount( instanceIdMap.put("equipmentTotal", builldService.getEveryCount(
Long.parseLong(String.valueOf(instanceIdMap.get("instanceId"))), Long.parseLong(String.valueOf(instanceIdMap.get("instanceId"))),
GroupTypeEnum.FLOOR.getType()).get("equipCount")); GroupTypeEnum.FLOOR.getType(), "").get("equipCount"));
builldService.sourceBuild(instanceIdMap); builldService.sourceBuild(instanceIdMap);
}); });
} }
......
...@@ -199,7 +199,7 @@ public interface IBuilldService extends IService<Building> { ...@@ -199,7 +199,7 @@ public interface IBuilldService extends IService<Building> {
* @param groupType * @param groupType
* @return * @return
*/ */
Map<String ,Object> getEveryCount( Long id, String groupType); Map<String ,Object> getEveryCount( Long id, String groupType, String bizOrgCode);
/** /**
* 消防建筑视屏监控统计树 * 消防建筑视屏监控统计树
...@@ -304,8 +304,9 @@ public interface IBuilldService extends IService<Building> { ...@@ -304,8 +304,9 @@ public interface IBuilldService extends IService<Building> {
/** /**
* 根据登陆人获取公司部门树 * 根据登陆人获取公司部门树
* @return list * @return list
* @param authKey
*/ */
List<BuildingTreeVo> getCompanyBuildingTree(); List<BuildingTreeVo> getCompanyBuildingTree(String authKey);
List<BuildingTreeVo> getBuildingVideoTreeNew(); List<BuildingTreeVo> getBuildingVideoTreeNew();
} }
...@@ -221,4 +221,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -221,4 +221,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
* @throws Exception * @throws Exception
*/ */
Object getCarTypeAndCount(String bizOrgCode) throws Exception; Object getCarTypeAndCount(String bizOrgCode) throws Exception;
public Object refreshEquipmentTypeAndCount(String bizOrgCode) throws Exception;
public Object refreshCarTypeAndCount(String bizOrgCode) throws Exception;
} }
...@@ -17,7 +17,7 @@ public interface IWarehouseStructureService extends IService<WarehouseStructure> ...@@ -17,7 +17,7 @@ public interface IWarehouseStructureService extends IService<WarehouseStructure>
WarehouseStructure saveOne(WarehouseStructure warehouseStructure); WarehouseStructure saveOne(WarehouseStructure warehouseStructure);
List<WarehouseStructure> tree(Long warehouseId); List<WarehouseStructure> tree(Long warehouseId);
List<WarehouseStructure> gettree(Long warehouseId,String bizOrgCode);
WarehouseStructure updateOneById(WarehouseStructure warehouseStructure); WarehouseStructure updateOneById(WarehouseStructure warehouseStructure);
boolean removeOneById(Long id) throws Exception; boolean removeOneById(Long id) throws Exception;
......
...@@ -94,9 +94,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -94,9 +94,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Autowired @Autowired
ISourceSceneService sourceSceneService; ISourceSceneService sourceSceneService;
@Autowired
private IBuilldService buildService;
@Value("${morphic.projectSeq}") @Value("${morphic.projectSeq}")
private Long projectSeq; private Long projectSeq;
...@@ -124,6 +121,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -124,6 +121,9 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Value("${auth-key-fire-building:fire_building_info}") @Value("${auth-key-fire-building:fire_building_info}")
private String authKey; private String authKey;
@Value("${auth-key-fire-building:auth-key-fire-build-video}")
private String buildVideoAuthKey;
@Autowired @Autowired
private JCSRemoteService jcsRemoteService; private JCSRemoteService jcsRemoteService;
...@@ -525,10 +525,15 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -525,10 +525,15 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
@Override @Override
public Map<String, Object> getEveryCount(Long id, String groupType) { public Map<String, Object> getEveryCount(Long id, String groupType, String bizOrgCode) {
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if ("".equals(groupType) || "allBuilding".equals(groupType) || groupType == null) { if ("".equals(groupType) || "allBuilding".equals(groupType)) {
map.put("error", "类型填写错误"); Long roomCount = this.baseMapper.getCountByTypeCode("room", bizOrgCode);
Long floorCount = this.baseMapper.getCountByTypeCode("floor", bizOrgCode);
Long equipCount = this.baseMapper.getEquipCount(bizOrgCode);
map.put("floorCount", floorCount);
map.put("roomCount", roomCount);
map.put("equipCount", equipCount);
return map; return map;
} }
if ("allfloor".equals(groupType)) { if ("allfloor".equals(groupType)) {
...@@ -635,7 +640,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -635,7 +640,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
*/ */
@Override @Override
public Long equipmentTotal(Long instanceId, String groupType) { public Long equipmentTotal(Long instanceId, String groupType) {
Map<String, Object> map = getEveryCount(instanceId, groupType); Map<String, Object> map = getEveryCount(instanceId, groupType,null);
return Long.parseLong(String.valueOf(map.get("equipCount"))); return Long.parseLong(String.valueOf(map.get("equipCount")));
} }
...@@ -765,9 +770,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -765,9 +770,8 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public Page<BuildingVideoVO> buildingVideoList(Page page, BuildingVideoListVO dto) { public Page<BuildingVideoVO> buildingVideoList(Page page, BuildingVideoListVO dto) {
String buildingId = dto.getBuildingId();
String orgTypes = dto.getOrgTypes(); String orgTypes = dto.getOrgTypes();
if ("0".equals(buildingId) && StringUtils.isNotBlank(orgTypes)) { if (StringUtils.isNotBlank(orgTypes)) {
List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes); List<OrgUsrDto> list = jcsRemoteService.getCompanyDeptListWithAuth(authKey, orgTypes);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<String> bizOrgCodeList = new ArrayList<>(); List<String> bizOrgCodeList = new ArrayList<>();
...@@ -776,18 +780,18 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -776,18 +780,18 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
} }
Page<BuildingVideoVO> pages = videoService.pageBuildingVideo(page, dto); Page<BuildingVideoVO> pages = videoService.pageBuildingVideo(page, dto);
// if (0 < pages.getRecords().size()) { if (0 < pages.getRecords().size()) {
// pages.getRecords().forEach(x -> { pages.getRecords().forEach(x -> {
// if (StringUtil.isNotEmpty(x.getLocation()) && StringUtil.isNotEmpty(x.getAddress())) { if (StringUtil.isNotEmpty(x.getLocation()) && StringUtil.isNotEmpty(x.getAddress())) {
// x.setLocation(x.getLocation() + '-' + x.getAddress()); x.setLocation(x.getLocation() + '-' + x.getAddress());
// } else { } else {
// if (!StringUtil.isNotEmpty(x.getLocation())) { if (!StringUtil.isNotEmpty(x.getLocation())) {
// x.setLocation(x.getAddress()); x.setLocation(x.getAddress());
// } }
// } }
// x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode())); x.setUrl(videoService.getVideoUrl(x.getName(), x.getPresetPosition(), x.getUrl(), x.getCode()));
// }); });
// } }
return pages; return pages;
} }
...@@ -1120,7 +1124,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1120,7 +1124,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
@Override @Override
public List<BuildingTreeVo> getCompanyBuildingTree() { public List<BuildingTreeVo> getCompanyBuildingTree(String authKey) {
if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey;
}
List<BuildingTreeVo> allListVo = getBuildingTreeVos(); List<BuildingTreeVo> allListVo = getBuildingTreeVos();
// 获取公司部门list // 获取公司部门list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey,"COMPANY"); List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey,"COMPANY");
...@@ -1150,7 +1157,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1150,7 +1157,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public List<BuildingTreeVo> getBuildingVideoTreeNew() { public List<BuildingTreeVo> getBuildingVideoTreeNew() {
List<BuildingTreeVo> list = buildService.getCompanyBuildingTree(); List<BuildingTreeVo> list = getCompanyBuildingTree(buildVideoAuthKey);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {
List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount(); List<Map<String, Long>> countList = iFormInstanceService.getBuildVideoCount();
if (!CollectionUtils.isEmpty(countList)) { if (!CollectionUtils.isEmpty(countList)) {
...@@ -1172,7 +1179,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1172,7 +1179,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
public List<BuildingTreeVo> getBuildingVideoTotal(List<BuildingTreeVo> children, Map<Long, Long> map) { public List<BuildingTreeVo> getBuildingVideoTotal(List<BuildingTreeVo> children, Map<Long, Long> map) {
for (BuildingTreeVo treeVo : children) { for (BuildingTreeVo treeVo : children) {
List<BuildingTreeVo> childrenList = treeVo.getChildren(); List<BuildingTreeVo> childrenList = treeVo.getChildren();
if (!CollectionUtils.isEmpty(children)) { if (!CollectionUtils.isEmpty(childrenList)) {
getBuildingVideoTotal (childrenList, map); getBuildingVideoTotal (childrenList, map);
} }
treeVo.setTotal(map.get(treeVo.getInstanceId())); treeVo.setTotal(map.get(treeVo.getInstanceId()));
......
...@@ -395,7 +395,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -395,7 +395,7 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
} }
equipmentSpecificMapper.insert(equipmentSpecific); equipmentSpecificMapper.insert(equipmentSpecific);
refreshCount(equipmentSpecific.getBizOrgCode());//添加对于装备类型统计数据的刷新
//位置编码不为空入库 //位置编码不为空入库
if (equipmentDetailDownloadVOS.get(i) != null && equipmentDetailDownloadVOS.get(i).getWarehouseStructCode() != null) { if (equipmentDetailDownloadVOS.get(i) != null && equipmentDetailDownloadVOS.get(i).getWarehouseStructCode() != null) {
QueryWrapper<WarehouseStructure> warehouseStructureQueryWrapper = new QueryWrapper<>(); QueryWrapper<WarehouseStructure> warehouseStructureQueryWrapper = new QueryWrapper<>();
...@@ -467,10 +467,18 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements ...@@ -467,10 +467,18 @@ public class StockServiceImpl extends ServiceImpl<StockMapper, Stock> implements
this.equipmentSpecificIndexSave(equipmentDetail, equipmentSpecific); this.equipmentSpecificIndexSave(equipmentDetail, equipmentSpecific);
} }
relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString()); relationRedisUtil.delSysRedisKey(fireFightSysIdsBuffer.toString());
equipmentSpecificSerivce.refreshStaData();//添加对于装备类型统计数据的刷新
return list; return list;
} }
@Async
public void refreshCount(String bizOrgCode) {
equipmentSpecificSerivce.refreshStaData();
try {
fireFightingSystemService.refreshEquipmentTypeAndCount(bizOrgCode);
} catch (Exception e) {
}
}
private void equipmentSpecificIndexSave(EquipmentDetail equipmentDetail, EquipmentSpecific equipmentSpecific) { private void equipmentSpecificIndexSave(EquipmentDetail equipmentDetail, EquipmentSpecific equipmentSpecific) {
List<EquipmentIndex> equipmentIndexList = iEquipmentIndexService.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId, equipmentDetail.getEquipmentId())); List<EquipmentIndex> equipmentIndexList = iEquipmentIndexService.list(new LambdaQueryWrapper<EquipmentIndex>().eq(EquipmentIndex::getEquipmentId, equipmentDetail.getEquipmentId()));
List<EquipmentSpecificIndex> equipmentSpecificIndices = equipmentIndexList.stream().map(index -> { List<EquipmentSpecificIndex> equipmentSpecificIndices = equipmentIndexList.stream().map(index -> {
......
...@@ -6,6 +6,7 @@ import java.util.HashMap; ...@@ -6,6 +6,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.yeejoin.equipmanage.common.entity.FormInstance;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -63,6 +64,18 @@ public class WarehouseStructureServiceImpl extends ServiceImpl<WarehouseStructur ...@@ -63,6 +64,18 @@ public class WarehouseStructureServiceImpl extends ServiceImpl<WarehouseStructur
return list; return list;
} }
@Override
public List<WarehouseStructure> gettree(Long warehouseId,String bizOrgCode) {
QueryWrapper<WarehouseStructure> one = new QueryWrapper<>();
one.eq("warehouse_id",warehouseId);
one.likeRight("biz_org_code",bizOrgCode);
List<WarehouseStructure> list = warehouseStructureMapper.selectList(one);
list = buildByRecursive(list,warehouseId);
return list;
}
/** /**
* 生成code * 生成code
* *
......
...@@ -239,4 +239,25 @@ ...@@ -239,4 +239,25 @@
END# END#
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="gaojianqiang" id="1641307260-20220104-01" runAlways="true">
<comment>`getBuildChildIdsByRootId`</comment>
<sql endDelimiter="#">
DROP FUNCTION IF EXISTS `getBuildChildIdsByRootId`#
CREATE DEFINER=`root`@`%` FUNCTION `getBuildChildIdsByRootId`(`rootId` VARCHAR(100)) RETURNS varchar(4000) CHARSET utf8mb4 COLLATE utf8mb4_general_ci
BEGIN
DECLARE sTemp TEXT;
DECLARE sTempChd VARCHAR(4000);
SET group_concat_max_len=102400;
SET sTemp='$';
SET sTempChd = CAST(rootId AS CHAR);
WHILE sTempChd IS NOT NULL DO
SET sTemp= CONCAT(sTemp,',',sTempChd);
SELECT GROUP_CONCAT(distinct instanceId) INTO sTempChd FROM get_building_tree WHERE FIND_IN_SET(parentId,sTempChd)>0;
END WHILE;
RETURN sTemp;
END#
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -2238,4 +2238,31 @@ ...@@ -2238,4 +2238,31 @@
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="tw" id="20220104-5">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_warehouse_structure" columnName="biz_org_name"/>
</not>
</preConditions>
<comment>wl_warehouse_structure add column biz_org_name</comment>
<sql>
alter table `wl_warehouse_structure` add column `biz_org_name` varchar(128) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构/部门名称';
</sql>
</changeSet>
<changeSet author="tw" id="20220104-6">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_warehouse_structure" columnName="biz_org_code"/>
</not>
</preConditions>
<comment>wl_warehouse_structure add column biz_org_code</comment>
<sql>
alter table `wl_warehouse_structure` add column `biz_org_code` varchar(64) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '机构编码';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -435,4 +435,29 @@ ...@@ -435,4 +435,29 @@
union all union all
select id,null as parentId,fei.`name`,'equipment' as type from f_equipment fei where fei.risk_source_id=#{id} select id,null as parentId,fei.`name`,'equipment' as type from f_equipment fei where fei.risk_source_id=#{id}
</select> </select>
<select id="getCountByTypeCode" resultType="java.lang.Long">
SELECT
count(1)
FROM
wl_form_instance
WHERE
field_name = 'bizOrgCode'
AND field_value LIKE CONCAT(#{bizOrgCode},'%')
AND group_type = #{type}
</select>
<select id="getEquipCount" resultType="java.lang.Long">
SELECT
IF (
sum(sto.amount) IS NULL,
0,
sum(sto.amount)
) AS count
FROM
wl_stock_detail AS sto
LEFT JOIN wl_warehouse_structure AS war ON sto.warehouse_structure_id = war.id
LEFT JOIN wl_form_instance wfi ON wfi.instance_id = war.source_id
WHERE
wfi.field_name = 'bizOrgCode'
AND wfi.field_value LIKE CONCAT(#{bizOrgCode},'%')
</select>
</mapper> </mapper>
...@@ -482,13 +482,23 @@ FROM ...@@ -482,13 +482,23 @@ FROM
WHERE WHERE
instance_id = #{instanceId} instance_id = #{instanceId}
</select> </select>
<!--<select id="getBuildVideoCount" resultType="hashmap">-->
<!-- SELECT-->
<!-- wlv.source_id AS buildId,-->
<!-- count( wlv.source_id ) AS total-->
<!-- FROM-->
<!-- `wl_video_source` wlv-->
<!-- GROUP BY-->
<!-- wlv.source_id-->
<!--</select>-->
<select id="getBuildVideoCount" resultType="hashmap"> <select id="getBuildVideoCount" resultType="hashmap">
SELECT SELECT
wlv.source_id AS buildId, b.instanceId AS buildId,
count( wlv.source_id ) AS total COUNT( vs.video_id ) AS total
FROM FROM
`wl_video_source` wlv get_building_tree b
LEFT JOIN wl_video_source vs ON FIND_IN_SET( vs.source_id, getBuildChildIdsByRootId ( b.instanceId ) )
GROUP BY GROUP BY
wlv.source_id b.instanceId
</select> </select>
</mapper> </mapper>
...@@ -74,14 +74,21 @@ ...@@ -74,14 +74,21 @@
JOIN wl_video_source vc ON vc.video_id = v.id JOIN wl_video_source vc ON vc.video_id = v.id
<where> <where>
<if test="dto.buildingId!=null and dto.buildingId!=''"> <if test="dto.buildingId!=null and dto.buildingId!=''">
FIND_IN_SET(vc.source_id, getChildrenIdsByRootId(#{dto.buildingId})) FIND_IN_SET(vc.source_id, getBuildChildIdsByRootId(#{dto.buildingId}))
</if>
<if test="dto.bizOrgCodeList != null and dto.bizOrgCodeList.size > 0">
AND v.biz_org_code IN
<foreach collection="dto.bizOrgCodeList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if> </if>
<choose>
<when test="dto.bizOrgCode!=null and dto.bizOrgCode!=''">
OR v.biz_org_code LIKE CONCAT(#{dto.bizOrgCode}, '%')
</when>
<otherwise>
<if test="dto.bizOrgCodeList != null and dto.bizOrgCodeList.size > 0">
AND v.biz_org_code IN
<foreach collection="dto.bizOrgCodeList" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</otherwise>
</choose>
<if test="dto.equipmentName!=null and dto.equipmentName!=''"> <if test="dto.equipmentName!=null and dto.equipmentName!=''">
and v.name like concat('%',#{dto.equipmentName},'%') and v.name like concat('%',#{dto.equipmentName},'%')
</if> </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