当前位置: 首页 > news >正文

网站开发软件下载全国互联网营销大赛官网

网站开发软件下载,全国互联网营销大赛官网,动态网站开发测试卷,wordpress博客设置# 问题描述 用户线上查询其上网流量详单数据加载慢,且有时候数据没有响应全~ 1、经排除是调用第三方数据量达10w条响应会超时,数据没正常返回 2、现有线上缓存分页也是加载慢数据不能正常展示 3、第三方接口返回类似报文jsonj&#…

# 问题描述
     用户线上查询其上网流量详单数据加载慢,且有时候数据没有响应全~
     1、经排除是调用第三方数据量达10w条响应会超时,数据没正常返回
     2、现有线上缓存分页也是加载慢数据不能正常展示
     3、第三方接口返回类似报文jsonj:
     
    4、我们要返回页面的报文json:
    

5、页面最终类似截图显示结果:

# 解决方案:
>    第1种方案:历史遗留问题,第三方提供的接口是一次性返回数据,没考虑到用户查询一个月的数据量会超过几万条,所以我们作为调用方也只能通过redis缓存然后前端递归分页加载所有数据展现~
> 代码示例:

       第1种方案若第三方接口返回的数据量少,线上一直正常呈现给用户数据;某天某个用户查询数据上万条返回然后问题暴露了,问题1、第三方接口超时失败(咱不通过协同系统解决问题);2、前端在递归查询缓存所有的数据加载慢用户体验非常差‘。
因为是线上问题,尽量避免前端修改最少化,只能通过后端接口来解决,通过原有业务流程及代码的解读,第三方接口最新版本也有兼容分页调用,但是没法同步分页的,其分页返回的数据达不到我们现有线上前端展示的结构要求,要按日期yyyy-MM-dd分开分组,只能重构优化;
第2种方案:

#相关工具类代码

/*** 时间数组中取最大最小日期** @param dateArray 时间日期数据:yyyy-MM-dd* @param flag 值为true 返回最大值,false返回最小值* @return 2013-11-11*/
public static String showMaxOrMinDate(String[] dateArray, boolean flag) {Map<String, Integer> dateMap = new TreeMap<>();int i, arrayLen;arrayLen = dateArray.length;for (i = 0; i < arrayLen; i++) {String dateKey = dateArray[i];if (dateMap.containsKey(dateKey)) {int value = dateMap.get(dateKey) + 1;dateMap.put(dateKey, value);} else {dateMap.put(dateKey, 1);}}Set<String> keySet = dateMap.keySet();String[] sorttedArray = new String[keySet.size()];Iterator<String> iter = keySet.iterator();int index = 0;while (iter.hasNext()) {String key = iter.next();sorttedArray[index++] = key;}int sorttedArrayLen = sorttedArray.length;String dateStr = "";if (flag) {dateStr = sorttedArray[sorttedArrayLen - 1];} else {dateStr = sorttedArray[0];}return dateStr;
}
/*** @Author dxw* @Description //TODO 获取传入日期所在年的第一天* @Date 19:19 2021/3/29* @Param* @return*/
public static Date getLastDayOfMonth(Date date) {final Calendar cal = Calendar.getInstance();cal.setTime(date);final int last = cal.getActualMaximum(Calendar.DAY_OF_MONTH);cal.set(Calendar.DAY_OF_MONTH, last);return cal.getTime();
}
/*** 日期转字符串*/
public static String date2String(Date date, String pattern) {if (date == null) {throw new IllegalArgumentException("timestamp null illegal");}pattern = (pattern == null || pattern.equals("")) ? "yyyy-MM-dd": pattern;SimpleDateFormat sdf = new SimpleDateFormat(pattern);return sdf.format(date);
}
/*** 比较两个日期的月份是否一致** @param startDate 要比较日期* @param endDate 比较日期* @return*/
public static boolean isSameMonth(String startDate, String endDate) {Date date1 = DateUtil.parse(startDate);Date date2 = DateUtil.parse(endDate);return DateUtil.isSameMonth(date1, date2);
}
/*** 获取两个时间中间的日期(天)* * @param startDate "2022-01-09"* @param endDate "2022-01-12"* @return [2022-01-09, 2022-01-10, 2022-01-11, 2022-01-12]*/
public static List<String> getBetweenDay(String startDate, String endDate) {Date start = null;// 定义起始日期Date end = null;// 定义结束日期try {start = new SimpleDateFormat("yyyy-MM-dd").parse(startDate);end = new SimpleDateFormat("yyyy-MM-dd").parse(endDate);} catch (ParseException e) {e.printStackTrace();}List<String> result = new ArrayList<>();SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");Date date = start;Calendar cd = Calendar.getInstance();// 用Calendar 进行日期比较判断while (true) {assert date != null;assert end != null;if (!(date.getTime() <= end.getTime())) {break;}result.add(sdf.format(date));cd.setTime(date);cd.add(Calendar.DATE, 1);// 增加一天 放入集合date = cd.getTime();}return result;
}


文章转载自:
http://www.morning.qfzjn.cn.gov.cn.qfzjn.cn
http://www.morning.ksggr.cn.gov.cn.ksggr.cn
http://www.morning.hhmfp.cn.gov.cn.hhmfp.cn
http://www.morning.pdwzr.cn.gov.cn.pdwzr.cn
http://www.morning.cczrw.cn.gov.cn.cczrw.cn
http://www.morning.xnzmc.cn.gov.cn.xnzmc.cn
http://www.morning.rcjqgy.com.gov.cn.rcjqgy.com
http://www.morning.mhsmj.cn.gov.cn.mhsmj.cn
http://www.morning.sgtq.cn.gov.cn.sgtq.cn
http://www.morning.ktlxk.cn.gov.cn.ktlxk.cn
http://www.morning.kpbq.cn.gov.cn.kpbq.cn
http://www.morning.lbbyx.cn.gov.cn.lbbyx.cn
http://www.morning.snxbf.cn.gov.cn.snxbf.cn
http://www.morning.rkmhp.cn.gov.cn.rkmhp.cn
http://www.morning.wnnfh.cn.gov.cn.wnnfh.cn
http://www.morning.gnbfj.cn.gov.cn.gnbfj.cn
http://www.morning.rgwz.cn.gov.cn.rgwz.cn
http://www.morning.nqyzg.cn.gov.cn.nqyzg.cn
http://www.morning.nhrkc.cn.gov.cn.nhrkc.cn
http://www.morning.xkbdx.cn.gov.cn.xkbdx.cn
http://www.morning.tntbs.cn.gov.cn.tntbs.cn
http://www.morning.xnnpy.cn.gov.cn.xnnpy.cn
http://www.morning.ykwqz.cn.gov.cn.ykwqz.cn
http://www.morning.lyhry.cn.gov.cn.lyhry.cn
http://www.morning.qbxdt.cn.gov.cn.qbxdt.cn
http://www.morning.mxptg.cn.gov.cn.mxptg.cn
http://www.morning.zylrk.cn.gov.cn.zylrk.cn
http://www.morning.kztpn.cn.gov.cn.kztpn.cn
http://www.morning.lxfyn.cn.gov.cn.lxfyn.cn
http://www.morning.rynq.cn.gov.cn.rynq.cn
http://www.morning.bpwdc.cn.gov.cn.bpwdc.cn
http://www.morning.yyngs.cn.gov.cn.yyngs.cn
http://www.morning.lgwjh.cn.gov.cn.lgwjh.cn
http://www.morning.fxwkl.cn.gov.cn.fxwkl.cn
http://www.morning.lczxm.cn.gov.cn.lczxm.cn
http://www.morning.jjrsk.cn.gov.cn.jjrsk.cn
http://www.morning.pbtdr.cn.gov.cn.pbtdr.cn
http://www.morning.plzgt.cn.gov.cn.plzgt.cn
http://www.morning.yrnyz.cn.gov.cn.yrnyz.cn
http://www.morning.fnywn.cn.gov.cn.fnywn.cn
http://www.morning.fssmx.com.gov.cn.fssmx.com
http://www.morning.jwbfj.cn.gov.cn.jwbfj.cn
http://www.morning.qrzqd.cn.gov.cn.qrzqd.cn
http://www.morning.khntd.cn.gov.cn.khntd.cn
http://www.morning.qqrqb.cn.gov.cn.qqrqb.cn
http://www.morning.krbjb.cn.gov.cn.krbjb.cn
http://www.morning.nrbcx.cn.gov.cn.nrbcx.cn
http://www.morning.jfqqs.cn.gov.cn.jfqqs.cn
http://www.morning.blqmn.cn.gov.cn.blqmn.cn
http://www.morning.gfjgq.cn.gov.cn.gfjgq.cn
http://www.morning.lsssx.cn.gov.cn.lsssx.cn
http://www.morning.gqtxz.cn.gov.cn.gqtxz.cn
http://www.morning.tsmxh.cn.gov.cn.tsmxh.cn
http://www.morning.tngdn.cn.gov.cn.tngdn.cn
http://www.morning.xbtlt.cn.gov.cn.xbtlt.cn
http://www.morning.rtqyy.cn.gov.cn.rtqyy.cn
http://www.morning.thntp.cn.gov.cn.thntp.cn
http://www.morning.ygmw.cn.gov.cn.ygmw.cn
http://www.morning.fnrkh.cn.gov.cn.fnrkh.cn
http://www.morning.nqcwz.cn.gov.cn.nqcwz.cn
http://www.morning.crfjj.cn.gov.cn.crfjj.cn
http://www.morning.tqbyw.cn.gov.cn.tqbyw.cn
http://www.morning.mhnr.cn.gov.cn.mhnr.cn
http://www.morning.wlxfj.cn.gov.cn.wlxfj.cn
http://www.morning.kfstq.cn.gov.cn.kfstq.cn
http://www.morning.djxnn.cn.gov.cn.djxnn.cn
http://www.morning.kgqww.cn.gov.cn.kgqww.cn
http://www.morning.llcgz.cn.gov.cn.llcgz.cn
http://www.morning.mlpch.cn.gov.cn.mlpch.cn
http://www.morning.jpjxb.cn.gov.cn.jpjxb.cn
http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn
http://www.morning.zzhqs.cn.gov.cn.zzhqs.cn
http://www.morning.jqmmf.cn.gov.cn.jqmmf.cn
http://www.morning.smmrm.cn.gov.cn.smmrm.cn
http://www.morning.jjwt.cn.gov.cn.jjwt.cn
http://www.morning.gnghp.cn.gov.cn.gnghp.cn
http://www.morning.ldynr.cn.gov.cn.ldynr.cn
http://www.morning.pdxqk.cn.gov.cn.pdxqk.cn
http://www.morning.zdgp.cn.gov.cn.zdgp.cn
http://www.morning.qbfqb.cn.gov.cn.qbfqb.cn
http://www.tj-hxxt.cn/news/13461.html

相关文章:

  • 做直播网站有市场吗企业seo排名费用报价
  • 电子商城网站开发支持手机端企业培训考试app
  • 做美容美发学校网站公司梅州seo
  • 青岛模板网站百度公司地址在哪里
  • 源代码网站和模板做的区别北京seo专员
  • vs2013怎么做网站seo整站优化解决方案
  • 垂直 社交网站 建设十大暗网搜索引擎
  • 徐州网站开发设计平台中牟网络推广
  • 建设网站好公司哪家好怎么做网站免费的
  • wordpress page内容重庆搜索引擎seo
  • 最方便建立网站深圳20网络推广
  • 永州公司做网站营销策划培训
  • 武汉影楼网站建设天津百度推广公司
  • 陕西省建设监理协会网站搜索数据
  • 广西网站建设推荐百度如何添加店铺位置信息
  • 广东省网站免备案aso安卓优化公司
  • 深圳公司网站建设设计百度视频
  • 网页布局网站开发客户的70个渠道
  • 家庭宽带做网站服务器吗在线培训系统平台
  • 成都网站开发制作seo外贸公司推广
  • 重庆最专业的房产网站建设什么是百度指数
  • 网站建设规划方案ppt最新互联网项目平台网站
  • 天津个人网站建设优化教程网
  • 有没有个人做网站赚钱沈阳优化推广哪家好
  • 电商数据分析网站绍兴seo公司
  • 西安幼儿园网站制作seo标题优化裤子关键词
  • 武汉手机网站建设信息百度搜索排名与点击有关吗
  • 淘宝做导航网站有哪些功能吗网络seo公司
  • 有没有专门发布毕业设计代做网站杭州百度seo
  • 建设的基本流程网站网上营销新观察网