法规清单未匹配到平台件进行提示

This commit is contained in:
zhn
2023-09-22 17:20:55 +08:00
parent 571a5a781e
commit 79bc3c8544
3 changed files with 37 additions and 5 deletions
@@ -71,8 +71,8 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
@ApiOperation(value="勾选法规清单进行关联平台件", notes="勾选法规清单进行关联平台件")
@PostMapping(value = "/listPlatform")
public Result<?> listPlatform(@RequestBody Map<String,Object> params) {
List<Map<String, Object>> mapList = projectLibraryBaseService.listPlatform(params);
return Result.OK(params.get("cut").toString(),mapList);
Map<String, Object> map = projectLibraryBaseService.listPlatform(params);
return Result.OK(params.get("cut").toString(),map);
}
/**
* 不勾选法规清单进行关联平台件
@@ -91,7 +91,7 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
* @param params
* @return
*/
List<Map<String,Object>> listPlatform(Map<String, Object> params);
Map<String,Object> listPlatform(Map<String, Object> params);
/**
* 不勾选法规清单进行关联平台件
@@ -1274,7 +1274,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
* @return
*/
@Override
public List<Map<String,Object>> listPlatform(Map<String,Object> params) {
public Map<String,Object> listPlatform(Map<String,Object> params) {
String cut = (String) params.get("cut");//
String ids = (String) params.get("ids");//法规清单id
String projectLibraryIds = (String) params.get("projectLibraryIds");//平台件项目id
@@ -1303,6 +1303,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
List<SysCategory> categoryList = sysCategoryService.list();
List<Map<String,Object>> mapList = new ArrayList<>();
List<Map<String,Object>> mapListOne = new ArrayList<>();
List<ProjectLawsInventoryEO> emptyList = new ArrayList<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : lawsInventoryEOList) {
Map<String,Object> map = new HashMap<>();
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = new ArrayList<>();
@@ -1360,6 +1361,9 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
projectLawsInventoryEOS.add(lawsInventoryEO);
}
}
if(ObjectUtils.isEmpty(projectLawsInventoryEOS)){
emptyList.add(projectLawsInventoryEO);
}
if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() > 1){
map.put("lawsInventoryId",projectLawsInventoryEO.getId());
@@ -1373,6 +1377,31 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
mapListOne.add(mapTemp);
}
}
List<String> msgList = new ArrayList<>();
//未匹配上法规清单
if(ObjectUtils.isNotEmpty(emptyList)){
for (ProjectLawsInventoryEO projectLawsInventoryEO : emptyList) {
List<String> list = new LinkedList<>();
if(StringUtils.isNotBlank(projectLawsInventoryEO.getDutyTerritory())){
for (String s : projectLawsInventoryEO.getDutyTerritory().split(",")) {
List<SysDictItem> collect = sysDictItemList.stream().filter(e -> e.getItemValue().equals(s)).collect(Collectors.toList());
if(CutEnum.CN.getValue().equals(cut) && !collect.isEmpty()){
list.add(collect.get(0).getItemText());
}else if(CutEnum.EN.getValue().equals(cut) && !collect.isEmpty()){
list.add(collect.get(0).getEnName());
}
}
}
String serialNumber = projectLawsInventoryEO.getSerialNumber();
String dutyTerritoryName = StringUtils.join(list,",");
String msg = serialNumber+" "+dutyTerritoryName+"未匹配到数据";
msgList.add(msg);
}
}
String html = "";
for (String s : msgList) {
html += s + "</br>";
}
if(!mapListOne.isEmpty()){
//匹配一条平台件时直接新增
List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS = new ArrayList<>();
@@ -1390,7 +1419,10 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS);
}
}
return mapList;
Map<String,Object> map = new HashMap<>();
map.put("msg",html);
map.put("result",mapList);
return map;
}
/**
* 不勾选法规清单进行关联平台件