if(listNew.size()>0){ logger.info("走批量插入一个大list:"+listNew.size()+"分70一分小list"); List< List<InstantQtyEntity>> listMap = new ArrayList<>(); int size =70; int arrSize = listNew.size()%size==0?listNew.size()/size:listNew.size()/size+1;//分成几份 logger.info("大list:"+listNew.size()+"分{"+size+"}一分小list:分成"+arrSize+"份"); for(int i=0;i<arrSize;i++){//--- List<InstantQtyEntity> itemList = new ArrayList<>(); for(int j=i*size;j<=size*(i+1)-1;j++){//-- if(j<=listNew.size()-1){//核-- itemList.add(listNew.get(j)); } } listMap.add(itemList); } for(List<InstantQtyEntity> item : listMap){ logger.info(item.toString()); int a = webApiMapper.insertInstantQtyStocknumList(item); logger.info("取即时alu_kingdee_outbound_request_stocknum;入库:" + (a > 0 ? "成功" : "失败")); } }
解决:
在java代码中将精度设置成统一的,如
new BigDecimal(“10.28”).setScale(5),
new BigDecimal("(11.2").setScale(5),
new BigDecimal(“12.51”).setScale(5),
再次测试批量新增,数据正常:
column1 column2
10.28000 xxx
11.20000 yyy
12.51000 zzz