|
@@ -4,6 +4,7 @@ import java.sql.SQLException;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -48,18 +49,16 @@ public class OriginalTask {
|
|
|
String yesterday = DateUtil.yesterday();
|
|
|
//查询昨日数据
|
|
|
List<Object> params = new ArrayList<Object>();
|
|
|
- params.add(yesterday+"%");
|
|
|
+ params.add(yesterday+"%");
|
|
|
List<Map<String, Object>> resCount = newJdbc.findModeResult(sqlCount, params);
|
|
|
//开始分页
|
|
|
// int start = 0;//开始位置,从0行开始查询
|
|
|
// int pageSize = 20;//偏移量
|
|
|
- int numrows = resCount.size();//SELECT COUNT( * ) FROM news_comment,这里是总的行数
|
|
|
+ int numrows = resCount.size();//这里是总的行数
|
|
|
int pages = (int)(numrows / pageSize);//根据偏移量计算需要翻多少页
|
|
|
if (numrows % pageSize > 0){
|
|
|
pages++;
|
|
|
}
|
|
|
- System.out.println(start + "————————————————————————————————————————" + pageSize);
|
|
|
-
|
|
|
|
|
|
String insertSql = "insert into dw_file_detail_00 ("
|
|
|
+ "DFD0_ID,DFD0_NUMBER,DFD0_FILE_ID,DFD0_ADDRESS_NUM,DFD0_ADDRESS_NAME, "
|
|
@@ -73,9 +72,10 @@ public class OriginalTask {
|
|
|
+ "?,?)";
|
|
|
int i=1;
|
|
|
while(pages>0){
|
|
|
+ System.out.println(start + "————————————————————————————————————————" + pageSize);
|
|
|
String sql = "SELECT sus_id,sus_name_of_taiwan_district,sus_terminal_name,"
|
|
|
- + "sus_terminal_address_code,sus_data_date,sus_blackout_time,"
|
|
|
- + "sus_call_time,sus_unit_name,sus_station_area_number,sus_terminal_number,region "
|
|
|
+ + "sus_terminal_address_code,date_format(sus_data_date, '%Y-%c-%e %T') as sus_data_date,date_format(sus_blackout_time, '%Y-%c-%e %T') as sus_blackout_time,"
|
|
|
+ + "date_format(sus_call_time, '%Y-%c-%e %T') as sus_call_time,sus_unit_name,sus_station_area_number,sus_terminal_number,region "
|
|
|
+ "FROM suspected_power_failure "
|
|
|
+ "LEFT JOIN taiwan_district_manager_daixiugai "
|
|
|
+ "ON taiwan_District_number=sus_station_area_number "
|
|
@@ -90,12 +90,14 @@ public class OriginalTask {
|
|
|
//台区停电表导入数据
|
|
|
String fileDetailId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_DETAIL_00_NO");
|
|
|
List<Object> params1 = new ArrayList<Object>();
|
|
|
- Date sjrqDate = (Date) map.get("sus_data_date");
|
|
|
- Date tdsjDate = (Date) map.get("sus_blackout_time");
|
|
|
- Date ldsjDate = (Date) map.get("sus_call_time");
|
|
|
- String sjrq = DateUtil.format(sjrqDate,"yyyyMMdd");
|
|
|
- String tdsj = DateUtil.format(tdsjDate,"yyyyMMddHHmmss");
|
|
|
- String ldsj = DateUtil.format(ldsjDate,"yyyyMMddHHmmss");
|
|
|
+ //时间截取 反正时间强转 导致时间不准问题
|
|
|
+ String sjrqDate = map.get("sus_data_date")+"";
|
|
|
+ String sjrqArray[] = sjrqDate.split(" ");
|
|
|
+ String tdsjDate = map.get("sus_blackout_time")+"";
|
|
|
+ String ldsjDate = map.get("sus_call_time")+"";
|
|
|
+ String sjrq = DateUtil.formatStr(sjrqArray[0]);
|
|
|
+ String tdsj = DateUtil.formatTime(tdsjDate);
|
|
|
+ String ldsj = DateUtil.formatTime(ldsjDate);
|
|
|
//id
|
|
|
params1.add(fileDetailId);
|
|
|
//文件编号
|
|
@@ -124,7 +126,7 @@ public class OriginalTask {
|
|
|
params1.add(ldsj);
|
|
|
boolean a = oldJdbc.updateByPreparedStatement(insertSql, params1);
|
|
|
if(a == true){
|
|
|
- System.out.println("低电压插入:" + params1 + " 数量:" + (i) +" 原主键:"+map.get("sus_id"));
|
|
|
+ System.out.println("台区停电插入:" + params1 + " 数量:" + (i) +" 原主键:"+map.get("sus_id"));
|
|
|
}else{
|
|
|
System.out.println("!!!!!!!!!!!!————出现异常————!!!!!!!!!!!!");
|
|
|
}
|
|
@@ -141,6 +143,181 @@ public class OriginalTask {
|
|
|
|
|
|
}
|
|
|
/**
|
|
|
+ * 95598工单数据导入
|
|
|
+ * @param start
|
|
|
+ * @param pageSize
|
|
|
+ * @throws SQLException
|
|
|
+ * @throws MINBusinessException
|
|
|
+ * @throws ParseException
|
|
|
+ */
|
|
|
+ public static void workOrderData(int start,int pageSize) throws SQLException, MINBusinessException, ParseException {
|
|
|
+ System.out.println("<----------------电网95598工单数据导入开始--------->");
|
|
|
+ IMINDataBaseService db = Service.lookup(IMINDataBaseService.class);
|
|
|
+ //获取文件id
|
|
|
+ String fileId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_INF_NO");
|
|
|
+ //当前报表库
|
|
|
+ OldDBJdbcUtils oldJdbc = new OldDBJdbcUtils();
|
|
|
+ oldJdbc.getConnection();
|
|
|
+ //rpa数据库
|
|
|
+ NewDBJdbcUtils newJdbc = new NewDBJdbcUtils();
|
|
|
+ newJdbc.getConnection();
|
|
|
+ //故障条数
|
|
|
+ String sqlFaultCount = "SELECT fa_id FROM fault_work_order WHERE fa_acceptance_time LIKE ?";
|
|
|
+ //昨日日期
|
|
|
+ String yesterday = DateUtil.yesterday();
|
|
|
+ //查询昨日数据
|
|
|
+ List<Object> params = new ArrayList<Object>();
|
|
|
+// params.add(yesterday+"%");
|
|
|
+ params.add("2019-08-16%");
|
|
|
+ List<Map<String, Object>> faultCount = newJdbc.findModeResult(sqlFaultCount, params);
|
|
|
+ //开始分页
|
|
|
+// int start = 0;//开始位置,从0行开始查询
|
|
|
+// int pageSize = 20;//偏移量
|
|
|
+
|
|
|
+ int faultNumrows = faultCount.size();//这里是总的行数
|
|
|
+ //故障页数
|
|
|
+ int faultPages = (int)(faultNumrows / pageSize);//根据偏移量计算需要翻多少页
|
|
|
+ if (faultNumrows % pageSize > 0){
|
|
|
+ faultPages++;
|
|
|
+ }
|
|
|
+
|
|
|
+ String insertSql = "insert into dw_file_detail_05 ("
|
|
|
+ + "DFD5_ID,DFD5_NO,DFD5_FILE_ID,DFD5_GDBH,DFD5_GWGDBH,DFD5_ZT,"
|
|
|
+ + "DFD5_YWLX,DFD5_DQBZ,DFD5_SLRY,"
|
|
|
+ + "DFD5_SLSJ,DFD5_SLLR,DFD5_YHBH,"
|
|
|
+ + "DFD5_YHMC,DFD5_LXDZ,DFD5_LXDH,"
|
|
|
+ + "DFD5_HFNR,DFD5_YJFL,DFD5_EJFL,"
|
|
|
+ + "DFD5_YWZL,DFD5_SJDW,DFD5_GDDW,"
|
|
|
+ + "DFD5_CBD,DFD5_CLJG,DFD5_CLDW,"
|
|
|
+ + "DFD5_CLBM,DFD5_GLGD,DFD5_WTYYFL,"
|
|
|
+ + "DFD5_GDFJ,DFD5_ZRBM,DFD5_GDSJ,"
|
|
|
+ + "DFD5_GQSJ,DFD5_GQYY,DFD5_FWQD,"
|
|
|
+ + "DFD5_SJHTZRYY)"
|
|
|
+ + "values ("
|
|
|
+ + "?,?,?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?,?,"
|
|
|
+ + "?,?)";
|
|
|
+ int i=1;
|
|
|
+ while(faultPages>0){
|
|
|
+ System.out.println(start + "————————————————————————————————————————" + pageSize);
|
|
|
+ String sql = "SELECT fa_id,fa_work_order_no,fa_state_grid_work_order_no,fa_state,"
|
|
|
+ + "fa_business_type,fa_current_steps,fa_acceptance_personnel,"
|
|
|
+ + "date_format(fa_acceptance_time, '%Y-%c-%e %T') as fa_acceptance_time,fa_acceptance_content,fa_user_number,"
|
|
|
+ + "fa_user_name,fa_contact_address,fa_contact_number,"
|
|
|
+ + "fa_content_of_return_visit,fa_primary_classification,fa_secondary_classification,"
|
|
|
+ + "fa_superior_units,fa_power_supply_unit,fa_meter_reading_section,"
|
|
|
+ + "fa_processing_results,fa_processing_department,fa_associated_work_order,"
|
|
|
+ + "fa_responsible_department,fa_service_channels "
|
|
|
+ + "from fault_work_order "
|
|
|
+ + "where fa_acceptance_time LIKE ? "
|
|
|
+ + "ORDER BY fa_id DESC "
|
|
|
+ + "limit "+start+","+ pageSize;
|
|
|
+ List<Map<String, Object>> resList = newJdbc.findModeResult(sql, params);
|
|
|
+
|
|
|
+ //循环插入数据
|
|
|
+ for(Map<String,Object> map:resList){
|
|
|
+ //95598工单故障类型表导入数据
|
|
|
+ String fileDetailId = db.getMybatisMapper(SequenceMapper.class).getSequence("FILE_DETAIL_05_NO");
|
|
|
+ List<Object> params1 = new ArrayList<Object>();
|
|
|
+ String slsjDate = map.get("fa_acceptance_time")+"";
|
|
|
+ String slsjArray[] = slsjDate.split(" ");
|
|
|
+ //id
|
|
|
+ params1.add(fileDetailId);
|
|
|
+ //文件编号
|
|
|
+ params1.add(i);
|
|
|
+ //文件id
|
|
|
+ params1.add(fileId);
|
|
|
+ //工单编号
|
|
|
+ params1.add(map.get("fa_work_order_no"));
|
|
|
+ //国网工单编号
|
|
|
+ params1.add(map.get("fa_state_grid_work_order_no"));
|
|
|
+ //状态
|
|
|
+ params1.add(map.get("fa_state"));
|
|
|
+ //业务类型
|
|
|
+ params1.add(map.get("fa_business_type"));
|
|
|
+ //当前步骤
|
|
|
+ params1.add(map.get("fa_current_steps"));
|
|
|
+ //受理人员
|
|
|
+ params1.add(map.get("fa_acceptance_personnel"));
|
|
|
+ //受理时间
|
|
|
+ params1.add(slsjArray[0]);
|
|
|
+ //受理内容
|
|
|
+ params1.add(map.get("fa_acceptance_content"));
|
|
|
+ //用户编号
|
|
|
+ params1.add(map.get("fa_user_number"));
|
|
|
+ //用户名称
|
|
|
+ params1.add(map.get("fa_user_name"));
|
|
|
+ //联系地址
|
|
|
+ params1.add(map.get("fa_contact_address"));
|
|
|
+ //联系电话
|
|
|
+ params1.add(map.get("fa_contact_number"));
|
|
|
+ //回访内容
|
|
|
+ params1.add(map.get("fa_content_of_return_visit"));
|
|
|
+ //一级分类
|
|
|
+ params1.add(map.get("fa_primary_classification"));
|
|
|
+ //二级分类
|
|
|
+ params1.add(map.get("fa_secondary_classification"));
|
|
|
+ //业务子类 及 三级分类
|
|
|
+ params1.add(map.get("fa_three_level_classification"));
|
|
|
+ //上级单位
|
|
|
+ params1.add(map.get("fa_superior_units"));
|
|
|
+ //供电单位
|
|
|
+ params1.add(map.get("fa_power_supply_unit"));
|
|
|
+ //抄表段
|
|
|
+ params1.add(map.get("fa_meter_reading_section"));
|
|
|
+ //处理结果
|
|
|
+ params1.add(map.get("fa_processing_results"));
|
|
|
+ //处理单位 --
|
|
|
+ params1.add("");
|
|
|
+ //处理部门
|
|
|
+ params1.add(map.get("fa_processing_department"));
|
|
|
+ //关联工单
|
|
|
+ params1.add(map.get("fa_associated_work_order"));
|
|
|
+ //问题原因分类 --
|
|
|
+ params1.add("");
|
|
|
+ //工单分级 --
|
|
|
+ params1.add("");
|
|
|
+ //责任部门
|
|
|
+ params1.add(map.get("fa_responsible_department"));
|
|
|
+ //归档时间 --
|
|
|
+ params1.add("");
|
|
|
+ //挂起时间 --
|
|
|
+ params1.add("");
|
|
|
+ //挂起原因 --
|
|
|
+ params1.add("");
|
|
|
+ //服务渠道
|
|
|
+ params1.add(map.get("fa_service_channels"));
|
|
|
+ //省级回退责任原因 --
|
|
|
+ params1.add("");
|
|
|
+
|
|
|
+ boolean a = oldJdbc.updateByPreparedStatement(insertSql, params1);
|
|
|
+ if(a == true){
|
|
|
+ System.out.println("95598工单 故障类型数据插入:" + params1 + " 数量:" + (i) +" 原主键:"+map.get("fa_id"));
|
|
|
+ }else{
|
|
|
+ System.out.println("!!!!!!!!!!!!————出现异常————!!!!!!!!!!!!");
|
|
|
+ }
|
|
|
+ i++;
|
|
|
+ }
|
|
|
+ start+=pageSize;
|
|
|
+ faultPages--;
|
|
|
+ }
|
|
|
+ oldJdbc.releaseConn();
|
|
|
+ newJdbc.releaseConn();
|
|
|
+ int numrows = faultNumrows;
|
|
|
+ fileCreate(fileId,numrows,"1000006","95598工单明细");
|
|
|
+// //递归处理分页
|
|
|
+ System.out.println("<----------------95598数据导入结束--------->");
|
|
|
+
|
|
|
+ }
|
|
|
+ /**
|
|
|
* 文件表插入公共方法
|
|
|
* @param fileId 文件id
|
|
|
* @param number 数据总条数
|