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));
list.getRecords().parallelStream().forEach(item -> { }
if (StringUtil.isNotEmpty(item.getSystemId())) { Map<String, String> finalSystemNameMap = systemNameMap;
ArrayList<String> systemNames = new ArrayList<>();
List<String> systemIdList = Arrays.asList(item.getSystemId().split(",")); Map<String, String> unitNameMap = new HashMap<>();
systemIdList.parallelStream().forEach(id -> systemNames.add(systemNameMap.getOrDefault(id, ""))); if (CollUtil.isNotEmpty(unitList)) {
String join = String.join(",", systemNames); LambdaQueryWrapper<Unit> wrapper = new LambdaQueryWrapper<>();
item.setSystemName(join); 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 -> {
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<>();
List<String> systemIdList = Arrays.asList(item.getSystemId().split(","));
systemIdList.parallelStream().forEach(id -> systemNames.add(finalSystemNameMap.getOrDefault(id, "")));
String join = String.join(",", systemNames);
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,109 +2100,99 @@ ...@@ -2100,109 +2100,99 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList"> <select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
SELECT SELECT
wles.id, wles.id,
wles.qr_code, wles.qr_code,
CONCAT('01#',wles.qr_code) fullqrCode, CONCAT('01#',wles.qr_code) fullqrCode,
wled.standard, wled.standard,
wle.img, wle.img,
wles.name equipmentName, wle.unit_id as unitId,
wec.name as systemType, wles.name equipmentName,
concat_ws('-',wlws.full_name,wled.area) as full_name, wec.name as systemType,
wlws.name as belongBuildName, concat_ws('-',wlws.full_name,wled.area) as full_name,
wlun.NAME unitName, wlws.name as belongBuildName,
wles.system_id as systemId, wles.system_id as systemId,
wlsd.amount, 'equipment' as type,
wlsd.id as stockDetailId, wled.manufacturer_id as manufacturerId,
'equipment' as type, wles.code,
wlai.`name` manufacturerName, wles.iot_code as iotCode,
wles.code, wles.create_date as createDate,
wles.iot_code as iotCode, wled.code as eqtype,
case wlsd.`status` wles.biz_org_code as bizOrgCode,
when '1' then '在位' wles.biz_org_name as bizOrgName,
when '2' then '执勤' wles.equip_status as equipStatus,
when '3' then '维修' wec.industry_code as industryCode,
when '6' then '退役' wle.is_iot as wleIsIot
when '7' then '报废' FROM
when '10' then '车载' (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
when '11' then '损耗' LEFT JOIN wl_warehouse_structure wlws on wles.warehouse_structure_id = wlws.id
when '12' then '配装' 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
else '未入库' END as status, LEFT JOIN wl_equipment wle ON wle.id = wled.equipment_id
wles.create_date as createDate, LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id
wled.code as eqtype, WHERE 1=1
wles.biz_org_code as bizOrgCode, <if test="codeHead!=null and codeHead!='' and codeHead!=' '">
wles.biz_org_name as bizOrgName, and LEFT (wle.CODE, #{hierarchy}) = #{codeHead}
wles.equip_status as equipStatus </if>
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 <if test="equipTypeAmountPage.teamId!=null">
LEFT JOIN (select id,amount,status,equipment_specific_id,warehouse_structure_id from wl_stock_detail ) wlsd on wlsd.equipment_specific_id = wles.id and wles.team_id = #{equipTypeAmountPage.teamId}
LEFT JOIN wl_warehouse_structure wlws on wlsd.warehouse_structure_id = wlws.id </if>
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 <if test="equipTypeAmountPage.systemId!=null">
LEFT JOIN wl_equipment wle ON wle.id = wled.equipment_id and wles.system_id = #{equipTypeAmountPage.systemId}
LEFT JOIN wl_unit wlun ON wle.unit_id = wlun.id </if>
LEFT JOIN wl_manufacturer_info wlai on wled.manufacturer_id=wlai.id <if test="equipTypeAmountPage.manufacturerId!=null">
LEFT JOIN wl_equipment_category wec ON wle.category_id = wec.id and wled.manufacturer_id = #{equipTypeAmountPage.manufacturerId}
WHERE 1=1 </if>
<if test="codeHead!=null and codeHead!='' and codeHead!=' '"> <if test="equipTypeAmountPage.isImport!=null">
and LEFT (wle.CODE, #{hierarchy}) = #{codeHead} and wled.is_import = #{equipTypeAmountPage.isImport}
<!-- and wec.`code` like concat(#{codeHead}, '%')--> </if>
</if> <if test="equipTypeAmountPage.warehouseStructureId!=null">
<if test="equipTypeAmountPage.industryCode!=null"> and wles.warehouse_structure_id in (
and wec.industry_code = #{equipTypeAmountPage.industryCode} select id from wl_warehouse_structure where parent_id in(
</if> select id from wl_warehouse_structure where parent_id = #{equipTypeAmountPage.warehouseStructureId})
<if test="equipTypeAmountPage.teamId!=null"> union
and wles.team_id = #{equipTypeAmountPage.teamId} select id from wl_warehouse_structure where parent_id = #{equipTypeAmountPage.warehouseStructureId} or
</if> id = #{equipTypeAmountPage.warehouseStructureId}
<if test="equipTypeAmountPage.systemId!=null"> )
and wles.system_id = #{equipTypeAmountPage.systemId} </if>
</if> <if test="equipTypeAmountPage.status == 1">
<if test="equipTypeAmountPage.manufacturerId!=null"> and wles.warehouse_structure_id is null
and wled.manufacturer_id = #{equipTypeAmountPage.manufacturerId} </if>
</if>
<if test="equipTypeAmountPage.isImport!=null"> <if test="equipTypeAmountPage.status == 0">
and wled.is_import = #{equipTypeAmountPage.isImport} and wles.warehouse_structure_id is not null
</if> </if>
<if test="equipTypeAmountPage.warehouseStructureId!=null"> <if test="equipTypeAmountPage.equipmentName!=null and equipTypeAmountPage.equipmentName!=''">
and wlsd.warehouse_structure_id in ( AND wled.name LIKE CONCAT('%',#{equipTypeAmountPage.equipmentName},'%')
select id from wl_warehouse_structure where parent_id in( </if>
select id from wl_warehouse_structure where parent_id = #{equipTypeAmountPage.warehouseStructureId}) <if test="equipTypeAmountPage.nameOrCode!=null and equipTypeAmountPage.nameOrCode!=''">
union AND (wled.name LIKE CONCAT('%',#{equipTypeAmountPage.nameOrCode},'%') or wles.code LIKE CONCAT('%',#{equipTypeAmountPage.nameOrCode},'%'))
select id from wl_warehouse_structure where parent_id = #{equipTypeAmountPage.warehouseStructureId} or </if>
id = #{equipTypeAmountPage.warehouseStructureId} <if test="equipTypeAmountPage.code!=null and equipTypeAmountPage.code!=''">
) AND wles.code LIKE CONCAT('%',#{equipTypeAmountPage.code},'%')
</if> </if>
<if test="equipTypeAmountPage.status == 1"> <if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
and wlsd.warehouse_structure_id is null AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if> </if>
<if test="equipTypeAmountPage.isIot!=null">
and wle.is_iot=#{equipTypeAmountPage.isIot} <if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
</if> AND concat_ws('-',wlws.full_name,wled.area) LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
<if test="equipTypeAmountPage.status == 0"> </if>
and wlsd.warehouse_structure_id is not null <if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
</if> AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
<if test="equipTypeAmountPage.equipmentName!=null and equipTypeAmountPage.equipmentName!=''"> </if>
AND wled.name LIKE CONCAT('%',#{equipTypeAmountPage.equipmentName},'%') <if test="equipTypeAmountPage.industryCode!=null">
</if> AND wec.industry_code = #{equipTypeAmountPage.industryCode}
<if test="equipTypeAmountPage.nameOrCode!=null and equipTypeAmountPage.nameOrCode!=''"> </if>
AND (wled.name LIKE CONCAT('%',#{equipTypeAmountPage.nameOrCode},'%') or wles.code LIKE CONCAT('%',#{equipTypeAmountPage.nameOrCode},'%')) <if test="equipTypeAmountPage.isIot!=null">
</if> AND wle.is_iot = #{equipTypeAmountPage.isIot}
<if test="equipTypeAmountPage.code!=null and equipTypeAmountPage.code!=''"> </if>
AND wles.code LIKE CONCAT('%',#{equipTypeAmountPage.code},'%') order by createDate DESC
</if> </select>
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
AND concat_ws('-',wlws.full_name,wled.area) LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
order by createDate DESC
</select>
<select id="listByBizOrgCode" resultType="java.util.Map"> <select id="listByBizOrgCode" resultType="java.util.Map">
SELECT SELECT
......
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