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