From 52d4fbddfd46b0dd684d99e5c0849b022606c8e2 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 26 五月 2020 10:37:32 +0800
Subject: [PATCH] 邀请成功消息延迟

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java |   38 +++++++++++++++++++++++++-------------
 1 files changed, 25 insertions(+), 13 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java
index 2a75869..1f3232c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/UserMoneyControllerV2.java
@@ -34,6 +34,7 @@
 import com.yeshi.fanli.entity.order.OrderMoneyDailyCount;
 import com.yeshi.fanli.entity.order.OrderMoneyDailyCount.SourceTypeEnum;
 import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.service.inter.config.ConfigService;
 import com.yeshi.fanli.service.inter.count.HongBaoV2CountService;
 import com.yeshi.fanli.service.inter.money.TeamEincomeRecordService;
@@ -113,7 +114,7 @@
 					return new JsonPrimitive("");
 				} else {
 					// 淇濈暀2浣嶅皬鏁�
-					value = value.setScale(2);
+					value = value.setScale(2, BigDecimal.ROUND_DOWN);
 					return new JsonPrimitive(value.toString());
 				}
 			}
@@ -483,7 +484,9 @@
 			object.put("list", gson.toJson(list));
 			out.print(JsonUtil.loadTrueResult(object));
 		} catch (ParseException e) {
+			out.print(JsonUtil.loadFalseResult(1, "鏌ヨ澶辫触"));
 			e.printStackTrace();
+			LogHelper.errorDetailInfo(e);
 		}
 	}
 
@@ -735,8 +738,9 @@
 			object.put("list", gson.toJson(list));
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
 		} catch (ParseException e) {
-			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("缁熻澶辫触"));
+			e.printStackTrace();
+			LogHelper.errorDetailInfo(e);
 		}
 	}
 
@@ -778,21 +782,21 @@
 				minDay = TimeUtil.parseYYYYMMDD(DateUtil.getFirstDayOfMonth(date));
 				maxDay = TimeUtil.parseYYYYMMDD_HHMMSS(DateUtil.getLastDayOfMonth(date) + " 23:59:59");
 			}
-			List<TeamDividentsVO> list = teamDividentsSourceOrderUserMapService.listByDateAndTargetUid((page-1) * pageSize, pageSize, uid, minDay, maxDay);
+			List<TeamDividentsVO> list = teamDividentsSourceOrderUserMapService.listByDateAndTargetUid((page-1) * pageSize, pageSize, uid, minDay, maxDay, key);
 			if (list == null) {
 				list = new ArrayList<>();
 			}
-			long count = teamDividentsSourceOrderUserMapService.countByDateAndTargetUid(uid, minDay, maxDay);
+			long count = teamDividentsSourceOrderUserMapService.countByDateAndTargetUid(uid, minDay, maxDay, key);
 			
 			GsonBuilder builder = new GsonBuilder();
 			builder.registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
 				@Override
 				public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
 					if (value == null) {
-						return new JsonPrimitive("0.000");
+						return new JsonPrimitive("0.00");
 					} else {
-						// 淇濈暀2浣嶅皬鏁�
-						value = value.setScale(3);
+						// 淇濈暀3浣嶅皬鏁�
+						value = value.setScale(3,RoundingMode.DOWN);
 						return new JsonPrimitive(value.toString());
 					}
 				}
@@ -802,23 +806,23 @@
 			JSONObject object = new JSONObject();
 
 			if (page == 1) {
-				TeamDividentsVO teamDividentsVO = teamDividentsSourceOrderUserMapService.sumByDateAndTargetUid(uid, minDay, maxDay);
+				TeamDividentsVO teamDividentsVO = teamDividentsSourceOrderUserMapService.sumByDateAndTargetUid(uid, minDay, maxDay, key);
 				if (teamDividentsVO == null) {
 					teamDividentsVO = new TeamDividentsVO();
 					teamDividentsVO.setSubsidy(BigDecimal.ZERO);
 					teamDividentsVO.setDividents(BigDecimal.ZERO);
 				}
-				object.put("subsidy", teamDividentsVO.getSubsidy().setScale(3).toString());
-				object.put("dividents", teamDividentsVO.getDividents().setScale(3).toString());
+				object.put("subsidy", teamDividentsVO.getSubsidy().setScale(2,RoundingMode.DOWN).toString());
+				object.put("dividents", teamDividentsVO.getDividents().setScale(2, RoundingMode.DOWN).toString());
 			}
-			
 			
 			object.put("count", count);
 			object.put("list", gson.toJson(list));
 			JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
 		} catch (Exception e) {
-			e.printStackTrace();
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
+			e.printStackTrace();
+			LogHelper.errorDetailInfo(e);
 		}
 	}
 
@@ -893,6 +897,7 @@
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("缁熻澶辫触"));
 			e.printStackTrace();
+			LogHelper.errorDetailInfo(e);
 		}
 	}
 	
@@ -954,8 +959,14 @@
 			
 			List<OrderRankingVO> list = orderMoneyDailyCountService.getRankingByOrderNum(uid, minDate, maxDate);
 			if (list.size() > 0) {
-				for (OrderRankingVO vo: list) {
+				for (int i = 0; i < list.size(); i ++) {
+					OrderRankingVO vo = list.get(i);
 					UserInfo user = userInfoService.getUserByIdWithMybatis(vo.getUid());
+					if (user == null) {
+						list.remove(i);
+						i--;
+						continue;
+					}
 					vo.setNickName(user.getNickName());
 					vo.setPortrait(user.getPortrait());
 				}
@@ -967,6 +978,7 @@
 		} catch (Exception e) {
 			JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("缁熻澶辫触"));
 			e.printStackTrace();
+			LogHelper.errorDetailInfo(e);
 		}
 	}
 }

--
Gitblit v1.8.0