fix 87894 年度数据锁定--新增,删除,批量删除性能需要调整

This commit is contained in:
lijiarao
2024-07-31 16:54:23 +08:00
parent 9f019b3c43
commit 511dcaa46c
@@ -43,6 +43,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -115,225 +116,229 @@ public class AnnualDataLockingService extends ServiceImpl<AnnualDataLockingMappe
throw new JeroBootException(year+"年年度数据已经锁定"); throw new JeroBootException(year+"年年度数据已经锁定");
} }
this.save(annualDataLocking); this.save(annualDataLocking);
//第一步先获取所有企业和联系人 CompletableFuture.supplyAsync(() -> {
List<PayMeetingSituation> meetingSituations = meetingSituationMapper.listByYear(year); //第一步先获取所有企业和联系人
List<PayWorkingGroupSubItem> workingGroupSubItems = payWorkingGroupSubItemMapper.listByYear(year); List<PayMeetingSituation> meetingSituations = meetingSituationMapper.listByYear(year);
List<String> workingGroupSubIdList = workingGroupSubItems.stream().map(PayWorkingGroupSubItem::getId).distinct().collect(Collectors.toList()); List<PayWorkingGroupSubItem> workingGroupSubItems = payWorkingGroupSubItemMapper.listByYear(year);
List<PayWorkingGroupSubItemContacts> workingGroupSubItemContacts = workingGroupSubItemContactsMapper.listByWorkingGroupSubIdIn(workingGroupSubIdList); List<String> workingGroupSubIdList = workingGroupSubItems.stream().map(PayWorkingGroupSubItem::getId).distinct().collect(Collectors.toList());
List<PayCommonProject> payCommonProjects = payCommonProjectMapper.listByYear(year); List<PayWorkingGroupSubItemContacts> workingGroupSubItemContacts = workingGroupSubItemContactsMapper.listByWorkingGroupSubIdIn(workingGroupSubIdList);
List<PayMemberProjectSubitem> memberProjectSubitems = payMemberProjectSubitemMapper.listByYear(year); List<PayCommonProject> payCommonProjects = payCommonProjectMapper.listByYear(year);
List<TbMemberProjectSubitem> tbMemberProjectSubitems = tbMemberProjectSubitemMapper.listByYear(year); List<PayMemberProjectSubitem> memberProjectSubitems = payMemberProjectSubitemMapper.listByYear(year);
List<PayPackCompany> packCompanyList = packCompanyMapper.listByYear(year); List<TbMemberProjectSubitem> tbMemberProjectSubitems = tbMemberProjectSubitemMapper.listByYear(year);
//获得去重后的所有企业和联系人(联系人和邮寄联系人) List<PayPackCompany> packCompanyList = packCompanyMapper.listByYear(year);
ArrayList<String> distinctCompanyIdList = getDistinctCompanyIdList(meetingSituations, workingGroupSubItems, payCommonProjects, memberProjectSubitems, tbMemberProjectSubitems,packCompanyList); //获得去重后的所有企业和联系人(联系人和邮寄联系人)
ArrayList<String> distinctContactIdList = getDistinctContactIdList(meetingSituations, workingGroupSubItems, workingGroupSubItemContacts, payCommonProjects, memberProjectSubitems, tbMemberProjectSubitems,packCompanyList); ArrayList<String> distinctCompanyIdList = getDistinctCompanyIdList(meetingSituations, workingGroupSubItems, payCommonProjects, memberProjectSubitems, tbMemberProjectSubitems,packCompanyList);
//如果企业或联系人为空那么直接返回 ArrayList<String> distinctContactIdList = getDistinctContactIdList(meetingSituations, workingGroupSubItems, workingGroupSubItemContacts, payCommonProjects, memberProjectSubitems, tbMemberProjectSubitems,packCompanyList);
if (CollectionUtil.isEmpty(distinctCompanyIdList)||CollectionUtil.isEmpty(distinctContactIdList)){ //如果企业或联系人为空那么直接返回
return; if (CollectionUtil.isEmpty(distinctCompanyIdList)||CollectionUtil.isEmpty(distinctContactIdList)){
} return "";
//生成企业和联系人临时数据 }
List<PayCompanyManagementTemporary> companyTemporaryList = companyTemporaryService.insertList(distinctCompanyIdList,year); //生成企业和联系人临时数据
Map<String, PayCompanyManagementTemporary> companyTemporaryMap = CollStreamUtil.toIdentityMap(companyTemporaryList, PayCompanyManagementTemporary::getCompanyId); List<PayCompanyManagementTemporary> companyTemporaryList = companyTemporaryService.insertList(distinctCompanyIdList,year);
List<PayContactsManagementTemporary> contactsTemporaryList = contactsTemporaryService.insertList(distinctContactIdList,year); Map<String, PayCompanyManagementTemporary> companyTemporaryMap = CollStreamUtil.toIdentityMap(companyTemporaryList, PayCompanyManagementTemporary::getCompanyId);
Map<String, PayContactsManagementTemporary> contactsTemporaryMap = CollStreamUtil.toIdentityMap(contactsTemporaryList, PayContactsManagementTemporary::getContactId); List<PayContactsManagementTemporary> contactsTemporaryList = contactsTemporaryService.insertList(distinctContactIdList,year);
Map<String, PayContactsManagementTemporary> contactsTemporaryMap = CollStreamUtil.toIdentityMap(contactsTemporaryList, PayContactsManagementTemporary::getContactId);
//会议项目 //会议项目
List<PayMeetingSituation> updateMeetingSituationList = new ArrayList<>(); List<PayMeetingSituation> updateMeetingSituationList = new ArrayList<>();
for (PayMeetingSituation meetingSituation : meetingSituations) { for (PayMeetingSituation meetingSituation : meetingSituations) {
String companyId = meetingSituation.getCompanyId(); String companyId = meetingSituation.getCompanyId();
String companyContactId = meetingSituation.getCompanyContactId(); String companyContactId = meetingSituation.getCompanyContactId();
String postContactId = meetingSituation.getPostContactId(); String postContactId = meetingSituation.getPostContactId();
//获得临时表id //获得临时表id
companyTemporaryMap.get(companyId); companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId); PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){ if (companyTemporary == null){
continue; continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayMeetingSituation update = new PayMeetingSituation();
update.setId(meetingSituation.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setPostContactTemporaryId(contactsTemporary1.getId());
} }
} PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
update.setCompanyTemporaryId(companyTemporary.getId()); if (contactsTemporary == null){
update.setCompanyContactTemporaryId(contactsTemporary.getId()); continue;
updateMeetingSituationList.add(update);
}
meetingSituationService.updateBatchById(updateMeetingSituationList);
//工作组项目
List<PayWorkingGroupSubItem> updateWorkingGroupSubItemList = new ArrayList<>();
for (PayWorkingGroupSubItem workingGroupSubItem : workingGroupSubItems) {
String companyId = workingGroupSubItem.getChargeCompanyId();
String postContactId = workingGroupSubItem.getMailContactsId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
//更新临时表id
PayWorkingGroupSubItem update = new PayWorkingGroupSubItem();
update.setId(workingGroupSubItem.getId());
update.setChargeCompanyTemporaryId(companyTemporary.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setMailContactsTemporaryId(contactsTemporary1.getId());
} }
} //更新临时表id
PayMeetingSituation update = new PayMeetingSituation();
updateWorkingGroupSubItemList.add(update); update.setId(meetingSituation.getId());
} if (StringUtils.isNotBlank(postContactId)){
workingGroupSubItemService.updateBatchById(updateWorkingGroupSubItemList); PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
//工作组成员联系人 update.setPostContactTemporaryId(contactsTemporary1.getId());
List<PayWorkingGroupSubItemContacts> updateWorkingGroupSubItemContacts = new ArrayList<>(); }
for (PayWorkingGroupSubItemContacts contacts : workingGroupSubItemContacts) {
String contactsId = contacts.getContactsId();
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(contactsId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayWorkingGroupSubItemContacts update = new PayWorkingGroupSubItemContacts();
update.setId(contacts.getId());
update.setContactsTemporaryId(contactsTemporary.getId());
updateWorkingGroupSubItemContacts.add(update);
}
workingGroupSubItemContactsService.updateBatchById(updateWorkingGroupSubItemContacts);
//普通项目
List<PayCommonProject> updatePayCommonProjects = new ArrayList<>();
for (PayCommonProject commonProject : payCommonProjects) {
String companyId = commonProject.getChargeCompanyId();
String companyContactId = commonProject.getContactsId();
String postContactId = commonProject.getMailContactsId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayCommonProject update = new PayCommonProject();
update.setId(commonProject.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setMailContactsId(contactsTemporary1.getId());
} }
update.setCompanyTemporaryId(companyTemporary.getId());
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updateMeetingSituationList.add(update);
} }
update.setChargeCompanyTemporaryId(companyTemporary.getId()); meetingSituationService.updateBatchById(updateMeetingSituationList);
update.setContactsTemporaryId(contactsTemporary.getId());
updatePayCommonProjects.add(update);
}
commonProjectService.updateBatchById(updatePayCommonProjects);
//会员项目 //工作组项目
List<PayMemberProjectSubitem> updateMemberProjectSubitems = new ArrayList<>(); List<PayWorkingGroupSubItem> updateWorkingGroupSubItemList = new ArrayList<>();
for (PayMemberProjectSubitem memberProjectSubitem : memberProjectSubitems) { for (PayWorkingGroupSubItem workingGroupSubItem : workingGroupSubItems) {
String companyId = memberProjectSubitem.getCompanyId(); String companyId = workingGroupSubItem.getChargeCompanyId();
String companyContactId = memberProjectSubitem.getCompanyContactId(); String postContactId = workingGroupSubItem.getMailContactsId();
String postContactId = memberProjectSubitem.getPostContactId(); //获得临时表id
//获得临时表id companyTemporaryMap.get(companyId);
companyTemporaryMap.get(companyId); PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId); if (companyTemporary == null){
if (companyTemporary == null){ continue;
continue; }
} //更新临时表id
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId); PayWorkingGroupSubItem update = new PayWorkingGroupSubItem();
if (contactsTemporary == null){ update.setId(workingGroupSubItem.getId());
continue; update.setChargeCompanyTemporaryId(companyTemporary.getId());
} if (StringUtils.isNotBlank(postContactId)){
//更新临时表id PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
PayMemberProjectSubitem update = new PayMemberProjectSubitem(); if (contactsTemporary1 != null){
update.setId(memberProjectSubitem.getId()); update.setMailContactsTemporaryId(contactsTemporary1.getId());
if (StringUtils.isNotBlank(postContactId)){ }
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setPostContactTemporaryId(contactsTemporary1.getId());
} }
}
update.setCompanyTemporaryId(companyTemporary.getId());
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updateMemberProjectSubitems.add(update);
}
memberProjectSubitemService.updateBatchById(updateMemberProjectSubitems);
//标协会员项目 updateWorkingGroupSubItemList.add(update);
List<TbMemberProjectSubitem> updateTbMemberProjectSubitems = new ArrayList<>();
for (TbMemberProjectSubitem tbMemberProjectSubitem : tbMemberProjectSubitems) {
String companyId = tbMemberProjectSubitem.getCompanyId();
String companyContactId = tbMemberProjectSubitem.getLiaisonManId();
String postContactId = tbMemberProjectSubitem.getPostContactId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
} }
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId); workingGroupSubItemService.updateBatchById(updateWorkingGroupSubItemList);
if (contactsTemporary == null){
continue;
}
//更新临时表id
TbMemberProjectSubitem update = new TbMemberProjectSubitem();
update.setId(tbMemberProjectSubitem.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setPostContactTemporaryId(contactsTemporary1.getId());
}
}
update.setCompanyTemporaryId(companyTemporary.getId());
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updateTbMemberProjectSubitems.add(update);
}
tbMemberProjectSubitemService.updateBatchById(updateTbMemberProjectSubitems);
//打包项目 //工作组成员联系人
List<PayPackCompany> updatePackCompanyList = new ArrayList<>(); List<PayWorkingGroupSubItemContacts> updateWorkingGroupSubItemContacts = new ArrayList<>();
for (PayPackCompany packCompany : packCompanyList) { for (PayWorkingGroupSubItemContacts contacts : workingGroupSubItemContacts) {
String companyId = packCompany.getCompanyId(); String contactsId = contacts.getContactsId();
String companyContactId = packCompany.getCompanyContactId();
String postContactId = packCompany.getMailContactsId(); PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(contactsId);
//获得临时表id if (contactsTemporary == null){
companyTemporaryMap.get(companyId); continue;
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayPackCompany update = new PayPackCompany();
update.setId(packCompany.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setMailContactsId(contactsTemporary1.getId());
} }
//更新临时表id
PayWorkingGroupSubItemContacts update = new PayWorkingGroupSubItemContacts();
update.setId(contacts.getId());
update.setContactsTemporaryId(contactsTemporary.getId());
updateWorkingGroupSubItemContacts.add(update);
} }
update.setCompanyTemporaryId(companyTemporary.getId()); workingGroupSubItemContactsService.updateBatchById(updateWorkingGroupSubItemContacts);
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updatePackCompanyList.add(update); //普通项目
} List<PayCommonProject> updatePayCommonProjects = new ArrayList<>();
packCompanyService.updateBatchById(updatePackCompanyList); for (PayCommonProject commonProject : payCommonProjects) {
String companyId = commonProject.getChargeCompanyId();
String companyContactId = commonProject.getContactsId();
String postContactId = commonProject.getMailContactsId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayCommonProject update = new PayCommonProject();
update.setId(commonProject.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setMailContactsId(contactsTemporary1.getId());
}
}
update.setChargeCompanyTemporaryId(companyTemporary.getId());
update.setContactsTemporaryId(contactsTemporary.getId());
updatePayCommonProjects.add(update);
}
commonProjectService.updateBatchById(updatePayCommonProjects);
//会员项目
List<PayMemberProjectSubitem> updateMemberProjectSubitems = new ArrayList<>();
for (PayMemberProjectSubitem memberProjectSubitem : memberProjectSubitems) {
String companyId = memberProjectSubitem.getCompanyId();
String companyContactId = memberProjectSubitem.getCompanyContactId();
String postContactId = memberProjectSubitem.getPostContactId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayMemberProjectSubitem update = new PayMemberProjectSubitem();
update.setId(memberProjectSubitem.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setPostContactTemporaryId(contactsTemporary1.getId());
}
}
update.setCompanyTemporaryId(companyTemporary.getId());
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updateMemberProjectSubitems.add(update);
}
memberProjectSubitemService.updateBatchById(updateMemberProjectSubitems);
//标协会员项目
List<TbMemberProjectSubitem> updateTbMemberProjectSubitems = new ArrayList<>();
for (TbMemberProjectSubitem tbMemberProjectSubitem : tbMemberProjectSubitems) {
String companyId = tbMemberProjectSubitem.getCompanyId();
String companyContactId = tbMemberProjectSubitem.getLiaisonManId();
String postContactId = tbMemberProjectSubitem.getPostContactId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
TbMemberProjectSubitem update = new TbMemberProjectSubitem();
update.setId(tbMemberProjectSubitem.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setPostContactTemporaryId(contactsTemporary1.getId());
}
}
update.setCompanyTemporaryId(companyTemporary.getId());
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updateTbMemberProjectSubitems.add(update);
}
tbMemberProjectSubitemService.updateBatchById(updateTbMemberProjectSubitems);
//打包项目
List<PayPackCompany> updatePackCompanyList = new ArrayList<>();
for (PayPackCompany packCompany : packCompanyList) {
String companyId = packCompany.getCompanyId();
String companyContactId = packCompany.getCompanyContactId();
String postContactId = packCompany.getMailContactsId();
//获得临时表id
companyTemporaryMap.get(companyId);
PayCompanyManagementTemporary companyTemporary = companyTemporaryMap.get(companyId);
if (companyTemporary == null){
continue;
}
PayContactsManagementTemporary contactsTemporary = contactsTemporaryMap.get(companyContactId);
if (contactsTemporary == null){
continue;
}
//更新临时表id
PayPackCompany update = new PayPackCompany();
update.setId(packCompany.getId());
if (StringUtils.isNotBlank(postContactId)){
PayContactsManagementTemporary contactsTemporary1 = contactsTemporaryMap.get(postContactId);
if (contactsTemporary1 != null){
update.setMailContactsId(contactsTemporary1.getId());
}
}
update.setCompanyTemporaryId(companyTemporary.getId());
update.setCompanyContactTemporaryId(contactsTemporary.getId());
updatePackCompanyList.add(update);
}
packCompanyService.updateBatchById(updatePackCompanyList);
return "";
});
} }
@NotNull @NotNull
@@ -426,127 +431,130 @@ public class AnnualDataLockingService extends ServiceImpl<AnnualDataLockingMappe
AnnualDataLocking annualDataLocking = this.getById(id); AnnualDataLocking annualDataLocking = this.getById(id);
this.removeById(id); this.removeById(id);
String year = annualDataLocking.getYear(); String year = annualDataLocking.getYear();
//会议项目 CompletableFuture.supplyAsync(() -> {
List<PayMeetingSituation> updateMeetingSituationList = new ArrayList<>(); //会议项目
List<PayMeetingSituation> meetingSituations = meetingSituationMapper.listByYear(year); List<PayMeetingSituation> updateMeetingSituationList = new ArrayList<>();
for (PayMeetingSituation meetingSituation : meetingSituations) { List<PayMeetingSituation> meetingSituations = meetingSituationMapper.listByYear(year);
String companyId = meetingSituation.getCompanyId(); for (PayMeetingSituation meetingSituation : meetingSituations) {
String companyContactId = meetingSituation.getCompanyContactId(); String companyId = meetingSituation.getCompanyId();
String postContactId = meetingSituation.getPostContactId(); String companyContactId = meetingSituation.getCompanyContactId();
//更新临时表id String postContactId = meetingSituation.getPostContactId();
PayMeetingSituation update = new PayMeetingSituation(); //更新临时表id
update.setId(meetingSituation.getId()); PayMeetingSituation update = new PayMeetingSituation();
update.setCompanyTemporaryId(companyId); update.setId(meetingSituation.getId());
update.setCompanyContactTemporaryId(companyContactId); update.setCompanyTemporaryId(companyId);
update.setPostContactTemporaryId(postContactId); update.setCompanyContactTemporaryId(companyContactId);
updateMeetingSituationList.add(update); update.setPostContactTemporaryId(postContactId);
} updateMeetingSituationList.add(update);
meetingSituationService.updateBatchById(updateMeetingSituationList); }
meetingSituationService.updateBatchById(updateMeetingSituationList);
//工作组项目 //工作组项目
List<PayWorkingGroupSubItem> updateWorkingGroupSubItemList = new ArrayList<>(); List<PayWorkingGroupSubItem> updateWorkingGroupSubItemList = new ArrayList<>();
List<PayWorkingGroupSubItem> workingGroupSubItems = payWorkingGroupSubItemMapper.listByYear(year); List<PayWorkingGroupSubItem> workingGroupSubItems = payWorkingGroupSubItemMapper.listByYear(year);
for (PayWorkingGroupSubItem workingGroupSubItem : workingGroupSubItems) { for (PayWorkingGroupSubItem workingGroupSubItem : workingGroupSubItems) {
String companyId = workingGroupSubItem.getChargeCompanyId(); String companyId = workingGroupSubItem.getChargeCompanyId();
String postContactId = workingGroupSubItem.getMailContactsId(); String postContactId = workingGroupSubItem.getMailContactsId();
//更新临时表id //更新临时表id
PayWorkingGroupSubItem update = new PayWorkingGroupSubItem(); PayWorkingGroupSubItem update = new PayWorkingGroupSubItem();
update.setId(workingGroupSubItem.getId()); update.setId(workingGroupSubItem.getId());
update.setChargeCompanyTemporaryId(companyId); update.setChargeCompanyTemporaryId(companyId);
update.setMailContactsTemporaryId(postContactId); update.setMailContactsTemporaryId(postContactId);
updateWorkingGroupSubItemList.add(update); updateWorkingGroupSubItemList.add(update);
} }
workingGroupSubItemService.updateBatchById(updateWorkingGroupSubItemList); workingGroupSubItemService.updateBatchById(updateWorkingGroupSubItemList);
//工作组成员联系人 //工作组成员联系人
List<PayWorkingGroupSubItemContacts> updateWorkingGroupSubItemContacts = new ArrayList<>(); List<PayWorkingGroupSubItemContacts> updateWorkingGroupSubItemContacts = new ArrayList<>();
List<String> workingGroupSubIdList = workingGroupSubItems.stream().map(PayWorkingGroupSubItem::getId).distinct().collect(Collectors.toList()); List<String> workingGroupSubIdList = workingGroupSubItems.stream().map(PayWorkingGroupSubItem::getId).distinct().collect(Collectors.toList());
List<PayWorkingGroupSubItemContacts> workingGroupSubItemContacts = workingGroupSubItemContactsMapper.listByWorkingGroupSubIdIn(workingGroupSubIdList); List<PayWorkingGroupSubItemContacts> workingGroupSubItemContacts = workingGroupSubItemContactsMapper.listByWorkingGroupSubIdIn(workingGroupSubIdList);
for (PayWorkingGroupSubItemContacts contacts : workingGroupSubItemContacts) { for (PayWorkingGroupSubItemContacts contacts : workingGroupSubItemContacts) {
String contactsId = contacts.getContactsId(); String contactsId = contacts.getContactsId();
//更新临时表id //更新临时表id
PayWorkingGroupSubItemContacts update = new PayWorkingGroupSubItemContacts(); PayWorkingGroupSubItemContacts update = new PayWorkingGroupSubItemContacts();
update.setId(contacts.getId()); update.setId(contacts.getId());
update.setContactsTemporaryId(contactsId); update.setContactsTemporaryId(contactsId);
updateWorkingGroupSubItemContacts.add(update); updateWorkingGroupSubItemContacts.add(update);
} }
workingGroupSubItemContactsService.updateBatchById(updateWorkingGroupSubItemContacts); workingGroupSubItemContactsService.updateBatchById(updateWorkingGroupSubItemContacts);
//普通项目 //普通项目
List<PayCommonProject> updatePayCommonProjects = new ArrayList<>(); List<PayCommonProject> updatePayCommonProjects = new ArrayList<>();
List<PayCommonProject> payCommonProjects = payCommonProjectMapper.listByYear(year); List<PayCommonProject> payCommonProjects = payCommonProjectMapper.listByYear(year);
for (PayCommonProject commonProject : payCommonProjects) { for (PayCommonProject commonProject : payCommonProjects) {
String companyId = commonProject.getChargeCompanyId(); String companyId = commonProject.getChargeCompanyId();
String companyContactId = commonProject.getContactsId(); String companyContactId = commonProject.getContactsId();
String postContactId = commonProject.getMailContactsId(); String postContactId = commonProject.getMailContactsId();
//更新临时表id //更新临时表id
PayCommonProject update = new PayCommonProject(); PayCommonProject update = new PayCommonProject();
update.setId(commonProject.getId()); update.setId(commonProject.getId());
update.setChargeCompanyTemporaryId(companyId); update.setChargeCompanyTemporaryId(companyId);
update.setContactsTemporaryId(companyContactId); update.setContactsTemporaryId(companyContactId);
update.setMailContactsTemporaryId(postContactId); update.setMailContactsTemporaryId(postContactId);
updatePayCommonProjects.add(update); updatePayCommonProjects.add(update);
} }
commonProjectService.updateBatchById(updatePayCommonProjects); commonProjectService.updateBatchById(updatePayCommonProjects);
//会员项目 //会员项目
List<PayMemberProjectSubitem> updateMemberProjectSubitems = new ArrayList<>(); List<PayMemberProjectSubitem> updateMemberProjectSubitems = new ArrayList<>();
List<PayMemberProjectSubitem> memberProjectSubitems = payMemberProjectSubitemMapper.listByYear(year); List<PayMemberProjectSubitem> memberProjectSubitems = payMemberProjectSubitemMapper.listByYear(year);
for (PayMemberProjectSubitem memberProjectSubitem : memberProjectSubitems) { for (PayMemberProjectSubitem memberProjectSubitem : memberProjectSubitems) {
String companyId = memberProjectSubitem.getCompanyId(); String companyId = memberProjectSubitem.getCompanyId();
String companyContactId = memberProjectSubitem.getCompanyContactId(); String companyContactId = memberProjectSubitem.getCompanyContactId();
String postContactId = memberProjectSubitem.getPostContactId(); String postContactId = memberProjectSubitem.getPostContactId();
//更新临时表id //更新临时表id
PayMemberProjectSubitem update = new PayMemberProjectSubitem(); PayMemberProjectSubitem update = new PayMemberProjectSubitem();
update.setId(memberProjectSubitem.getId()); update.setId(memberProjectSubitem.getId());
update.setCompanyTemporaryId(companyId); update.setCompanyTemporaryId(companyId);
update.setCompanyContactTemporaryId(companyContactId); update.setCompanyContactTemporaryId(companyContactId);
update.setPostContactTemporaryId(postContactId); update.setPostContactTemporaryId(postContactId);
updateMemberProjectSubitems.add(update); updateMemberProjectSubitems.add(update);
} }
memberProjectSubitemService.updateBatchById(updateMemberProjectSubitems); memberProjectSubitemService.updateBatchById(updateMemberProjectSubitems);
//标协会员项目 //标协会员项目
List<TbMemberProjectSubitem> updateTbMemberProjectSubitems = new ArrayList<>(); List<TbMemberProjectSubitem> updateTbMemberProjectSubitems = new ArrayList<>();
List<TbMemberProjectSubitem> tbMemberProjectSubitems = tbMemberProjectSubitemMapper.listByYear(year); List<TbMemberProjectSubitem> tbMemberProjectSubitems = tbMemberProjectSubitemMapper.listByYear(year);
for (TbMemberProjectSubitem tbMemberProjectSubitem : tbMemberProjectSubitems) { for (TbMemberProjectSubitem tbMemberProjectSubitem : tbMemberProjectSubitems) {
String companyId = tbMemberProjectSubitem.getCompanyId(); String companyId = tbMemberProjectSubitem.getCompanyId();
String companyContactId = tbMemberProjectSubitem.getLiaisonManId(); String companyContactId = tbMemberProjectSubitem.getLiaisonManId();
String postContactId = tbMemberProjectSubitem.getPostContactId(); String postContactId = tbMemberProjectSubitem.getPostContactId();
//更新临时表id //更新临时表id
TbMemberProjectSubitem update = new TbMemberProjectSubitem(); TbMemberProjectSubitem update = new TbMemberProjectSubitem();
update.setId(tbMemberProjectSubitem.getId()); update.setId(tbMemberProjectSubitem.getId());
update.setCompanyTemporaryId(companyId); update.setCompanyTemporaryId(companyId);
update.setCompanyContactTemporaryId(companyContactId); update.setCompanyContactTemporaryId(companyContactId);
update.setPostContactTemporaryId(postContactId); update.setPostContactTemporaryId(postContactId);
updateTbMemberProjectSubitems.add(update); updateTbMemberProjectSubitems.add(update);
} }
tbMemberProjectSubitemService.updateBatchById(updateTbMemberProjectSubitems); tbMemberProjectSubitemService.updateBatchById(updateTbMemberProjectSubitems);
//打包项目 //打包项目
List<PayPackCompany> updatePackCompanyList = new ArrayList<>(); List<PayPackCompany> updatePackCompanyList = new ArrayList<>();
List<PayPackCompany> packCompanyList = packCompanyMapper.listByYear(year); List<PayPackCompany> packCompanyList = packCompanyMapper.listByYear(year);
for (PayPackCompany packCompany : packCompanyList) { for (PayPackCompany packCompany : packCompanyList) {
String companyId = packCompany.getCompanyId(); String companyId = packCompany.getCompanyId();
String companyContactId = packCompany.getCompanyContactId(); String companyContactId = packCompany.getCompanyContactId();
String postContactId = packCompany.getMailContactsId(); String postContactId = packCompany.getMailContactsId();
//更新临时表id //更新临时表id
PayPackCompany update = new PayPackCompany(); PayPackCompany update = new PayPackCompany();
update.setId(packCompany.getId()); update.setId(packCompany.getId());
update.setMailContactsId(postContactId); update.setMailContactsId(postContactId);
update.setCompanyTemporaryId(companyId); update.setCompanyTemporaryId(companyId);
update.setCompanyContactTemporaryId(companyContactId); update.setCompanyContactTemporaryId(companyContactId);
updatePackCompanyList.add(update); updatePackCompanyList.add(update);
} }
packCompanyService.updateBatchById(updatePackCompanyList); packCompanyService.updateBatchById(updatePackCompanyList);
return "";
});
} }