关联平台件信息我一条时直接新增

This commit is contained in:
zhn
2023-09-20 15:47:01 +08:00
parent 9e960f6fb4
commit a4581a38e8
@@ -23,6 +23,7 @@ import com.jero.modules.dummy.enums.OrderEnum;
import com.jero.modules.enums.DictCodeEnum;
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
import com.jero.modules.ota.service.impl.OtaManageApplyEOServiceImpl;
import com.jero.modules.project.entity.LawsInventoryPlatformEO;
import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLawsInventoryLogEO;
@@ -203,6 +204,8 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
private IProjectLibraryStatisticsService projectLibraryStatisticsService;
@Autowired
private OtaManageApplyEOServiceImpl otaManageApplyEOService;
@Autowired
private LawsInventoryPlatformEOServiceImpl lawsInventoryPlatformEOService;
private static final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
private static DecimalFormat df = new DecimalFormat("#.00");
@@ -1294,12 +1297,15 @@ 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<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : lawsInventoryEOList) {
Map<String,Object> map = new HashMap<>();
List<ProjectLawsInventoryEO> projectLawsInventoryEOS = new ArrayList<>();
//serialNumber dutyTerritory
String serialNumber = projectLawsInventoryEO.getSerialNumber();
String dutyTerritory = projectLawsInventoryEO.getDutyTerritory();
String subtitle = projectLawsInventoryEO.getSubtitle();
//责任领域
List<String> list = new LinkedList<>();
@@ -1333,15 +1339,36 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
}
}
if(!projectLawsInventoryEOS.isEmpty()){
if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() > 1){
map.put("lawsInventoryId",projectLawsInventoryEO.getId());
map.put("title",serialNumber+" "+dutyTerritoryNew+"在平台件项目中包含多条匹配内容,请选择关联");
map.put("title",serialNumber+" "+dutyTerritoryNew+" "+subtitle+"在平台件项目中包含多条匹配内容,请选择关联");
map.put("result",projectLawsInventoryEOS);
mapList.add(map);
}else if(!projectLawsInventoryEOS.isEmpty() && projectLawsInventoryEOS.size() == 1){
Map<String,Object> mapTemp = new HashMap<>();
mapTemp.put("lawsInventoryId",projectLawsInventoryEO.getId());
mapTemp.put("result",projectLawsInventoryEOS);
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);
}
}
return mapList;
}