| | |
| | | package com.integrated.zyyt.service; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.integrated.zyyt.enetity.StationInfo; |
| | | import com.integrated.zyyt.enetity.YyztTDjtjb; |
| | | import com.integrated.zyyt.enetity.YyztTShkdrb; |
| | |
| | | Long totalSize = 0L; |
| | | |
| | | int pageNum = 0; |
| | | int pageSize = 2000; |
| | | int pageSize = 1000; |
| | | |
| | | //设置回滚点 |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | |
| | | int fromIndex = i * batchSize; |
| | | // 结束位置 |
| | | int toIndex = (i + 1) * batchSize < length ? (i + 1) * batchSize : length; |
| | | if (fromIndex == batchSize) { |
| | | if (fromIndex == length) { |
| | | continue; |
| | | } |
| | | System.out.println(fromIndex + " === " + toIndex); |
| | |
| | | @Override |
| | | public void setValues(PreparedStatement ps, int i) throws SQLException { |
| | | StationInfo stationInfo = stationInfoListCopy.get(i); |
| | | log.info("stationInfo==> {}", JSON.toJSONString(stationInfo)); |
| | | // log.info("stationInfo==> {}", JSON.toJSONString(stationInfo)); |
| | | |
| | | ps.setObject(1, stationInfo.getVJgbh()); |
| | | ps.setString(1, stationInfo.getVJgbh()); |
| | | |
| | | ps.setObject(2, stationInfo.getVSfmc()); |
| | | ps.setObject(3, stationInfo.getVSfdm()); |
| | | ps.setObject(4, stationInfo.getVDsdm()); |
| | | ps.setObject(5, stationInfo.getVDsmc()); |
| | | ps.setObject(6, stationInfo.getVQxdm()); |
| | | ps.setObject(7, stationInfo.getVXsmc()); |
| | | ps.setObject(8, stationInfo.getVTdjgbh()); |
| | | ps.setObject(9, stationInfo.getVTdjgmc()); |
| | | ps.setObject(10, stationInfo.getVJgmc()); |
| | | ps.setObject(11, stationInfo.getVLxrxm()); |
| | | ps.setObject(12, stationInfo.getVLxdh()); |
| | | ps.setObject(13, stationInfo.getVSjhm()); |
| | | ps.setObject(14, stationInfo.getVLxdz()); |
| | | ps.setObject(15, stationInfo.getIscountry()); |
| | | ps.setObject(16, stationInfo.getCWdlx()); |
| | | ps.setObject(17, stationInfo.getCYzbm()); |
| | | ps.setObject(18, stationInfo.getVYywdbh()); |
| | | ps.setObject(19, stationInfo.getVYywdmc()); |
| | | ps.setObject(20, stationInfo.getVGpsjd()); |
| | | ps.setObject(21, stationInfo.getVGpswd()); |
| | | ps.setObject(22, stationInfo.getYlgzdid()); |
| | | ps.setObject(23, stationInfo.getYlgzdmc()); |
| | | ps.setObject(24, stationInfo.getVStatus()); |
| | | ps.setDate(25, new Date(stationInfo.getDSqrq().getTime())); |
| | | // ps.setObject(25, stationInfo.getDSqrq()); |
| | | // ps.setObject(26, stationInfo.getDSprq()); |
| | | ps.setDate(26, new Date(stationInfo.getDSprq().getTime())); |
| | | ps.setString(2, stationInfo.getVSfmc()); |
| | | ps.setString(3, stationInfo.getVSfdm()); |
| | | ps.setString(4, stationInfo.getVDsdm()); |
| | | ps.setString(5, stationInfo.getVDsmc()); |
| | | ps.setString(6, stationInfo.getVQxdm()); |
| | | ps.setString(7, stationInfo.getVXsmc()); |
| | | ps.setString(8, stationInfo.getVTdjgbh()); |
| | | ps.setString(9, stationInfo.getVTdjgmc()); |
| | | ps.setString(10, stationInfo.getVJgmc()); |
| | | ps.setString(11, stationInfo.getVLxrxm()); |
| | | ps.setString(12, stationInfo.getVLxdh()); |
| | | ps.setString(13, stationInfo.getVSjhm()); |
| | | ps.setString(14, stationInfo.getVLxdz()); |
| | | ps.setString(15, stationInfo.getIscountry()); |
| | | ps.setShort(16, stationInfo.getCWdlx()); |
| | | ps.setString(17, stationInfo.getCYzbm()); |
| | | ps.setString(18, stationInfo.getVYywdbh()); |
| | | ps.setString(19, stationInfo.getVYywdmc()); |
| | | ps.setString(20, stationInfo.getVGpsjd()); |
| | | ps.setString(21, stationInfo.getVGpswd()); |
| | | ps.setString(22, stationInfo.getYlgzdid()); |
| | | ps.setString(23, stationInfo.getYlgzdmc()); |
| | | ps.setString(24, stationInfo.getVStatus()); |
| | | // ps.setDate(25, new Date(stationInfo.getDSqrq().getTime())); |
| | | ps.setDate(25, |
| | | stationInfo.getDSqrq() == null ? null : |
| | | new Date(stationInfo.getDSqrq().getTime())); |
| | | // ps.setString(25, stationInfo.getDSqrq()); |
| | | // ps.setString(26, stationInfo.getDSprq()); |
| | | ps.setDate(26, stationInfo.getDSprq() == null ? null : |
| | | new Date(stationInfo.getDSprq().getTime())); |
| | | |
| | | ps.setObject(27, stationInfo.getVSfmc()); |
| | | ps.setObject(28, stationInfo.getVSfdm()); |
| | | ps.setObject(29, stationInfo.getVDsdm()); |
| | | ps.setObject(30, stationInfo.getVDsmc()); |
| | | ps.setObject(31, stationInfo.getVQxdm()); |
| | | ps.setObject(32, stationInfo.getVXsmc()); |
| | | ps.setObject(33, stationInfo.getVTdjgbh()); |
| | | ps.setObject(34, stationInfo.getVTdjgmc()); |
| | | ps.setObject(35, stationInfo.getVJgbh()); |
| | | ps.setObject(36, stationInfo.getVJgmc()); |
| | | ps.setObject(37, stationInfo.getVLxrxm()); |
| | | ps.setObject(38, stationInfo.getVLxdh()); |
| | | ps.setObject(39, stationInfo.getVSjhm()); |
| | | ps.setObject(40, stationInfo.getVLxdz()); |
| | | ps.setObject(41, stationInfo.getIscountry()); |
| | | ps.setObject(42, stationInfo.getCWdlx()); |
| | | ps.setObject(43, stationInfo.getCYzbm()); |
| | | ps.setObject(44, stationInfo.getVYywdbh()); |
| | | ps.setObject(45, stationInfo.getVYywdmc()); |
| | | ps.setObject(46, stationInfo.getVGpsjd()); |
| | | ps.setObject(47, stationInfo.getVGpswd()); |
| | | ps.setObject(48, stationInfo.getYlgzdid()); |
| | | ps.setObject(49, stationInfo.getYlgzdmc()); |
| | | ps.setObject(50, stationInfo.getVStatus()); |
| | | // ps.setObject(51, stationInfo.getDSqrq()); |
| | | ps.setDate(51, new Date(stationInfo.getDSqrq().getTime())); |
| | | ps.setString(27, stationInfo.getVSfmc()); |
| | | ps.setString(28, stationInfo.getVSfdm()); |
| | | ps.setString(29, stationInfo.getVDsdm()); |
| | | ps.setString(30, stationInfo.getVDsmc()); |
| | | ps.setString(31, stationInfo.getVQxdm()); |
| | | ps.setString(32, stationInfo.getVXsmc()); |
| | | ps.setString(33, stationInfo.getVTdjgbh()); |
| | | ps.setString(34, stationInfo.getVTdjgmc()); |
| | | ps.setString(35, stationInfo.getVJgbh()); |
| | | ps.setString(36, stationInfo.getVJgmc()); |
| | | ps.setString(37, stationInfo.getVLxrxm()); |
| | | ps.setString(38, stationInfo.getVLxdh()); |
| | | ps.setString(39, stationInfo.getVSjhm()); |
| | | ps.setString(40, stationInfo.getVLxdz()); |
| | | ps.setString(41, stationInfo.getIscountry()); |
| | | ps.setShort(42, stationInfo.getCWdlx()); |
| | | ps.setString(43, stationInfo.getCYzbm()); |
| | | ps.setString(44, stationInfo.getVYywdbh()); |
| | | ps.setString(45, stationInfo.getVYywdmc()); |
| | | ps.setString(46, stationInfo.getVGpsjd()); |
| | | ps.setString(47, stationInfo.getVGpswd()); |
| | | ps.setString(48, stationInfo.getYlgzdid()); |
| | | ps.setString(49, stationInfo.getYlgzdmc()); |
| | | ps.setString(50, stationInfo.getVStatus()); |
| | | // ps.setString(51, stationInfo.getDSqrq()); |
| | | ps.setDate(51, stationInfo.getDSqrq() == null ? null : new Date(stationInfo.getDSqrq().getTime())); |
| | | |
| | | ps.setObject(52, stationInfo.getDSprq()); |
| | | ps.setDate(52, new Date(stationInfo.getDSprq().getTime())); |
| | | ps.setDate(52, stationInfo.getDSprq() == null ? null : new Date(stationInfo.getDSprq().getTime())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | log.error("设置参数值报错了"); |
| | | e.printStackTrace(); |
| | | log.error(e.getMessage()); |
| | | //手工回滚异常 |
| | | TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); |
| | |
| | | Object savePoint = TransactionAspectSupport.currentTransactionStatus().createSavepoint(); |
| | | try { |
| | | int pageNum = 0; |
| | | int pageSize = 500; |
| | | int pageSize = 1000; |
| | | |
| | | String batchInsertSql = "INSERT INTO YYZT_T_SHKDRB (\"V_SFDM\",\"V_SFMC\",\"V_DSDM\",\"V_DSMC\",\"V_QXDM\",\"V_XSMC\",\"V_TDJGBH\",\"V_TDJGMC\",\"V_JGBH\",\"V_JGMC\",\"D_RBRQ\",\"N_ZGYZLJS\",\"N_ZGYZQJS\",\"N_SHKDLJS\",\"N_SHKDQJS\",\"N_ZTLJS\",\"N_ZTQJS\",\"N_YTLJS\",\"N_YTQJS\",\"N_STLJS\",\"N_STQJS\",\"N_BSLJS\",\"N_BSQJS\",\"N_YDLJS\",\"N_YDQJS\",\"N_YFLJS\",\"N_YFQJS\",\"N_JDLJS\",\"N_JDQJS\",\"N_JTLJS\",\"N_JTQJS\",\"N_TTLJS\",\"N_TTQJS\",\"N_DBLJS\",\"N_DBQJS\",\"N_DNLJS\",\"N_DNQJS\",\"N_FWLJS\",\"N_FWQJS\",\"N_YSLJS\",\"N_YSQJS\",\"N_QTLJS\",\"N_QTQJS\",\"RESERVED1\",\"RESERVED2\",\"RESERVED3\",\"RESERVED4\",\"BATCH_NO\") VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; |
| | | |
| | |
| | | int fromIndex = i * batchSize; |
| | | // 结束位置 |
| | | int toIndex = (i + 1) * batchSize < length ? (i + 1) * batchSize : length; |
| | | if (fromIndex == batchSize) { |
| | | if (fromIndex == length) { |
| | | continue; |
| | | } |
| | | List<YyztTShkdrb> yyztTShkdrbs = stationInfoList.subList(fromIndex, toIndex); |
| | |
| | | item.getReserved2(), |
| | | item.getReserved3(), |
| | | item.getReserved4(), |
| | | item.getBatchNo() |
| | | }); |
| | | batchNo}); |
| | | }); |
| | | jdbcTemplate.batchUpdate(batchInsertSql, insertShkdrbList); |
| | | } catch (Exception e) { |
| | |
| | | |
| | | try { |
| | | int pageNum = 0; |
| | | int pageSize = 500; |
| | | int pageSize = 1000; |
| | | |
| | | String batchInsertSql = "INSERT INTO YYZT_T_DJTJB (\"V_SFDM\", \"V_SFMC\", \"V_DSDM\", \"V_DSMC\", \"V_QXDM\", \"V_XSMC\", \"V_TDJGBH\", \"V_JGBH\", \"V_JGMC\", \"D_RBRQ\", \"V_YLGZDID\", \"V_YLGZDMC\", \"N_SJYWL\", \"N_TKYWL\", \"N_BKYEL\", \"N_SJZJE\", \"N_TKSR\", \"N_BKSR\", \"BATCH_NO\") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; |
| | | // 查询总数 |
| | |
| | | int fromIndex = i * batchSize; |
| | | // 结束位置 |
| | | int toIndex = (i + 1) * batchSize < length ? (i + 1) * batchSize : length; |
| | | if (fromIndex == batchSize) { |
| | | if (fromIndex == length) { |
| | | continue; |
| | | } |
| | | System.out.println(fromIndex + " === " + toIndex); |
| | |
| | | item.getNSjzje(), |
| | | item.getNTksr(), |
| | | item.getNBksr(), |
| | | item.getBatchNo() |
| | | batchNo |
| | | }); |
| | | }); |
| | | jdbcTemplate.batchUpdate(batchInsertSql, insertShkdrbList); |