Commit 79c6a22a authored by zhangsen's avatar zhangsen

巡检bug修改

parent 1d66f95c
......@@ -61,7 +61,11 @@ public class EquipmentCategory extends BaseEntity implements TreeNode<EquipmentC
@TableField(exist=false)
@ApiModelProperty(value = "级别")
private String level;
@TableField(exist = false)
@ApiModelProperty(value = "个数-巡检树用")
private Integer patrolNum;
@TableField(exist=false)
@ApiModelProperty(value = "个数")
private Double count;
......
......@@ -389,28 +389,26 @@ public class EquipmentCategoryController extends AbstractBaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防设施分类定义树组合消防装备树", notes = "消防设施分类定义树组合消防装备树")
public ResponseModel<List<EquipmentCategory>> equipAndFireAllTree() {
Double countAll = 0.0;
Integer countAll = 0;
List<EquipmentCategory> result = new ArrayList<>();
List<EquipmentCategory> listFireCategories = listFirePrivate();
if (listFireCategories.size() == 2) {
countAll = listFireCategories.get(0).getCount() + listFireCategories.get(1).getCount();
countAll = listFireCategories.get(0).getPatrolNum() + listFireCategories.get(1).getPatrolNum();
}
List<EquipmentCategory> listEquipCategories = listEquipPrivate();
if (listEquipCategories.size() == 1) {
countAll = countAll + listEquipCategories.get(0).getCount();
countAll = countAll + listEquipCategories.get(0).getPatrolNum();
}
List<EquipmentCategory> treeListByCustom = getTreeListByCustom();
if (treeListByCustom.size() == 2) {
countAll = countAll + treeListByCustom.get(0).getCount() + treeListByCustom.get(1).getCount();
countAll = countAll + treeListByCustom.get(0).getPatrolNum() + treeListByCustom.get(1).getPatrolNum();
}
Integer countAllInteger = (int) Math.ceil(countAll);
listFireCategories.addAll(listEquipCategories);
listFireCategories.addAll(treeListByCustom);
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(listFireCategories);
equipmentCategory.setCode("-3");
equipmentCategory.setName("全部类型" + "(" + countAllInteger + ")");
equipmentCategory.setName("全部类型" + "(" + countAll + ")");
equipmentCategory.setId(-3L);
equipmentCategory.setHasLowerClassification(true);
result.add(equipmentCategory);
......@@ -428,7 +426,7 @@ public class EquipmentCategoryController extends AbstractBaseController {
int keyPartsTypeCount = equipmentCategoryMapper.countByKeyPartsType();
equipmentCategory.setCode("-4");
equipmentCategory.setName("重点部位" + "(" + keyPartsTypeCount + ")");
equipmentCategory.setCount((double) keyPartsTypeCount);
equipmentCategory.setPatrolNum(keyPartsTypeCount);
equipmentCategory.setId(-4L);
equipmentCategory.setParentId(-3L);
equipmentCategory.setHasLowerClassification(false);
......@@ -437,7 +435,7 @@ public class EquipmentCategoryController extends AbstractBaseController {
int customTypeCount = equipmentCategoryMapper.countByCustomType();
equipmentCategory2.setCode("-5");
equipmentCategory2.setName("自定义巡查点" + "(" + customTypeCount + ")");
equipmentCategory2.setCount((double) customTypeCount);
equipmentCategory2.setPatrolNum(customTypeCount);
equipmentCategory2.setId(-5L);
equipmentCategory2.setParentId(-3L);
equipmentCategory2.setHasLowerClassification(false);
......@@ -451,15 +449,14 @@ public class EquipmentCategoryController extends AbstractBaseController {
List<EquipmentCategory> list = new ArrayList<>();
List<EquipmentCategory> result = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
final Double[] countAll = {0.0};
final Integer[] countAll = {0};
equipmentCategorys.forEach(action -> {
String subCode = action.getCode().replaceAll("0+$", "");
int count = equipmentCategoryMapper.countByCategoryCode(subCode);
action.setName(action.getName() + "(" + count + ")");
countAll[0] = count + countAll[0];
if (action.getName().equals("消防设施") ||action.getName().equals("消防系统")) {
action.setCount((double) count);
action.setPatrolNum(count);
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
......@@ -478,7 +475,7 @@ public class EquipmentCategoryController extends AbstractBaseController {
equipmentCategory.setChildren(list);
equipmentCategory.setCode("-1");
equipmentCategory.setName("消防设施(" + countAll[0] + ")");
equipmentCategory.setCount(countAll[0]);
equipmentCategory.setPatrolNum(countAll[0]);
equipmentCategory.setId(-1L);
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setParentId(-3L);
......@@ -500,7 +497,7 @@ public class EquipmentCategoryController extends AbstractBaseController {
countAll[0] = countAll[0] + count;
action.setName(action.getName() + "(" + count + ")");
if (action.getParentId() == null) {
action.setCount((double) count);
action.setPatrolNum(count);
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
......@@ -518,9 +515,9 @@ public class EquipmentCategoryController extends AbstractBaseController {
EquipmentCategory equipmentCategory = new EquipmentCategory();
equipmentCategory.setChildren(list);
equipmentCategory.setCode("-2");
equipmentCategory.setName("消防装备");
equipmentCategory.setName("消防装备(" + countAll[0] + ")");
equipmentCategory.setId(-2L);
equipmentCategory.setCount((double)countAll[0]);
equipmentCategory.setPatrolNum(countAll[0]);
equipmentCategory.setHasLowerClassification(true);
equipmentCategory.setParentId(-3L);
result.add(equipmentCategory);
......
......@@ -4,11 +4,13 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.patrol.business.dao.mapper.InputItemMapper;
import com.yeejoin.amos.patrol.business.feign.JcsFeignClient;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
......@@ -90,7 +92,7 @@ public class InputItemController extends AbstractBaseController {
@ApiParam(value = "树code")@RequestParam(required = false) String treeId) {
int inhierarchy = 1;
String subCode = "";
if (StringUtil.isNotEmpty(treeId)) {
if (StringUtil.isNotEmpty(treeId) && Long.parseLong(treeId) > 0) {
String[] result = hierarchy.split(",");
Map<Integer, Integer> map = new HashMap<>();
for (int i = 0; i < result.length; i++) {
......@@ -132,6 +134,18 @@ public class InputItemController extends AbstractBaseController {
criterias.setInhierarchy(inhierarchy);
criterias.setSubCode(subCode);
Page<InputItemVo> page = inputItemService.queryInputItemByPageNew(criterias);
List<Map<String, String>> allCategoryNameList = inputItemMapper.getAllCategoryName();
Map<String, String> resultMap = new HashMap<>();
for (Map<String, String> map : allCategoryNameList) {
resultMap.put(map.get("code"), map.get("name"));
}
for (InputItemVo inputItemVo : page.getContent()) {
String customTypeName = StringUtils.isNotEmpty(inputItemVo.getCustomType())? "自定义巡检点" : "";
String keyPartsTypeName = StringUtils.isNotEmpty(inputItemVo.getKeyPartsType())? "重点部位类型" : "";
String equipmentTypeName = StringUtils.isNotEmpty(inputItemVo.getEquipmentType())? resultMap.get(inputItemVo.getEquipmentType()) : "";
String facilitiesTypeName = StringUtils.isNotEmpty(inputItemVo.getFacilitiesType())? resultMap.get(inputItemVo.getFacilitiesType()) : "";
inputItemVo.setTypeName(customTypeName + keyPartsTypeName + equipmentTypeName + facilitiesTypeName);
}
return CommonResponseUtil.success(page);
}
......
......@@ -26,6 +26,8 @@ public interface InputItemMapper extends BaseMapper {
Map<String, String> getCategoryById(@Param("id") String id);
List<Map<String, String>> getAllCategoryName();
public List<InputItemVo> getInputItemInfoNew(InputItemPageParam param);
Map<Long, Long> getAllCountInfo();
......
......@@ -9,6 +9,8 @@ public class InputItemVo {
private long catalogId;
private String catalogName;
private String typeName;
/**
* 创建者
......@@ -103,6 +105,54 @@ public class InputItemVo {
//单位名称
private String bizOrgName;
private String keyPartsType;
private String customType;
private String facilitiesType;
private String equipmentType;
public String getFacilitiesType() {
return facilitiesType;
}
public void setFacilitiesType(String facilitiesType) {
this.facilitiesType = facilitiesType;
}
public String getEquipmentType() {
return equipmentType;
}
public void setEquipmentType(String equipmentType) {
this.equipmentType = equipmentType;
}
public String getKeyPartsType() {
return keyPartsType;
}
public void setKeyPartsType(String keyPartsType) {
this.keyPartsType = keyPartsType;
}
public String getCustomType() {
return customType;
}
public void setCustomType(String customType) {
this.customType = customType;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getBizOrgCode() {
return bizOrgCode;
}
......
......@@ -60,6 +60,10 @@
<result property="riskDesc" column="risk_desc" />
<result property="bizOrgName" column="biz_org_name" />
<result property="bizOrgCode" column="biz_org_code" />
<result property="keyPartsType" column="key_parts_type" />
<result property="customType" column="custom_type" />
<result property="facilitiesType" column="facilities_type" />
<result property="equipmentType" column="equipment_type" />
</resultMap>
<!--统计 -->
<select id="countInputItemInfoData" resultType="long">
......@@ -281,9 +285,6 @@
<if test="treeId != null and treeId != '' and treeId == -5">
and a.custom_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId != -3 and treeId != -1 and treeId != -2 and treeId != -4 and treeId != -5">
and (a.facilities_type = #{treeId} or a.equipment_type = #{treeId})
</if>
<if test="subCode!=null and subCode!='' and subCode!=' ' and treeId != null and treeId != '' and treeId != -3 and treeId != -1 and treeId != -2 and treeId != -4 and treeId != -5">
and ((LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}) or (LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}))
</if>
......@@ -325,7 +326,10 @@
ELSE
'5级'
END )AS level,
key_parts_type,
custom_type,
equipment_type,
facilities_type,
a.risk_desc
from
p_input_item a left join p_catalog_tree b on a.catalog_id = b.id
......@@ -354,9 +358,6 @@
<if test="treeId != null and treeId != '' and treeId == -5">
and a.custom_type is not null
</if>
<if test="treeId != null and treeId != '' and treeId != -3 and treeId != -1 and treeId != -2 and treeId != -4 and treeId != -5">
and (a.facilities_type = #{treeId} or a.equipment_type = #{treeId})
</if>
<if test="subCode!=null and subCode!='' and subCode!=' ' and treeId != null and treeId != '' and treeId != -3 and treeId != -1 and treeId != -2 and treeId != -4 and treeId != -5">
and ((LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}) or (LEFT (a.facilities_type, #{inhierarchy}) = #{subCode}))
</if>
......@@ -418,4 +419,8 @@
WHERE
key_parts_type IS NOT NULL
</select>
<select id="getAllCategoryName" resultType="java.util.Map">
select code, `name` from wl_equipment_category
</select>
</mapper>
\ No newline at end of file
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