Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
| | |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/libs/vpush-server-sdk-2.0.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <!-- 唯品会 --> |
| | | <dependency> |
| | | <groupId>vop-sdk</groupId> |
| | | <artifactId>vop-sdk</artifactId> |
| | | <version>1.0</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/libs/vop-sdk-1.0.jar</systemPath> |
| | | </dependency> |
| | | |
| | | <dependency> |
| | | <groupId>osp-sdk</groupId> |
| | | <artifactId>osp-sdk</artifactId> |
| | | <version>1.0</version> |
| | | <scope>system</scope> |
| | | <systemPath>${basedir}/libs/osp-sdk-1.0.jar</systemPath> |
| | | </dependency> |
| | | |
| | | |
| | | |
| | | </dependencies> |
| | |
| | | if (params != null)
|
| | | down = params.getValue();
|
| | |
|
| | | if (!state.equals(wxState)) {// 不是微信返回的!
|
| | | if (state!=null&&!state.equals(wxState)) {// 不是微信返回的!
|
| | | // request.setAttribute("error", "1");
|
| | | return "redirect:" + down;
|
| | | }
|
| | |
| | | @RequestMapping(value = "testListTLJGoods")
|
| | | public void getGoodsList(String callback,PrintWriter out) {
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setMaterialId("19450");
|
| | | sf.setQuan(1);
|
| | | sf.setTmall(true);
|
| | | sf.setStartTkRate(5);
|
| | | sf.setEndPrice(new BigDecimal(1000));
|
| | | // sf.setEndPrice(new BigDecimal(1000));
|
| | | sf.setPage(1);
|
| | | sf.setPage(100);
|
| | | sf.setCateIds("16");
|
| | | sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
|
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
|
| | | Gson gson = new Gson();
|
| | |
| | | }
|
| | |
|
| | | data.put("clickUrl", url);
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | data.put("token",TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("rule", configService.get("share_single_goods_rule"));
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | String shareText = "";
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO : TaoBaoConstant.SHARE_PRICE_TM;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | |
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("shareText", shareText);
|
| | | String descText = shareText.replace(taoBaoLink.getGoods().getTitle(), "").trim();
|
| | | if (descText.startsWith("\\r\\n"))
|
| | |
| | | history.setHongbao(shareMoney);
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsType(UserShareGoodsHistory.TYPE_TAOBAO);
|
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(taobaoLink.getTaoToken()));
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(taobaoLink.getGoods().getAuctionId());
|
| | |
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | }
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | |
|
| | | data.put("rule",
|
| | | "http://apph5.yeshitv.com/apppage/all_help_content.html?id=148&from=singlemessage&isappinstalled=0");
|
| | | data.put("pictUrl", TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO : TaoBaoConstant.SHARE_PRICE_TM;
|
| | | String shareText = "";
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | |
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | data.put("shareText", shareText);
|
| | | String descText = shareText.replace(taoBaoLink.getGoods().getTitle(), "").trim();
|
| | | if (descText.startsWith("\\r\\n"))
|
| | |
| | | history.setHongbao(shareMoney);
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsType(UserShareGoodsHistory.TYPE_TAOBAO);
|
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(taobaoLink.getTaoToken()));
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(taobaoLink.getGoods().getAuctionId());
|
| | |
| | | relationId = extraInfo.getRelationId();
|
| | | }
|
| | | TaoBaoLink taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(uid, auctionId, relationId);
|
| | | data.put("token", taoBaoLink.getTaoToken());
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | }
|
| | |
|
| | | } else if (cid == 4) { // 邀请分享
|
| | |
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.exception.taobao.TaoKeApiException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @RequestMapping("getMianDanGoodsList")
|
| | | public void getMianDanGoodsList(AcceptData acceptData, PrintWriter out, int page, int pageSize, String callback) {
|
| | |
| | | }
|
| | | // 获取免单券数量
|
| | | long couponCount = userSystemCouponService.countUsableRewardCoupon(uid);
|
| | | UserInfoExtra extraInfo=userInfoExtraService.getUserInfoExtra(uid);
|
| | | long integralCount=extraInfo!=null?extraInfo.getGoldCoin():0L;
|
| | | JSONObject userJson = new JSONObject();
|
| | | userJson.put("nickName", user.getNickName());
|
| | | userJson.put("portrait", user.getPortrait());
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("user", userJson);
|
| | | data.put("couponCount", couponCount);
|
| | | data.put("integralCount", integralCount);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.encrypt.DESUtil;
|
| | |
|
| | | import com.taobao.api.TaobaoClient;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | |
| | | } else {// 老人
|
| | | data.put("userTimeType", 1);
|
| | | }
|
| | | data.put("hotFuctionLink",configService.getByVersion("hot_function_url", platform, Integer.parseInt(acceptData.getVersion())));
|
| | | data.put("hotFuctionLink",
|
| | | configService.getByVersion("hot_function_url", platform, Integer.parseInt(acceptData.getVersion())));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取饿了么的推广链接
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getElemeLink")
|
| | | public void getElemeLink(AcceptData acceptData, Long uid, String callback, PrintWriter out) {
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("hongBao", configService.get("eleme_hongbao_link").replace("{用户ID}", uid + ""));
|
| | | data.put("goods", configService.get("eleme_goods_link").replace("{用户ID}", uid + ""));
|
| | |
|
| | | ClientTBPid clientTBPid1 = new ClientTBPid(TaoBaoConstant.TAOBAO_AUTH_APPKEY, TaoBaoConstant.TAOBAO_ELEME_PID,
|
| | | null, TaoBaoConstant.TAOBAO_ELEME_PID.split("_")[3]);
|
| | | data.put("taoKeParams", clientTBPid1);
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("goldCoin", goldCoin);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (IntegralTaskRecordException e) { |
| | | } catch (IntegralTaskRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | }
|
| | | }
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getExchangeDetail")
|
| | | public void getExchangeDetail(AcceptData acceptData, Long id, String callback, PrintWriter out) {
|
| | | if (id == null || id <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "兑换ID有误"));
|
| | | return;
|
| | | }
|
| | | IntegralExchange exchange = integralExchangeService.selectByPrimaryKey(id);
|
| | | if (exchange != null) {
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | Gson gson = gsonBuilder.create();
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(gson.toJson(exchange)));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(gson.toJson(exchange))));
|
| | | } else {
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadFalseResult("未找到"));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult("未找到")));
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 兑换金币检验
|
| | | *
|
| | |
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "verifyExchange", method = RequestMethod.POST)
|
| | | public void verifyExchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | @RequestMapping(value = "verifyExchange")
|
| | | public void verifyExchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
|
| | | try {
|
| | | ExchangeTipVO exchange = integralExchangeService.verifyExchange(uid, id);
|
| | |
|
| | |
| | | Gson gson = gsonBuilder.create();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", gson.toJson(exchange));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | if (StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } else {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | }
|
| | | } catch (IntegralExchangeException e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | if (StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | } else {
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, e.getMsg())));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestSerializableByKey(key = "'integralexchange-'+#uid")
|
| | | @RequestMapping(value = "exchange", method = RequestMethod.POST)
|
| | | public void exchange(AcceptData acceptData, Long uid, Long id, PrintWriter out) {
|
| | | @RequestMapping(value = "exchange")
|
| | | public void exchange(AcceptData acceptData, Long uid, Long id, String callback, PrintWriter out) {
|
| | | try {
|
| | | IntegralExchange exchange = integralExchangeService.exchange(uid, id);
|
| | |
|
| | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("result", gson.toJson(exchange));
|
| | | data.put("goldCoin", extraVO.getGoldCoin() + "枚");
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(data)));
|
| | | } catch (IntegralExchangeException e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | if (StringUtil.isNullOrEmpty(callback))
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | else
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadFalseResult(1, e.getMsg())));
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | shareInfo.setClickUrl(url);
|
| | | shareInfo.setToken(taoBaoLink.getTaoToken());
|
| | | shareInfo.setToken(TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | shareInfo.setRule(configService.get("share_single_goods_rule"));
|
| | | shareInfo.setPictUrl(TbImgUtil.getTBSizeImg(taoBaoLink.getGoods().getPictUrl(), 500));
|
| | |
|
| | | String shareText = "";
|
| | | // 无券
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = taoBaoLink.getGoods().getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO : TaoBaoConstant.SHARE_PRICE_TM;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(taoBaoLink.getGoods().getCouponInfo())) {
|
| | | String text = shareGoodsTextTemplateService.getCommonTemplate(uid);
|
| | |
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(taoBaoLink.getGoods().getBiz30day()))
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{领券短链}", shortLink).replace("{淘口令}", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | |
|
| | | shareInfo.setShareText(shareText);
|
| | |
|
| | |
| | | history.setHongbao(shareMoney);
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsType(UserShareGoodsHistory.TYPE_TAOBAO);
|
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(taobaoLink.getTaoToken()));
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(taobaoLink.getGoods().getAuctionId());
|
| | |
| | | }
|
| | |
|
| | | if (goods.getTkRate() == null || goods.getTkRate().compareTo(new BigDecimal(0)) <= 0) {
|
| | | //TaoKeApiUtil.specialConvertCoupon(auctionId, app);
|
| | | // TaoKeApiUtil.specialConvertCoupon(auctionId, app);
|
| | |
|
| | | }
|
| | |
|
| | |
| | | taoBaoLink.setTaoToken(quanToken);
|
| | | }
|
| | | }
|
| | | shareInfo.setToken(taoBaoLink.getTaoToken());
|
| | | shareInfo.setToken(TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | shareInfo.setRule(configService.get("share_single_goods_rule"));
|
| | | shareInfo.setPictUrl(TbImgUtil.getTBSizeImg(goods.getPictUrl(), 500));
|
| | |
|
| | | // 无券
|
| | | String shopType = goods.getUserType() == 0 ? "淘宝价" : "天猫价";
|
| | | String shopType = goods.getUserType() == 0 ? TaoBaoConstant.SHARE_PRICE_TAOBAO :TaoBaoConstant.SHARE_PRICE_TM;
|
| | | String shareText = "";
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo())) {
|
| | |
| | |
|
| | | shareText = shareText.replace("{店铺类型}", shopType)
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(goods.getBiz30day())).replace("{领券短链}", shortLink)
|
| | | .replace("{淘口令}", taoBaoLink.getTaoToken());
|
| | | .replace("{淘口令}", TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
|
| | | shareInfo.setShareText(shareText);
|
| | |
|
| | | String descText = shareText.replace(goods.getTitle(), "").trim();
|
| | |
| | | history.setHongbao(shareMoney);
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsType(UserShareGoodsHistory.TYPE_TAOBAO);
|
| | | history.setTkCode(taobaoLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(taobaoLink.getTaoToken()));
|
| | | history.setLink(taobaoLink.getClickUrl());
|
| | | history.setQuanLink(taobaoLink.getCouponLink());
|
| | | history.setGoodsId(finalGoods.getAuctionId());
|
| | |
| | | data.put("quanPrice", afterCouponPrice);
|
| | | data.put("zkPrice", goods.getZkPrice());
|
| | | data.put("shareContent", "长按复制本段文字,打开【手机淘宝】即可领取【特别优惠券】购买下单,");
|
| | | data.put("token", link.getTaoToken());
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(link.getTaoToken()));
|
| | | data.put("reservePrice", goods.getReservePrice());
|
| | | data.put("shopType", goods.getUserType() == 1 ? 2 : 1);
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && !"无".equalsIgnoreCase(goods.getCouponInfo())) {
|
| | |
| | | data.put("quanPrice", afterCouponPrice);
|
| | | data.put("zkPrice", goods.getZkPrice());
|
| | | data.put("shareContent", "长按复制本段文字,打开【手机淘宝】即可领取【特别优惠券】购买下单,");
|
| | | data.put("token", link.getTaoToken());
|
| | | data.put("token", TaoBaoUtil.filterTaoToken(link.getTaoToken()));
|
| | | data.put("reservePrice", goods.getReservePrice());
|
| | | data.put("shopType", goods.getUserType() == 1 ? 2 : 1);
|
| | | if (!StringUtil.isNullOrEmpty(goods.getCouponInfo()) && !"无".equalsIgnoreCase(goods.getCouponInfo())) {
|
| | |
| | | */ |
| | | MsgDeviceReadState selectByDeviceAndPlatformAndType(@Param("device") String device, @Param("platform") int platform, |
| | | @Param("type") String type); |
| | | |
| | | MsgDeviceReadState selectByDeviceAndPlatformAndTypeForUpdate(@Param("device") String device, @Param("platform") int platform, |
| | | @Param("type") String type); |
| | | |
| | | /** |
| | | * 设置所有消息已读 |
| | |
| | | Long selectCount(@Param("versionList") List<Integer> versionList); |
| | | |
| | | List<DeviceTokenHW> selectByDevice(String device); |
| | | |
| | | List<DeviceTokenHW> selectByDeviceForUpdate(String device); |
| | | |
| | | int bindUidByDevice(@Param("uid") Long uid, @Param("device") String device); |
| | | |
| | |
| | | |
| | | DeviceTokenIOS selectByDevice(String device); |
| | | |
| | | DeviceTokenIOS selectByDeviceForUpdate(String device); |
| | | |
| | | DeviceTokenIOS selectByDeviceToken(String deviceToken); |
| | | |
| | | List<DeviceTokenIOS> selectByUid( @Param("uid")Long uid, @Param("list")List<Integer> list); |
| | |
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.persistence.Entity;
|
| | | import javax.persistence.GeneratedValue;
|
| | | import javax.persistence.GenerationType;
|
| | | import javax.persistence.Id;
|
| | |
| | | }
|
| | | if (goods != null && goods.getCouponAmount() != null
|
| | | && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
|
| | |
|
| | | // 淘礼金的金额位于1-10块之间 必须是天猫
|
| | | if (TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
|
| | | .compareTo(new BigDecimal("143")) >= 0) {
|
| | | .compareTo(new BigDecimal("143")) >= 0
|
| | | && TaoBaoUtil.getAfterUseCouplePrice(goods).multiply(goods.getTkRate())
|
| | | .compareTo(new BigDecimal("1430")) <= 0
|
| | | && goods.getUserType() == 1) {
|
| | | goods = daTaoKeGoodsDetailService.filterTaoBaoGoods(goods);
|
| | | int totalHongBaoCount = 2000 + (int) (Math.random() * 8000);
|
| | | int leftHongBaoCount = 200 + (int) (Math.random() * 2000);
|
| | |
| | | <select id="countOrderNumber" resultMap="ChartMap"> |
| | | SELECT IFNULL(COUNT(`joi_id`),0) AS showValue, |
| | | <include refid="Column_DateType" /> |
| | | FROM `yeshi_ec_jd_order_item` left join yeshi_ec_jd_order on jo_order_id=joi_order_id WHERE jo_order_time IS NOT NULL |
| | | FROM `yeshi_ec_jd_order_item` left join yeshi_ec_jd_order on jo_order_id=joi_order_id WHERE jo_order_time IS NOT NULL and joi_valid_code!=2 |
| | | <include refid="Count_Select_DateType" /> |
| | | <include refid="Count_Group_DateType" /> |
| | | ORDER BY jo_order_time |
| | |
| | | from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and |
| | | mdrs_platform=#{platform} and mdrs_type=#{type} |
| | | </select> |
| | | |
| | | <select id="selectByDeviceAndPlatformAndTypeForUpdate" resultMap="BaseResultMap" useCache="false" flushCache="true"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and |
| | | mdrs_platform=#{platform} and mdrs_type=#{type} for update |
| | | </select> |
| | | |
| | | |
| | | <select id="listByDeviceAndPlatform" resultMap="BaseResultMap" useCache="false" flushCache="true"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw where dh_device = #{0} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByDeviceForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String" useCache="false" flushCache="true"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_hw where dh_device = #{0} for update |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_uid_devicetoken_hw where dh_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_ios where device = #{0} limit 1 |
| | | </select> |
| | | |
| | | <select id="selectByDeviceForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_ios where device = #{0} limit 1 for update |
| | | </select> |
| | | |
| | | <select id="selectByDeviceToken" resultMap="BaseResultMap" |
| | | parameterType="java.lang.String"> |
| | |
| | | }
|
| | |
|
| | | UserShareGoodsHistory history = new UserShareGoodsHistory();
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | history.setLink(tbLink.getClickUrl());
|
| | | history.setQuanLink(tbLink.getCouponLink());
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | |
|
| | | history.setCreateTime(new Date());
|
| | | history.setGoodsId(goods.getAuctionId());
|
| | |
| | |
|
| | | UserShareGoodsHistory history = new UserShareGoodsHistory();
|
| | | history.setId(userShareGoodsHistory.getId());
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | history.setLink(tbLink.getClickUrl());
|
| | | history.setQuanLink(tbLink.getCouponLink());
|
| | | history.setTkCode(tbLink.getTaoToken());
|
| | | history.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | userShareGoodsHistoryMapper.updateByPrimaryKeySelective(history);
|
| | |
|
| | | userShareGoodsHistory.setTkCode(tbLink.getTaoToken());
|
| | | userShareGoodsHistory.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | userShareGoodsHistory.setLink(tbLink.getClickUrl());
|
| | | userShareGoodsHistory.setQuanLink(tbLink.getCouponLink());
|
| | | userShareGoodsHistory.setTkCode(tbLink.getTaoToken());
|
| | | userShareGoodsHistory.setTkCode(TaoBaoUtil.filterTaoToken(tbLink.getTaoToken()));
|
| | | }
|
| | |
|
| | | return userShareGoodsHistory;
|
| | |
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.jd.JDUtil;
|
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | | .replace("{淘礼金面额}", BigDecimalUtil.getWithNoZera(spreadMoney).toString())
|
| | | .replace("{优惠券价}",
|
| | | BigDecimalUtil.getWithNoZera(TaoBaoUtil.getAfterUseCouplePrice(goods)).toString())
|
| | | .replace("{店铺类型}", goods.getUserType() == 1 ? "天猫价" : "淘宝价");
|
| | | .replace("{店铺类型}", goods.getUserType() == 1 ? TaoBaoConstant.SHARE_PRICE_TM : TaoBaoConstant.SHARE_PRICE_TAOBAO);
|
| | | }
|
| | |
|
| | | if (!hasCoupon) {
|
| | | return template.replace("{标题}", goods.getTitle())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getZkPrice()).toString())
|
| | | .replace("{月销量}", TaoBaoUtil.getSaleCount(goods.getBiz30day())).replace("{领券短链}", shortLink)
|
| | | .replace("{淘口令}", token).replace("{店铺类型}", goods.getUserType() == 1 ? "天猫价"
|
| | | : "淘宝价");
|
| | | .replace("{淘口令}", token).replace("{店铺类型}", goods.getUserType() == 1 ? TaoBaoConstant.SHARE_PRICE_TM
|
| | | : TaoBaoConstant.SHARE_PRICE_TAOBAO);
|
| | | } else {
|
| | | return template.replace("{标题}", goods.getTitle())
|
| | | .replace("{商品原价}", BigDecimalUtil.getWithNoZera(goods.getZkPrice()).toString())
|
| | |
| | | .replace("{优惠券面额}", BigDecimalUtil.getWithNoZera(goods.getCouponAmount()).toString())
|
| | | .replace("{优惠券价}",
|
| | | BigDecimalUtil.getWithNoZera(TaoBaoUtil.getAfterUseCouplePrice(goods)).toString())
|
| | | .replace("{店铺类型}", goods.getUserType() == 1 ? "天猫价" : "淘宝价");
|
| | | .replace("{店铺类型}", goods.getUserType() == 1 ? TaoBaoConstant.SHARE_PRICE_TM : TaoBaoConstant.SHARE_PRICE_TAOBAO);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.msg.MsgDeviceReadStateMapper;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg,Date msgTime) {
|
| | | public void addUnreadDeviceMsg(String type, String device, int platform, int msgCount, String msg, Date msgTime) {
|
| | | MsgDeviceReadState state = msgDeviceReadStateMapper.selectByDeviceAndPlatformAndType(device, platform, type);
|
| | | if (state != null) {
|
| | | MsgDeviceReadState update = new MsgDeviceReadState();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public MsgDeviceReadState getByDeviceAndPlatformAndType(String type, String device, int platform) {
|
| | | MsgDeviceReadState state = msgDeviceReadStateMapper.selectByDeviceAndPlatformAndType(device, platform, type);
|
| | | MsgDeviceReadState state = msgDeviceReadStateMapper.selectByDeviceAndPlatformAndTypeForUpdate(device, platform,
|
| | | type);
|
| | | if (state == null) {
|
| | | state = new MsgDeviceReadState();
|
| | | state.setCreateTime(new Date());
|
| | |
| | | private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
|
| | | Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
|
| | | System.out.println(commonOrder.getOrderNo());
|
| | | HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKey(hongBaoOrder.getHongBaoV2().getId());
|
| | | //锁行
|
| | | HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (oldHongBao == null)
|
| | | throw new HongBaoException(10, "红包对象不存在");
|
| | | // 已经失效,已经领取,新老状态一致的红包不做处理
|
| | |
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.push.DeviceTokenHWMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | return count == null ? 0 : count;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addDeviceToken(String token, String device, Long uid, int version) {
|
| | | if (StringUtil.isNullOrEmpty(device))
|
| | |
| | | if (uid != null && uid == 0)
|
| | | uid = null;
|
| | |
|
| | | List<DeviceTokenHW> list = deviceTokenHWMapper.selectByDevice(device);
|
| | | List<DeviceTokenHW> list = deviceTokenHWMapper.selectByDeviceForUpdate(device);
|
| | | if (list == null || list.size() == 0) {
|
| | | DeviceTokenHW deviceTokenHW = new DeviceTokenHW();
|
| | | deviceTokenHW.setDevice(device);
|
| | |
| | | return;
|
| | |
|
| | | // 判断device是否存在
|
| | | DeviceTokenIOS deviceTokenIos = deviceTokenIOSMapper.selectByDevice(device);
|
| | | DeviceTokenIOS deviceTokenIos = deviceTokenIOSMapper.selectByDeviceForUpdate(device);
|
| | | if (deviceTokenIos == null) {
|
| | | deviceTokenIos = new DeviceTokenIOS();
|
| | | deviceTokenIos.setCreateTime(new Date());
|
| | |
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.HWPushService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.push.OPPOPushService;
|
| | | import com.yeshi.fanli.service.inter.push.PushRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.push.XMPushService;
|
| | |
| | |
|
| | | @Resource
|
| | | private XMPushService xmPushService;
|
| | |
|
| | | @Resource
|
| | | private OPPOPushService oPPOPushService;
|
| | |
|
| | | @Resource
|
| | | private PushRecordMapper pushRecordMapper;
|
| | |
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushGoods(uid, Long.parseLong(gid), title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | |
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushUrl(uid, url, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushUrl(uid, url, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | PushRecord pushRecord = new PushRecord();
|
| | |
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushZNX(uId, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushZNX(uId, title, content, versionCodeList);
|
| | | }
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushWEEX(uid, title, content, weexUrl, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | hwPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushBaiChuanUrl(uid, title, content, url, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setUrl(url);
|
| | |
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | hwPushService.pushWelfareCenter(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushWelfareCenter(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | |
| | | hwPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // OPPO推送
|
| | | if (listAndroid == null || listAndroid.size() > 0) {
|
| | | List<Integer> versionCodeList = null;
|
| | | if (listAndroid != null)
|
| | | versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
|
| | | oPPOPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
|
| | | }
|
| | |
|
| | | // 插入推送记录
|
| | | PushRecord pushRecord = new PushRecord();
|
| | | pushRecord.setTitle(title);
|
| | |
| | | public List<DaTaoKeDetailV2> listPreTLJBuyGoods(int page) {
|
| | | if (page == 1) {
|
| | | List<DaTaoKeDetailV2> listPreGoodsList = new ArrayList<>();
|
| | | // 热销榜
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_HOT, null);
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | listPreGoodsList.addAll(result.getGoodsList());
|
| | |
|
| | | // 复购榜
|
| | | result = DaTaoKeApiUtil.getRankingList(DaTaoKeApiUtil.RANK_TYPE_REBUY, null);
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | listPreGoodsList.addAll(result.getGoodsList());
|
| | | // 综合搜索
|
| | | try {
|
| | | result = DaTaoKeApiUtil.search("", null, null, null, 1, 200, DaTaoKeApiUtil.SORT_DEFAULT);
|
| | | if (result == null)
|
| | | throw new Exception();
|
| | | } catch (Exception e) {// 异常重复一次
|
| | | result = DaTaoKeApiUtil.search("", null, null, null, 1, 200, DaTaoKeApiUtil.SORT_DEFAULT);
|
| | | }
|
| | |
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | listPreGoodsList.addAll(result.getGoodsList());
|
| | |
|
| | | List<DaTaoKeDetailV2> goodsList = new ArrayList<>();
|
| | | for (DaTaoKeDetailV2 v2 : listPreGoodsList) {
|
| | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | |
|
| | | @Resource
|
| | | private IntegralExchangeMapper integralExchangeMapper;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinOriginService userTaoLiJinOriginService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CodePublishRecordService codePublishRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private IntegralExchangeRecordService integralExchangeRecordService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserOtherMsgNotificationService userOtherMsgNotificationService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private MsgInviteDetailService msgInviteDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private IntegralDetailService integralDetailService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<IntegralExchange> listValidCache(long start, int count){
|
| | | public IntegralExchange selectByPrimaryKey(Long id) {
|
| | | return integralExchangeMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<IntegralExchange> listValidCache(long start, int count) {
|
| | | return integralExchangeMapper.listValid(start, count);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public Long countValid(){
|
| | | public Long countValid() {
|
| | | return integralExchangeMapper.countValid();
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public ExchangeTipVO verifyExchange(Long uid, Long id) throws IntegralExchangeException{
|
| | | if (uid == null || uid <= 0) |
| | | public ExchangeTipVO verifyExchange(Long uid, Long id) throws IntegralExchangeException {
|
| | | if (uid == null || uid <= 0)
|
| | | throw new IntegralExchangeException(1, "用户未登录");
|
| | | |
| | | if (id == null || id <= 0) |
| | |
|
| | | if (id == null || id <= 0)
|
| | | throw new IntegralExchangeException(1, "兑换id不正确");
|
| | | |
| | |
|
| | | UserInfoExtraVO extraVO = userInfoExtraService.getInfoExtraVOByUid(uid);
|
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | | |
| | |
|
| | | IntegralExchange exchange = integralExchangeMapper.selectByPrimaryKey(id);
|
| | | if (exchange == null)
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | | |
| | |
|
| | | Integer state = exchange.getState();
|
| | | if (state == null || state != 1)
|
| | | throw new IntegralExchangeException(1, "兑换活动未开启");
|
| | | |
| | | |
| | |
|
| | | Integer goldCoin = exchange.getGoldCoin();
|
| | | |
| | |
|
| | | ExchangeTipVO exchangeTip = new ExchangeTipVO();
|
| | | exchangeTip.setId(id);
|
| | | ExchangeTypeEnum type = exchange.getType();
|
| | |
| | | exchangeTip.setType(type.name());
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | |
|
| | | long exchangeCount = 0;
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, null);
|
| | |
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Integer upperLimit = exchange.getUpperLimit();
|
| | | if (upperLimit != null) { // 是否有限制每日次数
|
| | | Integer today = 1;
|
| | |
| | | throw new IntegralExchangeException(1, "今日兑换已达上限");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) {
|
| | | exchangeTip.setType("notEnough");
|
| | |
| | | exchangeTip.setGoldCoin((goldCoin.intValue() - goldCoinHas.intValue()) + "金币");
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | |
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | exchangeTip.setTip("自购免单券仅能自己使用,且每个用户ID只能兑换一次。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) {
|
| | |
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
|
| | | exchangeTip.setTip("返利奖励券兑换次数不限,赠送次数不限,受赠人若无“邀请人”成功领取后将成为你的一级队员。\r\n注:兑换成功后请到“我的-福利中心”中查看");
|
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | if(codePublishRecordService.countValidRecord(uid) > 0)
|
| | | if (codePublishRecordService.countValidRecord(uid) > 0)
|
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换");
|
| | | exchangeTip.setInviteCode(extraVO.getInviteCode());
|
| | | exchangeTip.setTip("兑换成功后,将发布于“激活邀请码兑换功能中”,需激活邀请的用户可用金币兑换,本次展示有效期为3天。");
|
| | | } else if (ExchangeTypeEnum.taoLiJin == type) {
|
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元推广红包");
|
| | | exchangeTip.setTip("注:兑换成功后请到“我的-推广红包”中查看");
|
| | | } else if (ExchangeTypeEnum.cash == type) { |
| | | } else if (ExchangeTypeEnum.cash == type) {
|
| | | exchangeTip.setName(exchange.getAmount().setScale(0) + "元现金红包");
|
| | | exchangeTip.setTip("注:兑换成功后请到“我的-账户余额”中查看");
|
| | | } else {
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | | }
|
| | | |
| | |
|
| | | exchangeTip.setGoldCoin(goldCoin + "金币");
|
| | | exchangeTip.setType(type.name());
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public IntegralExchange exchange(Long uid, Long id) throws IntegralExchangeException {
|
| | | if (uid == null || uid <= 0)
|
| | |
| | | Integer state = exchange.getState();
|
| | | if (state == null || state != 1)
|
| | | throw new IntegralExchangeException(1, "兑换活动未开启");
|
| | | |
| | |
|
| | | long exchangeCount = 0;
|
| | | ExchangeTypeEnum type = exchange.getType();
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | |
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Integer upperLimit = exchange.getUpperLimit();
|
| | | if (upperLimit != null) { // 是否有限制每日次数
|
| | | if (upperLimit != null) { // 是否有限制每日次数
|
| | | Integer today = 1;
|
| | | exchangeCount = integralExchangeRecordService.countRecordByUid(id, uid, today);
|
| | | if (exchangeCount >= upperLimit) {
|
| | | throw new IntegralExchangeException(1, "兑换已达上限");
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | Integer goldCoin = exchange.getGoldCoin();
|
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue()) {
|
| | | throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!");
|
| | | }
|
| | | |
| | |
|
| | | String thing = "";
|
| | | String thingNum = "";
|
| | | int couponNews = 0;
|
| | | boolean once = false; // 兑换一次是否消失
|
| | | try {
|
| | | if (ExchangeTypeEnum.freeCouponBuy == type) {
|
| | | List<UserSystemCoupon> listCoupon = userSystemCouponService.getFreeCouponByType(uid, CouponTypeEnum.freeCouponBuy.name());
|
| | | List<UserSystemCoupon> listCoupon = userSystemCouponService.getFreeCouponByType(uid,
|
| | | CouponTypeEnum.freeCouponBuy.name());
|
| | | if (listCoupon != null && listCoupon.size() > 0)
|
| | | throw new IntegralExchangeException(1, "自购免单券,仅能兑换一次");
|
| | | |
| | |
|
| | | thing = "自购免单券";
|
| | | thingNum = "1张";
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponBuy.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | once = true; |
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponBuy.name(),
|
| | | UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | once = true;
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.freeCouponGive == type) {
|
| | | thing = "赠送免单券";
|
| | | thingNum = "1张";
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponGive.name(), UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.freeCouponGive.name(),
|
| | | UserSystemCoupon.SOURCE_EXCHANGE, null);
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.rebatePercentCoupon == type) {
|
| | | thing = "返利奖励券";
|
| | | thingNum = "1张";
|
| | | String percent = configService.get("exchange_rebate_percent");
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(), UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
|
| | | userSystemCouponService.exchangeCoupon(uid, CouponTypeEnum.rebatePercentCoupon.name(),
|
| | | UserSystemCoupon.SOURCE_EXCHANGE, new BigDecimal(percent));
|
| | | couponNews = 1;
|
| | | } else if (ExchangeTypeEnum.inviteCodePublish == type) {
|
| | | thing = "邀请码发布卡";
|
| | | thingNum = "3天";
|
| | | if(codePublishRecordService.countValidRecord(uid) > 0)
|
| | | if (codePublishRecordService.countValidRecord(uid) > 0)
|
| | | throw new IntegralExchangeException(1, "三天之内不可重复兑换");
|
| | | codePublishRecordService.publishInviteCode(uid);
|
| | | |
| | |
|
| | | exchange.setNeedJump(true);
|
| | | exchange.setBtnName("去查看");
|
| | | } else if (ExchangeTypeEnum.taoLiJin == type) {
|
| | |
| | | thing = "现金红包";
|
| | | BigDecimal money = exchange.getAmount();
|
| | | thingNum = money + "元";
|
| | | |
| | |
|
| | | // 1、插入红包数据
|
| | | HongBaoV2 hongBaoV2 = new HongBaoV2();
|
| | | hongBaoV2.setMoney(money);
|
| | |
| | | } else {
|
| | | throw new IntegralExchangeException(1, "兑换方式不存在");
|
| | | }
|
| | | |
| | | exchangeCount ++;
|
| | |
|
| | | exchangeCount++;
|
| | | String progress = exchange.getProgress();
|
| | | if (!StringUtil.isNullOrEmpty(progress))
|
| | | progress = progress.replace("{已兑换}",exchangeCount + "").replace("{上限数}", exchange.getUpperLimit() + "");
|
| | | progress = progress.replace("{已兑换}", exchangeCount + "").replace("{上限数}",
|
| | | exchange.getUpperLimit() + "");
|
| | | exchange.setProgress(progress);
|
| | | |
| | |
|
| | | // 剩余金币
|
| | | int surplus = goldCoinHas.intValue() - goldCoin.intValue();
|
| | | exchange.setUserGoldCoin(surplus + "枚");
|
| | | |
| | |
|
| | | // 更新金币 + 福利中心消息数
|
| | | if (extraVO.getCouponNews() != null && extraVO.getCouponNews() > 0) |
| | | if (extraVO.getCouponNews() != null && extraVO.getCouponNews() > 0)
|
| | | couponNews = couponNews + extraVO.getCouponNews();
|
| | | |
| | |
|
| | | UserInfoExtraVO extraUpdate = new UserInfoExtraVO();
|
| | | extraUpdate.setId(extraVO.getId());
|
| | | extraUpdate.setGoldCoin(surplus);
|
| | | extraUpdate.setCouponNews(couponNews);
|
| | | userInfoExtraService.saveUserInfoExtra(extraUpdate);
|
| | | |
| | |
|
| | | // 添加兑换记录
|
| | | integralExchangeRecordService.addExchangeRecord(id, uid);
|
| | | |
| | |
|
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setUid(uid);
|
| | |
| | | detail.setMoney(-goldCoin);
|
| | | detail.setCreateTime(new Date());
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | | // 消息 |
| | |
|
| | | // 消息
|
| | | final String things = thing;
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | |
| | | userOtherMsgNotificationService.exchangeMsg(uid, "", msgOther);
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | if (once) // 兑换之后消失
|
| | | exchange = null;
|
| | | |
| | |
|
| | | return exchange;
|
| | | } catch (IntegralExchangeException e) {
|
| | | throw new IntegralExchangeException(1, e.getMsg());
|
| | |
| | | throw new IntegralExchangeException(1, "兑换异常");
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public ExchangeTipVO verifyInviteCode(Long uid, Long id) throws IntegralExchangeException{
|
| | | public ExchangeTipVO verifyInviteCode(Long uid, Long id) throws IntegralExchangeException {
|
| | | if (uid == null || uid <= 0)
|
| | | throw new IntegralExchangeException(1, "用户未登录");
|
| | |
|
| | |
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode())) |
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode()))
|
| | | throw new IntegralExchangeException(1, "邀请码已激活,无需兑换");
|
| | | |
| | |
|
| | | CodePublishRecord record = codePublishRecordService.selectByPrimaryKey(id);
|
| | | if (record == null)
|
| | | throw new IntegralExchangeException(1, "兑换记录不存在");
|
| | |
| | | exchangeTip.setTip("当前账户中可用金币不足,无法兑换该奖品!");
|
| | | exchangeTip.setGoldCoin((goldCoin.intValue() - goldCoinHas.intValue()) + "金币");
|
| | | return exchangeTip;
|
| | | } |
| | | |
| | | }
|
| | |
|
| | | exchangeTip.setTip("注:兑换成功后请到“消息-系统消息”查看");
|
| | | exchangeTip.setGoldCoin(goldCoin + "金币");
|
| | | exchangeTip.setType(ExchangeTypeEnum.inviteCodeActivate.name());
|
| | | return exchangeTip;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | @Override
|
| | | public String exchangeInviteCode(Long uid, Long id) throws IntegralExchangeException {
|
| | | if (uid == null || uid <= 0)
|
| | |
| | | if (extraVO == null)
|
| | | throw new IntegralExchangeException(1, "用户相关信息不存在");
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode())) |
| | | if (!StringUtil.isNullOrEmpty(extraVO.getInviteCode()))
|
| | | throw new IntegralExchangeException(1, "邀请码已激活,无需兑换");
|
| | | |
| | |
|
| | | CodePublishRecord record = codePublishRecordService.selectByPrimaryKey(id);
|
| | | if (record == null)
|
| | | throw new IntegralExchangeException(1, "兑换记录不存在");
|
| | |
| | | Integer goldCoinHas = extraVO.getGoldCoin();
|
| | | if (goldCoin.intValue() > goldCoinHas.intValue())
|
| | | throw new IntegralExchangeException(1, "当前账户中可用金币不足,无法兑换该奖品!");
|
| | | |
| | | |
| | |
|
| | | try {
|
| | | UserInfoExtraVO inviteExtra = userInfoExtraService.getInfoExtraVOByUid(record.getUid());
|
| | | if (inviteExtra == null || StringUtil.isNullOrEmpty(inviteExtra.getInviteCode()))
|
| | | throw new IntegralExchangeException(1, "兑换失败,该用户邀请码不存在");
|
| | | |
| | |
|
| | | String inviteCode = inviteExtra.getInviteCode();
|
| | | |
| | |
|
| | | // 剩余金币
|
| | | int surplus = goldCoinHas.intValue() - goldCoin.intValue();
|
| | | |
| | |
|
| | | // 更新金币
|
| | | UserInfoExtraVO extraUpdate = new UserInfoExtraVO();
|
| | | extraUpdate.setId(extraVO.getId());
|
| | | extraUpdate.setGoldCoin(surplus);
|
| | | userInfoExtraService.saveUserInfoExtra(extraUpdate);
|
| | | |
| | |
|
| | | // 加入明细
|
| | | IntegralDetail detail = new IntegralDetail();
|
| | | detail.setUid(uid);
|
| | |
| | | detail.setMoney(-goldCoin);
|
| | | detail.setCreateTime(new Date());
|
| | | integralDetailService.insertSelective(detail);
|
| | | |
| | |
|
| | | // 添加兑换记录
|
| | | integralExchangeRecordService.addExchangeRecord(exchange.getId(), uid);
|
| | | |
| | | // 消息 |
| | |
|
| | | // 消息
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | UserInfo userInfo = userInfoService.selectByPKey(record.getUid());
|
| | | if (userInfo == null)
|
| | | return;
|
| | | |
| | |
|
| | | String beizu = "邀请人:" + userInfo.getNickName() + ",邀请码:" + inviteCode;
|
| | | |
| | |
|
| | | MsgOtherExchangeContentDTO msgOther = new MsgOtherExchangeContentDTO();
|
| | | msgOther.setState("金币兑换成功");
|
| | | msgOther.setExpend(goldCoin + "金币");
|
| | | msgOther.setTotalGold(surplus + "金币");
|
| | | msgOther.setThing("邀请码激活卡");
|
| | | |
| | |
|
| | | userOtherMsgNotificationService.exchangeMsg(uid, beizu, msgOther);
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | return inviteCode;
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | throw new IntegralExchangeException(1, "兑换失败");
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<IntegralExchange> listExchange(long start, int count, Long uid);
|
| | | |
| | |
|
| | | /**
|
| | | * 今日任务统计
|
| | |
| | | import com.yeshi.fanli.vo.integral.ExchangeTipVO;
|
| | |
|
| | | public interface IntegralExchangeService {
|
| | | |
| | | /**
|
| | | * 根据主键查询
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public IntegralExchange selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 查询有效的
|
| | |
| | |
|
| | | @Component
|
| | | public class CommonGoodsUtil {
|
| | | |
| | |
|
| | | /**
|
| | | * 商品佣金包含¥符号
|
| | | * |
| | | * @param goods
|
| | | * @param rate
|
| | | * @return
|
| | |
| | | public static String getCommissionInfo(CommonGoods goods, BigDecimal rate) {
|
| | | return "¥" + getCommission(goods, rate).toString();
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 商品佣金
|
| | | * 商品佣金
|
| | | * |
| | | * @param goods
|
| | | * @param rate
|
| | | * @return
|
| | |
| | | public static BigDecimal getCommission(CommonGoods goods, BigDecimal rate) {
|
| | | BigDecimal money = null;
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo())
|
| | | || goods.getCouponInfo().trim().equalsIgnoreCase("无")) {
|
| | | money = MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()),
|
| | | new BigDecimal("0.01")),
|
| | | if (StringUtil.isNullOrEmpty(goods.getCouponInfo()) || goods.getCouponInfo().trim().equalsIgnoreCase("无")) {
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | } else// 有券
|
| | | {
|
| | | List<BigDecimal> list = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
|
| | | BigDecimal startFee = list.get(0);
|
| | | BigDecimal couponAccount = list.get(1);
|
| | | if (startFee.compareTo(goods.getPrice()) <= 0
|
| | | && goods.getPrice().compareTo(couponAccount) > 0) {
|
| | | if (startFee.compareTo(goods.getPrice()) <= 0 && goods.getPrice().compareTo(couponAccount) > 0) {
|
| | | BigDecimal finalPrice = goods.getPrice().subtract(couponAccount);
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(finalPrice, goods.getRate()), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | |
|
| | | } else {// 不能用券
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil.mul(
|
| | | MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()),
|
| | | new BigDecimal("0.01")), MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | money = MoneyBigDecimalUtil.mul(MoneyBigDecimalUtil
|
| | | .mul(MoneyBigDecimalUtil.mul(goods.getPrice(), goods.getRate()), new BigDecimal("0.01")),
|
| | | MoneyBigDecimalUtil.div(rate, new BigDecimal(100)));
|
| | | }
|
| | | }
|
| | | return BigDecimalUtil.getWithNoZera(money);
|
| | |
|
| | | // 京东商品特殊处理
|
| | | if (goods.getGoodsType() == Constant.SOURCE_TYPE_JD)
|
| | | return BigDecimalUtil.getWithNoZera(MoneyBigDecimalUtil.mul(money, new BigDecimal("0.9")));
|
| | | else
|
| | | return BigDecimalUtil.getWithNoZera(money);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 计算商品券后价,没有券则返回原价
|
| | | *
|
| | |
| | | List<BigDecimal> list = TaoBaoCouponUtil.getCouponInfo(goods.getCouponInfo());
|
| | | BigDecimal startFee = list.get(0);
|
| | | BigDecimal couponAccount = list.get(1);
|
| | | if (startFee.compareTo(goods.getPrice()) <= 0
|
| | | && goods.getPrice().compareTo(couponAccount) > 0) {
|
| | | if (startFee.compareTo(goods.getPrice()) <= 0 && goods.getPrice().compareTo(couponAccount) > 0) {
|
| | | BigDecimal finalPrice = goods.getPrice().subtract(couponAccount);
|
| | | return finalPrice;
|
| | | } else {// 不能用券
|
| | |
| | | doUpdateGoodsJob(); // 更新商品队列
|
| | | doJDOrderJob();// 京东订单处理
|
| | | doPDDOrderJob();// 拼多多订单处理
|
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新 |
| | | doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | | doDouYinDeviceActiveJob();// 抖音设备激活广告监测 |
| | | doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
|
| | | // doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
|
| | | // doPlaceOrderIntegralJob();// 下单赠送金币任务
|
| | | doDouYinDeviceActiveJob();// 抖音设备激活广告监测
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | Map<String, Order> map = PlaceOrderCMQManager.getInstance()
|
| | | .consumeQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL, 16);
|
| | | if (map != null) {
|
| | | // 是否是首单
|
| | |
|
| | | for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
|
| | | try {
|
| | | String key = its.next();
|
| | | Order order = map.get(key);
|
| | | // 统计订单下的用户所获得的返利金额
|
| | | List<CommonOrder> list = commonOrderService
|
| | | .listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
|
| | | Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
|
| | | if (list != null)
|
| | | for (CommonOrder commonOrder : list) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService
|
| | | .selectDetailByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
|
| | | Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
|
| | | if (hongBaoMoney.get(mainUid) == null)
|
| | | hongBaoMoney.put(mainUid, new BigDecimal(0));
|
| | | hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
|
| | | .add(hongBaoOrder.getHongBaoV2().getMoney()));
|
| | | // 查询上级
|
| | | List<HongBaoV2> children = hongBaoV2Service
|
| | | .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (children != null) {
|
| | | for (HongBaoV2 hongBao : children) {
|
| | | Long uid = hongBao.getUserInfo().getId();
|
| | | if (hongBaoMoney.get(uid) == null)
|
| | | hongBaoMoney.put(uid, new BigDecimal(0));
|
| | | hongBaoMoney.put(uid,
|
| | | hongBaoMoney.get(uid).add(hongBao.getMoney()));
|
| | | // 是否是首单
|
| | | if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
|
| | | order.getUserInfo().getId())) {
|
| | | // 统计订单下的用户所获得的返利金额
|
| | | List<CommonOrder> list = commonOrderService
|
| | | .listBySourceTypeAndOrderId(order.getOrderType(), order.getOrderId());
|
| | | Map<Long, BigDecimal> hongBaoMoney = new HashMap<>();
|
| | | if (list != null)
|
| | | for (CommonOrder commonOrder : list) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderService
|
| | | .selectDetailByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder != null && hongBaoOrder.getHongBaoV2() != null) {
|
| | | Long mainUid = hongBaoOrder.getHongBaoV2().getUserInfo().getId();
|
| | | if (hongBaoMoney.get(mainUid) == null)
|
| | | hongBaoMoney.put(mainUid, new BigDecimal(0));
|
| | | hongBaoMoney.put(mainUid, hongBaoMoney.get(mainUid)
|
| | | .add(hongBaoOrder.getHongBaoV2().getMoney()));
|
| | | // 查询上级
|
| | | List<HongBaoV2> children = hongBaoV2Service
|
| | | .listChildrenById(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (children != null) {
|
| | | for (HongBaoV2 hongBao : children) {
|
| | | Long uid = hongBao.getUserInfo().getId();
|
| | | if (hongBaoMoney.get(uid) == null)
|
| | | hongBaoMoney.put(uid, new BigDecimal(0));
|
| | | hongBaoMoney.put(uid,
|
| | | hongBaoMoney.get(uid).add(hongBao.getMoney()));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
|
| | | order.getUserInfo().getId())) {// 有效的首单
|
| | | if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
|
| | | .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 分享奖金是0
|
| | | integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
|
| | | null);
|
| | | }
|
| | |
|
| | | // 获取上两级数据
|
| | | UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
|
| | | if (boss != null) {// 判断上级的红包
|
| | | if (hongBaoMoney.get(boss.getId()) == null
|
| | | || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 补偿金币
|
| | | integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
|
| | | order.getUserInfo().getId(), null);
|
| | | }
|
| | | }
|
| | |
|
| | | } else {// 自购订单
|
| | | UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
|
| | | if (boss != null) {// 判断上级的红包
|
| | | if (hongBaoMoney.get(boss.getId()) == null
|
| | | || hongBaoMoney.get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 补偿金币1级
|
| | | integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
|
| | | order.getUserInfo().getId(), null);
|
| | | if (isFirstValidOrder(order.getOrderId(), order.getOrderType(),
|
| | | order.getUserInfo().getId())) {// 有效的首单
|
| | | if (hongBaoMoney.get(order.getUserInfo().getId()) == null || hongBaoMoney
|
| | | .get(order.getUserInfo().getId()).compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 分享奖金是0
|
| | | integralTaskRecordService.firstShareOrderReward(order.getUserInfo().getId(),
|
| | | null);
|
| | | }
|
| | |
|
| | | boss = threeSaleSerivce.getBoss(boss.getId());
|
| | | // 获取上两级数据
|
| | | UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
|
| | | if (boss != null) {// 判断上级的红包
|
| | | if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney.get(boss.getId())
|
| | | .compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 补偿金币2级
|
| | | integralTaskRecordService.firstRebateOrderRewardBossSuper(boss.getId(),
|
| | | // 补偿金币
|
| | | integralTaskRecordService.firstSharerOrderRewardBoss(boss.getId(),
|
| | | order.getUserInfo().getId(), null);
|
| | | }
|
| | | }
|
| | |
|
| | | } else {// 自购订单
|
| | | UserInfo boss = threeSaleSerivce.getBoss(order.getUserInfo().getId());
|
| | | if (boss != null) {// 判断上级的红包
|
| | | if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney.get(boss.getId())
|
| | | .compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 补偿金币1级
|
| | | integralTaskRecordService.firstRebateOrderRewardBoss(boss.getId(),
|
| | | order.getUserInfo().getId(), null);
|
| | | }
|
| | |
|
| | | boss = threeSaleSerivce.getBoss(boss.getId());
|
| | | if (boss != null) {// 判断上级的红包
|
| | | if (hongBaoMoney.get(boss.getId()) == null || hongBaoMoney
|
| | | .get(boss.getId()).compareTo(new BigDecimal("0")) <= 0) {
|
| | | // 补偿金币2级
|
| | | integralTaskRecordService.firstRebateOrderRewardBossSuper(
|
| | | boss.getId(), order.getUserInfo().getId(), null);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | PlaceOrderCMQManager.getInstance().deleteQueueMsg(PlaceOrderCMQManager.QUEUE_INTEGRAL,
|
| | |
| | | public static final String TAOBAO_TLJ_RELATION_PID_DEFAULT = "mm_124933865_56750082_19507100253";
|
| | | // 淘礼金渠道会员
|
| | | public static final String TAOBAO_TLJ_RELATION_AS_SPECIAL_PID = "mm_124933865_56750082_19508150186";
|
| | | |
| | | //饿了么PID
|
| | | public static final String TAOBAO_ELEME_PID = "mm_124933865_56750082_109491050276";
|
| | | |
| | | // 淘礼金会员
|
| | | public static final String TAOBAO_TLJ_SPECIAL_PID_DEFAULT = "mm_124933865_56750082_19509300170";
|
| | | public static BigDecimal OWN_BUY_WITHOUT_FANLI_RATE = new BigDecimal(70);// 自购立减的比例
|
| | | |
| | | public final static String SHARE_PRICE_TAOBAO="Tao宝价";
|
| | | public final static String SHARE_PRICE_TM="T猫价";
|
| | |
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | public static DaTaoKeGoodsResult search(String key, List<Integer> cidList, BigDecimal priceLowerLimit,
|
| | | BigDecimal priceUpperLimit, int page, int pageSize, int sort) {
|
| | | BigDecimal priceUpperLimit, int page, int pageSize, Integer sort) {
|
| | |
|
| | | TaoKeAppInfo app = getRandomApp();
|
| | | DaTaoKeGoodsResult daTaoKeGoodsResult = new DaTaoKeGoodsResult();
|
| | |
| | | params.put("cids", cids);
|
| | |
|
| | | params.put("keyWords", key);
|
| | | params.put("sort", sort + "");
|
| | | if (sort != null)
|
| | | params.put("sort", sort + "");
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | String result = HttpUtil.get("https://openapi.dataoke.com/api/goods/get-dtk-search-goods", params,
|
| | | new HashMap<>());
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 各大榜单
|
| | | *
|
| | |
| | | params.put("version", "v1.0.1");
|
| | | params.put("appKey", app.getAppKey());
|
| | | params.put("sign", getSign(params, app.getAppSecret()));
|
| | | |
| | |
|
| | | String result = null;
|
| | | try {
|
| | | result = HttpUtil.get("https://openapi.dataoke.com/api/category/get-top100", params, new HashMap<>());
|
| | | } catch (Exception e) {
|
| | | result = HttpUtil.get("https://openapi.dataoke.com/api/category/get-top100", params, new HashMap<>());
|
| | | }
|
| | | |
| | |
|
| | | String hotWords = null;
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | if (json != null) {
|
| | |
| | | }
|
| | | return hotWords;
|
| | | }
|
| | | |
| | | |
| | |
|
| | | class DaTaoKeResult {
|
| | | Date updateTime;
|
| | | List<DaTaoKeDetail> dataList;
|
| | |
| | |
|
| | | /**
|
| | | * 查询天猫商品图片、标题
|
| | | * |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | |
| | | if (content.contains("var _DATA_Mdskip")) {
|
| | | content = content.replace("<script>", "");
|
| | | content = content.replace("</script>", "");
|
| | | content+=";function getData(){ var json={title:_DATA_Mdskip.item.title,pictUrl:_DATA_Mdskip.item.videoDetail.videoThumbnailURL}; return JSON.stringify(json);}";
|
| | | |
| | | content += ";function getData(){ var json={title:_DATA_Mdskip.item.title,pictUrl:_DATA_Mdskip.item.videoDetail.videoThumbnailURL}; return JSON.stringify(json);}";
|
| | |
|
| | | ScriptEngineManager manager = new ScriptEngineManager();
|
| | | ScriptEngine engine = manager.getEngineByName("javascript");
|
| | | engine.eval(content);
|
| | | |
| | |
|
| | | if (engine instanceof Invocable) {
|
| | | Invocable in = (Invocable) engine;
|
| | | JSONObject json = JSONObject.fromObject(in.invokeFunction("getData"));
|
| | |
| | | taoBaoGoodsBrief.setTitle(title.toString());
|
| | | taoBaoGoodsBrief.setPictUrl(pictUrl.toString());
|
| | | }
|
| | | |
| | |
|
| | | break;
|
| | | }
|
| | | }
|
| | |
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 淘口令过滤
|
| | | * |
| | | * @param token
|
| | | * @return
|
| | | */
|
| | | public static String filterTaoToken(String token) {
|
| | | if (StringUtil.isNullOrEmpty(token))
|
| | | return token;
|
| | | if (token.contains("¥")||token.contains("€")) {
|
| | | String newToken = "";
|
| | | for (int i = 0; i < token.length(); i++) {
|
| | | if (token.charAt(i) == '¥'||token.charAt(i) == '€') {
|
| | | if (!newToken.contains("("))
|
| | | newToken += "(";
|
| | | else
|
| | | newToken += ")";
|
| | | } else
|
| | | newToken += token.charAt(i) + "";
|
| | | }
|
| | | return newToken;
|
| | | }
|
| | | return token;
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.vip;
|
| | |
|
| | | import java.util.HashMap;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | | * TODO 未完成 唯品会接口
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class VipApiUtil {
|
| | |
|
| | | private final static String appKey = "f9e7f22f";
|
| | | private final static String appSecret = "9B2291352497FAF42B2DF44BFCF62316";
|
| | |
|
| | | private static String getSign() {
|
| | |
|
| | | return null;
|
| | | }
|
| | |
|
| | | private static Map<String, String> getBaseParams(String service, String method) {
|
| | | Map<String, String> params = new HashMap<String, String>();
|
| | | params.put("service", service);
|
| | | params.put("method", method);
|
| | | params.put("version", "1.0");
|
| | | params.put("timestamp", System.currentTimeMillis() / 1000 + "");
|
| | | params.put("format", "json");
|
| | | params.put("appKey", appKey);
|
| | | params.put("sign", null);
|
| | | return params;
|
| | | }
|
| | | }
|