Commit 8e2e4cec authored by KeYong's avatar KeYong

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

parents dcf4873b df7a0674
...@@ -28,6 +28,8 @@ public class EquipTypeImgAmountVO { ...@@ -28,6 +28,8 @@ public class EquipTypeImgAmountVO {
private String iotCode; private String iotCode;
@ApiModelProperty(value = "单位数量名称") @ApiModelProperty(value = "单位数量名称")
private String unitName; private String unitName;
@ApiModelProperty(value = "单位Id")
private String unitId;
@ApiModelProperty(value = "规格型号") @ApiModelProperty(value = "规格型号")
private String standard; private String standard;
@ApiModelProperty(value = "图片") @ApiModelProperty(value = "图片")
...@@ -38,6 +40,8 @@ public class EquipTypeImgAmountVO { ...@@ -38,6 +40,8 @@ public class EquipTypeImgAmountVO {
private String systemName; private String systemName;
@ApiModelProperty(value = "供应商名") @ApiModelProperty(value = "供应商名")
private String manufacturerName; private String manufacturerName;
@ApiModelProperty(value = "供应商Id")
private String manufacturerId;
@ApiModelProperty(value = "状态:在位。。。") @ApiModelProperty(value = "状态:在位。。。")
private String status; private String status;
@ApiModelProperty(value = "装备类型") @ApiModelProperty(value = "装备类型")
......
package com.yeejoin.equipmanage.common.enums;
public enum EquipStatusEquipPageEnum {
ZW("1", "在位"),
ZQ("2", "执勤"),
WX("3", "维修"),
TY("6", "退役"),
BF("7", "报废"),
CZ("10", "车载"),
SH("11", "损耗"),
PZ("12", "配装");
private String code;
private String describe;
private EquipStatusEquipPageEnum(String code, String describe) {
this.code = code;
this.describe = describe;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getDescribe() {
return describe;
}
public void setDescribe(String describe) {
this.describe = describe;
}
public static String getDescribe(String code) {
String describe = "未入库";
for (EquipStatusEquipPageEnum type : EquipStatusEquipPageEnum.values()) {
if (type.getCode().equals(code)) {
describe = type.getDescribe();
break;
}
}
return describe;
}
}
...@@ -181,6 +181,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -181,6 +181,16 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Lazy @Lazy
IWlCarMileageService iWlCarMileageService; IWlCarMileageService iWlCarMileageService;
@Autowired
private UnitMapper unitMapper;
@Autowired
private ManufacturerInfoMapper manufacturerInfoMapper;
@Autowired
private StockDetailMapper stockDetailMapper;
@Override @Override
public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) { public List<EquipCountBySystemVO> getEquipCountBySystemId(Long systemId) {
return this.baseMapper.getEquipCountBySystemId(systemId); return this.baseMapper.getEquipCountBySystemId(systemId);
...@@ -1012,30 +1022,89 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -1012,30 +1022,89 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
.getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage); .getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
ArrayList<String> systemIds = new ArrayList<>(); ArrayList<String> systemIds = new ArrayList<>();
ArrayList<String> unitList = new ArrayList<>();
ArrayList<String> manufacturerIds = new ArrayList<>();
ArrayList<Long> equipIds = new ArrayList<>();
list.getRecords().forEach(x -> { list.getRecords().forEach(x -> {
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]);
}
if (StringUtil.isNotEmpty(x.getSystemId())) { if (StringUtil.isNotEmpty(x.getSystemId())) {
List<String> systemId = Arrays.asList(x.getSystemId().split(",")); List<String> systemId = Arrays.asList(x.getSystemId().split(","));
systemIds.addAll(systemId); systemIds.addAll(systemId);
} }
if (StringUtil.isNotEmpty(x.getUnitId())) {
unitList.add(x.getUnitId());
}
if (StringUtil.isNotEmpty(x.getManufacturerId())) {
manufacturerIds.add(x.getManufacturerId());
}
equipIds.add(x.getId());
}); });
// 系统名称处理
Map<String, String> systemNameMap = new HashMap<>();
if (CollUtil.isNotEmpty(systemIds)) { if (CollUtil.isNotEmpty(systemIds)) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(FireFightingSystemEntity::getId, systemIds); wrapper.in(FireFightingSystemEntity::getId, systemIds);
List<FireFightingSystemEntity> fireSystemList = fireFightingSystemMapper.selectList(wrapper); List<FireFightingSystemEntity> fireSystemList = fireFightingSystemMapper.selectList(wrapper);
Map<String, String> systemNameMap = fireSystemList.stream().collect(Collectors.toMap(t -> t.getId().toString(), FireFightingSystemEntity::getName)); systemNameMap = fireSystemList.stream().collect(Collectors.toMap(t -> t.getId().toString(), FireFightingSystemEntity::getName));
}
Map<String, String> finalSystemNameMap = systemNameMap;
Map<String, String> unitNameMap = new HashMap<>();
if (CollUtil.isNotEmpty(unitList)) {
LambdaQueryWrapper<Unit> wrapper = new LambdaQueryWrapper<>();
wrapper.in(Unit::getId, unitList);
List<Unit> units = unitMapper.selectList(wrapper);
unitNameMap = units.stream().collect(Collectors.toMap(t -> t.getId().toString(), Unit::getName));
}
Map<String, String> finalUnitNameMap = unitNameMap;
Map<String, String> manufacturerIdMap = new HashMap<>();
if (CollUtil.isNotEmpty(manufacturerIds)) {
LambdaQueryWrapper<ManufacturerInfo> wrapper = new LambdaQueryWrapper<>();
wrapper.in(ManufacturerInfo::getId, manufacturerIds);
List<ManufacturerInfo> manufacturerInfoList = manufacturerInfoMapper.selectList(wrapper);
manufacturerIdMap = manufacturerInfoList.stream().collect(Collectors.toMap(t -> t.getId().toString(), ManufacturerInfo::getName));
}
Map<String, String> finalManufacturerIdMap = manufacturerIdMap;
Map<Long, StockDetail> stockMap = new HashMap<>();
if (CollUtil.isNotEmpty(equipIds)) {
LambdaQueryWrapper<StockDetail> wrapper = new LambdaQueryWrapper<>();
wrapper.in(StockDetail::getEquipmentSpecificId, equipIds);
List<StockDetail> selectList = stockDetailMapper.selectList(wrapper);
stockMap = selectList.stream().collect(Collectors.toMap(StockDetail::getEquipmentSpecificId, t -> t));
}
Map<Long, StockDetail> finalStockDetailMap = stockMap;
list.getRecords().parallelStream().forEach(item -> { list.getRecords().parallelStream().forEach(item -> {
if (StringUtil.isNotEmpty(item.getSystemId())) { if (!item.getEqtype().startsWith("4")
&& !ObjectUtils.isEmpty(finalStockDetailMap.get(item.getId()))
&& !ObjectUtils.isEmpty(finalStockDetailMap.get(item.getId()).getAmount())) {
item.setAmount(finalStockDetailMap.get(item.getId()).getAmount().toString().split("\\.")[0]);
}
if (StringUtil.isNotEmpty(item.getSystemId()) && !ObjectUtils.isEmpty(finalSystemNameMap)) {
ArrayList<String> systemNames = new ArrayList<>(); ArrayList<String> systemNames = new ArrayList<>();
List<String> systemIdList = Arrays.asList(item.getSystemId().split(",")); List<String> systemIdList = Arrays.asList(item.getSystemId().split(","));
systemIdList.parallelStream().forEach(id -> systemNames.add(systemNameMap.getOrDefault(id, ""))); systemIdList.parallelStream().forEach(id -> systemNames.add(finalSystemNameMap.getOrDefault(id, "")));
String join = String.join(",", systemNames); String join = String.join(",", systemNames);
item.setSystemName(join); item.setSystemName(join);
} }
}); if (StringUtil.isNotEmpty(item.getUnitId()) && !ObjectUtils.isEmpty(finalUnitNameMap)) {
item.setUnitName(finalUnitNameMap.getOrDefault(item.getUnitId(), ""));
}
if (StringUtil.isNotEmpty(item.getManufacturerId()) && !ObjectUtils.isEmpty(finalManufacturerIdMap)) {
item.setManufacturerName(finalManufacturerIdMap.getOrDefault(item.getManufacturerId(), ""));
} }
if (!ObjectUtils.isEmpty(finalStockDetailMap) && !ObjectUtils.isEmpty(finalStockDetailMap.get(item.getId()))) {
item.setStatus(EquipStatusEquipPageEnum.getDescribe(finalStockDetailMap.get(item.getId()).getStatus()));
item.setStockDetailId(finalStockDetailMap.get(item.getId()).getId());
}
});
return list; return list;
} }
......
...@@ -2100,6 +2100,7 @@ ...@@ -2100,6 +2100,7 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList"> <select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
SELECT SELECT
...@@ -2108,50 +2109,34 @@ ...@@ -2108,50 +2109,34 @@
CONCAT('01#',wles.qr_code) fullqrCode, CONCAT('01#',wles.qr_code) fullqrCode,
wled.standard, wled.standard,
wle.img, wle.img,
wle.unit_id as unitId,
wles.name equipmentName, wles.name equipmentName,
wec.name as systemType, wec.name as systemType,
concat_ws('-',wlws.full_name,wled.area) as full_name, concat_ws('-',wlws.full_name,wled.area) as full_name,
wlws.name as belongBuildName, wlws.name as belongBuildName,
wlun.NAME unitName,
wles.system_id as systemId, wles.system_id as systemId,
wlsd.amount,
wlsd.id as stockDetailId,
'equipment' as type, 'equipment' as type,
wlai.`name` manufacturerName, wled.manufacturer_id as manufacturerId,
wles.code, wles.code,
wles.iot_code as iotCode, wles.iot_code as iotCode,
case wlsd.`status`
when '1' then '在位'
when '2' then '执勤'
when '3' then '维修'
when '6' then '退役'
when '7' then '报废'
when '10' then '车载'
when '11' then '损耗'
when '12' then '配装'
else '未入库' END as status,
wles.create_date as createDate, wles.create_date as createDate,
wled.code as eqtype, wled.code as eqtype,
wles.biz_org_code as bizOrgCode, wles.biz_org_code as bizOrgCode,
wles.biz_org_name as bizOrgName, wles.biz_org_name as bizOrgName,
wles.equip_status as equipStatus wles.equip_status as equipStatus,
wec.industry_code as industryCode,
wle.is_iot as wleIsIot
FROM FROM
(select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id,equip_status from wl_equipment_specific) wles (select id,name,qr_code,code ,iot_code ,biz_org_code,team_id ,biz_org_name,create_date ,equipment_detail_id ,system_id,equip_status, warehouse_structure_id from wl_equipment_specific) wles
LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id LEFT JOIN wl_warehouse_structure wlws on wles.warehouse_structure_id = wlws.id
LEFT JOIN wl_warehouse_structure wlws on wlsd.warehouse_structure_id = wlws.id
LEFT JOIN (select id,standard ,name ,area ,code, equipment_id ,manufacturer_id,is_import from wl_equipment_detail) wled on wles.equipment_detail_id = wled.id LEFT JOIN (select id,standard ,name ,area ,code, equipment_id ,manufacturer_id,is_import from wl_equipment_detail) wled on wles.equipment_detail_id = wled.id
LEFT JOIN wl_equipment wle ON wle.id = wled.equipment_id LEFT JOIN wl_equipment wle ON wle.id = wled.equipment_id
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id
LEFT JOIN wl_manufacturer_info wlai on wled.manufacturer_id=wlai.id
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
WHERE 1=1 WHERE 1=1
<if test="codeHead!=null and codeHead!='' and codeHead!=' '"> <if test="codeHead!=null and codeHead!='' and codeHead!=' '">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead} and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
<!-- and wec.`code` like concat(#{codeHead}, '%')-->
</if>
<if test="equipTypeAmountPage.industryCode!=null">
and wec.industry_code = #{equipTypeAmountPage.industryCode}
</if> </if>
<if test="equipTypeAmountPage.teamId!=null"> <if test="equipTypeAmountPage.teamId!=null">
and wles.team_id = #{equipTypeAmountPage.teamId} and wles.team_id = #{equipTypeAmountPage.teamId}
</if> </if>
...@@ -2165,7 +2150,7 @@ ...@@ -2165,7 +2150,7 @@
and wled.is_import = #{equipTypeAmountPage.isImport} and wled.is_import = #{equipTypeAmountPage.isImport}
</if> </if>
<if test="equipTypeAmountPage.warehouseStructureId!=null"> <if test="equipTypeAmountPage.warehouseStructureId!=null">
and wlsd.warehouse_structure_id in ( and wles.warehouse_structure_id in (
select id from wl_warehouse_structure where parent_id in( select id from wl_warehouse_structure where parent_id in(
select id from wl_warehouse_structure where parent_id = #{equipTypeAmountPage.warehouseStructureId}) select id from wl_warehouse_structure where parent_id = #{equipTypeAmountPage.warehouseStructureId})
union union
...@@ -2174,13 +2159,11 @@ ...@@ -2174,13 +2159,11 @@
) )
</if> </if>
<if test="equipTypeAmountPage.status == 1"> <if test="equipTypeAmountPage.status == 1">
and wlsd.warehouse_structure_id is null and wles.warehouse_structure_id is null
</if>
<if test="equipTypeAmountPage.isIot!=null">
and wle.is_iot=#{equipTypeAmountPage.isIot}
</if> </if>
<if test="equipTypeAmountPage.status == 0"> <if test="equipTypeAmountPage.status == 0">
and wlsd.warehouse_structure_id is not null and wles.warehouse_structure_id is not null
</if> </if>
<if test="equipTypeAmountPage.equipmentName!=null and equipTypeAmountPage.equipmentName!=''"> <if test="equipTypeAmountPage.equipmentName!=null and equipTypeAmountPage.equipmentName!=''">
AND wled.name LIKE CONCAT('%',#{equipTypeAmountPage.equipmentName},'%') AND wled.name LIKE CONCAT('%',#{equipTypeAmountPage.equipmentName},'%')
...@@ -2201,9 +2184,16 @@ ...@@ -2201,9 +2184,16 @@
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''"> <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%') AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if> </if>
<if test="equipTypeAmountPage.industryCode!=null">
AND wec.industry_code = #{equipTypeAmountPage.industryCode}
</if>
<if test="equipTypeAmountPage.isIot!=null">
AND wle.is_iot = #{equipTypeAmountPage.isIot}
</if>
order by createDate DESC order by createDate DESC
</select> </select>
<select id="listByBizOrgCode" resultType="java.util.Map"> <select id="listByBizOrgCode" resultType="java.util.Map">
SELECT SELECT
form_group_id typeId, form_group_id typeId,
......
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