Commit d38aa048 authored by 李灿灿's avatar 李灿灿

导出办理,替换list交叉合并

parent 3a83e50f
......@@ -410,6 +410,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
);
BeanCopyUtils.copyProperties(detail,newDetail);
detail.setIsEffect(CommonConstants.ONE_INT);
detail.setIsOverdue(null);
this.updateById(detail);
//新数据置为待办理
newDetail.setId(null);
......@@ -722,6 +723,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
//被替换者无效
insuranceDetail.setIsEffect(CommonConstants.ONE_INT);
insuranceDetail.setIsOverdue(CommonConstants.ONE_INT);
insuranceDetail.setUpdateTime(LocalDateTime.now());
this.updateById(insuranceDetail);
//替换记录成功
......@@ -878,7 +880,8 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
}
insuranceExportList.addAll(list);
insuranceExportList.removeAll(listVOS);
insuranceExportList.addAll(crossMerger(list,listVOS));
}
}
......@@ -940,6 +943,7 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
if (Optional.ofNullable(byId).isPresent()){
//被替换者激活
byId.setIsEffect(CommonConstants.ZERO_INT);
byId.setIsOverdue(CommonConstants.ZERO_INT);
this.updateById(byId);
}
}
......@@ -2586,6 +2590,35 @@ public class TInsuranceDetailServiceImpl extends ServiceImpl<TInsuranceDetailMap
}
}
/**
* 将集合交叉合并,list1 是第一个顺序 list2 是第二个顺序
*
* @author licancan
* @param list1
* @param list2
* @return {@link List<InsuranceExportListVO>}
*/
private List<InsuranceExportListVO> crossMerger (List<InsuranceExportListVO> list1, List<InsuranceExportListVO> list2){
//将list放入到链表队列
LinkedList<InsuranceExportListVO> st1 = new LinkedList<>(list1);
LinkedList<InsuranceExportListVO> st2 = new LinkedList<>(list2);
//计算较大的数组长度
int max = list1.size() > list2.size() ? list1.size() : list2.size();
//新建一个最终结果的list
List<InsuranceExportListVO> list = new ArrayList<>(list1.size() + list2.size());
for ( int i = 0; i < max;i++){
//如果队列没取完,继续取
if (!st1.isEmpty()){
list.add(st1.poll());
}
//如果队列没取完,继续取
if (!st2.isEmpty()){
list.add(st2.poll());
}
}
return list;
}
/***********************减员办理********************************/
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment