From e9b8461ed03f2548be58733309689e61f7d6f6cc Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 30 一月 2019 12:35:04 +0800
Subject: [PATCH] 爬取订单规则修改 事务添加
---
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java | 249 +++++++++++++++++++++++++++++--------------------
1 files changed, 149 insertions(+), 100 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
index 4c658b8..0f6d60c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -211,16 +211,15 @@
@Resource
private UserShareGoodsRecordService userShareGoodsRecordService;
-
+
@Resource
private UserCustomSettingsService userCustomSettingsService;
-
+
@Resource
private UserInfoExtraService userInfoExtraService;
-
+
@Resource
private AppVersionService appVersionService;
-
private static final String PASSWORD_MAX_ERROR = "password_max_error";
private static final String EXTRACT_MIN_MONEY = "extract_min_money";
@@ -510,9 +509,8 @@
BigDecimal fanliHB = user.getTotalHongBao();
user.setTotalHongBao(fanliHB);
-
UserInfo filterForClientUser = UserUtil.filterForClientUser(user);
-
+
// 1.5.0 鐗堟湰涔嬪悗杩斿洖鏂扮殑绛夌骇
String version = acceptData.getVersion();
if (version != null && version.trim().length() > 0) {
@@ -533,16 +531,16 @@
}
}
}
-
+
GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
JSONObject data = new JSONObject();
- data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create()
- .toJson(filterForClientUser));
+ data.put("user",
+ JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(filterForClientUser));
data.put("first", 0);
int spreadImgCount = spreadUserImgService.countUserSpreadImg(user.getId());
long shareCount = userShareGoodsRecordService.countShareRecordByUid(user.getId());
-
+
int showTiCheng = 1; // 涓嶆樉绀�
if ("ios".equalsIgnoreCase(acceptData.getPlatform())
&& configService.iosOnLining(Integer.parseInt(acceptData.getVersion())))
@@ -560,16 +558,16 @@
Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
else
data.put("inviteList", configService.get("team_list"));
-
+
// 鐣岄潰鐘舵��
- UserSettingsVO mySettings = null;
+ UserSettingsVO mySettings = null;
try {
mySettings = userCustomSettingsService.getMySettings(user.getId());
} catch (UserCustomSettingsException e) {
mySettings = new UserSettingsVO();
e.printStackTrace();
}
-
+
if (mySettings.getCancelNotice() == null) {
mySettings.setCancelNotice(0);
}
@@ -585,18 +583,34 @@
if (mySettings.getNoInvitationBonus() == null) {
mySettings.setNoInvitationBonus(0);
}
-
+
data.put("moduleState", mySettings);
-
+
out.print(JsonUtil.loadTrueResult(data));
final UserInfo uuser = user;
ThreadUtil.run(new Runnable() {
public void run() {
+
+ try {
+ // 鑾峰彇閭�璇风爜锛氳嫢鏃犻個璇风爜涓斿瓨鍦ㄦ湁鏁堢殑闃熷憳鍏崇郴 鍒欒嚜鍔ㄧ敓鎴愰個璇风爜
+ userInfoExtraService.getUserInviteCode(uuser.getId());
+ } catch (UserInfoExtraException e) {
+ e.printStackTrace();
+ }
+
+
LogHelper.userInfo(GsonUtil.toJsonExpose(uuser));
uuser.setLastLoginIp(remotIP);
uuser.setLastLoginTime(java.lang.System.currentTimeMillis());
userInfoService.updateLoginInfo(uuser);
wxDownService.save(device);
+ // 鏇存柊鐢ㄦ埛闄勫姞淇℃伅锛岃�佺敤鎴蜂笉瀛樺湪鐨勯渶瑕佹坊鍔�
+ try {
+ userInfoExtraService.updateUserRankByUid(uuser.getId());
+ } catch (UserInfoExtraException e) {
+ e.printStackTrace();
+ }
+
}
});
}
@@ -876,7 +890,7 @@
}
String minMoney = configService.get(EXTRACT_MIN_MONEY); // 鍗曠瑪鎻愮幇鐨勬渶灏忛噾棰�
- String maxMoney = configService.get(EXTRACT_MAX_MONEY); // 鍗曠瑪鎻愮幇鐨勬渶澶ч噾棰�
+ String maxDayMoney = configService.get("extract_money_day"); // 姣忔棩鏈�澶ф彁鐜伴噾棰�
int maxDayCount = Integer.parseInt(configService.get("extract_count_day"));
ExtractRecord extractRecord = extractRecordService.getExtractRecordByUid(uid);
boolean canExtract = true;
@@ -885,9 +899,9 @@
canExtract = false;
errorMsg = String.format("姣忔棩鏈�澶氭彁鐜�%s娆�", maxDayCount + "");
} else if (extractRecord != null
- && extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxMoney)) > 0) {
+ && extractRecord.getMoney().add(money).compareTo(new BigDecimal(maxDayMoney)) > 0) {
canExtract = false;
- errorMsg = String.format("姣忔棩鏈�澶氭彁鐜�%s鍏�", maxMoney);
+ errorMsg = String.format("姣忔棩鏈�澶氭彁鐜�%s鍏�", maxDayMoney);
} else if (new BigDecimal(minMoney).compareTo(money) > 0) {
canExtract = false;
errorMsg = String.format("姣忔鏈�浣庢彁鐜�%s鍏�", minMoney);
@@ -1827,28 +1841,91 @@
@RequestMapping(value = "getMyTeam", method = RequestMethod.POST)
public void getMyTeam(AcceptData acceptData, long page, long uid, long type, PrintWriter out) {
- int pageSize = Constant.PAGE_SIZE;
+ try {
+ int pageSize = Constant.PAGE_SIZE;
- JSONObject resultData = new JSONObject();
- if (type == 1) {
- resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
- } else if (type == 2) {
- resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
+ JSONObject resultData = new JSONObject();
+ if (type == 1) {
+ resultData = threeSaleSerivce.getMyFirstTeam((page - 1) * pageSize, pageSize, uid);
+ } else if (type == 2) {
+ resultData = threeSaleSerivce.getMySecondTeam((page - 1) * pageSize, pageSize, uid);
+ }
+
+ // 瀹夊崜绯荤粺杩斿洖鎵�鏈夋暟鎹�
+ String platform = acceptData.getPlatform();
+ if ("android".equalsIgnoreCase(platform)) {
+ long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
+ long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
+
+ long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
+ long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
+
+ JSONObject bossData = null;
+ ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
+ if (threeSale != null) {
+ bossData = new JSONObject();
+ UserInfo boss = threeSale.getBoss();
+ if (boss != null) {
+ bossData.put("nickName", boss.getNickName());
+ bossData.put("portrait", boss.getPortrait());
+ }
+
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
+ Long createTime = threeSale.getCreateTime();
+ Date inviteTime = new Date(createTime);
+ bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
+ }
+
+ String helpLink = configService.get("team_help_url");
+ if (helpLink == null) {
+ helpLink = "";
+ }
+
+ boolean hasCode = false;
+ String inviteCode = userInfoExtraService.getUserInviteCode(uid);
+ if (inviteCode != null && inviteCode.trim().length() > 0) {
+ hasCode = true; // 宸叉湁閭�璇风爜
+ } else {
+ // 閭�璇锋縺娲婚摼鎺�
+ resultData.put("activationlink", configService.get("invite_activation_url"));
+ }
+ resultData.put("hasCode", hasCode);
+
+ resultData.put("helpLink", helpLink);
+ resultData.put("firstTeam", firstTeam);
+ resultData.put("firstTeamTotal", firstTeamTotal);
+ resultData.put("secondTeam", secondTeam);
+ resultData.put("secondTeamTotal", secondTeamTotal);
+ resultData.put("boss", bossData);
+ }
+ out.print(JsonUtil.loadTrueResult(resultData));
+ } catch (UserInfoExtraException e) {
+ out.print(JsonUtil.loadFalseResult(e.getMsg()));
+ } catch (Exception e) {
+ out.print(JsonUtil.loadFalseResult("缁熻澶辫触"));
+ e.printStackTrace();
}
- // 瀹夊崜绯荤粺杩斿洖鎵�鏈夋暟鎹�
- String platform = acceptData.getPlatform();
- if ("android".equalsIgnoreCase(platform)) {
+ }
+
+ /**
+ * 鐢ㄦ埛闃熷憳缁熻 1.4.1
+ *
+ * @param acceptData
+ * @param id
+ * @param out
+ */
+ @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
+ public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
+ try {
long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
-
- JSONObject bossData = null;
+ JSONObject bossData = new JSONObject();
ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
if (threeSale != null) {
- bossData = new JSONObject();
UserInfo boss = threeSale.getBoss();
if (boss != null) {
bossData.put("nickName", boss.getNickName());
@@ -1861,6 +1938,8 @@
bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
}
+ JSONObject resultData = new JSONObject();
+
String helpLink = configService.get("team_help_url");
if (helpLink == null) {
helpLink = "";
@@ -1871,54 +1950,26 @@
resultData.put("secondTeam", secondTeam);
resultData.put("secondTeamTotal", secondTeamTotal);
resultData.put("boss", bossData);
- }
- out.print(JsonUtil.loadTrueResult(resultData));
- }
- /**
- * 鐢ㄦ埛闃熷憳缁熻 1.4.1
- *
- * @param acceptData
- * @param id
- * @param out
- */
- @RequestMapping(value = "countMyTeam", method = RequestMethod.POST)
- public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
-
- long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
- long firstTeamTotal = threeSaleSerivce.countFirstTeam(uid, null);
-
- long secondTeam = threeSaleSerivce.countSecondTeam(uid, 1);
- long secondTeamTotal = threeSaleSerivce.countSecondTeam(uid, null);
- JSONObject bossData = new JSONObject();
- ThreeSale threeSale = threeSaleSerivce.getMyBoss(uid);
- if (threeSale != null) {
- UserInfo boss = threeSale.getBoss();
- if (boss != null) {
- bossData.put("nickName", boss.getNickName());
- bossData.put("portrait", boss.getPortrait());
+ boolean hasCode = false;
+ String inviteCode = userInfoExtraService.getUserInviteCode(uid);
+ if (inviteCode != null && inviteCode.trim().length() > 0) {
+ hasCode = true; // 宸叉湁閭�璇风爜
+ } else {
+ // 閭�璇锋縺娲婚摼鎺�
+ resultData.put("activationlink", configService.get("invite_activation_url"));
}
+ resultData.put("hasCode", hasCode);
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
- Long createTime = threeSale.getCreateTime();
- Date inviteTime = new Date(createTime);
- bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
+ out.print(JsonUtil.loadTrueResult(resultData));
+
+ } catch (UserInfoExtraException e) {
+ out.print(JsonUtil.loadFalseResult(e.getMsg()));
+ } catch (Exception e) {
+ out.print(JsonUtil.loadFalseResult("缁熻澶辫触"));
+ e.printStackTrace();
}
- JSONObject resultData = new JSONObject();
-
- String helpLink = configService.get("team_help_url");
- if (helpLink == null) {
- helpLink = "";
- }
- resultData.put("helpLink", helpLink);
- resultData.put("firstTeam", firstTeam);
- resultData.put("firstTeamTotal", firstTeamTotal);
- resultData.put("secondTeam", secondTeam);
- resultData.put("secondTeamTotal", secondTeamTotal);
- resultData.put("boss", bossData);
-
- out.print(JsonUtil.loadTrueResult(resultData));
}
/**
@@ -2012,10 +2063,10 @@
e.printStackTrace();
}
}
-
-
+
/**
- * 璁剧疆鐣岄潰寮�鍏崇姸鎬�
+ * 璁剧疆鐣岄潰寮�鍏崇姸鎬�
+ *
* @param acceptData
* @param uid
* @param params
@@ -2028,22 +2079,22 @@
out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
return;
}
-
+
try {
if (params == null || params.trim().length() == 0) {
out.print(JsonUtil.loadFalseResult("浼犻�掑弬鏁颁负绌�"));
return;
}
-
+
JSONObject json = JSONObject.fromObject(params);
- Iterator<String> iterator = json.keys();
- while(iterator.hasNext()){
- String type = (String) iterator.next();
- int state = json.getInt(type);
- userCustomSettingsService.saveModuleState(uid, type, state);
+ Iterator<String> iterator = json.keys();
+ while (iterator.hasNext()) {
+ String type = (String) iterator.next();
+ int state = json.getInt(type);
+ userCustomSettingsService.saveModuleState(uid, type, state);
}
out.print(JsonUtil.loadTrueResult("璁剧疆鎴愬姛"));
-
+
} catch (UserCustomSettingsException e) {
out.print(JsonUtil.loadFalseResult(e.getMsg()));
} catch (Exception e) {
@@ -2052,9 +2103,9 @@
}
}
-
/**
- * 鑾峰彇绛夌骇淇℃伅
+ * 鑾峰彇绛夌骇淇℃伅
+ *
* @param acceptData
* @param uid
* @param out
@@ -2066,20 +2117,18 @@
out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
return;
}
-
+
try {
-
UserInfoExtraVO rankInfo = userInfoExtraService.getRankInfo(uid);
-
GsonBuilder gsonBuilder = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder());
gsonBuilder.excludeFieldsWithoutExposeAnnotation();
Gson gson = gsonBuilder.setDateFormat("yyyy.MM.dd").create();
-
+
JSONObject resultData = new JSONObject();
resultData.put("rankInfo", gson.toJson(rankInfo));
-
+
out.print(JsonUtil.loadTrueResult(resultData));
-
+
} catch (UserInfoExtraException e) {
out.print(JsonUtil.loadFalseResult(e.getMsg()));
} catch (Exception e) {
@@ -2088,9 +2137,9 @@
}
}
-
/**
- * 鑾峰彇绛夌骇淇℃伅
+ * 鑾峰彇绛夌骇淇℃伅
+ *
* @param acceptData
* @param uid
* @param out
@@ -2102,11 +2151,11 @@
out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�"));
return;
}
-
+
try {
-
+
String inviteCode = userInfoExtraService.getUserInviteCode(uid);
-
+
JSONObject inviteData = new JSONObject();
if (inviteCode == null || inviteCode.trim().length() == 0) {
// 鏃犻個璇风爜
@@ -2117,12 +2166,12 @@
inviteData.put("content", "閭�璇风爜");
inviteData.put("link", configService.get("invite_activation_success_url"));
}
-
+
JSONObject data = new JSONObject();
data.put("invite", inviteData);
-
+
out.print(JsonUtil.loadTrueResult(data));
-
+
} catch (UserInfoExtraException e) {
out.print(JsonUtil.loadFalseResult(e.getMsg()));
} catch (Exception e) {
--
Gitblit v1.8.0