| | |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.fanli.controller.admin.utils.AdminUtils; |
| | | import com.yeshi.fanli.dto.ChartTDO; |
| | | import com.yeshi.fanli.entity.admin.count.CountUserInfo; |
| | | import com.yeshi.fanli.entity.bus.user.Extract; |
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService; |
| | | import com.yeshi.fanli.tag.PageEntity; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.RedisManager; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.TimeUtil; |
| | | |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Controller |
| | |
| | | } |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | if (countOrder != null && countOrder >= 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | |
| | | } |
| | | |
| | | Integer countOrder = commonOrderCountService.countOderByUidAndLess10(extract.getUserInfo().getId()); |
| | | if (countOrder != null && countOrder > 10) { |
| | | if (countOrder != null && countOrder >= 10) { |
| | | if (StringUtil.isNullOrEmpty(mark)) { |
| | | mark = "刷单预警!!"; |
| | | } else { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 统计审核次数 |
| | | * |
| | | * @param callback |
| | | * @param state |
| | | * 审核状态:所有-3 通过-1 拒绝- 2 |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有3 |
| | | * @param dateType |
| | | * 类型 1日 2月 3年 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getAuditTotal") |
| | | public void getAuditTotal(String callback, String stateArray, Integer dateType, String year, String startTime, |
| | | String endTime, PrintWriter out) { |
| | | try { |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime); |
| | | if (validateMsg != null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | String substring = stateArray.substring(1, stateArray.length()-1); |
| | | List<Integer> channelList = null; |
| | | if (stateArray != null && stateArray.trim().length() > 4) { |
| | | channelList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {}.getType()); |
| | | } |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | |
| | | if (channelList != null && channelList.size() > 0) { |
| | | for (Integer state : channelList) { |
| | | List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, state); |
| | | String name = ""; |
| | | if (state == 1) { |
| | | name = "通过"; |
| | | } else if (state == 2) { |
| | | name = "驳回"; |
| | | } |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", name); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | } else { |
| | | List<Object> list = getAuditData(dateList, dateType, beginDate, endDate, null); |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "全部"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | line_list.add(innerList); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("line_list", line_list); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | private List<Object> getAuditData(List<String> dateList, Integer dateType, Date beginDate, Date endDate, |
| | | Integer state) throws Exception{ |
| | | List<Object> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.getAuditCount(beginDate, endDate, state); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory != null) { |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | list.add(value + ""); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 统计提现申请总额 |
| | | * |
| | | * @param callback |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有 |
| | | * @param dateType |
| | | * 类型 1日 2月 3 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getExtractApplyMoney") |
| | | public void getExtractApplyMoney(String callback, Integer dateType, String year, String startTime, String endTime, |
| | | PrintWriter out) { |
| | | try { |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime); |
| | | if (validateMsg != null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.getApplyMoney(beginDate, endDate); |
| | | for (String date: dateList) { |
| | | BigDecimal money = new BigDecimal("0"); |
| | | if (listHistory == null) { |
| | | list.add(money.toString()); |
| | | continue; |
| | | } |
| | | |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | money = MoneyBigDecimalUtil.add(money, history.getMoney()); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | list.add(money.toString()); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "金额"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | line_list.add(innerList); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | data.put("line_list", line_list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 统计提现申请总次数 |
| | | * |
| | | * @param callback |
| | | * @param state |
| | | * 所有-空值或者不传 待审核-0 通过-1 拒绝- 2 |
| | | * @param type |
| | | * 统计类型 1-24小时 2-所有 |
| | | * @param dateType |
| | | * 类型 1日 2月 3年 |
| | | * @param year |
| | | * 2018 |
| | | * @param startTime |
| | | * 2018-12-01 |
| | | * @param endTime |
| | | * 2018-12-01 |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "getExtractApplyNumber") |
| | | public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime, |
| | | String endTime, PrintWriter out) { |
| | | try { |
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime); |
| | | if (validateMsg != null) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg)); |
| | | return; |
| | | } |
| | | |
| | | if (dateType != 1 && (!StringUtil.isNullOrEmpty(startTime) || !StringUtil.isNullOrEmpty(endTime))) { |
| | | startTime = null; |
| | | endTime = null; |
| | | } |
| | | |
| | | |
| | | Date beginDate = null; |
| | | Date endDate = null; |
| | | |
| | | if (dateType == 1) { |
| | | beginDate = TimeUtil.parse(startTime); |
| | | endDate = TimeUtil.parse(endTime); |
| | | } else if (dateType == 2) { |
| | | Calendar calendar=Calendar.getInstance(); |
| | | int currentYear = calendar.get(Calendar.YEAR); |
| | | if (!StringUtil.isNullOrEmpty(year)) { |
| | | currentYear = Integer.parseInt(year); |
| | | } |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | beginDate =calendar.getTime(); |
| | | |
| | | calendar.clear(); |
| | | calendar.set(Calendar.YEAR, currentYear); |
| | | calendar.roll(Calendar.DAY_OF_YEAR, -1); |
| | | endDate=calendar.getTime(); |
| | | } else if (dateType == 3) { |
| | | beginDate = TimeUtil.parse("2018-01-01"); |
| | | endDate = new Date(); |
| | | } |
| | | Gson gson = new Gson(); |
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year); |
| | | |
| | | List<Object> list = new ArrayList<>(); |
| | | List<CountUserInfo> listHistory = extractAuditRecordService.geApplyNumber(beginDate, endDate); |
| | | for (String date: dateList) { |
| | | int value = 0; |
| | | if (listHistory == null) { |
| | | list.add(value + ""); |
| | | continue; |
| | | } |
| | | |
| | | for (CountUserInfo history: listHistory) { |
| | | if (dateType == 1) { |
| | | String gernalTime = TimeUtil.getGernalTime(history.getDay().getTime()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 2){ |
| | | String gernalTime = TimeUtil.getMonthOnlyMM(history.getDay()); |
| | | if(gernalTime.startsWith("0")) { |
| | | gernalTime = gernalTime.substring(1, 2); |
| | | } |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } else if (dateType == 3) { |
| | | String gernalTime = TimeUtil.getYearOnlyYYYY(history.getDay()); |
| | | if (gernalTime.equalsIgnoreCase(date)) { |
| | | value += history.getNum(); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | list.add(value + ""); |
| | | } |
| | | |
| | | JSONObject innerList = new JSONObject(); |
| | | innerList.put("name", "数量"); |
| | | innerList.put("data", gson.toJson(list)); |
| | | |
| | | JSONArray line_list = new JSONArray(); |
| | | line_list.add(innerList); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("xAxis_list", gson.toJson(dateList)); |
| | | data.put("line_list", line_list); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("系统异常")); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 下载提现红包Openid |