法规清单未匹配上平台件的提示语

This commit is contained in:
zhn
2023-09-22 17:37:04 +08:00
parent 8510a049e2
commit c7018f1975
3 changed files with 45 additions and 26 deletions
@@ -83,7 +83,7 @@ public class ProjectLibraryBaseController extends JeroController<ProjectLibraryB
@ApiOperation(value="不勾选法规清单进行关联平台件", notes="不勾选法规清单进行关联平台件")
@PostMapping(value = "/listPlatformAll")
public Result<?> listPlatformAll(@RequestBody Map<String,Object> params) {
List<Map<String, Object>> mapList = projectLibraryBaseService.listPlatformAll(params);
Map<String, Object> mapList = projectLibraryBaseService.listPlatformAll(params);
return Result.OK(params.get("cut").toString(),mapList);
}
@@ -98,7 +98,7 @@ public interface IProjectLibraryBaseService extends IService<ProjectLibraryBase>
* @param params
* @return
*/
List<Map<String,Object>> listPlatformAll(Map<String, Object> params);
Map<String,Object> listPlatformAll(Map<String, Object> params);
// IPage<ProjectLibraryBase> queryPageList(Map<String, Object> params);
/**
@@ -1377,6 +1377,35 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
mapListOne.add(mapTemp);
}
}
if(!mapListOne.isEmpty()){
//匹配一条平台件时直接新增
List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS = new ArrayList<>();
for (Map<String, Object> map : mapListOne) {
LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO();
inventoryPlatformEO.setCreateTime(new Date());
inventoryPlatformEO.setUpdateTime(new Date());
inventoryPlatformEO.setLawsInventoryId((String) map.get("lawsInventoryId"));
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = (List<ProjectLawsInventoryEO>) map.get("result");
inventoryPlatformEO.setPlatformLawsInventoryId(projectLawsInventoryEOS.get(0).getId());
lawsInventoryPlatformEOS.add(inventoryPlatformEO);
}
if (!lawsInventoryPlatformEOS.isEmpty()) {
lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS);
}
}
//法规清单未匹配上平台件的提示语
String html = getMsg(cut, sysDictItemList, emptyList);
Map<String,Object> map = new HashMap<>();
map.put("msg",html);
map.put("result",mapList);
return map;
}
@NotNull
private String getMsg(String cut, List<SysDictItem> sysDictItemList, List<ProjectLawsInventoryEO> emptyList) {
List<String> msgList = new ArrayList<>();
//未匹配上法规清单
if(ObjectUtils.isNotEmpty(emptyList)){
@@ -1402,35 +1431,16 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
for (String s : msgList) {
html += s + "</br>";
}
if(!mapListOne.isEmpty()){
//匹配一条平台件时直接新增
List<LawsInventoryPlatformEO> lawsInventoryPlatformEOS = new ArrayList<>();
for (Map<String, Object> map : mapListOne) {
LawsInventoryPlatformEO inventoryPlatformEO = new LawsInventoryPlatformEO();
inventoryPlatformEO.setCreateTime(new Date());
inventoryPlatformEO.setUpdateTime(new Date());
inventoryPlatformEO.setLawsInventoryId((String) map.get("lawsInventoryId"));
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = (List<ProjectLawsInventoryEO>) map.get("result");
inventoryPlatformEO.setPlatformLawsInventoryId(projectLawsInventoryEOS.get(0).getId());
lawsInventoryPlatformEOS.add(inventoryPlatformEO);
}
if (!lawsInventoryPlatformEOS.isEmpty()) {
lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS);
}
}
Map<String,Object> map = new HashMap<>();
map.put("msg",html);
map.put("result",mapList);
return map;
return html;
}
/**
* 不勾选法规清单进行关联平台件
*
* @return
*/
@Override
public List<Map<String,Object>> listPlatformAll(Map<String,Object> params) {
public Map<String,Object> listPlatformAll(Map<String,Object> params) {
String cut = (String) params.get("cut");//
String projectLibraryIds = (String) params.get("projectLibraryIds");//法规清单id
String platformProjectLibraryIds = (String) params.get("platformProjectLibraryIds");//平台件法规id
@@ -1462,7 +1472,7 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
List<SysDictItem> sysDictItemList = sysDictItemMapper.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue());
List<Map<String,Object>> mapList = new ArrayList<>();
List<Map<String,Object>> mapListOne = new ArrayList<>();
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = new ArrayList<>();
List<ProjectLawsInventoryEO> emptyList = new ArrayList<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : lawsInventoryEOList) {
Map<String,Object> map = new HashMap<>();
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = new ArrayList<>();
@@ -1502,6 +1512,9 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
projectLawsInventoryEOS.add(lawsInventoryEO);
}
}
if(ObjectUtils.isEmpty(projectLawsInventoryEOS)){
emptyList.add(projectLawsInventoryEO);
}
if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() > 1){
@@ -1533,7 +1546,13 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
lawsInventoryPlatformEOService.saveBatch(lawsInventoryPlatformEOS);
}
}
return mapList;
//法规清单未匹配上平台件的提示语
String html = getMsg(cut, sysDictItemList, emptyList);
Map<String,Object> map = new HashMap<>();
map.put("msg",html);
map.put("result",mapList);
return map;
}
private void hearSort(Map<String, Object> params, List<ProjectLibraryBase> resultLast) {