fix: 88263 首页-最新入库企标代替标准编号没有正常回显
This commit is contained in:
+27
-2
@@ -8,16 +8,19 @@ import com.jero.modules.laws.localTool.entity.StandardEarlyWarning;
|
|||||||
import com.jero.modules.laws.localTool.service.ILawsStandardEarlyWarningService;
|
import com.jero.modules.laws.localTool.service.ILawsStandardEarlyWarningService;
|
||||||
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
|
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
|
||||||
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
|
||||||
|
import com.jero.modules.laws.standard.entity.LawsReplacedStandard;
|
||||||
import com.jero.modules.laws.standard.entity.OutStandardStateEnum;
|
import com.jero.modules.laws.standard.entity.OutStandardStateEnum;
|
||||||
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
|
import com.jero.modules.laws.standard.service.ILawsDomesticStandardService;
|
||||||
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
import com.jero.modules.laws.standard.service.ILawsEnterpriseStandardService;
|
||||||
|
import com.jero.modules.laws.standard.service.ILawsReplacedStandardService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.time.LocalDate;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liao
|
* @Author: liao
|
||||||
@@ -33,6 +36,9 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
|
|||||||
@Resource
|
@Resource
|
||||||
private ILawsEnterpriseStandardService enterpriseStandardService;
|
private ILawsEnterpriseStandardService enterpriseStandardService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ILawsReplacedStandardService replacedStandardService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liao
|
* @Author: liao
|
||||||
* @Date: 2023/11/10 17:13
|
* @Date: 2023/11/10 17:13
|
||||||
@@ -76,7 +82,26 @@ public class LawsStandardEarlyWarningServiceImpl implements ILawsStandardEarlyWa
|
|||||||
queryWrapper.between(LawsEnterpriseStandard::getCreateTime, LocalDateTime.now().minusDays(90), LocalDateTime.now());
|
queryWrapper.between(LawsEnterpriseStandard::getCreateTime, LocalDateTime.now().minusDays(90), LocalDateTime.now());
|
||||||
queryWrapper.orderByDesc(LawsEnterpriseStandard::getCreateTime);
|
queryWrapper.orderByDesc(LawsEnterpriseStandard::getCreateTime);
|
||||||
IPage<LawsEnterpriseStandard> page = new Page<>(pageNo, pageSize);
|
IPage<LawsEnterpriseStandard> page = new Page<>(pageNo, pageSize);
|
||||||
return enterpriseStandardService.page(page, queryWrapper);
|
IPage<LawsEnterpriseStandard> dataPage = enterpriseStandardService.page(page, queryWrapper);
|
||||||
|
List<LawsEnterpriseStandard> records = dataPage.getRecords();
|
||||||
|
if (records.isEmpty()) {
|
||||||
|
return dataPage;
|
||||||
|
}
|
||||||
|
// 设置代替标准编号字段
|
||||||
|
List<String> replaceByNumberList = records.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<LawsReplacedStandard> replaceByNumberQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
replaceByNumberQueryWrapper.in(LawsReplacedStandard::getReplacedBy, replaceByNumberList);
|
||||||
|
replaceByNumberQueryWrapper.eq(LawsReplacedStandard::getType, "1");
|
||||||
|
List<LawsReplacedStandard> list = replacedStandardService.list(replaceByNumberQueryWrapper);
|
||||||
|
Map<String, List<LawsReplacedStandard>> replaceByMap = list.stream().collect(Collectors.groupingBy(LawsReplacedStandard::getReplacedBy));
|
||||||
|
records.forEach(data -> {
|
||||||
|
List<LawsReplacedStandard> replacedStandardList = replaceByMap.get(data.getStandardNumber());
|
||||||
|
if (replacedStandardList != null && !replacedStandardList.isEmpty()) {
|
||||||
|
String replaced = replacedStandardList.stream().map(LawsReplacedStandard::getReplaced).collect(Collectors.joining());
|
||||||
|
data.setReplacedByStandardNumber(replaced);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return dataPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user