From dd209750c5fecd9b05e827bc3e634b06816f1249 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 15 一月 2019 09:07:31 +0800 Subject: [PATCH] 浏览足迹添加时间 --- fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java | 262 --------------------------------------------------- 1 files changed, 3 insertions(+), 259 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java b/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java index e8c87e9..6644b6b 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/admin/TaoBaoOrderAdminController.java @@ -1,14 +1,7 @@ package com.yeshi.fanli.controller.admin; import java.io.PrintWriter; -import java.math.BigDecimal; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.List; import java.util.Map; -import java.util.UUID; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -16,25 +9,14 @@ import net.sf.json.JSONObject; import org.springframework.stereotype.Controller; -import org.springframework.util.Base64Utils; import org.springframework.web.bind.annotation.RequestMapping; +import org.yeshi.utils.JsonUtil; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.yeshi.fanli.entity.admin.ReslutOrder; -import com.yeshi.fanli.entity.bus.user.HongBao; -import com.yeshi.fanli.entity.bus.user.UserInfo; -import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; import com.yeshi.fanli.service.inter.count.TaoBaoOrderCountService; import com.yeshi.fanli.service.inter.hongbao.HongBaoService; import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService; import com.yeshi.fanli.service.inter.user.UserInfoService; -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.taobao.TaoKeApiUtil; -import org.yeshi.utils.JsonUtil; @Controller @RequestMapping("admin/new/api/v1/taoBaoOrder") @@ -54,245 +36,8 @@ @Resource private UserInfoService userInfoService; - @RequestMapping(value = "queryJoinHongBao") - public void queryJoinHongBao(String callback, Integer pageIndex, Integer pageSize, String key, String startTime, String endTime, Integer type, Integer goodstype, Integer days, PrintWriter out) { - try { - - if (pageSize == null) - pageSize = Constant.PAGE_SIZE; - - if (pageIndex == null) - pageIndex = 1; - - 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()); - } - - List<ReslutOrder> reslutOrders = taoBaoOrderService.queryJoinHongBao((pageIndex - 1) * pageSize, pageSize, key, startTime, endTime, type, days); - - /* 鏆傛棤鏁版嵁鏄剧ず 杩斿洖娑堟伅 */ - if (reslutOrders == null || reslutOrders.size() == 0) { - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏆傛棤鏁版嵁")); - return; - } - - /* 楠岃瘉缃戠粶: */ - StringBuffer auctionIdBuf = new StringBuffer(); - for (ReslutOrder reslutOrder : reslutOrders) { - Long auctionId = reslutOrder.getAuctionId(); - if (auctionId != null) { - auctionIdBuf.append(auctionId + ","); - } - } - - /* 楠岃瘉缃戠粶: 鑾峰彇鍟嗗搧閾炬帴 鍥剧墖閾炬帴 */ - List<TaoBaoGoodsBrief> goodsBriefList = null; - if (auctionIdBuf != null && auctionIdBuf.length() > 0) { - String auctionIds = auctionIdBuf.toString(); - - String ids = auctionIds.substring(0, auctionIds.length() - 1); - goodsBriefList = TaoKeApiUtil.getBatchGoodsInfos(ids); - } - - for (ReslutOrder reslutOrder : reslutOrders) { - - String orderId = reslutOrder.getOrderId(); - BigDecimal payment = reslutOrder.getPayment(); - - String orderState = reslutOrder.getOrderState(); - if ("璁㈠崟缁撶畻".equals(orderState)) { - reslutOrder.setOrderStateAdmin("1"); - } else if ("璁㈠崟浠樻".equals(orderState)) { - reslutOrder.setOrderStateAdmin("2"); - } else if ("璁㈠崟澶辨晥".equals(orderState)) { - reslutOrder.setOrderStateAdmin("3"); - } - - /* 缃戜笂鐖彇鍟嗗搧 鍥剧墖銆侀摼鎺� */ - Long auctionId = reslutOrder.getAuctionId(); - - if (goodsBriefList != null && goodsBriefList.size() > 0) { - for (TaoBaoGoodsBrief taoBaoGoodsBrief : goodsBriefList) { - Long auctionIdTB = taoBaoGoodsBrief.getAuctionId(); - if (auctionId.equals(auctionIdTB)) { - reslutOrder.setGoodsStae("0");// 鍦ㄥ敭 - String auctionUrl = taoBaoGoodsBrief.getAuctionUrl(); - String pictUrl = taoBaoGoodsBrief.getPictUrl(); - String shopTitle = taoBaoGoodsBrief.getShopTitle(); - reslutOrder.setShopTitle(shopTitle); - reslutOrder.setAuctionUrl(auctionUrl); - reslutOrder.setPictUrl(pictUrl); - } - } - } else { - reslutOrder.setGoodsStae("1");// 鍋滃敭 - } - - String goodsStae = reslutOrder.getGoodsStae(); - if (StringUtil.isNullOrEmpty(goodsStae)) { - reslutOrder.setGoodsStae("1");// 鍋滃敭 - } - - UserInfo userInfo = reslutOrder.getUserInfo(); - if (userInfo == null) { - userInfo = new UserInfo(); - reslutOrder.setUserInfo(userInfo); - } else { - Long uid = userInfo.getId(); - if (uid != null) { - UserInfo currtUser = userInfoService.selectByPKey(uid); - if (currtUser != null) { - reslutOrder.setUserInfo(currtUser); - } - } - } - - /* 璁㈠崟鍙蜂负绌� 鍒欎笉杩涜鏌ヨ绾㈠寘 */ - if (StringUtil.isNullOrEmpty(orderId)) { - continue; - } - - /* 鏍规嵁璁㈠崟鍙� + 浠樻閲戦 杩涜鍖归厤绾㈠寘 */ - - List<HongBao> listHB = hongBaoService.queryByOrderIDAndPayMoney(Long.parseLong(orderId), payment); - - /* 鏃犵孩鍖� */ - if (listHB == null || listHB.size() == 0) { - Long uid = userInfo.getId(); - if (uid != null) { - listHB = hongBaoService.queryByOrderIDAndUid(Long.parseLong(orderId), uid); - } - - if (listHB == null || listHB.size() == 0) { - continue; - } - } - - HongBao hongBao = listHB.get(0); - - reslutOrder.setHongbaoId(hongBao.getId()); - reslutOrder.setGetTime(hongBao.getGetTime()); - reslutOrder.setMoney(hongBao.getMoney()); - reslutOrder.setType(hongBao.getType()); - // reslutOrder.setState(hongBao.getState()); - reslutOrder.setCreatetime(hongBao.getCreatetime()); - reslutOrder.setPreGettime(hongBao.getPreGettime()); - - /* 鏌ヨ闂存帴鏀剁泭 绾㈠寘id */ - Long pid = reslutOrder.getHongbaoId(); - - if (pid != null) { - - List<HongBao> childHongBaoList = hongBaoService.findChildHongBaoList(pid); - - if (childHongBaoList != null && childHongBaoList.size() > 0) { - - for (HongBao hb : childHongBaoList) { - - BigDecimal money = hb.getMoney(); - Integer childType = hb.getType(); - Long uid = null; - String nickName = null; - - UserInfo user = hb.getUserInfo(); - if (user != null) { - uid = user.getId(); - UserInfo cuent = userInfoService.getUserByIdWithMybatis(uid); - if (cuent != null) - nickName = cuent.getNickName(); - } - - if (childType != null) { - if (childType == HongBao.TYPE_YIJI || childType == HongBao.TYPE_SHARE_YIJI) { - // 涓�绾� - reslutOrder.setLevelOne(uid); - reslutOrder.setLevelOneMoney(money); - reslutOrder.setLevelOneName(nickName); - } else if (childType == HongBao.TYPE_ERJI || childType == HongBao.TYPE_SHARE_ERJI) { - reslutOrder.setLevelTwo(uid); - reslutOrder.setLevelTwoMoney(money); - reslutOrder.setLevelTwoName(nickName); - } - } - - } - } - } - - DateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 璁剧疆鏍煎紡 - SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); - - String createTime = reslutOrder.getCreateTime(); - if (!StringUtil.isNullOrEmpty(createTime)) { - Date d = f.parse(createTime); - reslutOrder.setCreateTime(format.format(d)); - } - - String settlementTime = reslutOrder.getSettlementTime(); - if (!StringUtil.isNullOrEmpty(settlementTime)) { - Date d = f.parse(settlementTime); - reslutOrder.setSettlementTime(format.format(d)); - } - - /* 鍒拌处鐘舵�� */ - int state = hongBao.getState(); - - if (HongBao.STATE_YILINGQU == state) { - reslutOrder.setMoneyState("3"); // 宸插埌璐� - } else if (HongBao.STATE_BUKELINGQU == state || HongBao.STATE_KELINGQU == state) { - reslutOrder.setMoneyState("2"); // 鏈埌璐� - } else { - reslutOrder.setMoneyState("4"); // 宸插け鏁� - } - - String rebateSource = null; - Integer typeHongBao = reslutOrder.getType(); - if (typeHongBao != null) { - - if (typeHongBao == HongBao.TYPE_HUODONG || typeHongBao == HongBao.TYPE_XINREN) { - /* 3-娲诲姩绾㈠寘 4-鏂颁汉绾㈠寘 */ - rebateSource = "1"; - - } else if (typeHongBao == HongBao.TYPE_JINGDONG || typeHongBao == HongBao.TYPE_TAOBAO || typeHongBao == HongBao.TYPE_YAOQING) { - /* 鑷喘璁㈠崟 */ - rebateSource = "2"; - } else if (typeHongBao == HongBao.TYPE_YIJI || typeHongBao == HongBao.TYPE_ERJI || typeHongBao == HongBao.TYPE_SHARE_YIJI || typeHongBao == HongBao.TYPE_SHARE_ERJI) { - /* 閭�璇疯鍗� 鍒嗛攢绾㈠寘瀵瑰簲鐨勬渶涓婄骇绾㈠寘 */ - rebateSource = "3"; - } else if (typeHongBao == HongBao.TYPE_SHARE_GOODS) { - /* 鍒嗕韩璁㈠崟 */ - rebateSource = "4"; - } - reslutOrder.setRebateSource(rebateSource); - } - - } - - int count = taoBaoOrderService.countQueryJoinHongBao(key, startTime, endTime, type, days); - int totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1; - PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage); - - GsonBuilder gsonBuilder = new GsonBuilder(); - gsonBuilder.serializeNulls(); // 閲嶇偣 - Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create(); - - JSONObject data = new JSONObject(); - data.put("pe", pe); - data.put("list", gson.toJson(reslutOrders)); - - JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); - - } catch (Exception e) { - e.printStackTrace(); - JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鎿嶄綔寮傚父")); - } - } - + + @RequestMapping(value = "countByType") public void countByType(String callback, HttpServletRequest request, PrintWriter out) { @@ -305,7 +50,6 @@ JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data)); } catch (Exception e) { - // TODO Auto-generated catch block JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("缁熻澶辫触")); e.printStackTrace(); } -- Gitblit v1.8.0