| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.OutputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.net.URLDecoder;
|
| | | import java.net.URLEncoder;
|
| | | import java.text.ParseException;
|
| | | import java.text.SimpleDateFormat;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.springframework.web.bind.annotation.RequestParam;
|
| | | import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
| | | import org.yeshi.utils.CsvUtil;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.entity.wx.RedPackRecord;
|
| | |
|
| | | 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.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.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.ExtractException;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.count.ExtractCountService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.PidOrderService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
|
| | | import com.yeshi.fanli.service.inter.count.UserInfoCountService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractAuditRecordService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractCountService;
|
| | | import com.yeshi.fanli.service.inter.money.extract.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractAuditRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | |
| | | private ExtractService extractService;
|
| | |
|
| | | @Resource
|
| | | private ExtractCountService extractCountService;
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | | private UserInfoCountService userInfoCountService;
|
| | |
|
| | | @Resource
|
| | | private ExtractCountService extractCountService;
|
| | |
|
| | | @Resource
|
| | | private PushRecordService pushRecordService;
|
| | |
| | | private ExtractAuditRecordService extractAuditRecordService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | |
|
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | | @Resource
|
| | | private PidOrderService pidOrderService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
|
| | |
|
| | | private final static String TODAY = "1";
|
| | | private final static String THREE = "2";
|
| | | private final static String AWEEK = "3";
|
| | |
|
| | | @RequestMapping(value = "getExtractList", method = RequestMethod.POST)
|
| | | public void getExtractList(int pageIndex, PrintWriter out) {
|
| | | List<Extract> extractList = extractService.getExtractList(pageIndex - 1);
|
| | | int count = extractService.getCount();
|
| | | int totalPage = count % Constant.PAGE_SIZE == 0 ? count / Constant.PAGE_SIZE : count / Constant.PAGE_SIZE + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, Constant.PAGE_SIZE, count, totalPage);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("extractList", extractList);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 通过提现请求
|
| | | * |
| | | * @author mawurui createTime 2018年3月14日 下午3:15:42
|
| | | * @param id
|
| | | * @param out
|
| | | * @param request
|
| | | */
|
| | | @RequestMapping(value = "passExtract", method = RequestMethod.POST)
|
| | | public void passExtract(String callback, long id, PrintWriter out, HttpServletRequest request) {
|
| | |
|
| | | // TODO 需要邮箱发送短信验证
|
| | |
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | |
|
| | | Integer integer = extractService.passExtract(id, admin);
|
| | | Extract extract = extractService.getExtractById(id);
|
| | | long uid = extract.getUserInfo().getId();
|
| | |
|
| | | if (integer == null) {
|
| | | out.print(JsonUtil.loadTrueResult("通过"));
|
| | | LogHelper
|
| | | .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的提现申请!"); // 同意之后成功
|
| | | } else if (integer == 1) {
|
| | |
|
| | | out.print(JsonUtil.loadFalseResult("不存在该对象")); // 同意之后失败
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请不存在");
|
| | | String title = "你的提现申请被驳回";
|
| | | String content = "非常遗憾,你的提现申请被驳回。我们通过核对发现你的账目明细有误,我们会在审计完成之后给你发通知消息。如有疑问请联系客服。";
|
| | | // xingePushController.pushSystemZnx(uid, title, content, out);
|
| | | } else {
|
| | |
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请状态异常");
|
| | | out.print(JsonUtil.loadFalseResult("该状态不等于不为初始状态"));
|
| | | String title = "你的提现申请不成功";
|
| | | String content = "请确保你的提现账户的隐私设置为 允许邮箱、手机号、会员名找到我。否则无法成功完成转账。如有疑问请联系客服。";
|
| | | // xingePushController.pushSystemZnx(uid, title, content, out);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | /* 允许提现 操作 */
|
| | | Integer integer = extractService.passExtract(id, admin);
|
| | |
|
| | | Extract extract = extractService.getExtractById(id);
|
| | | long uid = extract.getUserInfo().getId();
|
| | |
|
| | | // 日志记录
|
| | | if (integer == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("通过"));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("已通过"));
|
| | | LogHelper
|
| | | .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的提现申请!"); // 同意之后成功
|
| | | .userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "通过了[id=" + id + "]的提现申请!");
|
| | | } else if (integer == 1) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("不存在该对象"));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该提现记录已不存在,请刷新"));
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请不存在");
|
| | | String title = "你的提现申请被驳回";
|
| | | String content = "非常遗憾,你的提现申请被驳回。我们通过核对发现你的账目明细有误,我们会在审计完成之后给你发通知消息。如有疑问请联系客服。";
|
| | | // xingePushController.pushSystemZnx(uid, title, content, out);
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该状态不等于不为初始状态"));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户已被处理,请刷新"));
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 同意提现id=" + id + "的提现申请状态异常");
|
| | | String title = "你的提现申请不成功";
|
| | | String content = "请确保你的提现账户的隐私设置为 允许邮箱、手机号、会员名找到我。否则无法成功完成转账。如有疑问请联系客服。";
|
| | | // xingePushController.pushSystemZnx(uid, title, content, out);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 拒绝提现请求
|
| | | * |
| | | * @author mawurui createTime 2018年3月14日 下午3:15:55
|
| | | * @param id
|
| | | * @param reason
|
| | | * @param out
|
| | | * @param request
|
| | | */
|
| | | @RequestMapping(value = "rejectExtract", method = RequestMethod.POST)
|
| | | public void rejectExtract(String callback, long id, String reason, PrintWriter out, HttpServletRequest request) {
|
| | | AdminUser admin = (AdminUser) request.getSession().getAttribute(Constant.SESSION_ADMIN);
|
| | |
|
| | | Extract extract = extractService.getExtractById(id);
|
| | | long uid = extract.getUserInfo().getId();
|
| | | long extractTime = extract.getExtractTime();
|
| | |
|
| | | try {
|
| | | extractService.rejectExtract(id, reason, extractTime, admin);// 提现失败
|
| | |
|
| | | // 调用推送站内信给用户
|
| | | out.print(JsonUtil.loadTrueResult("拒绝"));
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "拒绝了[id=" + id
|
| | | + "]的提现申请!拒绝原因是" + reason);
|
| | |
|
| | | String title = "你的提现申请被驳回";
|
| | | String content = "非常遗憾,你的提现申请被驳回。我们通过核对发现你的账目明细有误,我们会在审计完成之后给你发通知消息。如有疑问请联系客服。";
|
| | | // xingePushController.pushSystemZnx(uid, title, content, out);
|
| | | } catch (ObjectStateException e) {
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请状态异常!"); //
|
| | |
|
| | | out.print(JsonUtil.loadFalseResult(e.getMessage()));
|
| | | } catch (NotExistObjectException e) {
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请不存在!");
|
| | |
|
| | | out.print(JsonUtil.loadFalseResult(e.getMessage()));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | /* 拒绝提现 操作 */
|
| | | 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);// 提现失败
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝"));
|
| | | extractService.rejectExtract(id, reason, admin);// 提现失败
|
| | |
|
| | | // 调用推送站内信给用户
|
| | | // out.print(JsonUtil.loadTrueResult("拒绝"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("拒绝成功"));
|
| | |
|
| | | LogHelper.userInfo("[ip:" + IPUtil.getRemotIP(request) + "]" + admin.getName() + "拒绝了[id=" + id
|
| | | + "]的提现申请!拒绝原因是" + reason);
|
| | |
|
| | | String title = "你的提现申请被驳回";
|
| | | String content = "非常遗憾,你的提现申请被驳回。我们通过核对发现你的账目明细有误,我们会在审计完成之后给你发通知消息。如有疑问请联系客服。";
|
| | | // xingePushController.pushSystemZnx(uid, title, content, out);
|
| | | } catch (ObjectStateException e) {
|
| | | LogHelper.userInfo(
|
| | | "[ip:" + IPUtil.getRemotIP(request) + "][管理员:" + admin.getName() + "] 拒绝提现id=" + id + "的提现申请状态异常!"); //
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 资金校验是否异常
|
| | | * |
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "checkExtract", method = RequestMethod.POST)
|
| | | public void checkExtract(String uid, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | try {
|
| | | extractService.checkExtract(uid);
|
| | | data.put("code", "1"); // 正常
|
| | | } catch (ExtractException e) {
|
| | | data.put("code", "0");// 异常
|
| | | }
|
| | | out.print(data);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取今日提现记录:今日总额、总次数、成功次数、失败次数 获取系统提现记录:总额、总次数
|
| | | *
|
| | | * @param out
|
| | |
| | |
|
| | | 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 (extract != null) {
|
| | | UserInfo userInfo = extract.getUserInfo();
|
| | | Long id = userInfo.getId();
|
| | | countByUid = hongBaoService.getCountByUid(id);
|
| | | countCancel = hongBaoService.getCountCancelByUid(id);
|
| | | countByUid = hongBaoV2CountService.countNumberByUid(id);
|
| | | countCancel = hongBaoV2CountService.countNumberByUidAndState(id, HongBaoV2.STATE_SHIXIAO);
|
| | | }
|
| | | extractAuditRecord.setCancelOrderNum((long) countCancel);
|
| | | extractAuditRecord.setOrderNum((long) countByUid);
|
| | |
| | | // }
|
| | |
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | Integer days = null;
|
| | | if (TODAY.equals(timeSlot)) {
|
| | | if ("1".equals(timeSlot)) {
|
| | | days = 0; // 今日
|
| | | } else if (THREE.equals(timeSlot)) {
|
| | | } else if ("2".equals(timeSlot)) {
|
| | | days = 3; // 前3天
|
| | | } else if (AWEEK.equals(timeSlot)) {
|
| | | } else if ("3".equals(timeSlot)) {
|
| | | days = 7; // 前7天
|
| | | }
|
| | |
|
| | |
| | | if (adminUser == null) {
|
| | | record.setAdminUser(new AdminUser());
|
| | | }
|
| | | |
| | |
|
| | | int warnLevel = 0;
|
| | | Extract extract = record.getExtract();
|
| | | if (extract != null) {
|
| | | Integer extractState = extract.getState();
|
| | | if (extractState != null && extractState == 0) {
|
| | | if (extractState != null && extractState == Extract.STATE_NOT_PROCESS) {
|
| | | UserInfo userInfo = extract.getUserInfo();
|
| | | if (userInfo != null) {
|
| | | double countTodayMoney = extractService.countTodayMoney(userInfo.getId());
|
| | | if (countTodayMoney >= 100) {
|
| | | BigDecimal countTodayMoney = extractService.sumTodayApplyMoney(userInfo.getId(),
|
| | | TimeUtil.getGernalTime(extract.getExtractTime()));
|
| | | if (countTodayMoney.compareTo(new BigDecimal(100)) > 0) {
|
| | | warnLevel = 1;
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | |
|
| | | if (record.getExtraInfo() != null) {
|
| | | StringBuffer desc = new StringBuffer();
|
| | | if (System.currentTimeMillis() > TimeUtil.convertToTimeTemp("2019-06-21", "yyyy-MM-dd")) {
|
| | | desc.append("大笔订单数:" + record.getExtraInfo().getOrderCount50More() + "\n#");
|
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
|
| | | desc.append("维权订单佣金:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
|
| | | if (record.getExtraInfo().getOrderCount50More() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 1
|
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(10)) >= 0)
|
| | | warnLevel = 2;
|
| | | } else {
|
| | | if (record.getExtraInfo().getOrderCount50More() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderCount() > 0
|
| | | || record.getExtraInfo().getWeiQuanOrderFanAmount().compareTo(new BigDecimal(0)) > 0)
|
| | | warnLevel = 2;
|
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#");
|
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
|
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
|
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount());
|
| | | }
|
| | | record.setExtraInfoStr(desc.toString());
|
| | | }
|
| | | record.setWarnLevel(warnLevel);
|
| | | }
|
| | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | gsonBuilder.setDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | |
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | for (ExtractAuditRecord record : list) {
|
| | |
|
| | | if (record.getExtraInfo() != null) {
|
| | | StringBuffer desc = new StringBuffer();
|
| | | desc.append("大于50元订单:" + record.getExtraInfo().getOrderCount50More() + "\n#");
|
| | | desc.append("维权订单数:" + record.getExtraInfo().getWeiQuanOrderCount() + "\n#");
|
| | | desc.append("维权订单退回金额:" + record.getExtraInfo().getWeiQuanOrderFanAmount() + "\n#");
|
| | | desc.append("180天安全订单数:" + record.getExtraInfo().getSafeOrderCount());
|
| | | record.setExtraInfoStr(desc.toString());
|
| | | }
|
| | | }
|
| | |
|
| | | int count = extractAuditRecordService.getByUidCount(uid);
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据用户id查询相应订单列表
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param key
|
| | | * 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getOrderRecordList")
|
| | | public void getOrderRecordList(String callback, Integer pageIndex, Integer pageSize, Long key, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | if (key == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到用户id"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(endTime)) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | Date enddate = sdf.parse(endTime);
|
| | | Calendar c = Calendar.getInstance();
|
| | | c.setTime(enddate);
|
| | | c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
|
| | | endTime = sdf.format(c.getTime());
|
| | | }
|
| | |
|
| | | if (pageIndex == null)
|
| | | pageIndex = 1;
|
| | |
|
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<HongBao> list = hongBaoService.selectOrderByUid(pageIndex, pageSize, key, startTime, endTime);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户无订单记录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Map<String, List<TaoBaoWeiQuanOrder>> wq = new HashMap<String, List<TaoBaoWeiQuanOrder>>();
|
| | | for (HongBao hongBao : list) {
|
| | | String orderId = hongBao.getOrderId();
|
| | |
|
| | | List<TaoBaoWeiQuanOrder> weiQuanList = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderId);
|
| | | if (weiQuanList != null && weiQuanList.size() > 0) {
|
| | | wq.put(orderId, weiQuanList);
|
| | | }
|
| | | }
|
| | |
|
| | | /* 验证网络: */
|
| | | StringBuffer auctionIdBuf = new StringBuffer();
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (HongBao hongBao : list) {
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | | Long preGettime = hongBao.getPreGettime();
|
| | | Long getTime = hongBao.getGetTime();
|
| | | Integer state = hongBao.getState();
|
| | | Integer type = hongBao.getType();
|
| | | String orderId = hongBao.getOrderId();
|
| | |
|
| | | // 单笔收益金额
|
| | | BigDecimal money = hongBao.getMoney();
|
| | |
|
| | | map.put("getTime", getTime);
|
| | |
|
| | | // 子订单号
|
| | | String orderItemId = "";
|
| | | map.put("orderItemId", orderItemId);
|
| | |
|
| | | /* 订单状态判断:1 订单已付款 2、订单已结算 4、订单失效 */
|
| | | if (state == HongBao.STATE_SHIXIAO) {
|
| | | map.put("orderState", 4); // 订单失效
|
| | | } else if (state == HongBao.STATE_BUKELINGQU) {
|
| | | Integer orderState = null;
|
| | |
|
| | | if (type == HongBao.TYPE_SHARE_GOODS) {
|
| | | // 分享订单
|
| | | Long hongbaoId = hongBao.getId();
|
| | | PidOrder pidOrder = pidOrderService.getPidOrderByHongBaoId(hongbaoId);
|
| | | String pidstate = pidOrder.getState();
|
| | | if ("订单付款".equals(pidstate)) {
|
| | | orderState = 1;
|
| | | } else if ("订单结算".equals(pidstate)) {
|
| | | orderState = 2;
|
| | | } else if ("订单失效".equals(pidstate)) {
|
| | | orderState = 4;
|
| | | }
|
| | | } else {
|
| | | if (preGettime != null && preGettime > 0) {
|
| | | orderState = 2; // 订单结算
|
| | | } else {
|
| | | orderState = 1; // 订单已付款
|
| | | }
|
| | | }
|
| | | map.put("orderState", orderState);
|
| | |
|
| | | } else if (state == HongBao.STATE_KELINGQU || state == HongBao.STATE_YILINGQU) {
|
| | | map.put("orderState", 2); // 订单结算
|
| | | }
|
| | |
|
| | | /* 订单返利状态: 2未到账 3已到账 4已失效 */
|
| | |
|
| | | if (HongBao.STATE_YILINGQU == state) {
|
| | | map.put("moneyState", 3); // 已到账
|
| | | } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) {
|
| | | map.put("moneyState", 2); // 未到账
|
| | | } else {
|
| | | map.put("moneyState", 4); // 已失效
|
| | | }
|
| | |
|
| | | /* 订单类型:1系统红包 2、自购订单 3、邀请订单 4 分享订单 */
|
| | | int rebateSource = 0;
|
| | | if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) {
|
| | | // 3-活动红包 4-新人红包
|
| | | rebateSource = 1;
|
| | | } else if (type == HongBao.TYPE_JINGDONG || type == HongBao.TYPE_TAOBAO) {
|
| | | // 自购订单
|
| | | rebateSource = 2;
|
| | | } else if (type == HongBao.TYPE_YAOQING || type == HongBao.TYPE_YIJI || type == HongBao.TYPE_ERJI
|
| | | || type == HongBao.TYPE_SHARE_ERJI || type == HongBao.TYPE_SHARE_YIJI) {
|
| | | // 邀请人自购订单+邀请人分享订单
|
| | | rebateSource = 3;
|
| | | } else if (type == HongBao.TYPE_SHARE_GOODS) {
|
| | | // 分享订单
|
| | | rebateSource = 4;
|
| | | }
|
| | | map.put("rebateSource", rebateSource);
|
| | |
|
| | | // 获取订单信息
|
| | | Map<String, Object> inMap = getOrderItem(hongBao);
|
| | |
|
| | | OrderItem orderItem = (OrderItem) inMap.get("orderItem");
|
| | | Long endtime = (Long) inMap.get("endtime");
|
| | | Long thirdCreateTime = (Long) inMap.get("thirdCreateTime");
|
| | |
|
| | | /* 初始化 空值 */
|
| | | if (orderItem == null) {
|
| | | orderItem = new OrderItem();
|
| | | map.put("goodsStae", "-1");
|
| | | }
|
| | |
|
| | | // 订单来源 0 无 1淘宝 2 京东
|
| | | map.put("orderSource", 1);
|
| | |
|
| | | // 当前实际返利金额
|
| | | orderItem.setFanMoney(money);
|
| | |
|
| | | String itemOrderId = orderItem.getOrderId();
|
| | | // 红包对应订单号
|
| | | if (StringUtil.isNullOrEmpty(itemOrderId))
|
| | | orderItem.setOrderId(orderId);
|
| | |
|
| | | Long auctionId = orderItem.getAuctionId();
|
| | | if (auctionId != null) {
|
| | | auctionIdBuf.append(auctionId + ",");
|
| | | } else {
|
| | | if (!StringUtil.isNullOrEmpty(orderId)) {
|
| | | List<TaoBaoOrder> taoBaoOrders = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | if (taoBaoOrders != null && taoBaoOrders.size() > 0) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrders.get(0);
|
| | | Long auctionId2 = taoBaoOrder.getAuctionId();
|
| | | orderItem.setAuctionId(auctionId2);
|
| | | auctionIdBuf.append(auctionId + ",");
|
| | |
|
| | | orderItem.setPayMoney(taoBaoOrder.getPayment());
|
| | | orderItem.setTitle(taoBaoOrder.getTitle());
|
| | |
|
| | | String settlementTime = taoBaoOrder.getSettlementTime();
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | if (!StringUtil.isNullOrEmpty(settlementTime)) {
|
| | | Date settleDate = sdf.parse(settlementTime);
|
| | | endtime = settleDate.getTime();
|
| | | }
|
| | |
|
| | | String createTime = taoBaoOrder.getCreateTime();
|
| | | if (!StringUtil.isNullOrEmpty(createTime)) {
|
| | | Date createDate = sdf.parse(createTime);
|
| | | thirdCreateTime = createDate.getTime();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | map.put("orderItem", orderItem);
|
| | |
|
| | | // 收货时间
|
| | | map.put("endtime", endtime);
|
| | | // 下单时间
|
| | | map.put("thirdCreateTime", thirdCreateTime);
|
| | |
|
| | | listmap.add(map);
|
| | | }
|
| | |
|
| | | /* 验证网络: 获取商品链接 图片链接 */
|
| | | List<TaoBaoGoodsBrief> goodsBriefList = null;
|
| | | if (auctionIdBuf != null && auctionIdBuf.length() > 0) {
|
| | | String auctionIds = auctionIdBuf.toString();
|
| | |
|
| | | String ids = auctionIds.substring(0, auctionIds.length() - 1);
|
| | | try {
|
| | | goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } |
| | | }
|
| | |
|
| | | List<Map<String, Object>> listResult = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | Iterator<Map<String, Object>> iterator = listmap.iterator();
|
| | | while (iterator.hasNext()) {
|
| | |
|
| | | Map<String, Object> map = iterator.next();
|
| | |
|
| | | int goodsStae = 1;
|
| | | String auctionUrl = ""; // 商品链接
|
| | |
|
| | | OrderItem orderItem = (OrderItem) map.get("orderItem");
|
| | | Long auctionId = orderItem.getAuctionId();
|
| | | if (auctionId != null) {
|
| | | if (goodsBriefList != null && goodsBriefList.size() > 0) {
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsBriefList) {
|
| | | Long auctionIdTB = taoBaoGoodsBrief.getAuctionId();
|
| | | if (auctionId.equals(auctionIdTB)) {
|
| | | goodsStae = 0;// 在售
|
| | | auctionUrl = taoBaoGoodsBrief.getAuctionUrl();
|
| | | String pictUrl = taoBaoGoodsBrief.getPictUrl();
|
| | | orderItem.setPicture(pictUrl);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | map.put("goodsStae", goodsStae); //
|
| | | map.put("auctionUrl", auctionUrl); // 商品链接
|
| | | listResult.add(map);
|
| | |
|
| | | }
|
| | |
|
| | | int count = hongBaoService.countOrderByUid(key, startTime, endTime);
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | // 该期间的总收益
|
| | | double countProfit = hongBaoService.countProfitByUid(key, startTime, endTime);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("countProfit", countProfit);
|
| | | data.put("listmap", listResult);
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 根据用户id查询相应订单列表
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param key
|
| | | * 用户id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getOrderList")
|
| | | public void getOrderList(String callback, Integer pageIndex, Integer pageSize, Long key, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | if (key == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未获取到用户id"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(endTime)) {
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
| | | Date enddate = sdf.parse(endTime);
|
| | | Calendar c = Calendar.getInstance();
|
| | | c.setTime(enddate);
|
| | | c.add(Calendar.DAY_OF_MONTH, 1);// 今天+1天
|
| | | endTime = sdf.format(c.getTime());
|
| | | }
|
| | |
|
| | | if (pageIndex == null)
|
| | | pageIndex = 1;
|
| | |
|
| | | if (pageSize == null)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<HongBao> list = hongBaoService.selectOrderByUid(pageIndex, pageSize, key, startTime, endTime);
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("该用户无订单记录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | /* 验证网络: */
|
| | | StringBuffer auctionIdBuf = new StringBuffer();
|
| | |
|
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (HongBao hongBao : list) {
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | | Long preGettime = hongBao.getPreGettime();
|
| | | Long getTime = hongBao.getGetTime();
|
| | | Integer state = hongBao.getState();
|
| | | Integer type = hongBao.getType();
|
| | | String orderId = hongBao.getOrderId();
|
| | | Date balanceTime = hongBao.getBalanceTime();
|
| | |
|
| | | // 自购订单id
|
| | | Long orderItemId = hongBao.getOrderItemId();
|
| | | // 单笔收益金额
|
| | | BigDecimal money = hongBao.getMoney();
|
| | |
|
| | | map.put("getTime", getTime);
|
| | | map.put("orderItemId", orderItemId);
|
| | |
|
| | | if (state == HongBao.STATE_SHIXIAO) {
|
| | | if (balanceTime != null) {
|
| | | map.put("orderState", 1); // 维权成功
|
| | | } else {
|
| | | map.put("orderState", 2); // 订单失效
|
| | | }
|
| | | } else if (state == HongBao.STATE_BUKELINGQU || state == HongBao.STATE_KELINGQU) {
|
| | | if (preGettime != null && preGettime > 0) {
|
| | | map.put("orderState", 0); // 订单结算
|
| | | } else {
|
| | | map.put("orderState", 3); // 订单付款中 未结算
|
| | | }
|
| | | } else {
|
| | | map.put("orderState", 0); // 订单已付款-已结算
|
| | | }
|
| | |
|
| | | if (HongBao.STATE_YILINGQU == state) {
|
| | | map.put("moneyState", 3); // 已到账
|
| | | } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) {
|
| | | map.put("moneyState", 2); // 未到账
|
| | | } else {
|
| | | map.put("moneyState", 4); // 已失效
|
| | | }
|
| | |
|
| | | /*
|
| | | * 1-淘宝订单 2-京东订单 3-活动红包 4-新人红包 5.邀请好友红包(布心街的) 6.一级分销红包 7.二级分销红包
|
| | | * 20-分享商品订单
|
| | | */
|
| | | int rebateSource = 0;
|
| | | if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) {
|
| | |
|
| | | /* 3-活动红包 4-新人红包 */
|
| | | rebateSource = 1;
|
| | |
|
| | | } else if (type == HongBao.TYPE_JINGDONG || type == HongBao.TYPE_TAOBAO) {
|
| | |
|
| | | /* 自购订单 */
|
| | | rebateSource = 2;
|
| | |
|
| | | } else if (type == HongBao.TYPE_YIJI || type == HongBao.TYPE_ERJI || type == HongBao.TYPE_YAOQING
|
| | | || type == HongBao.TYPE_SHARE_ERJI || type == HongBao.TYPE_SHARE_YIJI) {
|
| | |
|
| | | /* 邀请订单 分销红包对应的最上级红包 */
|
| | | rebateSource = 3;
|
| | |
|
| | | } else if (type == HongBao.TYPE_SHARE_GOODS) {
|
| | |
|
| | | /* 分享订单 */
|
| | | rebateSource = 4;
|
| | |
|
| | | }
|
| | | map.put("rebateSource", rebateSource);
|
| | |
|
| | | // 获取订单信息
|
| | | Map<String, Object> inMap = getOrderItem(hongBao);
|
| | |
|
| | | OrderItem orderItem = (OrderItem) inMap.get("orderItem");
|
| | | Long endtime = (Long) inMap.get("endtime");
|
| | | Long thirdCreateTime = (Long) inMap.get("thirdCreateTime");
|
| | |
|
| | | /* 初始化 空值 */
|
| | | if (orderItem == null) {
|
| | | orderItem = new OrderItem();
|
| | | map.put("goodsStae", "-1");
|
| | | }
|
| | |
|
| | | // 订单来源 0 无 1淘宝 2 京东
|
| | | map.put("orderSource", 1);
|
| | |
|
| | | // 当前实际返利金额
|
| | | orderItem.setFanMoney(money);
|
| | |
|
| | | String itemOrderId = orderItem.getOrderId();
|
| | | // 红包对应订单号
|
| | | if (StringUtil.isNullOrEmpty(itemOrderId))
|
| | | orderItem.setOrderId(orderId);
|
| | |
|
| | | Long auctionId = orderItem.getAuctionId();
|
| | | if (auctionId == null) {
|
| | | if (!StringUtil.isNullOrEmpty(orderId)) {
|
| | | List<TaoBaoOrder> taoBaoOrders = taoBaoOrderService.getTaoBaoOrderByOrderId(orderId);
|
| | | if (taoBaoOrders != null && taoBaoOrders.size() > 0) {
|
| | | TaoBaoOrder taoBaoOrder = taoBaoOrders.get(0);
|
| | | Long auctionId2 = taoBaoOrder.getAuctionId();
|
| | | orderItem.setAuctionId(auctionId2);
|
| | | auctionIdBuf.append(auctionId + ",");
|
| | |
|
| | | orderItem.setPayMoney(taoBaoOrder.getPayment());
|
| | | orderItem.setTitle(taoBaoOrder.getTitle());
|
| | |
|
| | | String settlementTime = taoBaoOrder.getSettlementTime();
|
| | |
|
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
| | | if (!StringUtil.isNullOrEmpty(settlementTime)) {
|
| | | Date settleDate = sdf.parse(settlementTime);
|
| | | endtime = settleDate.getTime();
|
| | | }
|
| | |
|
| | | String createTime = taoBaoOrder.getCreateTime();
|
| | | if (!StringUtil.isNullOrEmpty(createTime)) {
|
| | | Date createDate = sdf.parse(createTime);
|
| | | thirdCreateTime = createDate.getTime();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | map.put("orderItem", orderItem);
|
| | |
|
| | | // 收货时间
|
| | | map.put("endtime", endtime);
|
| | | // 下单时间
|
| | | map.put("thirdCreateTime", thirdCreateTime);
|
| | |
|
| | | listmap.add(map);
|
| | | }
|
| | |
|
| | | int count = hongBaoService.countOrderByUid(key, startTime, endTime);
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | // 该期间的总收益
|
| | | double countProfit = hongBaoService.countProfitByUid(key, startTime, endTime);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("countProfit", countProfit);
|
| | | data.put("listmap", listmap);
|
| | |
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(e.getMessage())));
|
| | | }
|
| | | }
|
| | |
|
| | | public Map<String, Object> getOrderItem(HongBao hongBao) {
|
| | |
|
| | | OrderItem orderItem = null;
|
| | |
|
| | | Long endtime = new Long(0);
|
| | | Long thirdCreateTime = new Long(0);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | | Integer type = hongBao.getType();
|
| | | if (type == null) {
|
| | | return map;
|
| | | }
|
| | |
|
| | | if (type == HongBao.TYPE_HUODONG || type == HongBao.TYPE_XINREN) {
|
| | | /* 3-活动红包 4-新人红包 */
|
| | |
|
| | | } else if (type == HongBao.TYPE_JINGDONG || type == HongBao.TYPE_TAOBAO) {
|
| | | /* 自购订单 */
|
| | |
|
| | | Long orderItemId = hongBao.getOrderItemId();
|
| | | orderItem = orderItemServcie.selectByPrimaryKey(orderItemId);
|
| | |
|
| | | // 下单时间
|
| | | Order order = hongBao.getOrder();
|
| | | if (order != null) {
|
| | | Date thirdCreateTime2 = order.getThirdCreateTime();
|
| | | if (thirdCreateTime2 != null) {
|
| | | thirdCreateTime = thirdCreateTime2.getTime();
|
| | | }
|
| | | }
|
| | |
|
| | | if (orderItem != null) {
|
| | |
|
| | | // 结束时间
|
| | | Long settlementTime = orderItem.getSettlementTime();
|
| | | if (settlementTime != 0) {
|
| | | endtime = settlementTime;
|
| | | }
|
| | |
|
| | | // 退款时间不为空 则已退款时间为结束时间
|
| | | Long refundTime = orderItem.getRefundTime();
|
| | | if (refundTime != 0) {
|
| | | endtime = refundTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | } else if (type == HongBao.TYPE_YIJI || type == HongBao.TYPE_ERJI || type == HongBao.TYPE_YAOQING
|
| | | || type == HongBao.TYPE_SHARE_ERJI || type == HongBao.TYPE_SHARE_YIJI) {
|
| | | /* 邀请订单 分销红包对应的最上级红包 */
|
| | |
|
| | | HongBao parent = hongBao.getParent();
|
| | |
|
| | | if (parent != null) {
|
| | | Long pid = parent.getId();
|
| | | HongBao phongbao = hongBaoService.selectByPrimaryKey(pid);
|
| | | Map<String, Object> map2 = getOrderItem(phongbao);
|
| | | return map2;
|
| | | }
|
| | |
|
| | | } else if (type == HongBao.TYPE_SHARE_GOODS) {
|
| | | /* 分享订单 */
|
| | |
|
| | | Long hongbaoId = hongBao.getId();
|
| | | PidOrder pidOrder = pidOrderService.getPidOrderByHongBaoId(hongbaoId);
|
| | |
|
| | | if (pidOrder != null) {
|
| | | orderItem = new OrderItem();
|
| | |
|
| | | orderItem.setOrderId(pidOrder.getOrderId());
|
| | | orderItem.setTitle(pidOrder.getGoodsTitle());
|
| | | orderItem.setPayMoney(pidOrder.getPayMoney());
|
| | | orderItem.setAuctionId(pidOrder.getAuctionId());
|
| | |
|
| | | // 下单时间
|
| | | Date createTime = pidOrder.getCreateTime();
|
| | | if (createTime != null) {
|
| | | thirdCreateTime = createTime.getTime();
|
| | | }
|
| | |
|
| | | // 结算时间
|
| | | Date balanceTime = pidOrder.getBalanceTime();
|
| | | if (balanceTime != null) {
|
| | | endtime = balanceTime.getTime();
|
| | | }
|
| | |
|
| | | String param = hongBao.getParam();
|
| | | if (!StringUtil.isNullOrEmpty(param)) {
|
| | | String picture = param.substring(11, param.length());
|
| | | if (!StringUtil.isNullOrEmpty(picture)) {
|
| | | orderItem.setPicture(picture.substring(0, picture.length() - 1));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | map.put("orderItem", orderItem);
|
| | | map.put("endtime", endtime);
|
| | | map.put("thirdCreateTime", thirdCreateTime);
|
| | |
|
| | | return map;
|
| | |
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | try {
|
| | | extractService.checkExtract(uid);
|
| | | extractService.checkExtract(Long.parseLong(uid));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("资金正常"));
|
| | | } catch (ExtractException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 统计审核次数
|
| | | * |
| | | * @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) {
|
| | |
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | 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<ChartTDO> 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);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | 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 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) {
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | 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();
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | List<ChartTDO> 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")));
|
| | | }
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | 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 out
|
| | | */
|
| | | @RequestMapping(value = "getExtractApplyNumber")
|
| | | public void getExtractApplyNumber(String callback, Integer state, Integer dateType, String year, String startTime,
|
| | | String endTime, PrintWriter out) {
|
| | | String validateMsg = AdminUtils.validateParams(dateType, startTime, endTime);
|
| | | if (validateMsg != null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(validateMsg));
|
| | | return;
|
| | | }
|
| | |
|
| | | 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;
|
| | | Gson gson = new Gson();
|
| | | List<String> dateList = AdminUtils.getDateList(dateType, startTime, endTime, year);
|
| | |
|
| | |
|
| | | JSONObject innerList = new JSONObject();
|
| | | innerList.put("name", "总计");
|
| | |
|
| | | List<ChartTDO> 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")));
|
| | | }
|
| | |
|
| | | JSONArray line_list = new JSONArray();
|
| | | line_list.add(innerList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | 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();
|
| | | }
|
| | | }
|
| | | |
| | | @RequestMapping(value = "downAutoExtractTxt")
|
| | | public void downAutoExtractTxt(String callback, HttpServletResponse response, PrintWriter out) {
|
| | | try {
|
| | | List<String> list = extractService.getAutoExtractOpenIds();
|
| | | if (list == null || list.size() <= 1) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
|
| | | return;
|
| | | }
|
| | | |
| | | String filepath = "自动提现OpenId "+ java.lang.System.currentTimeMillis() + ".txt";
|
| | | response.reset();
|
| | | response.setContentType("application/octet-stream");
|
| | | String fileName= URLDecoder.decode(filepath,"utf-8");
|
| | | response.addHeader("Content-Disposition","attachment;"+ "filename=\"" +URLEncoder.encode(fileName, "utf-8") + "\"");
|
| | | |
| | | StringBuilder sb = new StringBuilder();
|
| | | for(String t:list){
|
| | | sb.append(t+"\r\n");
|
| | | }
|
| | | |
| | | String opid_str = sb.toString();
|
| | | if (!StringUtil.isNullOrEmpty(opid_str) && opid_str.endsWith("\r\n")) {
|
| | | opid_str = opid_str.substring(0, opid_str.length() - 2);
|
| | | }
|
| | | |
| | | OutputStream os = response.getOutputStream();
|
| | | byte[] byt = opid_str.getBytes();
|
| | | os.write(byt);
|
| | | os.flush();
|
| | | os.close();
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | @RequestMapping(value = "uploadExcel", method = RequestMethod.POST)
|
| | | public void uploadExcel(@RequestParam("file") CommonsMultipartFile file, PrintWriter out) {
|
| | | if (file == null) {
|
| | | out.print(JsonUtil.loadFalseResult("上传文件不能为空!"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | List<RedPackRecord> list = CsvUtil.getCsvData(file, RedPackRecord.class);
|
| | | extractService.updateManualExtractRecord(list);
|
| | | out.print(JsonUtil.loadTrueResult("上传成功"));
|
| | | } catch (ExtractException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | out.print(JsonUtil.loadFalseResult("上传失败"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "preAutoUser")
|
| | | public void preAutoUser(String callback, Integer pageIndex, Integer pageSize, PrintWriter out) {
|
| | | try {
|
| | | List<UserInfo> list = extractService.preAutoUser();
|
| | | if (list == null || list.isEmpty()) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无用户满足自动提现条件"));
|
| | | return;
|
| | | }
|
| | | |
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | | |
| | | int count = list.size();
|
| | | int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | | |
| | | List<UserInfo> listResult = null;
|
| | | if (pageIndex < totalPage) {
|
| | | int start = (pageIndex - 1) * pageSize;
|
| | | listResult = list.subList(start, start + pageSize);
|
| | | } else if (pageIndex == totalPage) {
|
| | | listResult = list.subList((pageIndex - 1) * pageSize, list.size());
|
| | | } else {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("没有更多了"));
|
| | | return;
|
| | | }
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", listResult);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|