From 698e358a3183e062943fa9dc1b144b6dffb4f66b Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期四, 11 七月 2019 14:26:36 +0800
Subject: [PATCH] 冲突
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 208 insertions(+), 12 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java
index 855c9c6..e13d1ac 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserOrderController.java
@@ -8,26 +8,31 @@
import java.util.Map;
import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.DateUtil;
+import org.yeshi.utils.IPUtil;
import org.yeshi.utils.JsonUtil;
import org.yeshi.utils.encrypt.DESUtil;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.accept.AcceptData;
+import com.yeshi.fanli.entity.bus.user.LostOrder;
import com.yeshi.fanli.entity.bus.user.Order;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.exception.order.CommonOrderException;
+import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
import com.yeshi.fanli.service.inter.order.CommonOrderService;
+import com.yeshi.fanli.service.inter.order.LostOrderService;
import com.yeshi.fanli.service.inter.order.OrderService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
@@ -73,6 +78,9 @@
@Resource
private OrderService orderService;
+ @Resource
+ private LostOrderService lostOrderService;
+
/**
* 璁㈠崟鍒楄〃
*
@@ -101,7 +109,7 @@
@RequestMapping(value = "getorder", method = RequestMethod.POST)
public void getOrder(AcceptData acceptData, Integer page, Long uid, Integer state, Integer type, Integer orderState,
String orderNo, String startTime, String endTime, Integer slotTime, boolean needCount, Integer dateType,
- PrintWriter out) {
+ Integer goodsType, PrintWriter out) {
if (uid == null) {
out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
@@ -124,6 +132,10 @@
if (type != null && type == 0) {
type = null; // 鎵�鏈夌被鍨嬭鍗�
+ }
+
+ if (goodsType != null && goodsType == 0) {
+ goodsType = null; // 鎵�鏈夊钩鍙拌鍗�
}
try {
@@ -149,25 +161,25 @@
BigDecimal todayMoney = null;
// 鏌ヨ鍒楄〃
- List<CommonOrderVO> list = commonOrderService.getOrderByUid(page, uid, state, type, orderState, orderNo,
- startTime, endTime, dateType);
+ List<CommonOrderVO> list = commonOrderService.getOrderByUid(acceptData, page, uid, state, type, orderState, orderNo,
+ startTime, endTime, dateType, goodsType);
if (list != null && list.size() > 0) {
// 缁熻鎬绘暟
count = commonOrderService.countGroupOrderNoByUid(uid, state, type, orderState, orderNo, startTime,
- endTime, dateType);
+ endTime, dateType, goodsType);
}
// 闇�瑕佺粺璁$瓫閫変俊鎭� 锛氭湭澶辨晥鐨勬�婚噾棰� 浠ュ強璁㈠崟
if (needCount && page == 1) {
- todayMoney = commonOrderService.countBonusOrderMoney(uid, type, dateType, startTime, endTime);
+ todayMoney = commonOrderService.countBonusOrderMoney(uid, type, dateType, startTime, endTime, goodsType);
- todayTotal = commonOrderService.countBonusOrderNumber(uid, type, dateType, startTime, endTime);
+ todayTotal = commonOrderService.countBonusOrderNumber(uid, type, dateType, startTime, endTime, goodsType);
// 缁熻鏈夋晥鐨勮鍗曟暟閲� 銆� 澶辨晥璁㈠崟鏁伴噺 銆佺淮鏉冭鍗曟暟閲�
Map<String, BigDecimal> countOrder = commonOrderService.countByUidAndOrderState(uid, type, startTime,
- endTime, dateType);
+ endTime, dateType, goodsType);
if (countOrder.get("totalValid") != null) {
totalValid = countOrder.get("totalValid").intValue();
@@ -270,7 +282,7 @@
data.put("userInfo", userInfo);
/* 鎬昏鍗曠粺璁� */
- Map<String, BigDecimal> countOrder = commonOrderService.countHistoryOrder(uid, null);
+ Map<String, BigDecimal> countOrder = commonOrderService.countHistoryOrder(uid, null, null);
int self = 0;
if (countOrder.get("totalSelf") != null) {
self = countOrder.get("totalSelf").intValue();
@@ -294,7 +306,7 @@
data.put("invite", invite);
/* 浠婃棩璁㈠崟缁熻 */
- Map<String, BigDecimal> countToday = commonOrderService.countHistoryOrder(uid, 1);
+ Map<String, BigDecimal> countToday = commonOrderService.countHistoryOrder(uid, 1, null);
int todaySelf = 0;
if (countToday.get("totalSelf") != null) {
@@ -322,7 +334,7 @@
data.put("today", todaydata);
/* 鏄ㄦ棩璁㈠崟缁熻 */
- Map<String, BigDecimal> countYesterday = commonOrderService.countHistoryOrder(uid, 2);
+ Map<String, BigDecimal> countYesterday = commonOrderService.countHistoryOrder(uid, 2, null);
int yesterdaySelf = 0;
if (countYesterday.get("totalSelf") != null) {
yesterdaySelf = countYesterday.get("totalSelf").intValue();
@@ -353,7 +365,146 @@
e.printStackTrace();
}
}
+
+
+
+ @RequestMapping(value = "getTotalOrderNum")
+ public void getTotalOrderNum(AcceptData acceptData, Long uid, PrintWriter out) {
+ if (uid == null) {
+ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
+ return;
+ }
+ UserInfo user = userInfoService.selectByPKey(uid);
+ if (user == null) {
+ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛涓嶅瓨鍦�"));
+ return;
+ }
+
+ UserInfo userInfo = UserUtil.filterForClientUser(user);
+
+ // 1.5.0 鐗堟湰涔嬪悗杩斿洖鏂扮殑绛夌骇
+ String version = acceptData.getVersion();
+ if (version != null && version.trim().length() > 0) {
+ int versionCode = Integer.parseInt(version);
+ String platform = acceptData.getPlatform();
+
+ AppVersionInfo versionInfo = appVersionService.getByPlatformAndVersion(platform, "1.5.0");
+ if (versionInfo != null) {
+ int versionCode150 = versionInfo.getVersionCode();
+ if (versionCode >= versionCode150) {
+ UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
+ if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
+ String picture = userInfoExtra.getUserRank().getPicture();
+ String icon = userInfoExtra.getUserRank().getIcon();
+
+ userInfo.setRankIcon(icon);
+ userInfo.setRankNamePicture(picture);
+ }
+ }
+ }
+
+ }
+
+ /* 鎬昏鍗曠粺璁� */
+ Map<String, BigDecimal> countOrder = commonOrderService.countHistoryOrder(uid, null, null);
+ int self = 0; // 杩斿埄璁㈠崟
+ if (countOrder.get("totalSelf") != null) {
+ self = countOrder.get("totalSelf").intValue();
+ }
+
+ int shared = 0; // 鍒嗕韩璁㈠崟
+ if (countOrder.get("totalShared") != null) {
+ shared = countOrder.get("totalShared").intValue();
+ }
+
+ int invite = 0; // 閭�璇疯鍗�
+ if (countOrder.get("totalInvite") != null) {
+ invite = countOrder.get("totalInvite").intValue();
+ }
+ int total = self + shared + invite;
+
+ JSONObject data = new JSONObject();
+ data.put("total", total);
+ data.put("self", self);
+ data.put("shared", shared);
+ data.put("invite", invite);
+ data.put("userInfo", userInfo);
+ out.print(JsonUtil.loadTrueResult(data));
+ }
+
+
+
+ @RequestMapping(value = "getNearOrderNum", method = RequestMethod.POST)
+ public void getNearOrderNum(AcceptData acceptData, Long uid, Integer goodsType, PrintWriter out) {
+
+ if (uid == null) {
+ out.print(JsonUtil.loadFalseResult(1, "鐢ㄦ埛鏈櫥褰�"));
+ return;
+ }
+
+ if (goodsType != null && goodsType == 0) {
+ goodsType = null;
+ }
+
+
+ /* 浠婃棩璁㈠崟缁熻 */
+ Map<String, BigDecimal> countToday = commonOrderService.countHistoryOrder(uid, 1, goodsType);
+
+ int todaySelf = 0;
+ if (countToday.get("totalSelf") != null) {
+ todaySelf = countToday.get("totalSelf").intValue();
+ }
+
+ int todayShared = 0;
+ if (countToday.get("totalShared") != null) {
+ todayShared = countToday.get("totalShared").intValue();
+ }
+
+ int todayInvite = 0;
+ if (countToday.get("totalInvite") != null) {
+ todayInvite = countToday.get("totalInvite").intValue();
+ }
+
+ int todayTotal = todaySelf + todayShared + todayInvite;
+
+ JSONObject todaydata = new JSONObject();
+ todaydata.put("total", todayTotal);
+ todaydata.put("self", todaySelf);
+ todaydata.put("shared", todayShared);
+ todaydata.put("invite", todayInvite);
+
+ /* 鏄ㄦ棩璁㈠崟缁熻 */
+ Map<String, BigDecimal> countYesterday = commonOrderService.countHistoryOrder(uid, 2, goodsType);
+ int yesterdaySelf = 0;
+ if (countYesterday.get("totalSelf") != null) {
+ yesterdaySelf = countYesterday.get("totalSelf").intValue();
+ }
+
+ int yesterdayShared = 0;
+ if (countYesterday.get("totalShared") != null) {
+ yesterdayShared = countYesterday.get("totalShared").intValue();
+ }
+ int yesterdayInvite = 0;
+ if (countYesterday.get("totalInvite") != null) {
+ yesterdayInvite = countYesterday.get("totalInvite").intValue();
+ }
+ int yesterdayTotal = yesterdaySelf + yesterdayShared + yesterdayInvite;
+
+ JSONObject yesterdaydata = new JSONObject();
+ yesterdaydata.put("total", yesterdayTotal);
+ yesterdaydata.put("self", yesterdaySelf);
+ yesterdaydata.put("shared", yesterdayShared);
+ yesterdaydata.put("invite", yesterdayInvite);
+
+ JSONObject data = new JSONObject();
+
+ data.put("today", todaydata);
+ data.put("yesterday", yesterdaydata);
+ out.print(JsonUtil.loadTrueResult(data));
+ }
+
+
/**
* 缁熻濂栭噾
*
@@ -430,7 +581,8 @@
* @param out
*/
@RequestMapping(value = "uploadParsedOrder", method = RequestMethod.POST)
- public void uploadParsedOrder(AcceptData acceptData, Long uid, String orderData, String source, PrintWriter out) {
+ public void uploadParsedOrder(AcceptData acceptData, Long uid, String orderData, String source,
+ HttpServletRequest request, PrintWriter out) {
if (uid == null || StringUtil.isNullOrEmpty(orderData)) {
out.print(JsonUtil.loadFalseResult(1, "鏁版嵁閿欒"));
return;
@@ -446,14 +598,32 @@
}
if ("findOrder".equalsIgnoreCase(source)) {
+
+ boolean success = false;
// 鍖归厤璁㈠崟
for (String order : orders) {
if (!StringUtil.isNullOrEmpty(order)) {
List<TaoBaoOrder> orderList = taoBaoOrderService.getTaoBaoOrderByOrderId(order);
+ // 璁$畻璁㈠崟鐘舵��
+
if (orderList != null && orderList.size() > 0) {
+ int inValid = 0;
+ for (TaoBaoOrder taoBaoOrder : orderList) {
+ if (taoBaoOrder.getOrderState().equalsIgnoreCase("璁㈠崟澶辨晥")) {
+ inValid++;
+ }
+ }
+ // 璁㈠崟鍏ㄦ槸澶辨晥
+ if (inValid == orderList.size())
+ continue;
+
List<CommonOrder> commonOrderList = commonOrderService
.listBySourceTypeAndOrderId(Constant.SOURCE_TYPE_TAOBAO, order);
if (commonOrderList == null || commonOrderList.size() == 0) {
+ Order o = orderService.findOrderByOrderIdAndType(order, Order.ORDER_TYPE_TAOBAO);
+ if (o != null)// 鍘熸潵宸茬粡瀛樺湪锛屽垯涓嶉渶瑕佹壘鍥�
+ continue;
+
Order or = new Order();
or.setBeizhu("浜哄伐鑷姩鎵惧洖琛ュ崟");
or.setCreatetime(System.currentTimeMillis());
@@ -468,14 +638,40 @@
isS = orderService.addOrder(or);
if (isS) {
CMQManager.getInstance().addTaoBaoOrderMsg(order, orderList);
+ // 鍔犲叆鍒癓ostOrder
+ LostOrder lo = new LostOrder();
+ lo.setCreateTime(System.currentTimeMillis());
+ lo.setHandleTime(System.currentTimeMillis());
+ lo.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort());
+ lo.setOrder(or);
+ lo.setOrderId(order);
+ lo.setState(LostOrder.STATE_PASS);
+ lo.setResultCode(LostOrder.RESULT_CODE_VERFING);
+ lo.setType(LostOrder.TYPE_TAOBAO);
+ lo.setUserInfo(new UserInfo(uid));
+ lostOrderService.saveLostOrder(lo);
+ if (success == false)
+ success = true;
}
} catch (Exception e) {
- e.printStackTrace();
+ try {
+ LogHelper.errorDetailInfo(e, order, "");
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
}
}
}
}
}
+ if (success) {
+ out.print(JsonUtil.loadTrue(0, null, "璁㈠崟鎵惧洖鎴愬姛锛岃鍒扳�滄垜鐨�-璁㈠崟鈥濅腑鏌ョ湅"));
+ return;
+ } else {
+ out.print(JsonUtil.loadFalseResult("娌℃湁鍙壘鍥炵殑璁㈠崟锛岃灏濊瘯鎵嬪姩鎵惧洖"));
+ return;
+ }
+
} else {
String orderId = null;
if (orders != null && orders.length > 0)
--
Gitblit v1.8.0