| | |
| | | } |
| | | sqlExecuteService.makeManualCommit(sql_str); |
| | | } |
| | | //2.将数据插入电池组数据 |
| | | public void insertAnaysisXlsToTdata(int battGroupId, int testRecordCount, List<XlsToTdata> list) { |
| | | ArrayList sql_str=new ArrayList(); |
| | | String tableName="db_batt_testdata."+"tb_batttestdata_"+battGroupId; |
| | | //检测表是否存在 |
| | | if(list!=null){ |
| | | String insertSql="insert into "+tableName+" " |
| | | + "(" |
| | | + "BattGroupId," |
| | | + "test_record_count," |
| | | + "record_num," |
| | | + "record_time," |
| | | + "test_starttime," |
| | | + "test_timelong," |
| | | + "group_vol," |
| | | + "test_curr," |
| | | + "test_cap," |
| | | + "mon_num," |
| | | + "mon_vol," |
| | | + "test_type," |
| | | + "data_new," |
| | | + "data_available" |
| | | + ") " |
| | | + " values "; |
| | | for (int i=0;i<list.size();i++) { |
| | | XlsToTdata tdata=list.get(i); |
| | | List monVols=tdata.getMonVols(); |
| | | for (int j=0;j<monVols.size();j++) { |
| | | if(!(i==0&&j==0)){ |
| | | insertSql+=" , "; |
| | | } |
| | | String volSql="(" |
| | | + battGroupId+"," |
| | | + testRecordCount+"," |
| | | + (i+1)+"," |
| | | + "'"+tdata.getRecordTime()+"'," |
| | | + "'"+ActionUtil.sdf.format(new Date())+"'," |
| | | + tdata.getTestTimelong()+"," |
| | | + tdata.getGroupVol()+"," |
| | | + tdata.getGroupCurr()+"," |
| | | + tdata.getTestCap()+"," |
| | | + (j+1)+"," |
| | | + monVols.get(j)+"," |
| | | + 3+"," |
| | | + 1+"," |
| | | + 1+"" |
| | | + ")";//如果对应是字符几个带上单引号 |
| | | insertSql+=volSql; |
| | | } |
| | | } |
| | | sql_str.add(insertSql); |
| | | } |
| | | sqlExecuteService.makeManualCommit(sql_str); |
| | | } |
| | | } |