Commit f2fde89f authored by tangwei's avatar tangwei

修改装备统计数

parent 3207035b
...@@ -53,6 +53,8 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -53,6 +53,8 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
int checkUsed( String id ); int checkUsed( String id );
List<EquipmentCategory> getEquipmentCategoryList(Integer head); List<EquipmentCategory> getEquipmentCategoryList(Integer head);
List<EquipmentCategory> getEquipmentCategoryListNew( @Param("head") Integer code, @Param("type") String type);
List<Map<String,Object>> getequipmentListEQNew();
List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head); List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head);
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head); List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head);
......
...@@ -9,6 +9,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentCategoryTypeTreeVO; ...@@ -9,6 +9,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipmentCategoryTypeTreeVO;
import com.yeejoin.equipmanage.common.vo.IndustryVo; import com.yeejoin.equipmanage.common.vo.IndustryVo;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* 装备分类 服务类 * 装备分类 服务类
...@@ -46,7 +47,8 @@ public interface IEquipmentCategoryService extends IService<EquipmentCategory> { ...@@ -46,7 +47,8 @@ public interface IEquipmentCategoryService extends IService<EquipmentCategory> {
int checkUsed( List<String> ids); int checkUsed( List<String> ids);
List<EquipmentCategory> getEquipmentCategoryList(Integer head); List<EquipmentCategory> getEquipmentCategoryList(Integer head);
List<EquipmentCategory> getEquipmentCategoryListNew(Integer head,String type);
List<Map<String,Object>> getequipmentListEQNew();
List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) ; List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) ;
List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head) ; List<EquipmentCategory> getEquipmentCategoryListByFacilities(Integer head) ;
......
...@@ -390,6 +390,15 @@ public class EquipmentCategoryServiceImpl extends ServiceImpl<EquipmentCategoryM ...@@ -390,6 +390,15 @@ public class EquipmentCategoryServiceImpl extends ServiceImpl<EquipmentCategoryM
public List<EquipmentCategory> getEquipmentCategoryList(Integer head) { public List<EquipmentCategory> getEquipmentCategoryList(Integer head) {
return this.baseMapper.getEquipmentCategoryList(head); return this.baseMapper.getEquipmentCategoryList(head);
} }
@Override
public List<EquipmentCategory> getEquipmentCategoryListNew(Integer head,String type) {
return this.baseMapper.getEquipmentCategoryListNew(head,type);
}
@Override
public List<Map<String, Object>> getequipmentListEQNew() {
return this.baseMapper.getequipmentListEQNew();
}
public List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) { public List<EquipmentCategory> getEquipmentCategoryListNotFacilities(Integer head) {
return this.baseMapper.getEquipmentCategoryListNotFacilities(head); return this.baseMapper.getEquipmentCategoryListNotFacilities(head);
......
...@@ -1151,10 +1151,60 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1151,10 +1151,60 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
// return JSONArray.parseArray( // return JSONArray.parseArray(
// JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class); // JSONArray.toJSONString(redisUtils.get(equipTypeAndCount + bizOrgCode)), EquipmentCategory.class);
// } else { // } else {
return refreshEquipmentTypeAndCount(bizOrgCode); return refreshEquipmentTypeAndCountNew(bizOrgCode);
// } // }
} }
public Object refreshEquipmentTypeAndCountNew(String bizOrgCode) {
List<EquipmentCategory> responseList= this.iEquipmentCategoryService
.getEquipmentCategoryListNew(Integer.valueOf(equipmentCategoryLeftTypeCode),"eq");
if (responseList == null || responseList.size() < 1) {
return null;
}
List<EquipmentCategory> list = typeListTreeNew(responseList, bizOrgCode);
return list;
}
public List<EquipmentCategory> typeListTreeNew(List<EquipmentCategory> equipmentCategorys, String bizOrgCode) {
List<EquipmentCategory> list = new ArrayList<>();
Map<String, List<EquipmentCategory>> tmpMap = new HashMap<String, List<EquipmentCategory>>();
// 查询所有装备
List<Map<String,Object>> listMP = this.iEquipmentCategoryService.getequipmentListEQNew();
equipmentCategorys.forEach(action -> {
List<Map<String,Object>> listM= listMP.stream().filter(x->x.get("code").toString().contains(action.getCode())&&x.get("bizOrgCode").toString().contains(bizOrgCode)).collect(Collectors.toList());
int num=listM!=null?listM.size():0;
action.setCount(Double.parseDouble(num + ""));
if (action.getParentId() == null) {
list.add(action);
} else {
if (tmpMap.get(action.getParentId().toString()) == null) {
ArrayList<EquipmentCategory> tmplist = new ArrayList<EquipmentCategory>();
tmplist.add(action);
tmpMap.put(action.getParentId().toString(), tmplist);
} else {
if (!tmpMap.get(action.getParentId().toString()).contains(action)) {
tmpMap.get(action.getParentId().toString()).add(action);
}
}
}
});
getChildren(list, tmpMap);
return list;
}
@Override @Override
public Object refreshEquipmentTypeAndCount(String bizOrgCode) { public Object refreshEquipmentTypeAndCount(String bizOrgCode) {
List<EquipmentCategory> responseList = this.typeList(); List<EquipmentCategory> responseList = this.typeList();
......
...@@ -304,6 +304,57 @@ ...@@ -304,6 +304,57 @@
left join wl_industry i on ec.industry_code = i.code left join wl_industry i on ec.industry_code = i.code
</select> </select>
<select id="getEquipmentCategoryListNew" resultMap="Category">
SELECT ec.id,
ec.parent_id,
ec.CODE,
ec.NAME,
ec.is_consumptive,
ec.description,
ec.industry_code,
ec.remark,
ec.create_date,
i.`name` as industryName,
-- industry_code = 2代表消防设备
IF(LEFT(ec.CODE, 1) = #{head} and ec.industry_code = 2, 'car', 'equipment')
AS type
FROM wl_equipment_category ec
left join wl_industry i on ec.industry_code = i.code
WHERE 1=1
<if test="type != null">
and left(ec.code,1) != '2'
and left(ec.code,4) !='9306'
and ec.industry_code = 2
</if>
</select>
<select id="getequipmentListEQNew" resultType="Map">
SELECT
`s`.`biz_org_code` AS `bizOrgCode`,
`c`.`code` AS `categoryCode`,
`getParentListEQ` ( `c`.`id` ) AS `code`
FROM
( ( `wl_equipment_specific` `s` JOIN `wl_equipment` `e` ) JOIN `wl_equipment_category` `c` )
WHERE
(
( `s`.`equipment_code` = `e`.`code` )
AND ( `e`.`category_id` = `c`.`id` )
AND ( `s`.`biz_org_code` != '' )
)
</select>
<select id="getEquipmentCategoryListNotFacilities" resultMap="Category"> <select id="getEquipmentCategoryListNotFacilities" resultMap="Category">
SELECT ec.id, SELECT ec.id,
ec.parent_id, ec.parent_id,
......
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