Commit e187a9d4 authored by 刘凡's avatar 刘凡

优化:设备列表详细地址的展示

parent 172b2168
...@@ -124,4 +124,7 @@ public class JgChangeRegistrationTransferDto extends BaseDto { ...@@ -124,4 +124,7 @@ public class JgChangeRegistrationTransferDto extends BaseDto {
@ApiModelProperty (value = "下一节点可执行人") @ApiModelProperty (value = "下一节点可执行人")
private String nextExecuteUserIds; private String nextExecuteUserIds;
@ApiModelProperty(value = "设备移装完整详细地址")
private String fullAddress;
} }
...@@ -239,4 +239,11 @@ public class JgChangeRegistrationTransfer extends BaseEntity { ...@@ -239,4 +239,11 @@ public class JgChangeRegistrationTransfer extends BaseEntity {
@TableField(value = "next_execute_user_ids") @TableField(value = "next_execute_user_ids")
private String nextExecuteUserIds; private String nextExecuteUserIds;
/**
* 设备移装完整详细地址
*/
@TableField(value = "full_address")
private String fullAddress;
} }
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
crt.use_registration_code as useRegistrationCode, crt.use_registration_code as useRegistrationCode,
crt.next_execute_user_ids as nextExecuteUserIds, crt.next_execute_user_ids as nextExecuteUserIds,
crt.create_user_id as createUserId, crt.create_user_id as createUserId,
crt.full_address as address,
use.USE_UNIT_NAME as useUnitName, use.USE_UNIT_NAME as useUnitName,
(SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory, (SELECT name from tz_equipment_category where code = jri.EQU_CATEGORY) as equCategory,
jri.PRODUCT_NAME as productName, jri.PRODUCT_NAME as productName,
......
...@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.jg.biz.service; ...@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.jg.biz.service;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import java.util.List;
/** /**
* 使用信息表接口类 * 使用信息表接口类
* *
...@@ -14,4 +16,6 @@ public interface IIdxBizJgUseInfoService { ...@@ -14,4 +16,6 @@ public interface IIdxBizJgUseInfoService {
boolean saveOrUpdateData(IdxBizJgUseInfo useInfo); boolean saveOrUpdateData(IdxBizJgUseInfo useInfo);
IdxBizJgUseInfo getOneData(String record); IdxBizJgUseInfo getOneData(String record);
List<IdxBizJgUseInfo> getUseInfoListByEquIds(List<String> equIds);
} }
...@@ -1072,19 +1072,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste ...@@ -1072,19 +1072,39 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
String status = ConstructionEnum.getName.get(integer); String status = ConstructionEnum.getName.get(integer);
dto2.put(CONSTRUCTIONTYPE, status); dto2.put(CONSTRUCTIONTYPE, status);
} }
//查询设备是否正在使用
//设备的使用标识是,安装告知和使用登记中有使用记录。
String equId = (String) dto2.get("SEQUENCE_NBR");
dto2.put("record",equId);
List<JgInstallationNoticeEq> installationNoticeEqList = jgInstallationNoticeEqServiceImpl.getListByEquId(equId);
List<JgUseRegistrationEq> useRegistrationEqList = jgUseRegistrationEqServiceImpl.getListByEquId(equId);
if(!ValidationUtil.isEmpty(installationNoticeEqList) || !ValidationUtil.isEmpty(useRegistrationEqList)){
dto2.put("IS_USE", true);
}else {
dto2.put("IS_USE", false);
}
list.add(dto2); list.add(dto2);
} }
// 获取所有设备的Id
List<String> equIds = null;
if(!ValidationUtil.isEmpty(list)){
equIds = list.stream().map(item -> item.get("SEQUENCE_NBR").toString()).collect(Collectors.toList());
}
//查询设备是否正在使用
//设备的使用标识是,安装告知和使用登记中有使用记录。
List<JgInstallationNoticeEq> installationNoticeEqList = jgInstallationNoticeEqServiceImpl.getListByEquIds(equIds);
List<JgUseRegistrationEq> useRegistrationEqList = jgUseRegistrationEqServiceImpl.getListByEquIds(equIds);
Map<String, Boolean> equIsUseMap = new HashMap<>();
if(!ValidationUtil.isEmpty(installationNoticeEqList) ){
equIsUseMap.putAll(installationNoticeEqList.stream().collect(Collectors.toMap(JgInstallationNoticeEq::getEquId, obj -> true)));
}
if(!ValidationUtil.isEmpty(useRegistrationEqList)){
equIsUseMap.putAll(useRegistrationEqList.stream().collect(Collectors.toMap(JgUseRegistrationEq::getEquId, obj -> true)));
}
// 查询设备地址
List<IdxBizJgUseInfo> useInfoListByEquIds = idxBizJgUseInfoService.getUseInfoListByEquIds(equIds);
Map<String, String> equAddressMap = new HashMap<>();
if(!ValidationUtil.isEmpty(useInfoListByEquIds)){
equAddressMap = useInfoListByEquIds.stream().collect(Collectors.toMap(IdxBizJgUseInfo::getRecord,
useInfo -> useInfo.getProvinceName() + "/" + useInfo.getCityName() + "/" + useInfo.getCountyName() + "/" + useInfo.getStreetName() + "/" + useInfo.getAddress()));
}
// 更新设备使用情况和设备地址
for(JSONObject item : list){
Boolean isUse = equIsUseMap.get(item.getString("SEQUENCE_NBR"));
String fullAddress = equAddressMap.get(item.getString("SEQUENCE_NBR"));
item.put("IS_USE", isUse ? isUse : false);
item.put("ADDRESS", !ValidationUtil.isEmpty(fullAddress) ? fullAddress : "");
}
totle = response.getInternalResponse().hits().getTotalHits().value; totle = response.getInternalResponse().hits().getTotalHits().value;
result.setRecords(list); result.setRecords(list);
result.setTotal(totle); result.setTotal(totle);
......
...@@ -3,12 +3,13 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl; ...@@ -3,12 +3,13 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService; import com.yeejoin.amos.boot.module.jg.biz.service.IIdxBizJgUseInfoService;
import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgUseInfoDto; import com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgUseInfoDto;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgRegisterInfo;
import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo; import com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgUseInfo;
import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper; import com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgUseInfoMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/** /**
* 使用信息表服务实现类 * 使用信息表服务实现类
* *
...@@ -26,4 +27,11 @@ public class IdxBizJgUseInfoServiceImpl extends BaseService<IdxBizJgUseInfoDto,I ...@@ -26,4 +27,11 @@ public class IdxBizJgUseInfoServiceImpl extends BaseService<IdxBizJgUseInfoDto,I
public IdxBizJgUseInfo getOneData(String record) { public IdxBizJgUseInfo getOneData(String record) {
return this.getOne(new QueryWrapper<IdxBizJgUseInfo>().eq("RECORD", record)); return this.getOne(new QueryWrapper<IdxBizJgUseInfo>().eq("RECORD", record));
} }
@Override
public List<IdxBizJgUseInfo> getUseInfoListByEquIds(List<String> equIds) {
QueryWrapper<IdxBizJgUseInfo> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(IdxBizJgUseInfo::getRecord, equIds);
return list(queryWrapper);
}
} }
\ No newline at end of file
...@@ -32,9 +32,9 @@ public class JgInstallationNoticeEqServiceImpl extends BaseService<JgInstallatio ...@@ -32,9 +32,9 @@ public class JgInstallationNoticeEqServiceImpl extends BaseService<JgInstallatio
return this.queryForList("" , false); return this.queryForList("" , false);
} }
public List<JgInstallationNoticeEq> getListByEquId(String equId) { public List<JgInstallationNoticeEq> getListByEquIds(List<String> equIds) {
QueryWrapper<JgInstallationNoticeEq> queryWrapper = new QueryWrapper<>(); QueryWrapper<JgInstallationNoticeEq> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(JgInstallationNoticeEq::getEquId,equId); queryWrapper.lambda().in(JgInstallationNoticeEq::getEquId, equIds);
queryWrapper.lambda().eq(JgInstallationNoticeEq::getIsDelete,false); queryWrapper.lambda().eq(JgInstallationNoticeEq::getIsDelete,false);
return list(queryWrapper); return list(queryWrapper);
} }
......
...@@ -33,9 +33,9 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio ...@@ -33,9 +33,9 @@ public class JgUseRegistrationEqServiceImpl extends BaseService<JgUseRegistratio
} }
public List<JgUseRegistrationEq> getListByEquId(String equId) { public List<JgUseRegistrationEq> getListByEquIds(List<String> equIds) {
QueryWrapper<JgUseRegistrationEq> queryWrapper = new QueryWrapper<>(); QueryWrapper<JgUseRegistrationEq> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(JgUseRegistrationEq::getEquId,equId); queryWrapper.lambda().in(JgUseRegistrationEq::getEquId, equIds);
queryWrapper.lambda().eq(JgUseRegistrationEq::getIsDelete,false); queryWrapper.lambda().eq(JgUseRegistrationEq::getIsDelete,false);
return list(queryWrapper); return list(queryWrapper);
} }
......
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