| | |
| | | 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.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 net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | 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.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.service.inter.count.UserInfoCountService;
|
| | | 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.push.PushRecordService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | |
| | | 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
|
| | | @RequestMapping("admin/new/api/v1/extract")
|
| | |
| | |
|
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | | @Resource
|
| | | private PidOrderService pidOrderService;
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
| | | 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;
|
| | |
|
| | | }
|
| | |
|
| | | /**
|