fix(自定义对比): 自定义对比表格详情查询问题修复

This commit is contained in:
yjz
2023-10-27 16:05:05 +08:00
parent 40a3644e90
commit 8cca1d4188
3 changed files with 47 additions and 35 deletions
@@ -108,10 +108,10 @@ public class LawsCustomCompareInfoController {
@AutoLog(value = "自定义对比-标准列表分页查询") @AutoLog(value = "自定义对比-标准列表分页查询")
@ApiOperation(value="自定义对比-标准列表分页查询", notes="自定义对比-标准列表分页查询") @ApiOperation(value="自定义对比-标准列表分页查询", notes="自定义对比-标准列表分页查询")
@GetMapping(value = "/queryStandardByInfoId") @GetMapping(value = "/queryStandardByInfoId")
public Result<IPage<StandardVO>> queryStandardList(String id, public Result<IPage<StandardVO>> queryStandardList(String infoId,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo, @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) { @RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
return Result.OK(lawsCustomCompareInfoService.queryStandardByInfoId(id, pageNo, pageSize)); return Result.OK(lawsCustomCompareInfoService.queryStandardByInfoId(infoId, pageNo, pageSize));
} }
/** /**
@@ -121,8 +121,8 @@ public class LawsCustomCompareInfoController {
@AutoLog(value = "自定义对比-表格详情") @AutoLog(value = "自定义对比-表格详情")
@ApiOperation(value="自定义对比-表格详情", notes="自定义对比-表格详情") @ApiOperation(value="自定义对比-表格详情", notes="自定义对比-表格详情")
@GetMapping(value = "/queryTableDetail") @GetMapping(value = "/queryTableDetail")
public Result<TableDetailVO> queryTableDetail(String id) { public Result<TableDetailVO> queryTableDetail(String infoId) {
return Result.OK(lawsCustomCompareInfoService.queryTableDetail(id)); return Result.OK(lawsCustomCompareInfoService.queryTableDetail(infoId));
} }
/** /**
@@ -132,8 +132,8 @@ public class LawsCustomCompareInfoController {
@AutoLog(value = "自定义对比-清单维护列表查询") @AutoLog(value = "自定义对比-清单维护列表查询")
@ApiOperation(value="自定义对比-清单维护列表查询", notes="自定义对比-清单维护列表查询") @ApiOperation(value="自定义对比-清单维护列表查询", notes="自定义对比-清单维护列表查询")
@GetMapping(value = "/queryInventory") @GetMapping(value = "/queryInventory")
public Result<Map<String, Object>> queryInventoryByInfoId(String id) { public Result<Map<String, Object>> queryInventoryByInfoId(String infoId) {
return Result.OK(lawsCustomCompareInfoService.queryInventory(id)); return Result.OK(lawsCustomCompareInfoService.queryInventory(infoId));
} }
/** /**
@@ -232,8 +232,8 @@ public class LawsCustomCompareInfoController {
@AutoLog(value = "自定义对比-导出") @AutoLog(value = "自定义对比-导出")
@ApiOperation(value = "自定义对比-导出") @ApiOperation(value = "自定义对比-导出")
@GetMapping("/exportExcel") @GetMapping("/exportExcel")
public void exportExcel(String id,HttpServletRequest request, HttpServletResponse response) { public void exportExcel(String infoId, HttpServletRequest request, HttpServletResponse response) {
lawsCustomCompareInfoService.exportExcel(id, request, response); lawsCustomCompareInfoService.exportExcel(infoId, request, response);
} }
} }
@@ -62,10 +62,10 @@ public interface ILawsCustomCompareInfoService extends IService<LawsCustomCompar
/** /**
* 自定义对比-表格详情 * 自定义对比-表格详情
* @param id * @param infoId
* @return * @return
*/ */
TableDetailVO queryTableDetail(String id); TableDetailVO queryTableDetail(String infoId);
/** /**
* 自定义对比-根据id删除 * 自定义对比-根据id删除
@@ -75,16 +75,16 @@ public interface ILawsCustomCompareInfoService extends IService<LawsCustomCompar
/** /**
* 自定义对比-清单维护列表查询 * 自定义对比-清单维护列表查询
* @param id * @param infoId
*/ */
Map<String, Object> queryInventory(String id); Map<String, Object> queryInventory(String infoId);
/** /**
* 自定义对比-标准列表分页查询 * 自定义对比-标准列表分页查询
* @param id * @param infoId
* @return * @return
*/ */
IPage<StandardVO> queryStandardByInfoId(String id,Integer pageNo, Integer pageSize); IPage<StandardVO> queryStandardByInfoId(String infoId,Integer pageNo, Integer pageSize);
/** /**
* 自定义对比-删除标准列表 * 自定义对比-删除标准列表
@@ -98,7 +98,7 @@ public interface ILawsCustomCompareInfoService extends IService<LawsCustomCompar
* @param request * @param request
* @param response * @param response
*/ */
void exportExcel(String id, HttpServletRequest request, HttpServletResponse response); void exportExcel(String infoId, HttpServletRequest request, HttpServletResponse response);
/** /**
* 自定义对比-清单维护编辑 * 自定义对比-清单维护编辑
@@ -120,6 +120,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
queryWrapper.eq("i.create_by", loginUser.getId()); queryWrapper.eq("i.create_by", loginUser.getId());
queryWrapper.eq("is_show", LawsCustomCompareCommon.IS_SHOW_1); queryWrapper.eq("is_show", LawsCustomCompareCommon.IS_SHOW_1);
} }
queryWrapper.eq("i.del_flag", 0);
return lawsCustomCompareInfoMapper.queryByPage(new Page<>(pageNo, pageSize), queryWrapper); return lawsCustomCompareInfoMapper.queryByPage(new Page<>(pageNo, pageSize), queryWrapper);
} }
@@ -224,14 +225,14 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
@Override @Override
public TableDetailVO queryTableDetail(String id) { public TableDetailVO queryTableDetail(String infoId) {
TableDetailVO tableDetailVO = new TableDetailVO(); TableDetailVO tableDetailVO = new TableDetailVO();
// 处理表头 // 处理表头
setCountryMap(id, tableDetailVO); setCountryMap(infoId, tableDetailVO);
// 处理特点/对比项 // 处理特点/对比项
setRanksMap(id, tableDetailVO); setRanksMap(infoId, tableDetailVO);
// 处理单元格 // 处理单元格
setList(id, tableDetailVO); setList(infoId, tableDetailVO);
return tableDetailVO; return tableDetailVO;
} }
@@ -254,10 +255,10 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
@Override @Override
public Map<String, Object> queryInventory(String id) { public Map<String, Object> queryInventory(String infoId) {
List<LawsCustomCompareInventory> list = lawsCustomCompareInventoryService.list( List<LawsCustomCompareInventory> list = lawsCustomCompareInventoryService.list(
new LambdaQueryWrapper<LawsCustomCompareInventory>() new LambdaQueryWrapper<LawsCustomCompareInventory>()
.eq(LawsCustomCompareInventory::getInfoId, id)); .eq(LawsCustomCompareInventory::getInfoId, infoId));
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
// 特点 // 特点
@@ -285,11 +286,11 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
@Override @Override
public IPage<StandardVO> queryStandardByInfoId(String id, Integer pageNo, Integer pageSize){ public IPage<StandardVO> queryStandardByInfoId(String infoId, Integer pageNo, Integer pageSize){
// 自定义对比_标准 关联表 // 自定义对比_标准 关联表
List<LawsCustomCompareInfoStandard> list = lawsCustomCompareInfoStandardService.list( List<LawsCustomCompareInfoStandard> list = lawsCustomCompareInfoStandardService.list(
new LambdaQueryWrapper<LawsCustomCompareInfoStandard>() new LambdaQueryWrapper<LawsCustomCompareInfoStandard>()
.eq(LawsCustomCompareInfoStandard::getInfoId, id) .eq(LawsCustomCompareInfoStandard::getInfoId, infoId)
.orderByAsc(LawsCustomCompareInfoStandard::getCreateTime)); .orderByAsc(LawsCustomCompareInfoStandard::getCreateTime));
if (!list.isEmpty()){ if (!list.isEmpty()){
// 查询标准数据 // 查询标准数据
@@ -311,9 +312,9 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
@Override @Override
public void exportExcel(String id, HttpServletRequest request, HttpServletResponse response) { public void exportExcel(String infoId, HttpServletRequest request, HttpServletResponse response) {
// 获取清单数据 // 获取清单数据
TableDetailVO tableDetailVO = queryTableDetail(id); TableDetailVO tableDetailVO = queryTableDetail(infoId);
// 获取国家/地区内容和标准内容 // 获取国家/地区内容和标准内容
Map<String, List<StandardVO>> countryMap = tableDetailVO.getCountryMap(); Map<String, List<StandardVO>> countryMap = tableDetailVO.getCountryMap();
// 内容整合 // 内容整合
@@ -522,17 +523,17 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
} }
private void setList(String id, TableDetailVO tableDetailVO) { private void setList(String infoId, TableDetailVO tableDetailVO) {
List<LawsCustomCompareCell> cellList = lawsCustomCompareCellService.list( List<LawsCustomCompareCell> cellList = lawsCustomCompareCellService.list(
new LambdaQueryWrapper<LawsCustomCompareCell>() new LambdaQueryWrapper<LawsCustomCompareCell>()
.eq(LawsCustomCompareCell::getInfoId, id)); .eq(LawsCustomCompareCell::getInfoId, infoId));
tableDetailVO.setList(cellList); tableDetailVO.setList(cellList);
} }
private void setRanksMap(String id, TableDetailVO tableDetailVO) { private void setRanksMap(String infoId, TableDetailVO tableDetailVO) {
List<LawsCustomCompareInventory> inventoryList = lawsCustomCompareInventoryService.list( List<LawsCustomCompareInventory> inventoryList = lawsCustomCompareInventoryService.list(
new LambdaQueryWrapper<LawsCustomCompareInventory>() new LambdaQueryWrapper<LawsCustomCompareInventory>()
.eq(LawsCustomCompareInventory::getInfoId, id) .eq(LawsCustomCompareInventory::getInfoId, infoId)
.orderByAsc(LawsCustomCompareInventory::getCreateTime)); .orderByAsc(LawsCustomCompareInventory::getCreateTime));
if (!inventoryList.isEmpty()){ if (!inventoryList.isEmpty()){
List<SysDictItem> sysDictItemList = getDicItem("inventory_type"); List<SysDictItem> sysDictItemList = getDicItem("inventory_type");
@@ -561,10 +562,10 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
} }
} }
private void setCountryMap(String id, TableDetailVO tableDetailVO) { private void setCountryMap(String infoId, TableDetailVO tableDetailVO) {
List<LawsCustomCompareInfoStandard> infoStandardList = lawsCustomCompareInfoStandardService.list( List<LawsCustomCompareInfoStandard> infoStandardList = lawsCustomCompareInfoStandardService.list(
new LambdaQueryWrapper<LawsCustomCompareInfoStandard>() new LambdaQueryWrapper<LawsCustomCompareInfoStandard>()
.eq(LawsCustomCompareInfoStandard::getInfoId, id) .eq(LawsCustomCompareInfoStandard::getInfoId, infoId)
.orderByAsc(LawsCustomCompareInfoStandard::getCreateTime)); .orderByAsc(LawsCustomCompareInfoStandard::getCreateTime));
if (!infoStandardList.isEmpty()){ if (!infoStandardList.isEmpty()){
// 国内 // 国内
@@ -572,21 +573,30 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
.filter(v -> LawsCustomCompareCommon.STANDARD_TYPE1.equals(v.getStandardType())) .filter(v -> LawsCustomCompareCommon.STANDARD_TYPE1.equals(v.getStandardType()))
.map(LawsCustomCompareInfoStandard::getStandardId) .map(LawsCustomCompareInfoStandard::getStandardId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<LawsDomesticStandard> lawsDomesticStandards = lawsDomesticStandardService.listByIds(domesticIds); List<LawsDomesticStandard> lawsDomesticStandards = new ArrayList<>();
if (!domesticIds.isEmpty()){
lawsDomesticStandards = lawsDomesticStandardService.listByIds(domesticIds);
}
// 海外 // 海外
List<String> overseasIds= infoStandardList.stream() List<String> overseasIds= infoStandardList.stream()
.filter(v -> LawsCustomCompareCommon.STANDARD_TYPE2.equals(v.getStandardType())) .filter(v -> LawsCustomCompareCommon.STANDARD_TYPE2.equals(v.getStandardType()))
.map(LawsCustomCompareInfoStandard::getStandardId) .map(LawsCustomCompareInfoStandard::getStandardId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<LawsOverseasStandard> lawsOverseasStandards = lawsOverseasStandardService.listByIds(overseasIds); List<LawsOverseasStandard> lawsOverseasStandards = new ArrayList<>();
if (!overseasIds.isEmpty()){
lawsOverseasStandards = lawsOverseasStandardService.listByIds(overseasIds);
}
// 企业 // 企业
List<String> enterpriseIds = infoStandardList.stream() List<String> enterpriseIds = infoStandardList.stream()
.filter(v -> LawsCustomCompareCommon.STANDARD_TYPE3.equals(v.getStandardType())) .filter(v -> LawsCustomCompareCommon.STANDARD_TYPE3.equals(v.getStandardType()))
.map(LawsCustomCompareInfoStandard::getStandardId) .map(LawsCustomCompareInfoStandard::getStandardId)
.collect(Collectors.toList()); .collect(Collectors.toList());
List<LawsEnterpriseStandard> lawsEnterpriseStandards = lawsEnterpriseStandardService.listByIds(enterpriseIds); List<LawsEnterpriseStandard> lawsEnterpriseStandards = new ArrayList<>();
if (!enterpriseIds.isEmpty()){
lawsEnterpriseStandards = lawsEnterpriseStandardService.listByIds(enterpriseIds);
}
// 处理数据 // 处理数据
List<StandardVO> standardVOList = new ArrayList<>(); List<StandardVO> standardVOList = new ArrayList<>();
@@ -602,7 +612,7 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
// 按国家/地区分组 // 按国家/地区分组
Map<String, List<StandardVO>> countryMap = standardVOList.stream() Map<String, List<StandardVO>> countryMap = standardVOList.stream()
.map(v -> { .map(v -> {
v.setInfoId(id); v.setInfoId(infoId);
// 字典翻译 // 字典翻译
String countryOrRegion = v.getCountryOrRegion(); String countryOrRegion = v.getCountryOrRegion();
if (StringUtils.isNotBlank(countryOrRegion)){ if (StringUtils.isNotBlank(countryOrRegion)){
@@ -613,6 +623,8 @@ public class LawsCustomCompareInfoServiceImpl extends ServiceImpl<LawsCustomComp
if (!sysDictItems.isEmpty()){ if (!sysDictItems.isEmpty()){
v.setCountryOrRegion(String.join(",", sysDictItems)); v.setCountryOrRegion(String.join(",", sysDictItems));
} }
}else {
v.setCountryOrRegion("");
} }
return v; return v;
}) })