|
@@ -198,6 +198,148 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
|
|
|
/**
|
|
|
* 刷新数据
|
|
|
*/
|
|
|
+ @Override
|
|
|
+ public void refreshData(){
|
|
|
+ //(164-57) t_guiji_gas_zenner_gas_purchase_center_infor - 归集-市燃气(真兰收费系统)-中心计费购气信息 - 467184 ms total:[12746163]
|
|
|
+ //(123-29) t_guiji_gas_zenner_meter_reading_infor - 归集-市燃气(真兰收费系统)-抄表信息 - 324043 ms total:[12703733]
|
|
|
+ //t_guiji_naturalresources_bdcdjxx - 归集-市自然资源(不动产)-个人基本信息 - updating database... id = 672238a3-3687-433c-888e-5db0c81eb8a8
|
|
|
+ TUInterfaceinfo param = new TUInterfaceinfo();
|
|
|
+ param.setNeedRefresh("1");
|
|
|
+ List<TUInterfaceinfo> tuInterfaceinfoList = tUInterfaceinfoMapper.selectTUInterfaceinfoList(param);
|
|
|
+ for (int i = 0; i < tuInterfaceinfoList.size(); i++) {
|
|
|
+ TUInterfaceinfo tuInterfaceinfo = tuInterfaceinfoList.get(i);
|
|
|
+ String tableName = tuInterfaceinfo.getTableName();
|
|
|
+ if(tableName == null || tableName.equals("")){
|
|
|
+ System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + 0 + " ms");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ System.out.println(tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + "updating database... id = " + tuInterfaceinfo.getId());
|
|
|
+ //select count(id) callsuccnum from ${tableName}
|
|
|
+ Date dateBegin = new Date();
|
|
|
+ TUInterfaceinfo result = tUInterfaceinfoMapper.selectCountByTableName(tuInterfaceinfo);
|
|
|
+ Long interval = new Date().getTime() - dateBegin.getTime();//接口查询总数所用时间
|
|
|
+ System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + interval + " ms total:[" + result.getCallsuccnum() + "]");
|
|
|
+ tuInterfaceinfo.setCallsuccnum(result.getCallsuccnum());
|
|
|
+ tuInterfaceinfo.setRefreshTime(new Date());
|
|
|
+ tuInterfaceinfo.setNeedRefresh("2");
|
|
|
+ tUInterfaceinfoMapper.updateInterfaceCallsuccnum(tuInterfaceinfo);
|
|
|
+ //update t_u_interfaceinfo set callsuccnum = #{callsuccnum} where id = #{id}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 刷新归集数据分析
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void imputationData(){
|
|
|
+ String year = "2022";
|
|
|
+ TUInterfaceinfo param = new TUInterfaceinfo();
|
|
|
+// param.setNeedRefresh("1");
|
|
|
+ //(164-57) t_guiji_gas_zenner_gas_purchase_center_infor - 归集-市燃气(真兰收费系统)-中心计费购气信息 - 237962 ms
|
|
|
+ //(164-70) t_guiji_gas_zenner_meter_reading_infor - 归集-市燃气(真兰收费系统)-抄表信息 - 352968 ms
|
|
|
+ List<TUInterfaceinfo> tuInterfaceinfoList = tUInterfaceinfoMapper.selectTUInterfaceinfoList(param);
|
|
|
+ for (int i = 0; i < tuInterfaceinfoList.size(); i++) {
|
|
|
+ TUInterfaceinfo tuInterfaceinfo = tuInterfaceinfoList.get(i);
|
|
|
+ String tableName = tuInterfaceinfo.getTableName();
|
|
|
+ if (tableName == null || tableName.equals("") || tableName.equals("t_u_interfaceinfo_emptytable")) {
|
|
|
+ System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + 0 + " ms");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ImputationData imputationDataParam = new ImputationData();
|
|
|
+ imputationDataParam.setYear(year);
|
|
|
+ imputationDataParam.setTableName(tableName);
|
|
|
+ boolean isExist = !(imputationDataMapper.selectImputationInterface(imputationDataParam).size() == 0);
|
|
|
+ if(isExist){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("year", year);
|
|
|
+ map.put("tableName", tableName);
|
|
|
+ System.out.println(tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + "updating database... id = " + tuInterfaceinfo.getId());
|
|
|
+ Date dateBegin = new Date();
|
|
|
+ ImputationData imputationData = tUInterfaceinfoMapper.imputationData(map);
|
|
|
+ Long interval = new Date().getTime() - dateBegin.getTime();//接口查询总数所用时间
|
|
|
+ ImputationData imputationDataInsert = new ImputationData();
|
|
|
+ imputationDataInsert.setYear(year);
|
|
|
+ imputationDataInsert.setTableName(tableName);
|
|
|
+ imputationDataInsert.setInterfaceName(tuInterfaceinfo.getInterfaceName());
|
|
|
+ imputationDataInsert.setJan(imputationData.getJan());
|
|
|
+ imputationDataInsert.setFeb(imputationData.getFeb());
|
|
|
+ imputationDataInsert.setMar(imputationData.getMar());
|
|
|
+ imputationDataInsert.setApr(imputationData.getApr());
|
|
|
+ imputationDataInsert.setMay(imputationData.getMay());
|
|
|
+ imputationDataInsert.setJun(imputationData.getJun());
|
|
|
+ imputationDataInsert.setJul(imputationData.getJul());
|
|
|
+ imputationDataInsert.setAug(imputationData.getAug());
|
|
|
+ imputationDataInsert.setSep(imputationData.getSep());
|
|
|
+ imputationDataInsert.setOct(imputationData.getOct());
|
|
|
+ imputationDataInsert.setNov(imputationData.getNov());
|
|
|
+ imputationDataInsert.setDecb(imputationData.getDecb());
|
|
|
+ imputationDataMapper.insertImputationInterface(imputationDataInsert);
|
|
|
+ System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + interval + " ms");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按月刷新归集数据分析
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void imputationDataByMonth(){
|
|
|
+ String year = new SimpleDateFormat("yyyy").format(new Date());//String year = "2022";
|
|
|
+ String month = new SimpleDateFormat("M").format(new Date());
|
|
|
+ TUInterfaceinfo param = new TUInterfaceinfo();
|
|
|
+ param.setShareType("share_type_2");//市归集
|
|
|
+// param.setNeedRefresh("1");
|
|
|
+ //(164-57) t_guiji_gas_zenner_gas_purchase_center_infor - 归集-市燃气(真兰收费系统)-中心计费购气信息 - 237962 ms
|
|
|
+ //(164-70) t_guiji_gas_zenner_meter_reading_infor - 归集-市燃气(真兰收费系统)-抄表信息 - 352968 ms
|
|
|
+ //t_guiji_naturalresources_qlrjbxx - 归集-市自然资源(不动产)-权利人基本信息 - updating database... id = 1de6752d-19c2-4010-9b61-9450a9d718b6
|
|
|
+ List<TUInterfaceinfo> tuInterfaceinfoList = tUInterfaceinfoMapper.selectTUInterfaceinfoList(param);
|
|
|
+ for (int i = 0; i < tuInterfaceinfoList.size(); i++) {
|
|
|
+ TUInterfaceinfo tuInterfaceinfo = tuInterfaceinfoList.get(i);
|
|
|
+ String tableName = tuInterfaceinfo.getTableName();
|
|
|
+ if (tableName == null || tableName.equals("") || tableName.equals("t_u_interfaceinfo_emptytable")) {
|
|
|
+ System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + 0 + " ms");
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ ImputationData imputationDataParam = new ImputationData();
|
|
|
+ imputationDataParam.setYear(year);
|
|
|
+ imputationDataParam.setTableName(tableName);
|
|
|
+ boolean isExist = !(imputationDataMapper.selectImputationInterface(imputationDataParam).size() == 0);
|
|
|
+ if(!isExist){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("year", year);
|
|
|
+ map.put("month", month);
|
|
|
+ map.put("tableName", tableName);
|
|
|
+ System.out.println(tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + "updating database... id = " + tuInterfaceinfo.getId());
|
|
|
+ Map column = new HashMap();
|
|
|
+ column.put("tableSchema", tableName.contains("\\.") ? tableName.split("\\.")[0] : "thsjzt");//thgjj / thsjzt
|
|
|
+ column.put("tableName", tableName.contains("\\.") ? tableName.split("\\.")[1] : tableName);//thgjj.tgjj_gtjkrxx / t_guiji_gas_zenner_meter_reading_infor
|
|
|
+ column.put("columnName", "create_time");//create_time / LAST_UPDATE_TIME
|
|
|
+ System.out.println(column.get("tableSchema"));
|
|
|
+ System.out.println(column.get("tableName"));
|
|
|
+ System.out.println(column.get("columnName"));
|
|
|
+ List<Object> objectList = tUInterfaceinfoMapper.checkColumnExists(column);
|
|
|
+ System.out.println(objectList.size() + "=object");
|
|
|
+ Date dateBegin = new Date();
|
|
|
+ ImputationData imputationData;
|
|
|
+ if(objectList.size() != 0){
|
|
|
+ imputationData = tUInterfaceinfoMapper.imputationDataByMonth(map);
|
|
|
+ }else {
|
|
|
+ imputationData = tUInterfaceinfoMapper.imputationDataByMonthLastUpdateTime(map);
|
|
|
+ }
|
|
|
+ Long interval = new Date().getTime() - dateBegin.getTime();//接口查询总数所用时间
|
|
|
+ ImputationData imputationDataInsert = new ImputationData();
|
|
|
+ imputationDataInsert.setYear(year);
|
|
|
+ imputationDataInsert.setMonth(month);
|
|
|
+ imputationDataInsert.setTableName(tableName);
|
|
|
+// imputationDataInsert.setInterfaceName(tuInterfaceinfo.getInterfaceName());//接口名称可能会变
|
|
|
+ imputationDataInsert.setCount(imputationData.getCount());
|
|
|
+ imputationDataMapper.updateImputationInterfaceByYearMonthTableName(imputationDataInsert);
|
|
|
+ System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + tuInterfaceinfo.getTableName() + " - " + tuInterfaceinfo.getInterfaceName() + " - " + interval + " ms");
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 查询接口数量
|