| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
| | | import com.google.gson.stream.JsonReader;
|
| | | import com.google.gson.stream.JsonWriter;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.lable.QualityFactory;
|
| | | 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.user.UserInfoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserMoneyExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRank;
|
| | | import com.yeshi.fanli.entity.taobao.ShareHotGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TLJBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinOriginException;
|
| | | import com.yeshi.fanli.exception.tlj.UserTaoLiJinRecordException;
|
| | | 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.monitor.BusinessEmergent110Service;
|
| | | import com.yeshi.fanli.service.inter.monitor.MonitorService;
|
| | | import com.yeshi.fanli.service.inter.taobao.ShareHotGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.tlj.ConfigTaoLiJinService;
|
| | | import com.yeshi.fanli.service.inter.tlj.DeviceTaoLiJinRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.GoodsTaoLiJinRateService;
|
| | | 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.UserShareGoodsRecordService;
|
| | | 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.tlj.ReduceHongBao;
|
| | | import com.yeshi.fanli.vo.tlj.SpreadHongBao;
|
| | | import com.yeshi.fanli.vo.tlj.TaoLiJinDetailVO;
|
| | | import com.yeshi.fanli.vo.user.UserTaoLiJinRecordVO;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserExtraTaoBaoInfoService userExtraTaoBaoInfoService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinOriginService userTaoLiJinOriginService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserTaoLiJinDetailService userTaoLiJinDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserMoneyExtraService userMoneyExtraService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private ConfigTaoLiJinService configTaoLiJinService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private QualityGoodsService qualityGoodsService;
|
| | | |
| | | @Resource
|
| | | private GoodsTaoLiJinRateService goodsTaoLiJinRateService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private DeviceTaoLiJinRecordService deviceTaoLiJinRecordService;
|
| | |
|
| | | @Resource
|
| | | private JumpDetailV2Service jumpDetailV2Service;
|
| | | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | |
|
| | | @Resource
|
| | | private ShareHotGoodsService shareHotGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | /**
|
| | | * 获取淘礼金分享记录
|
| | |
| | | page = 1;
|
| | | }
|
| | |
|
| | | long count = 0;
|
| | | int pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | | List<UserTaoLiJinRecordVO> list = userTaoLiJinRecordService.getRecordByUid((page - 1) * pageSize, pageSize, uid);
|
| | |
|
| | | List<UserTaoLiJinRecordVO> list = userTaoLiJinRecordService.getRecordByUid((page - 1) * pageSize, pageSize,
|
| | | uid);
|
| | | if (list == null) {
|
| | | list = new ArrayList<UserTaoLiJinRecordVO>();
|
| | | } else if (list.size() > 0) {
|
| | | count = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | long count = userTaoLiJinRecordService.countShareRecordByUid(uid);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(Date.class, new JsonSerializer<Date>() {
|
| | | @Override
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | Gson gson = gsonBuilder.create();
|
| | | |
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 统计淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | | // 过期
|
| | | userTaoLiJinOriginService.overdueHongBao(uid);
|
| | | |
| | |
|
| | | // 过期 -取消收回
|
| | | // userTaoLiJinOriginService.overdueHongBao(uid);
|
| | |
|
| | | // 我的淘礼金
|
| | | BigDecimal tlj = null;
|
| | | UserMoneyExtra userMoneyExtra = userMoneyExtraService.selectByPrimaryKey(uid);
|
| | |
| | | } else {
|
| | | tlj = new BigDecimal(0);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | // 今日分享个数
|
| | | long countShare = userTaoLiJinRecordService.countTodayNum(uid);
|
| | | |
| | |
|
| | | // 获得
|
| | | BigDecimal todayWin = userTaoLiJinOriginService.countMoneyByDate(uid, 1);
|
| | | BigDecimal yesterdayWin = userTaoLiJinOriginService.countMoneyByDate(uid, 2);
|
| | | 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("tlj", tlj.setScale(2).toString());
|
| | | 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());
|
| | |
| | | data.put("yesterdayUse", yesterdayUse.setScale(2).toString().replaceAll("-", ""));
|
| | | data.put("thisMonthUse", thisMonthUse.setScale(2).toString().replaceAll("-", ""));
|
| | | data.put("lastMonthUse", lastMonthUse.setScale(2).toString().replaceAll("-", ""));
|
| | | |
| | | |
| | |
|
| | | // IOS 分享个数
|
| | | ClientTextStyleVO textVo1 = new ClientTextStyleVO();
|
| | | textVo1.setContent("今日创建分享");
|
| | |
| | | ClientTextStyleVO textVo3 = new ClientTextStyleVO();
|
| | | textVo3.setContent("个");
|
| | | textVo3.setColor("#888888");
|
| | | |
| | |
|
| | | List<ClientTextStyleVO> listCountShare = new ArrayList<ClientTextStyleVO>();
|
| | | listCountShare.add(textVo1);
|
| | | listCountShare.add(textVo2);
|
| | | listCountShare.add(textVo3);
|
| | | data.put("listShare", listCountShare);
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 获取淘礼金明细详情
|
| | | *
|
| | |
| | | ca.add(Calendar.MONTH, 1);
|
| | | date = new Date(ca.getTimeInMillis() - 1);
|
| | | }
|
| | | |
| | |
|
| | | // 查询列表
|
| | | List<TaoLiJinDetailVO> list = userTaoLiJinDetailService.listUserMoneyDetailForClient(uid, index, date);
|
| | | // 统计总条数
|
| | | long count = userTaoLiJinDetailService.countUserMoneyDetailForClient(uid, index, date);
|
| | | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | | gsonBuilder.registerTypeAdapter(TaoLiJinDetailTypeEnum.class, new TypeAdapter<TaoLiJinDetailTypeEnum>() {
|
| | | @Override
|
| | |
| | | return new JsonPrimitive(TimeUtil.getGernalTime(value.getTime(), "yyyy.MM.dd HH:mm"));
|
| | | }
|
| | | }
|
| | | }).registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() {
|
| | | @Override
|
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) {
|
| | | if (value == null) {
|
| | | return new JsonPrimitive("");
|
| | | } else {
|
| | | // 保留2位小数
|
| | | value = value.setScale(2);
|
| | | return new JsonPrimitive(value.toString());
|
| | | }
|
| | | }
|
| | | });
|
| | |
|
| | | Gson gson = gsonBuilder.create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | data.put("data", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 红包领取详情
|
| | | * 红包领取详情
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param type
|
| | |
| | | */
|
| | | @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());
|
| | |
| | | // 已领取
|
| | | money = deviceRecord.getMoney();
|
| | | } else {
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies");
|
| | | String value = configTaoLiJinService.getValueByKey("hongbao_newbies", null);
|
| | | 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("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
|
| | | data.put("title", "新人红包");
|
| | | data.put("content", "自购直接抵现,优惠真实可见!");
|
| | | data.put("type", 1);
|
| | | data.put("money", money.setScale(2).toString());
|
| | | data.put("usage", "领取成功,去“首页-分享爆款”使用>");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_taolijin_goods"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("taolijin_rules"));
|
| | | |
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } |
| | | |
| | | |
| | | }
|
| | |
|
| | | // 登录用户
|
| | | boolean isReceive = false;
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("taolijin_rules"));
|
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon"));
|
| | | |
| | | data.put("icon", configTaoLiJinService.getValueByKey("taolijin_system_icon", null));
|
| | |
|
| | | if (type.equals(TaoLiJinOriginEnum.newbiesWin.name())) {
|
| | | BigDecimal hasMoney = null;
|
| | | UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getByUidAndOrigin(uid, type);
|
| | |
| | | return;
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | data.put("title", "新人红包");
|
| | | data.put("content", "自购直接抵现,优惠真实可见!");
|
| | | data.put("type", 1);
|
| | | data.put("money", hasMoney.setScale(2).toString());
|
| | | data.put("usage", "领取成功,去“首页-分享爆款”使用>");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_taolijin_goods"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip"));
|
| | | |
| | | } else if(type.equals(TaoLiJinOriginEnum.rankWin.name())) {
|
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_newbies_tip", null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("newbies_rules_link", null));
|
| | |
|
| | | } else if (type.equals(TaoLiJinOriginEnum.rankWin.name())) {
|
| | | boolean isRank = false;
|
| | | BigDecimal hasMoney = null;
|
| | | UserTaoLiJinOrigin userTaoLiJin = userTaoLiJinOriginService.getRankByThisMonth(uid, type);
|
| | | if (userTaoLiJin != null) { // 已领取
|
| | | isRank = true;
|
| | | isReceive = true;
|
| | | hasMoney = userTaoLiJin.getMoney();
|
| | | } else {
|
| | | isRank = false;
|
| | | UserRank userRank = userInfoExtraService.gerUserRank(uid);
|
| | | if (userRank != null) {
|
| | | try {
|
| | | isRank = true;
|
| | | 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("usage", "去“我的-账户等级”查看 >");
|
| | | data.put("jumpName", "去查看");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_rank"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_not_enough_tip", null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | return;
|
| | | } else {
|
| | |
| | | data.put("content", "推广红包,好友福利!");
|
| | | data.put("type", 1);
|
| | | data.put("money", hasMoney.setScale(2).toString());
|
| | | data.put("usage", "已存入“我的-推广红包”,去查看 >");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("user_taolijin"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip"));
|
| | | if (isReceive) {
|
| | | data.put("usage", "本月领取,已存入“我的-推广红包”");
|
| | | } else {
|
| | | data.put("usage", "领取成功,已存入“我的-推广红包”");
|
| | | }
|
| | | data.put("jumpName", "去使用");
|
| | | data.put("jumpDetail", jumpDetailV2Service.getByTypeCache("share_goods_hot"));
|
| | | data.put("tip", configTaoLiJinService.getValueByKey("hongbao_rank_tip", null));
|
| | | data.put("rules", configTaoLiJinService.getValueByKey("rank_rules_link", null));
|
| | | }
|
| | | |
| | |
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult(1, "类型不匹配"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getShareGoods", method = RequestMethod.POST)
|
| | | public void getShareGoods(AcceptData acceptData, Long uid, Integer page, PrintWriter out) {
|
| | | public void getShareGoods(AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | 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 = userInfoExtraService.isNewUser(uid);
|
| | | if (isNewUser) {
|
| | | // 判定为老用户: 新人只要使用了新人红包,也就是那1块钱,那么,他看到的分享爆款中的商品-就只能分享。
|
| | | long countRecord = userTaoLiJinRecordService.countRecordByUid(uid);
|
| | | if (countRecord > 0) {
|
| | | isNewUser = false;
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal proportion = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | 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;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(),
|
| | | null);
|
| | | // 去掉标签
|
| | | extra.setLabels(null);
|
| | |
|
| | | // 显示类型
|
| | | if (isNewUser) {
|
| | | extra.setMoneyType(1);
|
| | | extra.setSpreadMoney("推广红包 ¥" + 1);
|
| | | } else {
|
| | | extra.setMoneyType(2);
|
| | | extra.setSpreadMoney("推广红包 ¥" + spreadMoney);
|
| | | }
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | /*
|
| | | * // 过期 -取消收回 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) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | | }
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | BigDecimal shareRate = hongBaoManageService.getTLJShareRate(System.currentTimeMillis());
|
| | | 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, null, fanLiRate, shareRate);
|
| | | // 去掉标签
|
| | | 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("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享爆款商品-限于淘礼金
|
| | | * |
| | | * @param acceptData
|
| | | * @param uid
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getBuyGoods", method = RequestMethod.POST)
|
| | | public void getBuyGoods(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;
|
| | | 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;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(),
|
| | | null);
|
| | | // 去掉标签
|
| | | extra.setLabels(null);
|
| | |
|
| | | String hongBao = spreadMoney.toString();
|
| | | TLJBuyHongBaoVO vo = new TLJBuyHongBaoVO();
|
| | | vo.setLeft(hotGoods.getLeftHongBaoCount());
|
| | | vo.setMoney(hongBao);
|
| | | vo.setTagName("付款立减 ¥" + hongBao);
|
| | | vo.setTip("");
|
| | | vo.setTotal(hotGoods.getTotalHongBaoCount());
|
| | | extra.setTljBuyHongBao(vo);
|
| | | // 显示类型
|
| | | extra.setMoneyType(2);
|
| | | extra.setSpreadMoney("付款立减 ¥" + spreadMoney);
|
| | |
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | |
|
| | | 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.getByBannerCard("zigoulijian_banner");
|
| | |
|
| | | if (bannerList != null && bannerList.size() > 0)
|
| | | data.put("topPicture", bannerList.get(0).getSrc());
|
| | | else
|
| | | data.put("topPicture", "");
|
| | |
|
| | | data.put("ruleUrl", configService.get("zigoulijian_rule"));
|
| | | }
|
| | | 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;
|
| | | 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, null, proportion, proportion);
|
| | | // 去掉标签
|
| | | 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.getByBannerCard("zigoulijian_banner");
|
| | |
|
| | | if (bannerList != null && bannerList.size() > 0)
|
| | | data.put("topPicture", bannerList.get(0).getSrc());
|
| | | else
|
| | | data.put("topPicture", "");
|
| | |
|
| | | data.put("ruleUrl", configService.get("zigoulijian_rule"));
|
| | | }
|
| | | 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) {
|
| | | if (uid == null || uid <= 0) {
|
| | | out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | if (page == null || page < 1) {
|
| | | page = 1;
|
| | | try {
|
| | | String tips = userTaoLiJinRecordService.giveTaolijin(uid, amount);
|
| | | out.print(JsonUtil.loadTrueResult(tips));
|
| | | } catch (UserTaoLiJinRecordException e) {
|
| | | out.print(JsonUtil.loadFalseResult(1, e.getMsg()));
|
| | | }
|
| | |
|
| | | int pageSize = 10;
|
| | | |
| | | List<QualityFactory> listFreeGoods = qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize);
|
| | | if (listFreeGoods == null) {
|
| | | listFreeGoods = new ArrayList<QualityFactory>(); |
| | | }
|
| | | long count = listFreeGoods.size();
|
| | | |
| | | JSONArray array = new JSONArray();
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | |
| | | boolean isNewUser = userInfoExtraService.isNewUser(uid);
|
| | | |
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | for (QualityFactory qualityFactory : listFreeGoods) {
|
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief();
|
| | | if (taoBaoGoodsBrief == null) {
|
| | | continue;
|
| | | }
|
| | | |
| | | TaoBaoGoodsBriefExtra extra = TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null);
|
| | | |
| | | // 显示类型
|
| | | if (isNewUser) {
|
| | | extra.setMoneyType(1);
|
| | | } else {
|
| | | extra.setMoneyType(2);
|
| | | }
|
| | | |
| | | // 去掉标签
|
| | | extra.setLabels(null);
|
| | | |
| | | BigDecimal spreadMoney = goodsTaoLiJinRateService.getGoodsSpreadMoney(taoBaoGoodsBrief);
|
| | | // 推广红包 不能小于1
|
| | | if (spreadMoney.compareTo(new BigDecimal(1)) < 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | | extra.setSpreadMoney("推广红包 ¥"+ spreadMoney);
|
| | | array.add(gson.toJson(extra));
|
| | | }
|
| | | |
| | | // 过期
|
| | | userTaoLiJinOriginService.overdueHongBao(uid);
|
| | | |
| | | JSONObject data = new JSONObject();
|
| | | data.put("count", count);
|
| | | data.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | | |
| | |
|
| | | }
|