| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.DateUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.google.gson.TypeAdapter;
|
| | | import com.google.gson.stream.JsonReader;
|
| | | import com.google.gson.stream.JsonWriter;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.tlj.DeviceTaoLiJinRecord;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinDetail.TaoLiJinDetailTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinOrigin.TaoLiJinOriginEnum;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinNewbies;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
|
| | | import com.yeshi.fanli.exception.user.UserInfoException;
|
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsTextTemplateService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
|
| | | import com.yeshi.fanli.service.inter.money.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.monitor.BusinessEmergent110Service;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.redpack.UserTaoLiJinNewbiesService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinDetailService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserMoneyExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TaoBaoConstant;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoLiJinUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | | import com.yeshi.fanli.vo.goods.MoneyInfoVO;
|
| | | import com.yeshi.fanli.vo.goods.OtherInfo;
|
| | | import com.yeshi.fanli.vo.goods.taobao.TLJBuyHongBaoVO;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.redpack.TaoLiJinWinDetailVO;
|
| | | import com.yeshi.fanli.vo.tlj.ReduceHongBao;
|
| | | import com.yeshi.fanli.vo.tlj.SpreadHongBao;
|
| | | import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
|
| | | import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
|
| | |
|
| | |
| | | private QualityGoodsService qualityGoodsService;
|
| | |
|
| | | @Resource
|
| | | private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | |
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | | |
| | | @Resource
|
| | | private UserTaoLiJinNewbiesService userTaoLiJinNewbiesService;
|
| | | |
| | | @Resource
|
| | | private TLJFreeBuyGoodsService tljFreeBuyGoodsService;
|
| | | |
| | |
|
| | | /**
|
| | | * 获取淘礼金分享记录
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | // 过期
|
| | | userTaoLiJinOriginService.overdueHongBao(uid);
|
| | | // 过期 -取消收回
|
| | | // userTaoLiJinOriginService.overdueHongBao(uid);
|
| | |
|
| | | // 我的淘礼金
|
| | | BigDecimal tlj = null;
|
| | |
| | | BigDecimal thisMonthWin = userTaoLiJinOriginService.countMoneyByDate(uid, 3);
|
| | | BigDecimal lastMonthWin = userTaoLiJinOriginService.countMoneyByDate(uid, 4);
|
| | |
|
| | | BigDecimal zero = new BigDecimal(0);
|
| | | // 消耗
|
| | | BigDecimal todayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 1);
|
| | | BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2);
|
| | | BigDecimal thisMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 3);
|
| | | BigDecimal lastMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 4);
|
| | | if (todayUse == null || todayUse.compareTo(zero) > 0) {
|
| | | todayUse = zero;
|
| | | }
|
| | |
|
| | | // 问号链接
|
| | | String helpLink = configTaoLiJinService.getValueByKey("hongbao_help_link");
|
| | | BigDecimal yesterdayUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 2);
|
| | | if (yesterdayUse == null || yesterdayUse.compareTo(zero) > 0) {
|
| | | yesterdayUse = zero;
|
| | | }
|
| | | BigDecimal thisMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 3);
|
| | | if (thisMonthUse == null || thisMonthUse.compareTo(zero) > 0) {
|
| | | thisMonthUse = zero;
|
| | | }
|
| | | BigDecimal lastMonthUse = userTaoLiJinDetailService.countUseMoneyByDate(uid, 4);
|
| | | if (lastMonthUse == null || lastMonthUse.compareTo(zero) > 0) {
|
| | | lastMonthUse = zero;
|
| | | }
|
| | |
|
| | | String giveMin = configTaoLiJinService.getValueByKey("give_min_amount");
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("tlj", tlj.setScale(2).toString());
|
| | | data.put("helpLink", helpLink);
|
| | | data.put("giveMin", giveMin);
|
| | | data.put("giveTip", "注:赠送推广红包金额至少" + giveMin + "元");
|
| | | data.put("helpLink", configTaoLiJinService.getValueByKey("hongbao_help_link"));
|
| | | data.put("countShare", countShare);
|
| | | data.put("todayWin", todayWin.setScale(2).toString());
|
| | | data.put("yesterdayWin", yesterdayWin.setScale(2).toString());
|
| | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 红包领取详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param type
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getHongbaoDetails", method = RequestMethod.POST)
|
| | | public void getHongbaoDetails(AcceptData acceptData, Long uid, String type, PrintWriter out) {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(type)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "类型不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 用户未登录时 设备领取新红包
|
| | | if (uid == null || uid <= 0) {
|
| | | BigDecimal money = null;
|
| | | DeviceTaoLiJinRecord deviceRecord = deviceTaoLiJinRecordService.getByDevice(acceptData.getDevice());
|
| | | if (deviceRecord != null) {
|
| | | // 已领取
|
| | | money = deviceRecord.getMoney();
|
| | | } else {
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
|
| | | if (StringUtil.isNullOrEmpty(value)) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "系统红包不存在"));
|
| | | return;
|
| | | }
|
| | | money = new BigDecimal(value);
|
| | | deviceTaoLiJinRecordService.save(acceptData.getDevice(), money);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
|
| | | data.put("title", "新人红包");
|
| | | data.put("content", "自购直接抵现,优惠真实可见!");
|
| | | data.put("type", 1);
|
| | | data.put("money", money.setScale(2).toString());
|
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link"));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 登录用户
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
|
| | |
|
| | | if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
|
| | | BigDecimal hasMoney = null;
|
| | | UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getByUidAndOrigin(uid, type);
|
| | | if (userTaoLiJin != null) { // 已领取
|
| | | hasMoney = userTaoLiJin.getMoney();
|
| | | } else {
|
| | | try {
|
| | | UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addNewbiesWinMoney(uid);
|
| | | hasMoney = origin.getMoney();
|
| | | } catch (UserTaoLiJinOriginException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | return;
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("title", "新人红包");
|
| | | data.put("content", "自购直接抵现,优惠真实可见!");
|
| | | data.put("type", 1);
|
| | | data.put("money", hasMoney.setScale(2).toString());
|
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link"));
|
| | |
|
| | | } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) {
|
| | | boolean isRank = false;
|
| | | BigDecimal hasMoney = null;
|
| | | UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getRankByThisMonth(uid, type);
|
| | | if (userTaoLiJin != null) { // 已领取
|
| | | isRank = true;
|
| | | hasMoney = userTaoLiJin.getMoney();
|
| | | } else {
|
| | | isRank = false;
|
| | | UserRank userRank = userInfoExtraService.gerUserRank(uid);
|
| | | if (userRank != null) {
|
| | | try {
|
| | | UserTaoLiJinOrigin origin = userTaoLiJinOriginService.addRankWinMoney(uid, userRank);
|
| | | hasMoney = origin.getMoney();
|
| | | isRank = true;
|
| | | } catch (UserTaoLiJinOriginException e) {
|
| | | if (e.getCode() != 2) {
|
| | | isRank = false;
|
| | | out.print(JsonUtil.loadFalseResult(e.getMsg()));
|
| | | return;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 等级不足
|
| | | if (!isRank) {
|
| | | data.put("title", "账户等级福利");
|
| | | data.put("content", "推广红包,好友福利!");
|
| | | data.put("type", 2);
|
| | | data.put("money", "本月账户等级未达到\r\n继续加油");
|
| | | data.put("jumpName", "去查看");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link"));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } else {
|
| | | data.put("title", "账户等级福利");
|
| | | data.put("content", "推广红包,好友福利!");
|
| | | data.put("type", 1);
|
| | | data.put("money", hasMoney.setScale(2).toString());
|
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link"));
|
| | | }
|
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(1, "类型不匹配"));
|
| | | return;
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal proportion = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | for (ShareHotGoods hotGoods : listHot) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | |
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value");
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | |
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | // 过期
|
| | | userTaoLiJinOriginService.overdueHongBao(uid);
|
| | | /*
|
| | | * // 过期 -取消收回 executor.execute(new Runnable() {
|
| | | * |
| | | * @Override public void run() {
|
| | | * userTaoLiJinOriginService.overdueHongBao(uid); } });
|
| | | */
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", array.size());
|
| | | data.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShareGoodsV2", method = RequestMethod.POST)
|
| | | public void getShareGoodsV2(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | | List<ShareHotGoods> listHot = shareHotGoodsService.listByDay(day);
|
| | | if (listHot == null) {
|
| | | listHot = new ArrayList<ShareHotGoods>();
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | // 取消新人自购
|
| | | boolean isNewUser = false;// userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | if (countRecord > 0) {
|
| | | isNewUser = false;
|
| | | }
|
| | | });
|
| | | }
|
| | | |
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | |
|
| | | for (ShareHotGoods hotGoods : listHot) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | String warningRate = configTaoLiJinService.getValueByKey("warning_value", new Date());
|
| | | BigDecimal spreadMoney = TaoLiJinUtil.getSpreadMoney(warningRate, taoBaoGoodsBrief);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | | if (spreadMoney.compareTo(new BigDecimal(1.1)) < 0) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
|
| | | |
| | | // 大于1.6.5的才会显示福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | detailVO.setCouponPrice(detailVO.getCouponPrice().subtract(spreadMoney));
|
| | | else
|
| | | detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney));
|
| | | }
|
| | | |
| | | // 去掉标签
|
| | | detailVO.setLabels(null);
|
| | |
|
| | | MoneyInfoVO moneyInfo = detailVO.getMoneyInfo();
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | SpreadHongBao spreadHongBao = new SpreadHongBao();
|
| | |
|
| | | // 显示类型
|
| | | if (isNewUser) {
|
| | | moneyInfo.setMoneyType(1);
|
| | | spreadHongBao.setName("推广红包");
|
| | | spreadHongBao.setMoney(" ¥1");
|
| | | } else {
|
| | | moneyInfo.setMoneyType(2);
|
| | | spreadHongBao.setName("推广红包");
|
| | | spreadHongBao.setMoney(" ¥" + spreadMoney);
|
| | | }
|
| | | detailVO.setMoneyInfo(moneyInfo);
|
| | | otherInfo.setSpreadHongBao(spreadHongBao);
|
| | | detailVO.setOtherInfo(otherInfo);
|
| | |
|
| | | array.add(gson.toJson(detailVO));
|
| | | }
|
| | |
|
| | | /*
|
| | | * executor.execute(new Runnable() {
|
| | | * |
| | | * @Override public void run() { // 过期
|
| | | * userTaoLiJinOriginService.overdueHongBao(uid); } });
|
| | | */
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", array.size());
|
| | |
| | | data.put("count", array.size());
|
| | | data.put("list", array);
|
| | | if (page == 1) {
|
| | | try {
|
| | | List<SwiperPicture> bannerList = swiperPictureService.getByBannerCard("zigoulijian_banner");
|
| | | if (bannerList != null && bannerList.size() > 0)
|
| | | data.put("topPicture", bannerList.get(0).getSrc());
|
| | | else
|
| | | data.put("topPicture", "");
|
| | | } catch (SwiperPictureException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | data.put("ruleUrl", configService.get("zigoulijian_rule"));
|
| | | List<SwiperPicture> bannerList = swiperPictureService.getByBannerCardAndVersion("zigoulijian_banner",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | if (bannerList != null && bannerList.size() > 0)
|
| | | data.put("topPicture", bannerList.get(0).getSrc());
|
| | | else
|
| | | data.put("topPicture", "");
|
| | |
|
| | | data.put("ruleUrl", configService.get(ConfigKeyEnum.zigoulijianRule.getKey()));
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getBuyGoodsV2", method = RequestMethod.POST)
|
| | | public void getBuyGoodsV2(AcceptData acceptData, int page, PrintWriter out) {
|
| | |
|
| | | String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | | List<TLJBuyGoods> listHot = tljBuyGoodsService.listByDay(day);
|
| | | if (listHot == null) {
|
| | | listHot = new ArrayList<TLJBuyGoods>();
|
| | | }
|
| | |
|
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | BigDecimal proportion = TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE;
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(proportion, proportion, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate());
|
| | | for (TLJBuyGoods hotGoods : listHot) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = hotGoods.getGoods();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | // 计算推广红包
|
| | | BigDecimal spreadMoney = TaoBaoUtil.getGoodsHongBaoMoney(taoBaoGoodsBrief, proportion);
|
| | |
|
| | | // 推广红包 不能小于1
|
| | | if (spreadMoney.compareTo(new BigDecimal(1.0)) < 0) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
|
| | |
|
| | | // 大于1.6.5的才会显示福利价
|
| | | if (com.yeshi.fanli.util.VersionUtil.greaterThan_1_6_5(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | if (detailVO.getCouponPrice() != null && detailVO.getCouponPrice().compareTo(new BigDecimal(0)) > 0)
|
| | | detailVO.setCouponPrice(detailVO.getCouponPrice().subtract(spreadMoney));
|
| | | else
|
| | | detailVO.setZkPrice(detailVO.getZkPrice().subtract(spreadMoney));
|
| | | }
|
| | |
|
| | | // 去掉标签
|
| | | detailVO.setLabels(null);
|
| | |
|
| | | MoneyInfoVO moneyInfo = detailVO.getMoneyInfo();
|
| | | moneyInfo.setMoneyType(2);
|
| | | detailVO.setMoneyInfo(moneyInfo);
|
| | |
|
| | | String hongBao = spreadMoney.toString();
|
| | | ReduceHongBao vo = new ReduceHongBao();
|
| | | vo.setLeft(hotGoods.getLeftHongBaoCount());
|
| | | vo.setMoney(" ¥" + hongBao);
|
| | | vo.setName("付款立减 ");
|
| | | vo.setTip("");
|
| | | vo.setTotal(hotGoods.getTotalHongBaoCount());
|
| | |
|
| | | OtherInfo otherInfo = new OtherInfo();
|
| | | otherInfo.setReduceHongBao(vo);
|
| | | detailVO.setOtherInfo(otherInfo);
|
| | |
|
| | | array.add(gson.toJson(detailVO));
|
| | | }
|
| | |
|
| | | if (page > 1)
|
| | | array.clear();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", array.size());
|
| | | data.put("list", array);
|
| | | if (page == 1) {
|
| | | List<SwiperPicture> bannerList = swiperPictureService.getByBannerCardAndVersion("zigoulijian_banner",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | |
|
| | | if (bannerList != null && bannerList.size() > 0)
|
| | | data.put("topPicture", bannerList.get(0).getSrc());
|
| | | else
|
| | | data.put("topPicture", "");
|
| | |
|
| | | data.put("ruleUrl", configService.get(ConfigKeyEnum.zigoulijianRule.getKey()));
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 赠送淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param amount
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "giveTLJ", method = RequestMethod.POST)
|
| | | public void giveTLJ(AcceptData acceptData, Long uid, BigDecimal amount, PrintWriter out) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "抱歉,推广红包相关功能已下线!"));
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 新人红包详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getWinDetail", method = RequestMethod.POST)
|
| | | public void getWinDetail(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | | TaoLiJinWinDetailVO winDetail = userTaoLiJinNewbiesService.receiveReward(uid);
|
| | | if (winDetail == null) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "红包已被抢光"));
|
| | | return;
|
| | | }
|
| | |
|
| | | // 2、顶部轮播图
|
| | | List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("redpack_win_detail_banner",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
|
| | | List<SwiperPicture> topPicList = new ArrayList<>();
|
| | | if (oldtopPicList != null && oldtopPicList.size() > 0)
|
| | | topPicList.addAll(oldtopPicList);
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("detail", JsonUtil.getApiCommonGson().toJson(winDetail));
|
| | | data.put("banner", JsonUtil.getApiCommonGson().toJson(topPicList));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "红包已被抢光啦"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 新人免单列表
|
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "gerFreeList")
|
| | | public void gerFreeList(String callback, AcceptData acceptData, int page, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | String day = TimeUtil.getGernalTime(java.lang.System.currentTimeMillis());
|
| | | List<TLJFreeBuyGoods> listFree = tljFreeBuyGoodsService.listByDay(day);
|
| | | if (listFree == null) {
|
| | | listFree = new ArrayList<TLJFreeBuyGoods>();
|
| | | }
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | |
|
| | | ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
|
| | | acceptData.getVersion());
|
| | |
|
| | | for (TLJFreeBuyGoods freeGoods : listFree) {
|
| | | TaoBaoGoodsBrief goods = freeGoods.getGoods();
|
| | | if (goods == null)
|
| | | continue;
|
| | | |
| | | // 计算券后价 1<= n <= 2
|
| | | BigDecimal couplePrice = TaoBaoUtil.getAfterUseCouplePrice(goods);
|
| | | if (couplePrice.compareTo(new BigDecimal(1.0)) < 0 && couplePrice.compareTo(new BigDecimal(2.0)) > 0)
|
| | | continue;
|
| | | |
| | | GoodsDetailVO detailVO = GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO);
|
| | | |
| | | // 专属标签
|
| | | List<ClientTextStyleVO> labels = new ArrayList<ClientTextStyleVO>();
|
| | | labels.add(new ClientTextStyleVO("新人专属", "#FE0014"));
|
| | | labels.add(new ClientTextStyleVO("实付0元", "#FF9600"));
|
| | | detailVO.setLabels(labels);
|
| | | array.add(gson.toJson(detailVO));
|
| | | }
|
| | |
|
| | | if (page > 1)
|
| | | array.clear();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", array.size());
|
| | | data.put("list", array);
|
| | | if (page == 1) {
|
| | | try {
|
| | | data.put("portrait", userInfoService.getUserInfo(uid).getPortrait());
|
| | | } catch (UserInfoException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | return;
|
| | | }
|
| | | |
| | | String state = "已过期";
|
| | | BigDecimal balance = new BigDecimal(0);
|
| | | UserTaoLiJinNewbies winDetail = userTaoLiJinNewbiesService.selectByPrimaryKey(uid);
|
| | | if (winDetail != null) {
|
| | | balance = winDetail.getMoney() ;
|
| | | if (winDetail.getEndTime().getTime() > java.lang.System.currentTimeMillis()) {
|
| | | try {
|
| | | String remaining = DateUtil.dateDiff2(new Date(), winDetail.getEndTime());
|
| | | if (!remaining.equals("0分"))
|
| | | state = "剩" + remaining + "过期";
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | String rule = configTaoLiJinService.getValueByKey("new_user_free_buy_list_rule");
|
| | | rule = rule.replace("{链接}", configService.get(ConfigKeyEnum.customerServiceLink.getKey()));
|
| | | |
| | | data.put("state", state);
|
| | | data.put("balance","新人红包:" + balance.setScale(2) + "元");
|
| | | data.put("rule", rule);
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | }
|