From 06e70064fbc059c8cc9c654376ce589945e9702d Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 03 十二月 2019 12:32:41 +0800
Subject: [PATCH] 品牌修改
---
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java | 345 ++++++++++++++++++++++++++++++++++++++++-----------------
1 files changed, 242 insertions(+), 103 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
index b75337a..7d1d7d6 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -5,6 +5,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
+import java.util.Map;
import javax.annotation.Resource;
@@ -13,6 +14,7 @@
import org.springframework.web.bind.annotation.RequestMethod;
import org.yeshi.utils.JsonUtil;
+import com.yeshi.fanli.dto.wx.WXAccountInfoDTO;
import com.yeshi.fanli.entity.accept.AcceptData;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsg;
import com.yeshi.fanli.entity.bus.msg.UserSystemMsgTypeEnum;
@@ -20,48 +22,61 @@
import com.yeshi.fanli.entity.bus.user.ThreeSaleExtraInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
+import com.yeshi.fanli.entity.bus.user.WeiXinUser;
+import com.yeshi.fanli.exception.user.UserAccountException;
import com.yeshi.fanli.exception.user.UserInfoExtraException;
import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.hongbao.ThreeSaleExtraInfoSerivce;
-import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
import com.yeshi.fanli.service.inter.msg.UserSystemMsgService;
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
+import com.yeshi.fanli.service.inter.user.UserInfoService;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleExtraInfoSerivce;
+import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
+import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
import com.yeshi.fanli.util.Constant;
+import com.yeshi.fanli.util.RedisManager;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.VersionUtil;
+import com.yeshi.fanli.util.annotation.RequestSerializableByKey;
+import com.yeshi.fanli.util.wx.WXLoginUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
-
@Controller
@RequestMapping("api/v2/invite")
public class InviteControllerV2 {
@Resource
+ private RedisManager redisManager;
+
+ @Resource
private ConfigService configService;
-
+
@Resource
private PushService pushService;
@Resource
private UserSystemMsgService userSystemMsgService;
-
+
@Resource
private ThreeSaleSerivce threeSaleSerivce;
-
+
+ @Resource
+ private UserInfoService userInfoService;
+
@Resource
private UserInfoExtraService userInfoExtraService;
-
+
@Resource
private ThreeSaleExtraInfoSerivce threeSaleExtraInfoSerivce;
-
-
-
+ @Resource
+ private UserVIPInfoService userVIPInfoService;
+
/**
* 閭�璇风爜楠岃瘉
+ *
* @param out
*/
@RequestMapping(value = "verifyCode")
@@ -71,30 +86,82 @@
JSONObject data = new JSONObject();
data.put("nickName", userInfo.getNickName());
data.put("portrait", userInfo.getPortrait());
+ data.put("tips", "纭瑕佹垚涓篢A鐨勪竴绾ч槦鍛樺悧锛熼個璇峰叧绯讳竴鏃﹀缓绔嬩笉鍙洿鏀广��");
out.print(JsonUtil.loadTrueResult(data));
} catch (UserInfoExtraException e) {
out.print(JsonUtil.loadFalseResult(e.getMsg()));
}
}
-
-
+
/**
- * 閭�璇风爜寰俊
+ * 閭�璇风爜寰俊楠岃瘉
+ *
* @param out
*/
@RequestMapping(value = "verifyWX")
public void verifyWX(AcceptData acceptData, Long uid, String code, PrintWriter out) {
try {
- UserInfo userInfo = userInfoExtraService.getInviterInfo(uid, code);
+ WXAccountInfoDTO wxAccount = Constant.getWXAccount(acceptData.getPlatform(), acceptData.getVersion());
+ // 鑾峰彇寰俊淇℃伅
+ WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
+ if (weiXinUser == null)
+ throw new UserInfoExtraException(1, "寰俊鎺堟潈澶辫触");
+
+ String wxUnionId = weiXinUser.getUnionid();
+ if (wxUnionId == null || wxUnionId.trim().length() == 0)
+ throw new UserInfoExtraException(1, "寰俊鎺堟潈澶辫触");
+
+ String activeWX = StringUtil.Md5("activeWX:" + weiXinUser.getUnionid());
+ redisManager.cacheCommonString(activeWX, JsonUtil.getSimpleGson().toJson(weiXinUser), 60 * 20);
+
+ // 閭�璇峰叧绯荤敤鎴蜂俊鎭�
+ UserInfo userInfo = userInfoExtraService.getInviterInfo(uid, wxUnionId);
+
JSONObject data = new JSONObject();
data.put("nickName", userInfo.getNickName());
data.put("portrait", userInfo.getPortrait());
+ data.put("tips", "纭瑕佹垚涓篢A鐨勪竴绾ч槦鍛樺悧锛熼個璇峰叧绯讳竴鏃﹀缓绔嬩笉鍙洿鏀广��");
+ data.put("key", activeWX);
out.print(JsonUtil.loadTrueResult(data));
} catch (UserInfoExtraException e) {
out.print(JsonUtil.loadFalseResult(e.getMsg()));
}
}
-
+
+ /**
+ * 寰俊婵�娲�
+ *
+ * @param acceptData
+ * @param uid
+ * @param key
+ * 楠岃瘉杩斿洖鐨刱ey
+ * @param out
+ */
+ @RequestSerializableByKey(key = "'activeInviteWX-'+#uid")
+ @RequestMapping(value = "activeInviteWX")
+ public void activeInviteWX(AcceptData acceptData, Long uid, String key, PrintWriter out) {
+ try {
+ String value = redisManager.getCommonString(key);
+ if (StringUtil.isNullOrEmpty(value))
+ throw new UserAccountException(1, "寰俊鎺堟潈澶辨晥");
+
+ WeiXinUser weiXinUser = JsonUtil.getSimpleGson().fromJson(value, WeiXinUser.class);
+ if (weiXinUser == null)
+ throw new UserAccountException(1, "寰俊鎺堟潈澶辨晥");
+
+ userInfoExtraService.activeInviteWX(uid, weiXinUser);
+ // 鍒犻櫎缂撳瓨
+ redisManager.removeCommonString(key);
+
+ out.print(JsonUtil.loadTrueResult("閭�璇风爜婵�娲绘垚鍔�"));
+ } catch (UserInfoExtraException e) {
+ out.print(JsonUtil.loadFalseResult(e.getMsg()));
+ } catch (Exception e) {
+ out.print(JsonUtil.loadFalseResult("閭�璇风爜婵�娲诲け璐�"));
+ e.printStackTrace();
+ }
+ }
+
/**
* 鐢ㄦ埛闃熷憳鍒楄〃鏌ヨ 1.5.3鏌ヨ鏈夋晥闃熷憳
*
@@ -118,82 +185,73 @@
listTeam = threeSaleSerivce.listSecondTeam((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, uid, 1);
count = threeSaleSerivce.countSecondTeam(uid, 1);
}
-
- // 缁勭粐鏁版嵁
- JSONObject resultData = organizeTeam(count, listTeam, uid, type);
- resultData.put("helpLink", configService.get("team_help_url"));
- boolean hasCode = false;
- boolean bdWeiXin = false;
- UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
- if (userInfoExtra != null) {
- if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
- hasCode = true;
-
- if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
- bdWeiXin = true;
- }
-
- // 鏈縺娲婚個璇风爜
- if (!hasCode) {
- resultData.put("helpLinkActivate", configService.get("team_help_url"));
- resultData.put("tipCode", "婵�娲婚個璇峰姛鑳藉悗鎵嶅彲浠ラ個璇烽槦鍛橈紝涓�绾ч槦鍛樻槸鐢变綘鐩存帴閭�璇凤紝浜岀骇闃熷憳鏄敱浣犵殑涓�绾ч槦鍛橀個璇枫�俓r\n閭�璇锋縺娲诲姛鑳斤紝蹇呴』瑕佹湁閭�璇风爜锛岄個璇风爜鍙互閫氳繃閲戝竵鍏戞崲锛屼篃鍙互鍏ㄧ綉鎼滅储銆�");
- }
- resultData.put("hasCode", hasCode);
-
- // 鏈坊鍔犲井淇″彿
- if (!bdWeiXin) {
- resultData.put("tipWeiXin", "娣诲姞寰俊鍙峰悗锛屼綘鐨勯個璇蜂汉鍜屼竴绾ч槦鍛樺彲閫氳繃寰俊鍙蜂笌浣犲缓绔嬭仈绯伙紱\r\n浣犱篃鍙互鍚戦個璇蜂汉瀛︿範鎴栧悜涓�绾ч槦鍛樻暀鎺堣禋閽辨妧宸с��");
- }
- resultData.put("bdWeiXin", bdWeiXin);
-
-
- // 瀹夊崜杩斿洖缁熻鏁版嵁
- String platform = acceptData.getPlatform();
- if ("android".equalsIgnoreCase(platform)) {
- JSONObject bossData = getBossInfo(acceptData, uid, threeSaleSerivce.getMyBoss(uid));
- resultData.put("boss", bossData);
- resultData.put("firstTeam", threeSaleSerivce.countFirstTeam(uid, 1));
- resultData.put("secondTeam", threeSaleSerivce.countSecondTeam(uid, 1));
+ boolean needVIPInfo = false;
+ if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()))
+ needVIPInfo = true;
+
+ // 缁勭粐鏁版嵁
+ JSONObject resultData = organizeTeam(count, listTeam, uid, type,needVIPInfo);
+
+ // 绗竴椤靛垽鏂槸鍚︽縺娲� 鏄惁鏈夐槦鍛�
+ if (type == 1 && page == 1) {
+ boolean hasCode = false;
+ UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
+ if (userInfoExtra != null) {
+ if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
+ hasCode = true;
+ }
+ resultData.put("hasCode", hasCode);
+ resultData.put("hasTeam", count > 0 ? true : false);
}
out.print(JsonUtil.loadTrueResult(resultData));
}
-
-
-
+
/**
* 缁勭粐鏁版嵁
+ *
* @param count
* @param list
* @param uid
* @param type
* @return
*/
- private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type) {
+ private JSONObject organizeTeam(long count, List<ThreeSale> list, Long uid, int type, boolean needVipInfo) {
JSONObject result = new JSONObject();
JSONArray resultArray = new JSONArray();
-
+
Date todayTime = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("MM.dd HH:mm");
SimpleDateFormat format = new SimpleDateFormat("yyyy.MM.dd HH:mm");
SimpleDateFormat formatYears = new SimpleDateFormat("yyyy");
-
+
+ List<Long> workerIdList = new ArrayList<>();
+ Map<Long, Boolean> vipMap = null;
+ if (needVipInfo) {
+ for (ThreeSale threeSale : list)
+ workerIdList.add(threeSale.getWorker().getId());
+ if (workerIdList.size() > 0)
+ vipMap = userVIPInfoService.listByUids(workerIdList);
+ }
for (ThreeSale threeSale : list) {
UserInfo worker = threeSale.getWorker();
if (worker == null) {
continue;
}
Long workerId = worker.getId();
-
+
JSONObject object = new JSONObject();
object.put("workerId", worker.getId());
object.put("nickName", worker.getNickName());
object.put("portrait", worker.getPortrait());
object.put("inviteId", threeSale.getId());
-
+
Date inviteTime = new Date(threeSale.getCreateTime());
object.put("inviteTime", format.format(inviteTime) + " 鍔犲叆");
-
+ // 娣诲姞鏄惁涓篤IP
+ if (vipMap != null && vipMap.get(worker.getId()) != null)
+ object.put("vip", vipMap.get(worker.getId()));
+
String fontColor1 = "#888888";
JSONArray array = new JSONArray();
if (threeSale.getState()) {
@@ -212,9 +270,9 @@
contentJson.put("content", "鏈�杩戠櫥褰� " + format.format(lastLoginTime));
}
array.add(contentJson);
-
+
// 涓�绾ч槦鍛� 鏌ヨ
- if(type == 1) {
+ if (type == 1) {
String memoName = null;
ThreeSaleExtraInfo threeSaleExtraInfo = threeSale.getThreeSaleExtraInfo();
if (threeSaleExtraInfo != null) {
@@ -223,7 +281,7 @@
}
}
object.put("memoName", memoName);
-
+
UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(workerId);
if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
object.put("weiXin", userInfoExtra.getWeiXin());
@@ -239,7 +297,7 @@
}
}
}
- }
+ }
object.put("state", 1);
object.put("recentMsg", array);
resultArray.add(object);
@@ -250,7 +308,6 @@
return result;
}
-
/**
* 鐢ㄦ埛闃熷憳缁熻- IOS
*
@@ -262,17 +319,59 @@
public void countMyTeam(AcceptData acceptData, long uid, PrintWriter out) {
JSONObject bossData = getBossInfo(acceptData, uid, threeSaleSerivce.getMyBoss(uid));
JSONObject resultData = new JSONObject();
+
+ long firstTeam = threeSaleSerivce.countFirstTeam(uid, 1);
resultData.put("boss", bossData);
resultData.put("helpLink", configService.get("team_help_url"));
- resultData.put("firstTeam", threeSaleSerivce.countFirstTeam(uid, 1));
+ resultData.put("firstTeam", firstTeam);
resultData.put("firstTeamTotal", threeSaleSerivce.countFirstTeam(uid, null));
resultData.put("secondTeam", threeSaleSerivce.countSecondTeam(uid, 1));
resultData.put("secondTeamTotal", threeSaleSerivce.countSecondTeam(uid, null));
+
+ boolean hasTeam = true;
+ if (firstTeam <= 0) {
+ hasTeam = false;
+ resultData.put("invitelink", configService.get("invite_activation_url"));
+ }
+ resultData.put("hasTeam", hasTeam);
+
+ boolean hasCode = false;
+ boolean bdWeiXin = false;
+ UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
+ if (userInfoExtra != null) {
+ if (!StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode()))
+ hasCode = true;
+
+ if (!StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin()))
+ bdWeiXin = true;
+ }
+
+ // 鏈縺娲婚個璇风爜
+ resultData.put("hasCode", hasCode);
+ if (!hasCode) {
+ List<String> tipCode = new ArrayList<String>();
+ resultData.put("helpLinkActivate", configService.get("team_help_url"));
+ tipCode.add("婵�娲婚個璇峰姛鑳藉悗鎵嶅彲浠ラ個璇烽槦鍛橈紝涓�绾ч槦鍛樻槸鐢变綘鐩存帴閭�璇凤紝浜岀骇闃熷憳鏄敱浣犵殑涓�绾ч槦鍛橀個璇枫��");
+ tipCode.add("閭�璇锋縺娲诲姛鑳斤紝蹇呴』瑕佹湁閭�璇风爜锛岄個璇风爜鍙互閫氳繃閲戝竵鍏戞崲锛屼篃鍙互鍏ㄧ綉鎼滅储銆�");
+ resultData.put("tipCode", tipCode);
+ }
+
+ // 鏈坊鍔犲井淇″彿
+ List<String> tipWeiXin = new ArrayList<String>();
+ if (!bdWeiXin) {
+ tipWeiXin.add("娣诲姞寰俊鍙峰悗锛屼綘鐨勯個璇蜂汉鍜屼竴绾ч槦鍛樺彲閫氳繃寰俊鍙蜂笌浣犲缓绔嬭仈绯伙紱");
+ tipWeiXin.add("浣犱篃鍙互鍚戦個璇蜂汉瀛︿範鎴栧悜涓�绾ч槦鍛樻暀鎺堣禋閽辨妧宸с��");
+ }
+ resultData.put("tipWeiXin", tipWeiXin);
+ resultData.put("tipWeiXinAdd", "娣诲姞寰俊鍙峰悗锛屼綘鐨勯個璇蜂汉鍜屼竴绾ч槦鍛樺彲浠ラ�氳繃寰俊涓庝綘寤虹珛鑱旂郴銆�");
+ resultData.put("bdWeiXin", bdWeiXin);
+
out.print(JsonUtil.loadTrueResult(resultData));
}
-
+
/**
* 涓婄骇淇℃伅缁勭粐
+ *
* @param acceptData
* @param uid
* @param threeSale
@@ -289,39 +388,33 @@
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
Long createTime = threeSale.getCreateTime();
Date inviteTime = new Date(createTime);
-
-
- if(VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
- UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(boss.getId());
- if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
- bossData.put("weiXin", userInfoExtra.getWeiXin());
- bossData.put("weiXinState", 3);
- bossData.put("weiXinTip", "娣诲姞TA鐨勫井淇★紝浣犲彲鍚慣A瀛︿範濡備綍閫氳繃鏉挎牀蹇渷璧氶挶銆�");
- } else {
- if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
- bossData.put("weiXinState", 1);
- bossData.put("weiXinTip", "鐐瑰嚮鎻愰啋TA锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
- } else {
- bossData.put("weiXinState", 2);
- bossData.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
- }
- }
- bossData.put("inviteTime", "浣犱簬 " + sdf.format(inviteTime) + "鎺ュ彈浜員A鐨勯個璇�");
+
+ UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(boss.getId());
+ if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
+ bossData.put("weiXin", userInfoExtra.getWeiXin());
+ bossData.put("weiXinState", 3);
+ bossData.put("weiXinTip", "娣诲姞TA鐨勫井淇★紝浣犲彲鍚慣A瀛︿範濡備綍閫氳繃鏉挎牀蹇渷璧氶挶銆�");
} else {
- bossData.put("inviteTime", "閭�璇锋椂闂�: " + sdf.format(inviteTime));
+ if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
+ bossData.put("weiXinState", 1);
+ bossData.put("weiXinTip", "鐐瑰嚮鎻愰啋TA锛岀郴缁熶細鍙戦�佷竴灏佺珯鍐呬俊锛屾彁閱掑叾娣诲姞寰俊鍙枫��");
+ } else {
+ bossData.put("weiXinState", 2);
+ bossData.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
+ }
}
- } else if(VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())){
+ bossData.put("inviteTime", "浣犱簬 " + sdf.format(inviteTime) + "鎺ュ彈浜員A鐨勯個璇�");
+ } else {
bossData.put("hasBoss", false);
bossData.put("helpLink", configService.get("invite_code_hlep_link"));
- bossData.put("bossTip", "鎭枩浣狅紝鎴戜滑鐨勪紭璐ㄧ敤鎴凤紱\r\n浣犲苟娌℃湁閭�璇蜂汉锛屼絾浣犵殑閭�璇锋縺娲诲姛鑳芥槸琚粯璁ゅ紑鍚殑锛沑r\n浣犳嫢鏈夌嫭鐗圭殑鏃犻個璇蜂汉婵�娲荤爜銆�");
+ bossData.put("weiXinTip", "鎭枩浣狅紝鎴戜滑鐨勪紭璐ㄧ敤鎴凤紱\r\n浣犲苟娌℃湁閭�璇蜂汉锛屼絾浣犵殑閭�璇锋縺娲诲姛鑳芥槸琚粯璁ゅ紑鍚殑锛沑r\n浣犳嫢鏈夌嫭鐗圭殑鏃犻個璇蜂汉婵�娲荤爜銆�");
}
return bossData;
- }
-
-
-
+ }
+
/**
* 绔欏唴淇℃彁閱掗槦鍛樻坊鍔犲井淇″彿
+ *
* @param acceptData
* @param uid
* @param inviteId
@@ -333,40 +426,86 @@
out.print(JsonUtil.loadFalseResult("浼犻�掑弬鏁扮己澶�"));
return;
}
-
+
+ UserInfo userInfo = userInfoService.selectByPKey(uid);
+ if (userInfo == null) {
+ out.print(JsonUtil.loadFalseResult("鐢ㄦ埛淇℃伅涓嶅瓨鍦�"));
+ return;
+ }
+
ThreeSale threeSale = threeSaleSerivce.selectByPrimaryKey(inviteId);
if (threeSale == null) {
out.print(JsonUtil.loadFalseResult("鍏崇郴id涓嶅瓨鍦�"));
return;
- }
-
+ }
+
Long remindId = null;
+ boolean remindBoss = true;
if (uid.longValue() == threeSale.getWorker().getId().longValue()) {
remindId = threeSale.getBoss().getId(); // 鎻愰啋涓婄骇
} else if (uid.longValue() == threeSale.getBoss().getId().longValue()) {
+ remindBoss = false;
remindId = threeSale.getWorker().getId(); // 鎻愰啋涓嬬骇
- }
-
+ }
+
if (remindId == null) {
out.print(JsonUtil.loadFalseResult("淇℃伅楠岃瘉鏈�氳繃"));
return;
}
-
+
+ Long bossId = null;
+ Long workerId = null;
+ String title = "闃熷憳鎻愰啋娑堟伅";
+ String content = "";
+ if (remindBoss) {
+ // 鎻愮ず闃熼暱
+ bossId = remindId;
+ workerId = uid;
+ content = "浣犵殑涓�绾ч槦鍛�" + userInfo.getNickName()
+ + "锛屾彁閱掍綘娣诲姞寰俊鍙凤紝浠ヤ究浜庡拰浣犲彇寰楄仈绯诲拰瀛︿範鐪侀挶鎶�宸э紝璧跺揩鍘绘坊鍔犲惂锛涙敞锛氳鍗囩骇鍒版湰杞欢鏈�鏂扮増鏈湪鈥滄垜鐨�-鎴戠殑淇℃伅鈥濅腑娣诲姞銆�";
+ } else {
+ // 鎻愮ず闃熷憳
+ bossId = uid;
+ workerId = remindId;
+ content = "浣犵殑閭�璇蜂汉" + userInfo.getNickName()
+ + "锛屾彁閱掍綘娣诲姞寰俊鍙凤紝浠ヤ究浜庡拰浣犲彇寰楄仈绯诲府鍔╀綘鏇村ソ鐨勭渷閽憋紝璧跺揩鍘绘坊鍔犲惂锛涙敞锛氳鍗囩骇鍒版湰杞欢鏈�鏂扮増鏈湪鈥滄垜鐨�-鎴戠殑淇℃伅鈥濅腑娣诲姞銆�";
+ }
+
try {
List<String> listIOS = new ArrayList<String>();
List<String> listAndroid = new ArrayList<String>();
- pushService.pushZNX(remindId, "", "", listIOS, listAndroid);
+ pushService.pushZNX(remindId, title, content, listIOS, listAndroid);
- userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.question,
- "", "", UserSystemMsg.TIME_TAG_EMERGENT, null);
-
+ userSystemMsgService.addUserSystemMsg(remindId, UserSystemMsgTypeEnum.common, title, content,
+ UserSystemMsg.TIME_TAG_COMMON, null);
+
+ ThreeSaleExtraInfo newInfo = new ThreeSaleExtraInfo();
+ if (remindBoss) {
+ newInfo.setRemindBoss(1);
+ } else {
+ newInfo.setRemindWorker(1);
+ }
+
+ ThreeSaleExtraInfo threeExtra = threeSaleExtraInfoSerivce.getbyBossIdAndWorkerId(bossId, workerId);
+ if (threeExtra != null) {
+ newInfo.setId(threeExtra.getId());
+ newInfo.setUpdateTime(new Date());
+ threeSaleExtraInfoSerivce.updateByPrimaryKeySelective(newInfo);
+ } else {
+ newInfo.setBoss(new UserInfo(bossId));
+ newInfo.setWorker(new UserInfo(workerId));
+ newInfo.setCreateTime(new Date());
+ newInfo.setUpdateTime(new Date());
+ threeSaleExtraInfoSerivce.insertSelective(newInfo);
+ }
+
JSONObject data = new JSONObject();
data.put("weiXinState", 2);
data.put("weiXinTip", "绯荤粺宸插彂閫佹彁閱掞紝閭�璇蜂汉娣诲姞寰俊鍚庝綘鍙鍒讹紝濡傚鏂硅繜杩熶笉娣诲姞锛屼綘鍙仈绯讳汉宸ュ鏈嶅姹傚府鍔�");
out.print(JsonUtil.loadTrueResult(data));
} catch (Exception e) {
+ e.printStackTrace();
out.print(JsonUtil.loadFalseResult("鎻愰啋澶辫触"));
- return;
}
}
}
--
Gitblit v1.8.0