|
@@ -458,48 +458,6 @@ public class TUInterfaceinfoServiceImpl implements ITUInterfaceinfoService
|
|
|
|
|
|
@Override
|
|
|
public Long getGuijiCountByDeptId(String deptId){
|
|
|
- new Thread() {
|
|
|
- public void run() {
|
|
|
- try{
|
|
|
- TUInterfaceinfo tuInterfaceinfo = new TUInterfaceinfo();
|
|
|
- tuInterfaceinfo.setDeptId(deptId);
|
|
|
- tuInterfaceinfo.setStatus("0");//状态(0可用,2禁用)
|
|
|
- tuInterfaceinfo.setShareType("share_type_2");//数据来源 只统计市归集类型接口对应表中数据条数综合
|
|
|
- /*
|
|
|
- t_guiji_gas_zenner_gas_purchase_center_infor 真兰中心计费信息
|
|
|
- */
|
|
|
- List<TUInterfaceinfo> tuInterfaceinfoList = tUInterfaceinfoMapper.selectTUInterfaceinfoDataNumList(tuInterfaceinfo);
|
|
|
- for (int i = 0; i < tuInterfaceinfoList.size(); i ++) {
|
|
|
- TUInterfaceinfo interfaceinfo = tuInterfaceinfoList.get(i);
|
|
|
- boolean uninitialized = interfaceinfo.getUpdateTime() == null;//未初始化
|
|
|
- boolean oldData = interfaceinfo.getUpdateTime() != null && new Date().getTime() - interfaceinfo.getUpdateTime().getTime() > 10 * 60 * 1000;//最多10分钟刷新一次最新数据
|
|
|
- boolean isValid = interfaceinfo.getStatus().equals("0");//有效数据
|
|
|
- if(uninitialized || (oldData && isValid)){
|
|
|
- interfaceinfo.setUpdateTime(new Date());
|
|
|
- Date dateBegin = new Date();
|
|
|
- tUInterfaceinfoMapper.updateTUInterfaceinfoDataNum(interfaceinfo);//更新更新时间 防止多次操作
|
|
|
- System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + interfaceinfo.getInterfaceName() + "更新更新时间 防止多次操作");
|
|
|
- tUInterfaceinfoMapper.updateDataNum(interfaceinfo);//更新更新时间为最新的以及数据条数
|
|
|
- Long interval = new Date().getTime() - dateBegin.getTime();//接口查询总数所用时间
|
|
|
- System.out.println("(" + tuInterfaceinfoList.size() + "-" + (i + 1) + ") " + interfaceinfo.getTableName() + " - " + interfaceinfo.getInterfaceName() + " - " + interval + " ms");
|
|
|
- // update t_u_interfaceinfo_datanum set datanum = 0, update_time = null 重置数据总数重新查询 使用updateTime控制min分钟内只能查询一次
|
|
|
- // select count(*) from t_guiji_gas_zenner_gas_purchase_center_infor - 归集-真兰收费系统-中心计费购气信息 12452820
|
|
|
- // (17-4) t_guiji_gas_zenner_gas_purchase_center_infor - 归集-真兰收费系统-中心计费购气信息 - 32424 ms
|
|
|
- // (17-5) t_guiji_gas_zenner_meter_reading_infor - 归集-真兰收费系统-抄表信息 - 222659 ms
|
|
|
- /*
|
|
|
- update t_u_interfaceinfo_datanum set datanum = 0, update_time = null;
|
|
|
- update t_u_interfaceinfo_datanum set status = 2 where table_name = 't_guiji_gas_zenner_gas_purchase_center_infor'; -- 12489514 17ms
|
|
|
- update t_u_interfaceinfo_datanum set status = 2 where table_name = 't_guiji_gas_zenner_meter_reading_infor'; -- 12389252 23ms
|
|
|
- */
|
|
|
- // 燃气 25010409 26114283
|
|
|
- }
|
|
|
- }
|
|
|
- System.out.println((tuInterfaceinfoList.size()>0?tuInterfaceinfoList.get(0).getDeptName():deptId)+": 查询接口数据结束,共" + tuInterfaceinfoList.size() + "个接口");
|
|
|
- }catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }.start();
|
|
|
Map<String, Object> param = new HashMap<>();
|
|
|
param.put("deptId", deptId);
|
|
|
tUInterfaceinfoMapper.getGuijiCountByDeptId(param);
|