| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.io.UnsupportedEncodingException;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLDecoder;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | |
| | |
|
| | | 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.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.ExtractAuditRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.ExtractCountService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | |
| | |
|
| | | @Resource
|
| | | private ExtractService extractService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoCountService userInfoCountService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
| | | /* 拒绝提现 操作 */
|
| | |
|
| | | try {
|
| | | reason = URLDecoder.decode(reason, "UTF-8");
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | Extract extract = extractService.getExtractById(id);
|
| | | long extractTime = extract.getExtractTime();
|
| | | extractService.rejectExtract(id, reason, extractTime, admin);// 提现失败
|
| | |
| | |
|
| | | Map<String, Object> totalcount = extractCountService.getTodayCount();
|
| | |
|
| | | BigDecimal totalmoney = extractCountService.getTodayTotalSuccessMoney();
|
| | | // 今日提现成功金额
|
| | | BigDecimal todayextractMoney = extractCountService.getTodayTotalSuccessMoney();
|
| | |
|
| | | totalcount.put("totalmoney", totalmoney);
|
| | | // 当前用户余额总计:所有用户总余额
|
| | | BigDecimal amountMoney = userInfoCountService.countAllMoney(null);
|
| | |
|
| | | // 可提现金额限制
|
| | | String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY);
|
| | | if (minMoney == null) {
|
| | | minMoney = "0";
|
| | | }
|
| | | // 当前可提现金额总计: 超过最低提现金额---计入统计
|
| | | BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney));
|
| | |
|
| | | // 累计已提现金额总计:已提现成功的总额/ 次数
|
| | | Map<String, Object> resultData = extractCountService.countTotalSuccess();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("todayCount", totalcount);
|
| | | data.put("totalount", resultData);
|
| | | data.put("todayextractMoney", todayextractMoney);
|
| | |
|
| | | data.put("amountMoney", amountMoney); // 所有用户总余额
|
| | | data.put("extractApply", extractApply); // 可提现金额总计
|
| | | data.put("extractNumber", resultData.get("totalamount")); // 提现成功次数
|
| | | data.put("extractMoney", resultData.get("totalmoney")); // 提现成功金额
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
| | | if (adminUser == null) {
|
| | | record.setAdminUser(new AdminUser());
|
| | | }
|
| | | |
| | |
|
| | | int warnLevel = 0;
|
| | | Extract extract = record.getExtract();
|
| | | if (extract != null) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | | record.setWarnLevel(warnLevel);
|
| | | }
|
| | |
| | | try {
|
| | |
|
| | | // 统计已领取金额 账户历史总收益
|
| | | double receiveMoneys = hongBaoService.countReceiveMoneysByUid(uid);
|
| | | BigDecimal receiveMoneys = hongBaoV2CountService.countMoneyByUidAndState(uid, HongBaoV2.STATE_YILINGQU);
|
| | | if (receiveMoneys == null) {
|
| | | receiveMoneys = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | // 历史提现成功金额
|
| | | double successMoneys = extractCountService.countSuccessMoneysByUid(uid);
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | // TODO: handle exception
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } |
| | | }
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 统计审核次数 |
| | | * 统计审核次数
|
| | | * |
| | | * @param callback
|
| | | * @param state 审核状态:所有-空值或者不传 通过-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 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,Integer state, Integer dateType, String year, |
| | | String startTime, String endTime, PrintWriter out) {
|
| | | public void getAuditTotal(String callback, String stateArray, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | |
|
| | | String validateMsg = validateParams(dateType, startTime, endTime);
|
| | | 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;
|
| | | }
|
| | | |
| | | try {
|
| | |
|
| | | List<Map<String, Object>> resultList = extractAuditRecordService.countAuditTotal(state, dateType, |
| | | year, startTime, endTime);
|
| | | |
| | | JSONObject innerList = new JSONObject();
|
| | | if (state == null) {
|
| | | innerList.put("name", "总计");
|
| | | } else if (state == 1) {
|
| | | innerList.put("name", "通过数");
|
| | | } else if (state == 2) {
|
| | | innerList.put("name", "驳回数");
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | |
|
| | | try {
|
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Integer> stateList = gson.fromJson(stateArray, new TypeToken<ArrayList<Integer>>() {
|
| | | }.getType());
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | for (Integer state : stateList) {
|
| | | JSONObject innerList = new JSONObject();
|
| | | if (state == null || state == 3) {
|
| | | innerList.put("name", "总计");
|
| | | } else if (state == 1) {
|
| | | innerList.put("name", "通过数");
|
| | | } else if (state == 2) {
|
| | | innerList.put("name", "驳回数");
|
| | | }
|
| | |
|
| | | List<Map<String, Object>> list = extractAuditRecordService.countAuditTotal(state, dateType, year,
|
| | | startTime, endTime);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | |
|
| | | line_list.add(innerList);
|
| | | }
|
| | | innerList.put("data_list", resultList);
|
| | | |
| | | JSONArray outList = new JSONArray();
|
| | | outList.add(innerList);
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", outList);
|
| | | |
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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 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 = "getExtractMoney")
|
| | | public void getExtractMoney(String callback,Integer state, Integer dateType, String year, |
| | | String startTime, String endTime, PrintWriter out) {
|
| | | @RequestMapping(value = "getExtractApplyMoney")
|
| | | public void getExtractApplyMoney(String callback, Integer dateType, String year, String startTime, String endTime,
|
| | | PrintWriter out) {
|
| | |
|
| | | String validateMsg = validateParams(dateType, startTime, endTime);
|
| | | 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;
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | |
|
| | | List<Map<String, Object>> resultList = extractAuditRecordService.countExtractMoney(state, dateType, |
| | | year, startTime, endTime);
|
| | | |
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | Gson gson = new Gson();
|
| | | JSONArray line_list = new JSONArray();
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | if (state == null) {
|
| | | innerList.put("name", "总计");
|
| | | } else if (state == 0) {
|
| | | innerList.put("name", "待审核");
|
| | | } else if (state == 1) {
|
| | | innerList.put("name", "通过");
|
| | | } else if (state == 2) {
|
| | | innerList.put("name", "驳回");
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyMoney(null, dateType, year,
|
| | | startTime, endTime);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | innerList.put("data_list", resultList);
|
| | | |
| | | JSONArray outList = new JSONArray();
|
| | | outList.add(innerList);
|
| | | |
| | |
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", outList);
|
| | | |
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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 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) {
|
| | | public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | String validateMsg = validateParams(dateType, startTime, endTime);
|
| | | 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;
|
| | |
|
| | | if (dateType == 1 && year != null) {
|
| | | year = null; // 设置为空
|
| | | } else if (dateType == 2) {
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | |
|
| | | } else if (dateType == 3) {
|
| | | if (year != null)
|
| | | year = null;
|
| | |
|
| | | if (startTime != null)
|
| | | startTime = null;
|
| | |
|
| | | if (endTime != null)
|
| | | endTime = null;
|
| | | }
|
| | | |
| | |
|
| | | try {
|
| | |
|
| | | List<Map<String, Object>> resultList = extractAuditRecordService.countExtractApplyNumber(state, dateType, |
| | | year, startTime, endTime);
|
| | | |
| | | Object objectDate = null;
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | | Gson gson = new Gson();
|
| | | JSONArray line_list = new JSONArray();
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | if (state == null) {
|
| | | innerList.put("name", "总计");
|
| | | } else if (state == 0) {
|
| | | innerList.put("name", "待审核");
|
| | | } else if (state == 1) {
|
| | | innerList.put("name", "通过");
|
| | | } else if (state == 2) {
|
| | | innerList.put("name", "驳回");
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | List<Map<String, Object>> list = extractAuditRecordService.countExtractApplyNumber(null, dateType, year,
|
| | | startTime, endTime);
|
| | |
|
| | | if (dateType != 3) {
|
| | | innerList.put("data", gson.toJson(AdminUtils.dayOrMonthDataFactory(dateType, dateList, list)));
|
| | | } else {
|
| | | // 年视图
|
| | | Map<String, Object> map = AdminUtils.yearsDataFactory(list);
|
| | |
|
| | | if (objectDate == null) {
|
| | | objectDate = map.get("date");
|
| | | }
|
| | | innerList.put("data", gson.toJson(map.get("value")));
|
| | | }
|
| | | innerList.put("data_list", resultList);
|
| | | |
| | | JSONArray outList = new JSONArray();
|
| | | outList.add(innerList);
|
| | | |
| | |
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result_list", outList);
|
| | | |
| | | if (objectDate != null) {
|
| | | data.put("xAxis_list", gson.toJson(objectDate));
|
| | | } else {
|
| | | 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 out
|
| | | */
|
| | | @RequestMapping(value = "getMoneynfo")
|
| | | public void getHistoryInfo(String callback, PrintWriter out) {
|
| | |
|
| | | // 累计已提现金额总计:已提现成功的总额
|
| | | Map<String, Object> resultData = extractCountService.countTotalSuccess();
|
| | | // 当前用户余额总计:所有用户总余额
|
| | | BigDecimal amountMoney = userInfoCountService.countAllMoney(null);
|
| | | |
| | | // 可提现金额限制
|
| | | String minMoney = configService.get(Constant.EXTRACT_MIN_MONEY);
|
| | | if (minMoney == null){
|
| | | minMoney = "0";
|
| | | }
|
| | | // 当前可提现金额总计: 超过最低提现金额---计入统计
|
| | | BigDecimal extractApply = userInfoCountService.countAllMoney(Double.parseDouble(minMoney));
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("amountMoney", amountMoney);
|
| | | data.put("extractApply", extractApply);
|
| | | data.put("extractMoney", resultData.get("totalmoney"));
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | |
| | | public String validateParams(Integer shwoType, String startTime, String endTime) {
|
| | |
|
| | | if (shwoType == null) {
|
| | | return "请选择视图类型";
|
| | | }
|
| | | |
| | | if (shwoType == 1 && (StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime))) {
|
| | | return "请选择时间区间";
|
| | | }
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(startTime) && StringUtil.isNullOrEmpty(endTime)) {
|
| | | return "请选结束日期";
|
| | | }
|
| | | |
| | | if (StringUtil.isNullOrEmpty(startTime) && !StringUtil.isNullOrEmpty(endTime)) {
|
| | | return "请选起始日期";
|
| | | }
|
| | | |
| | | return null;
|
| | | }
|
| | | }
|