From 651a15c78f668bef3859d9ed1bb7ad0b669d3600 Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 03 七月 2020 17:52:07 +0800 Subject: [PATCH] 多APP优化 --- fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java | 205 +++++++++++++++++++++++++++++++++++++++++--------- 1 files changed, 166 insertions(+), 39 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java index 87cbb54..61bf942 100644 --- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java +++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java @@ -2,10 +2,12 @@ import java.io.PrintWriter; import java.util.ArrayList; +import java.util.Date; import java.util.List; import javax.annotation.Resource; +import org.json.JSONArray; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -15,10 +17,14 @@ import com.yeshi.fanli.entity.accept.AcceptData; import com.yeshi.fanli.entity.bus.homemodule.FloatAD; import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum; -import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture; import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState; +import com.yeshi.fanli.entity.bus.user.ThreeSale; import com.yeshi.fanli.entity.bus.user.UserActiveLog; import com.yeshi.fanli.entity.bus.user.UserInfo; +import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum; +import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify; +import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo; +import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo; import com.yeshi.fanli.entity.common.JumpDetailV2; import com.yeshi.fanli.entity.config.AppHomeFloatImg; import com.yeshi.fanli.entity.system.ConfigKeyEnum; @@ -34,13 +40,21 @@ import com.yeshi.fanli.service.inter.user.UserActiveLogService; import com.yeshi.fanli.service.inter.user.UserInfoExtraService; import com.yeshi.fanli.service.inter.user.UserInfoService; +import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce; import com.yeshi.fanli.service.inter.user.notify.UserActivedRecordService; +import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService; +import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService; +import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService; +import com.yeshi.fanli.service.inter.user.vip.UserVipConfigService; import com.yeshi.fanli.util.Constant; import com.yeshi.fanli.util.StringUtil; import com.yeshi.fanli.util.ThreadUtil; +import com.yeshi.fanli.util.TimeUtil; import com.yeshi.fanli.util.VersionUtil; +import com.yeshi.fanli.vo.homemodule.BannerVO; import com.yeshi.fanli.vo.user.UserDialogBtnVO; import com.yeshi.fanli.vo.user.UserDialogVO; +import com.yeshi.fanli.vo.user.VIPUpgradedNotifyVO; import net.sf.json.JSONObject; @@ -61,12 +75,6 @@ private TBPidService tbPidService; @Resource - private TaoBaoUnionConfigService taoBaoUnionConfigService; - - @Resource - private UserInfoExtraService userInfoExtraService; - - @Resource private FloatADService floatADService; @Resource @@ -74,9 +82,6 @@ @Resource private MsgDeviceReadStateService msgDeviceReadStateService; - - @Resource - private UserTaoLiJinOriginService uerTaoLiJinOriginService; @Resource private UserActiveLogService userActiveLogService; @@ -90,6 +95,21 @@ @Resource private UserInfoService userInfoService; + @Resource + private UserVIPInfoService userVIPInfoService; + + @Resource + private UserVIPPreInfoService userVIPPreInfoService; + + @Resource + private UserLevelUpgradedNotifyService userLevelUpgradedNotifyService; + + @Resource + private ThreeSaleSerivce threeSaleSerivce; + + @Resource + private UserVipConfigService userVipConfigService; + /** * s 棣栭〉閰嶇疆淇℃伅 * @@ -101,7 +121,7 @@ if (uid != null && uid == 0L) uid = null; - AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg(); + AppHomeFloatImg appHomeFloatImg = configService.getAppHomeFloatImg(acceptData.getSystem()); if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && !Constant.IS_TEST) { appHomeFloatImg = null; } @@ -111,7 +131,7 @@ data.put("floatImg", appHomeFloatImg); } - String notifyImg = configService.getAppHomeFloatNotifyImg(); + String notifyImg = configService.getAppHomeFloatNotifyImg(acceptData.getSystem()); if (!StringUtil.isNullOrEmpty(notifyImg)) { data.put("floatNotifyImg", notifyImg); } @@ -129,13 +149,13 @@ } // 棰嗗埜甯姪閾炬帴,1.5.2鍚庣敓鏁� - String couponHelp = configService.get(ConfigKeyEnum.taobaoCouponHelp.getKey()); + String couponHelp = configService.getValue(ConfigKeyEnum.taobaoCouponHelp.getKey(),acceptData.getSystem()); data.put("couponHelpUrl", couponHelp); // 搴曢儴缃戦〉閾炬帴 String platform = acceptData.getPlatform(); if ("android".equalsIgnoreCase(platform)) { - data.put("htmlLink", configService.get(ConfigKeyEnum.indexHtmlLinkAndroid.getKey())); + data.put("htmlLink", configService.getValue(ConfigKeyEnum.indexHtmlLinkAndroid.getKey(),acceptData.getSystem())); } // 鍒ゆ柇鏂拌�佺敤鎴� @@ -149,7 +169,7 @@ data.put("userTimeType", 1); } data.put("hotFuctionLink", configService.getByVersion(ConfigKeyEnum.hotFunctionUrl.getKey(), platform, - Integer.parseInt(acceptData.getVersion())));// + Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()));// out.print(JsonUtil.loadTrueResult(data)); } @@ -173,7 +193,7 @@ } // 鏄惁闇�瑕佽喘鐗╁煄杞摼 - boolean convert = "0".equalsIgnoreCase(configService.get(ConfigKeyEnum.showTaobaoCartConvert.getKey())) ? false + boolean convert = "0".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.showTaobaoCartConvert.getKey(),acceptData.getSystem())) ? false : true; if (!"cart".equalsIgnoreCase(position) && !convert) { @@ -188,8 +208,8 @@ clientTBPid = tbPidService.getAndroidDefault(); } - String cartJS = configService.get(ConfigKeyEnum.taobaoCartJS.getKey()); - String cartUrl = configService.get(ConfigKeyEnum.taobaoCartLink.getKey()); + String cartJS = configService.getValue(ConfigKeyEnum.taobaoCartJS.getKey(),acceptData.getSystem()); + String cartUrl = configService.getValue(ConfigKeyEnum.taobaoCartLink.getKey(),acceptData.getSystem()); if (!convert)// 涓嶈浆閾� { cartUrl = "http://"; @@ -241,8 +261,8 @@ @RequestMapping(value = "getBindAccountConfig", method = RequestMethod.POST) public void getBindAccountConfig(AcceptData acceptData, PrintWriter out) { - String alipayHelpUrl = configService.get(ConfigKeyEnum.alipayHelp.getKey());// 鏀粯瀹濆府鍔� - String alipayBindFailUrl = configService.get(ConfigKeyEnum.alipayBindFailReason.getKey());// 鏀粯瀹濈粦瀹氬け璐ュ師鍥� + String alipayHelpUrl = configService.getValue(ConfigKeyEnum.alipayHelp.getKey(),acceptData.getSystem());// 鏀粯瀹濆府鍔� + String alipayBindFailUrl = configService.getValue(ConfigKeyEnum.alipayBindFailReason.getKey(),acceptData.getSystem());// 鏀粯瀹濈粦瀹氬け璐ュ師鍥� JSONObject data = new JSONObject(); data.put("alipayHelp", alipayHelpUrl); data.put("alipayBindFailReason", alipayBindFailUrl); @@ -260,7 +280,8 @@ * @param out */ @RequestMapping(value = "closeDialogNotify", method = RequestMethod.POST) - public void closeDialogNotify(AcceptData acceptData, Long uid, String id, int type, PrintWriter out) { + public void closeDialogNotify(AcceptData acceptData, Long uid, String id, String sourceId, int type, + PrintWriter out) { if (uid == null) { out.print(JsonUtil.loadFalseResult("鐢ㄦ埛鏈櫥褰�")); @@ -273,6 +294,9 @@ if (id.equalsIgnoreCase("tearcherNotify")) { userActivedRecordService.setTearcherNotified(uid); out.print(JsonUtil.loadTrueResult("")); + } else if (id.equalsIgnoreCase("vipUpgradedNotify")) { + userLevelUpgradedNotifyService.setNotified(sourceId); + out.print(JsonUtil.loadTrueResult("")); } else { out.print(JsonUtil.loadFalseResult("id涓嶅瓨鍦�")); } @@ -282,36 +306,42 @@ public void getUserConfig(AcceptData acceptData, Long uid, PrintWriter out) { try { // 鐢ㄦ埛鍗忚閾炬帴 - String serviceProtocol = configService.get(ConfigKeyEnum.serviceProtocolLink.getKey()); + String serviceProtocol = configService.getValue(ConfigKeyEnum.serviceProtocolLink.getKey(),acceptData.getSystem()); // 闅愮鏉℃閾炬帴 - String privacyProtocol = configService.get(ConfigKeyEnum.privacyProtocolLink.getKey()); + String privacyProtocol = configService.getValue(ConfigKeyEnum.privacyProtocolLink.getKey(),acceptData.getSystem()); JSONObject data = new JSONObject(); data.put("serviceProtocolLink", serviceProtocol); data.put("privacyProtocolLink", privacyProtocol); // 璐墿杞﹁烦杞柟寮�(鍖呭惈jumpDetail涓巔arams) JSONObject source = JSONObject .fromObject(configService.getByVersion(ConfigKeyEnum.taobaoCartJumpDetail.getKey(), - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()))); + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); data.put("taoBaoCart", source); if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) { - // 鎴戠殑鐣岄潰banner - List<SwiperPicture> banner = swiperPictureService.getByBannerCardAndVersion("my_interface_banner", - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); - if (banner == null) - banner = new ArrayList<SwiperPicture>(); - data.put("banner", JsonUtil.getApiCommonGson().toJson(banner)); + // IOS姝e湪涓婄嚎鐗堟湰 + if ("ios".equalsIgnoreCase(acceptData.getPlatform()) + && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) { + data.put("banner", new JSONArray()); + } else { + // 鎴戠殑鐣岄潰banner + List<BannerVO> banner = swiperPictureService.getByBannerCardAndVersion("my_interface_banner", + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); + if (banner == null) + banner = new ArrayList<BannerVO>(); + data.put("banner", JsonUtil.getApiCommonGson().toJson(banner)); + } } if (VersionUtil.greaterThan_2_0_7(acceptData.getPlatform(), acceptData.getVersion())) { // 杞摼鐨勭綉椤甸摼鎺� - String convertLinkUrl = configService.get(ConfigKeyEnum.convertDocWebLink.getKey()); + String convertLinkUrl = configService.getValue(ConfigKeyEnum.convertDocWebLink.getKey(),acceptData.getSystem()); data.put("convertLinkUrl", convertLinkUrl); if (uid != null) { String tearcherLink = configService.getByVersion(ConfigKeyEnum.tearcherLink.getKey(), - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion())); - if (userActivedRecordService.canNotifyAddTearcher(uid)) { + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem()); + if (userActivedRecordService.canNotifyAddTearcher(uid) && !StringUtil.isNullOrEmpty(tearcherLink)) { UserInfo userInfo = userInfoService.selectAvailableByPrimaryKey(uid); if (userInfo != null) { JumpDetailV2 jumpDetail = jumpDetailV2Service.getByTypeCache("web", @@ -320,7 +350,7 @@ JSONObject negativeParams = new JSONObject(); negativeParams.put("url", configService.getByVersion(ConfigKeyEnum.newerGonglue.getKey(), - acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()))); + acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())); JSONObject positiveParams = new JSONObject(); positiveParams.put("url", tearcherLink); @@ -336,14 +366,111 @@ data.put("tearcherLink", tearcherLink); } + } + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) { + UserVIPPreInfo info = userVIPPreInfoService.getLatestProcessInfo(uid); + JSONObject inner = new JSONObject(); + inner.put("link", userVipConfigService.getValueByKey("vip_link")); + inner.put("ion", "http://img.flqapp.com/resource/vip/icon_vip.png"); + inner.put("title", "鍏嶈垂鍗囩骇 浜細鍛樻潈鐩�"); + inner.put("btnName", "鍗囩骇浼氬憳"); + + if (uid != null) { + if (info != null && info.getProcess() >= UserVIPPreInfo.PROCESS_3) { + inner.put("link", userVipConfigService.getValueByKey("vip_link")); + inner.put("ion", "http://img.flqapp.com/resource/vip/icon_tearcher.png"); + inner.put("title", "鎷夸簲闄╀笌娲ヨ创 浜甯堟潈鐩�"); + if (info.getProcess() == UserVIPPreInfo.PROCESS_4) + inner.put("btnName", "鏉挎牀蹇渷"); + else + inner.put("btnName", "鍗囩骇瀵煎笀"); + } else { + UserVIPPreInfo userVIPPreInfo = userVIPPreInfoService.getLatestProcessInfo(uid); + if (userVIPPreInfo != null) { + if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_1) { + inner.put("btnName", "鍗囩骇楂樼骇浼氬憳"); + } else if (userVIPPreInfo.getProcess() == UserVIPPreInfo.PROCESS_2) { + inner.put("btnName", "鍗囩骇瓒呯骇浼氬憳"); + } + } + } + } + // IOS姝e湪涓婄嚎 + if ("ios".equalsIgnoreCase(acceptData.getPlatform()) + && configService.iosOnLining(Integer.parseInt(acceptData.getVersion()),acceptData.getSystem())) { + } else + data.put("vip", inner); + // 骞冲彴瑙勫垯 + String platformRuleLink = configService.getValue(ConfigKeyEnum.platformRule.getKey(),acceptData.getSystem()); + data.put("platformRule", platformRuleLink); + } + + if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()) && uid != null) { + UserLevelUpgradedNotify notify = userLevelUpgradedNotifyService.getNeedNotifyByUid(uid); + if (notify != null) { + Date endTime = getUpgradedTime(uid, notify.getToLevel()); + Date startTime = getUpgradedTime(uid, notify.getFromLevel()); + if (endTime != null && startTime != null) { + VIPUpgradedNotifyVO notifyVO = new VIPUpgradedNotifyVO(); + notifyVO.setDay(TimeUtil.getDayDifferenceCount(startTime, endTime)); + notifyVO.setDetailLink(notify.getToLevel().getDetailLink()); + notifyVO.setFromLevelName(notify.getFromLevel().getName()); + notifyVO.setId("vipUpgradedNotify"); + notifyVO.setSourceId(notify.getId()); + notifyVO.setToLevel(notify.getToLevel().getTag()); + notifyVO.setToLevelName(notify.getToLevel().getName()); + data.put("vipUpgradedNotify", notifyVO); + } + } + } + + // 浜戝彂鍗曢摼鎺� + if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) { + boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpen.getKey(),acceptData.getPlatform(), acceptData.getVersion(),acceptData.getSystem()); + if (!cloudOpen && uid != null) { + List<String> testUsers = configService.getTestUsers(acceptData.getSystem()); + if (testUsers != null && testUsers.contains(uid+"")) { + cloudOpen = true; + } + } + + if (cloudOpen) { + data.put("cloudLink", configService.getValue(ConfigKeyEnum.robotCloudLink.getKey(),acceptData.getSystem())); + } } out.print(JsonUtil.loadTrueResult(data)); } catch (Exception e) { out.print(JsonUtil.loadFalseResult("鑾峰彇澶辫触")); e.printStackTrace(); } + } + // 鑾峰彇鍗囩骇鏃堕棿 + private Date getUpgradedTime(Long uid, UserLevelEnum level) { + Date time = null; + if (level == UserLevelEnum.superVIP) { + UserVIPInfo vipInfo = userVIPInfoService.selectByUid(uid); + if (vipInfo != null && vipInfo.getState() == UserVIPInfo.STATE_SUCCESS) + time = vipInfo.getSuccessTime(); + + } else if (level == UserLevelEnum.highVIP) { + UserVIPPreInfo info = userVIPPreInfoService.selectByUidAndProcess(uid, level.getLevel()); + if (info != null) + time = info.getCreateTime(); + } else if (level == UserLevelEnum.daRen) { + + // 鎴愪负杈句汉鐨勬椂闂�,鐢ㄦ埛婵�娲绘椂闂� + ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid); + if (threeSale != null && threeSale.getState() == true && threeSale.getSucceedTime() != null) { + time = new Date(threeSale.getSucceedTime()); + } else {// 鍙栫敤鎴锋敞鍐屾椂闂� + UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid); + time = new Date(user.getCreatetime()); + } + } + + return time; } /** @@ -355,10 +482,10 @@ @RequestMapping(value = "getOrderParseConfig", method = RequestMethod.POST) public void getOrderParseConfig(AcceptData acceptData, PrintWriter out) { - if ("0".equalsIgnoreCase(configService.get(ConfigKeyEnum.autoFindTaobaoOrder.getKey()))) + if ("0".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.autoFindTaobaoOrder.getKey(),acceptData.getSystem()))) out.print(JsonUtil.loadFalseResult(1, "鏆備笉鏀寔")); else { - String orderJS = configService.get(ConfigKeyEnum.taobaoOrderParseJS.getKey()); + String orderJS = configService.getValue(ConfigKeyEnum.taobaoOrderParseJS.getKey(),acceptData.getSystem()); JSONObject data = new JSONObject(); try { data.put("orderJS", DESUtil.encode(orderJS, StringUtil.getBase64String("YeShiFANLI889*+"), @@ -385,7 +512,7 @@ JSONObject data = new JSONObject(); // 娴嬭瘯 data.put("showTaoBaoOrder", - "0".equalsIgnoreCase(configService.get(ConfigKeyEnum.showTaobaoOrder.getKey()).trim()) ? false : true); + "0".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.showTaobaoOrder.getKey(),acceptData.getSystem()).trim()) ? false : true); data.put("taoBaoOrderUrl", "https://main.m.taobao.com/olist/index.html"); out.print(JsonUtil.loadTrueResult(data)); } @@ -393,7 +520,7 @@ @RequestMapping(value = "getKeFuConfig", method = RequestMethod.POST) public void getKeFuConfig(AcceptData acceptData, PrintWriter out) { JSONObject data = new JSONObject(); - data.put("meiqia", "1".equalsIgnoreCase(configService.get(ConfigKeyEnum.kefuMeiqia.getKey())) ? true : false);// 鏄惁璺宠浆缇庢唇锛屼笉璺宠浆缇庢唇灏辩敤鍘熸潵鐨� + data.put("meiqia", "1".equalsIgnoreCase(configService.getValue(ConfigKeyEnum.kefuMeiqia.getKey(),acceptData.getSystem())) ? true : false);// 鏄惁璺宠浆缇庢唇锛屼笉璺宠浆缇庢唇灏辩敤鍘熸潵鐨� out.print(JsonUtil.loadTrueResult(data)); // 璁剧疆娑堟伅宸茶 ThreadUtil.run(new Runnable() { @@ -414,7 +541,7 @@ @RequestMapping(value = "getInviteCodeInputHelp", method = RequestMethod.POST) public void getInviteCodeInputHelp(AcceptData acceptData, PrintWriter out) { JSONObject data = new JSONObject(); - data.put("helpUrl", configService.get(ConfigKeyEnum.inviteCodeInputHelp.getKey())); + data.put("helpUrl", configService.getValue(ConfigKeyEnum.inviteCodeInputHelp.getKey(),acceptData.getSystem())); out.print(JsonUtil.loadTrueResult(data)); } -- Gitblit v1.8.0