ConcurrentModificationException:null
这个异常原因是在for循环里对循环的那个数据做的操作,导致数据不一致。
解决方案:把A的数据给B就OK。比如
List<a> selectAllList = customDataOptimizeMapper.selectProject(openingProcessType);
List<a> tempNodes = new ArrayList<a>();
for (a n : selectAllList) {
tempNodes.add(n);
}
if(selectAllList != null){
for(a : selectAllList){
String orderCode = p.getWorkSheetCode();
BOMInventory bomInventory = new BOMInventory();
bomInventory.setOrderCode(orderCode);
bomInventory.setOpeningProcessType(openingProcessType);
int i = customDataOptimizeMapper.selectUsefulDataByCode(bomInventory);
int j = customDataOptimizeMapper.selectNotUsefulDataByCode(bomInventory);
if(i == j){
tempNodes.remove(p);
}
}
}
---------------
//获取前一个月第一天
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar calendar1 = Calendar.getInstance();
calendar1.add(Calendar.MONTH, -1);
calendar1.set(Calendar.DAY_OF_MONTH,1);
String firstDay = sdf.format(calendar1.getTime());
//获取前一个月最后一天
Calendar calendar2 = Calendar.getInstance();
calendar2.set(Calendar.DAY_OF_MONTH, 0);
String lastDay = sdf.format(calendar2.getTime());
System.out.println(firstDay+lastDay);