|
@@ -28,9 +28,9 @@ public class TslDataDao {
|
|
|
*/
|
|
|
public void batchInsertWorkFlowBasicData(List<WorkFlowBasicData> data, String tableName) {
|
|
|
String sqlFormat = "INSERT INTO %s " +
|
|
|
- "(order_no, kfsn, city_id, region_id, kd_accept_time, kd_request_reply_time, re_is_status_id, " +
|
|
|
- " kf_file_time, kf_file_type, work_flow_create_time, work_flow_update_time) " +
|
|
|
- "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
+ "(order_no,is_effctive, kfsn, city_id, region_id, kd_accept_time, kd_request_reply_time, re_is_status_id, "
|
|
|
+ + " kf_file_time, kf_file_type, work_flow_create_time, work_flow_update_time) " +
|
|
|
+ "VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
|
|
BatchSqlUpdate batchSqlUpdate = new BatchSqlUpdate(Objects.requireNonNull(jdbcTemplate.getDataSource()),
|
|
|
String.format(sqlFormat, tableName));
|
|
|
batchSqlUpdate.setBatchSize(1000);
|
|
@@ -38,11 +38,12 @@ public class TslDataDao {
|
|
|
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
Types.VARCHAR, Types.VARCHAR, Types.VARCHAR,
|
|
|
- Types.TIMESTAMP, Types.TIMESTAMP
|
|
|
+ Types.VARCHAR, Types.TIMESTAMP, Types.TIMESTAMP
|
|
|
});
|
|
|
for (WorkFlowBasicData item : data) {
|
|
|
batchSqlUpdate.update(
|
|
|
item.getOrderNo(),
|
|
|
+ item.getIsEffctive(),
|
|
|
item.getKfsn(),
|
|
|
item.getCityId(),
|
|
|
item.getRegionId(),
|
|
@@ -58,13 +59,12 @@ public class TslDataDao {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 创建临时表,并返回临时表表名
|
|
|
+ * 创建临时表
|
|
|
*/
|
|
|
- public String createTempTableOfWorkFlowBasicData() {
|
|
|
- // 临时表添加一个时间戳
|
|
|
- String tempTableName = "tsl_data.work_flow_basic_data_temp_" + System.currentTimeMillis();
|
|
|
+ public void createTempTableOfWorkFlowBasicData(String tempTableName) {
|
|
|
String sql = "CREATE TABLE %s ( " + //
|
|
|
" order_no varchar(50) not null, " + //
|
|
|
+ " is_effctive varchar(50) not null, " + //
|
|
|
" kfsn varchar(50) NOT NULL, " + //
|
|
|
" city_id varchar(50) NULL, " + //
|
|
|
" region_id varchar(50) NULL, " + //
|
|
@@ -77,7 +77,6 @@ public class TslDataDao {
|
|
|
" work_flow_update_time timestamp NULL " + //
|
|
|
");";
|
|
|
jdbcTemplate.update(String.format(sql, tempTableName));
|
|
|
- return tempTableName;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -107,14 +106,14 @@ public class TslDataDao {
|
|
|
*/
|
|
|
public int insertWorkFlowBasicDataFromTempTable(String tempTableName) {
|
|
|
String sqlFormat = "insert into tsl_data.work_flow_basic_data" +
|
|
|
- " (order_no, kfsn, city_id, region_id, kd_accept_time, kd_request_reply_time, re_is_status_id, " +
|
|
|
- " kf_file_time, kf_file_type, work_flow_create_time, work_flow_update_time)" +
|
|
|
- " select t.order_no, t.kfsn, t.city_id, t.region_id, t.kd_accept_time, t.kd_request_reply_time," +
|
|
|
- " t.re_is_status_id, t.kf_file_time, t.kf_file_type, t.work_flow_create_time, t.work_flow_update_time" +
|
|
|
- " from %s t " +
|
|
|
+ " (order_no, is_effctive, kfsn, city_id, region_id, kd_accept_time, kd_request_reply_time, re_is_status_id, "
|
|
|
+ + " kf_file_time, kf_file_type, work_flow_create_time, work_flow_update_time)" +
|
|
|
+ " select t.order_no, t.is_effctive, t.kfsn, t.city_id, t.region_id, t.kd_accept_time, t.kd_request_reply_time,"
|
|
|
+ + " t.re_is_status_id, t.kf_file_time, t.kf_file_type, t.work_flow_create_time, t.work_flow_update_time"
|
|
|
+ + " from %s t " +
|
|
|
" left join tsl_data.work_flow_basic_data b" +
|
|
|
- " on t.kfsn = b.kfsn" +
|
|
|
- " where b.kfsn is null";
|
|
|
+ " on t.order_no = b.order_no" +
|
|
|
+ " where b.order_no is null";
|
|
|
return jdbcTemplate.update(String.format(sqlFormat, tempTableName));
|
|
|
}
|
|
|
|
|
@@ -123,15 +122,15 @@ public class TslDataDao {
|
|
|
*/
|
|
|
public int updateWorkFlowBasicDataFromTempTable(String tempTableName) {
|
|
|
String sqlFormat = "update tsl_data.work_flow_basic_data b\n" +
|
|
|
- "set order_no = t.order_no, city_id = t.city_id, region_id = t.region_id, " +
|
|
|
- " kd_accept_time = t.kd_accept_time, kd_request_reply_time = t.kd_request_reply_time, " +
|
|
|
+ "set kfsn = t.kfsn, is_effctive = t.is_effctive, city_id = t.city_id, region_id = t.region_id, "
|
|
|
+ + " kd_accept_time = t.kd_accept_time, kd_request_reply_time = t.kd_request_reply_time, " +
|
|
|
" re_is_status_id = t.re_is_status_id, kf_file_time = t.kf_file_time, " +
|
|
|
" kf_file_type = t.kf_file_type, work_flow_create_time = t.work_flow_create_time, " +
|
|
|
" work_flow_update_time = t.work_flow_update_time " +
|
|
|
- " from (select order_no, kfsn, city_id, region_id, kd_accept_time, kd_request_reply_time, " +
|
|
|
- " re_is_status_id, kf_file_time, kf_file_type, work_flow_create_time, work_flow_update_time " +
|
|
|
+ " from (select order_no, is_effctive, kfsn, city_id, region_id, kd_accept_time, kd_request_reply_time, "
|
|
|
+ + " re_is_status_id, kf_file_time, kf_file_type, work_flow_create_time, work_flow_update_time " +
|
|
|
" from %s ) t" +
|
|
|
- " where b.kfsn = t.kfsn and (b.city_id != t.city_id or b.region_id != t.region_id)";
|
|
|
+ " where b.order_no = t.order_no";
|
|
|
return jdbcTemplate.update(String.format(sqlFormat, tempTableName));
|
|
|
}
|
|
|
|
|
@@ -234,8 +233,8 @@ public class TslDataDao {
|
|
|
*/
|
|
|
public void batchInsertCemMobileExperienceList(List<Object[]> data) {
|
|
|
String sql = "INSERT INTO tsl_data.cem_mobile_experience_list " + //
|
|
|
- "(month_id, day_id, service_id, contact_id, create_time, mobile_no, service_type_name1,"+
|
|
|
- " pro_name, code_cust_area, zyx, lwly_name, big_type_name, small_type_name, acct_month,"+
|
|
|
+ "(month_id, day_id, service_id, contact_id, create_time, mobile_no, service_type_name1," +
|
|
|
+ " pro_name, code_cust_area, zyx, lwly_name, big_type_name, small_type_name, acct_month," +
|
|
|
" day_id1, sheet_no, compl_city_local) " + //
|
|
|
"VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
|
|
|
jdbcTemplate.batchUpdate(sql, data);
|