处理问题

This commit is contained in:
wanggeng 2021-08-17 11:23:33 +08:00
parent d038ae066d
commit 020a201381
3 changed files with 41 additions and 42 deletions

View File

@ -158,41 +158,7 @@ public class DataRealServiceImpl extends AbstractService implements IDataRealSer
@Override @Override
public List<DataRealDTO> list(Map<String, Object> params) { public List<DataRealDTO> list(Map<String, Object> params) {
List<DataRealDTO> dataRealDTOs = dataMinuteDao.list(params); List<DataRealDTO> dataRealDTOs = dataMinuteDao.list(params);
setDataRealInfo(dataRealDTOs);
Set<String> enterpriseIdSet = new HashSet<>();
Set<String> instrumentIdSet = new HashSet<>();
for (DataRealDTO dataRealDTO : dataRealDTOs) {
enterpriseIdSet.add(dataRealDTO.getEnterpriseId());
instrumentIdSet.add(dataRealDTO.getInstrumentId());
}
List<EnterprisePO> enterprisePOs = enterpriseService.listPO(new ArrayList<>(enterpriseIdSet));
List<InstrumentPO> instrumentPOs = instrumentService.listPO(new ArrayList<>(instrumentIdSet));
List<PollPO> pollPOs = pollService.listPO(new HashMap<>());
for (DataRealDTO dataRealDTO : dataRealDTOs) {
for (EnterprisePO enterprisePO : enterprisePOs) {
if (StringUtils.equals(dataRealDTO.getEnterpriseId(), enterprisePO.getEnterpriseId())) {
dataRealDTO.setEnterpriseName(enterprisePO.getEnterpriseName());
break;
}
}
for (InstrumentPO instrumentPO : instrumentPOs) {
if (StringUtils.equals(dataRealDTO.getInstrumentId(), instrumentPO.getInstrumentId())) {
dataRealDTO.setInstrumentName(instrumentPO.getInstrumentName());
break;
}
}
for (PollPO pollPO : pollPOs) {
if (StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNo()) ||
StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNoOld())) {
dataRealDTO.setPollName(pollPO.getPollName());
break;
}
}
}
return dataRealDTOs; return dataRealDTOs;
} }
@ -300,4 +266,43 @@ public class DataRealServiceImpl extends AbstractService implements IDataRealSer
return listLastData; return listLastData;
} }
private void setDataRealInfo(List<DataRealDTO> dataRealDTOs) {
if (dataRealDTOs.isEmpty()) {
return;
}
Set<String> enterpriseIdSet = new HashSet<>();
Set<String> instrumentIdSet = new HashSet<>();
for (DataRealDTO dataRealDTO : dataRealDTOs) {
enterpriseIdSet.add(dataRealDTO.getEnterpriseId());
instrumentIdSet.add(dataRealDTO.getInstrumentId());
}
List<EnterprisePO> enterprisePOs = enterpriseService.listPO(new ArrayList<>(enterpriseIdSet));
List<InstrumentPO> instrumentPOs = instrumentService.listPO(new ArrayList<>(instrumentIdSet));
List<PollPO> pollPOs = pollService.listPO(new HashMap<>());
for (DataRealDTO dataRealDTO : dataRealDTOs) {
for (EnterprisePO enterprisePO : enterprisePOs) {
if (StringUtils.equals(dataRealDTO.getEnterpriseId(), enterprisePO.getEnterpriseId())) {
dataRealDTO.setEnterpriseName(enterprisePO.getEnterpriseName());
break;
}
}
for (InstrumentPO instrumentPO : instrumentPOs) {
if (StringUtils.equals(dataRealDTO.getInstrumentId(), instrumentPO.getInstrumentId())) {
dataRealDTO.setInstrumentName(instrumentPO.getInstrumentName());
break;
}
}
for (PollPO pollPO : pollPOs) {
if (StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNo()) ||
StringUtils.equals(dataRealDTO.getPollId(), pollPO.getPollNoOld())) {
dataRealDTO.setPollName(pollPO.getPollName());
break;
}
}
}
}
} }

View File

@ -263,12 +263,6 @@
<if test="keywords != null and keywords != ''"> <if test="keywords != null and keywords != ''">
AND ( AND (
t1.poll_id LIKE CONCAT('%', #{keywords}, '%') t1.poll_id LIKE CONCAT('%', #{keywords}, '%')
OR
jt1.enterprise_name LIKE CONCAT('%', #{keywords}, '%')
OR
jt2.instrument_name LIKE CONCAT('%', #{keywords}, '%')
OR
jt3.poll_name LIKE CONCAT('%', #{keywords}, '%')
) )
</if> </if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">

View File

@ -18,7 +18,7 @@
<div class="layui-card-body"> <div class="layui-card-body">
<div class="test-table-reload-btn" style="margin-bottom: 10px;"> <div class="test-table-reload-btn" style="margin-bottom: 10px;">
<div class="layui-inline"> <div class="layui-inline">
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字"> <input type="text" id="keywords" class="layui-input search-item search-item-width-200" placeholder="输入污染物因子编码">
</div> </div>
<div class="layui-inline"> <div class="layui-inline">
<input type="text" id="startTime" class="layui-input search-item search-item-width-100" placeholder="开始时间" readonly> <input type="text" id="startTime" class="layui-input search-item search-item-width-100" placeholder="开始时间" readonly>