Merge branch 'master' of http://gitlab.nhys.cdnhxx.com/root/zhihuishequ
| | |
| | | dates.add(date1); |
| | | } |
| | | return dates; |
| | | } |
| | | |
| | | /** |
| | | * 获取上月最后一天时间 |
| | | * @return 上月最后一天时间 |
| | | */ |
| | | public static String getOldMonthLastDay(){ |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int month=calendar.get(Calendar.MONTH); |
| | | calendar.set(Calendar.MONTH, month-1); |
| | | calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); |
| | | return format_yyymmdd.format(calendar.getTime()); |
| | | } |
| | | |
| | | /** |
| | | * 获取上月第一天时间 |
| | | * @return 上月第一天时间 |
| | | */ |
| | | public static String getOldMonthFirstDay(){ |
| | | Calendar calendar=Calendar.getInstance(); |
| | | calendar.add(Calendar.MONTH, -1); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | return format_yyymmdd.format(calendar.getTime()); |
| | | } |
| | | } |
| | |
| | | String dayUrl="https://api.weixin.qq.com/datacube/getweanalysisappidmonthlyvisittrend?access_token="+accessToken; |
| | | WxRequestEntity wxRequestEntity=new WxRequestEntity(); |
| | | wxRequestEntity.setAccess_token(accessToken); |
| | | wxRequestEntity.setBegin_date(DateUtil.format(DateUtil.offsetMonth(DateUtils.getFirstDayOfMonth(),-1),"yyyyMMdd")); |
| | | wxRequestEntity.setEnd_date(DateUtil.format(DateUtil.offsetMonth(DateUtils.getLastDayOfMonth(),-1),"yyyyMMdd")); |
| | | wxRequestEntity.setBegin_date(DateUtils.getOldMonthFirstDay()); |
| | | wxRequestEntity.setEnd_date(DateUtils.getOldMonthLastDay()); |
| | | String result=HttpClientUtil.httpPost(dayUrl, JSONObject.toJSONString(wxRequestEntity)); |
| | | if(StringUtils.isNotEmpty(result)&result.contains("session_cnt")){ |
| | | JSONArray resultEntity= (JSONArray) JSONObject.parseObject(result).get("list"); |