| | |
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.admin.EveryDayTask;
|
| | | import com.yeshi.fanli.entity.admin.InviteGetMoney;
|
| | | import com.yeshi.fanli.entity.bus.user.UserRankings;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.UserRankingsException;
|
| | | import com.yeshi.fanli.service.inter.config.EveryDayTaskService;
|
| | | import com.yeshi.fanli.exception.banner.SwiperPictureException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemClientParamsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
|
| | | import com.yeshi.fanli.service.inter.user.QrCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserRankingsService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | |
| | | private InviteGetMoneyService inviteGetMoneyService;
|
| | |
|
| | | @Resource
|
| | | private EveryDayTaskService everyDayTaskService;
|
| | |
|
| | | @Resource
|
| | | private SystemClientParamsService systemClientParamsService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserRankingsService userRankingsService;
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 返回到前端接口
|
| | | * |
| | | * @author mawurui createTime 2018年3月29日 下午2:37:38
|
| | | * @throws NotExistObjectException
|
| | | */
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private SwiperPictureService swiperPictureService;
|
| | |
|
| | | @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
|
| | | public void everyDayTaskList(AcceptData acceptData, int pageIndex, PrintWriter out, String uid)
|
| | | throws NotExistObjectException {
|
| | | // 查询商品总数
|
| | | Integer totalCount = everyDayTaskService.getCount();
|
| | | Integer totalCount = 0;
|
| | | int totalPage = totalCount % Constant.PAGE_SIZE == 0 ? totalCount / Constant.PAGE_SIZE
|
| | | : totalCount / Constant.PAGE_SIZE + 1;
|
| | | PageEntity pageEntity = new PageEntity(pageIndex, Constant.PAGE_SIZE, totalCount, totalPage);
|
| | |
|
| | | // 分页查询所有每日商品
|
| | | List<EveryDayTask> everyDayTaskList = everyDayTaskService.everyDayTaskListCache(pageIndex - 1, "");
|
| | | for (EveryDayTask everyDayTask : everyDayTaskList) {
|
| | | // 计算用户得到的佣金
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(everyDayTask.getEtGoods());
|
| | | String getMoney = money.toString();
|
| | | everyDayTask.setGetMoney("赚" + "¥" + getMoney);
|
| | | // 计算券后价
|
| | | BigDecimal quanhoujia = TaoBaoUtil.getAfterUseCouplePrice(everyDayTask.getEtGoods());
|
| | | if (Integer.parseInt(acceptData.getVersion()) >= 20)
|
| | | everyDayTask.setQuanhoujiaStr("¥" + quanhoujia.toString());
|
| | | else
|
| | | everyDayTask.setQuanhoujiaStr(quanhoujia.toString());
|
| | | everyDayTask.getEtGoods().setSalesCount(TaoBaoUtil.getSaleCount(everyDayTask.getEtGoods().getBiz30day()));
|
| | | }
|
| | |
|
| | | /*
|
| | | // 分页查询邀请提成榜
|
| | | List<InviteGetMoney> inviteGetMoneyList = inviteGetMoneyService.inviteGetMoneyList(pageIndex - 1, "");
|
| | | |
| | | // 名字*处理
|
| | | for (InviteGetMoney inviteGetMoney : inviteGetMoneyList) {
|
| | | * // 分页查询邀请提成榜 List<InviteGetMoney> inviteGetMoneyList =
|
| | | * inviteGetMoneyService.inviteGetMoneyList(pageIndex - 1, "");
|
| | | * |
| | | * // 名字*处理 for (InviteGetMoney inviteGetMoney : inviteGetMoneyList) {
|
| | | * |
| | | * String name = inviteGetMoney.getName(); if (name != null) { if
|
| | | * (name.length() > 2) { name = Utils.getStarString(name, 1,
|
| | | * name.length() - 1); } else { name = name.substring(0, 1) + "**" +
|
| | | * name.substring(name.length() - 1); } } inviteGetMoney.setName(name);
|
| | | * inviteGetMoney.setRankIcon(UserUtil.getRankIcon(3)); }
|
| | | */
|
| | |
|
| | | String name = inviteGetMoney.getName();
|
| | | if (name != null) {
|
| | | if (name.length() > 2) {
|
| | | name = Utils.getStarString(name, 1, name.length() - 1);
|
| | | } else {
|
| | | name = name.substring(0, 1) + "**" + name.substring(name.length() - 1);
|
| | | }
|
| | | }
|
| | | inviteGetMoney.setName(name);
|
| | | inviteGetMoney.setRankIcon(UserUtil.getRankIcon(3));
|
| | | }
|
| | | */
|
| | | |
| | | |
| | | List<InviteGetMoney> inviteGetMoneyList = userRankingsService.getRank(0,5);
|
| | | |
| | | |
| | | JSONObject data = new JSONObject();
|
| | | List<InviteGetMoney> inviteGetMoneyList = userRankingsService.getRank(0, 5);
|
| | |
|
| | | com.alibaba.fastjson.JSONObject data = new com.alibaba.fastjson.JSONObject();
|
| | | data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
|
| | | data.put("everyDayTaskList", JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(everyDayTaskList));
|
| | | data.put("inviteGetMoneyList", JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList));
|
| | | data.put("everyDayTaskList", new JSONArray());
|
| | | data.put("inviteGetMoneyList",
|
| | | JSONArray.fromObject(JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList)));
|
| | | if (uid.equals("0") || uid == null) {
|
| | | data.put("myTeam", "---");
|
| | | data.put("moneyToday", "---");
|
| | |
| | | int myTeamCount = myFirstTeamCount + mySecondTeamCount;
|
| | | data.put("myTeam", myTeamCount);
|
| | | // 今日 本月预估收益
|
| | | BigDecimal moneyToday = inviteGetMoneyService.getMoneyToday(uid);
|
| | | BigDecimal moneyToday = inviteGetMoneyService.getMoneyToday(uid + "");
|
| | | if (moneyToday == null) {
|
| | | moneyToday = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | BigDecimal moneyMonth = inviteGetMoneyService.getMoneyMonth(uid);
|
| | | BigDecimal moneyMonth = inviteGetMoneyService.getMoneyMonth(uid + "");
|
| | | if (moneyMonth == null) {
|
| | | moneyMonth = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid);
|
| | | BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid + "");
|
| | |
|
| | | data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("moneyLastMonth", moneyLastMonth);
|
| | | data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN).toString());
|
| | | data.put("moneyLastMonth", moneyLastMonth.toString());
|
| | | }
|
| | |
|
| | | // 活动规则
|
| | |
| | | data.put("activityRules", valueBr);
|
| | | data.put("inviteList", String.format("http://%s/%s/client/share/friends_new.html",
|
| | | Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | try {
|
| | | List<SwiperPicture> pictureList = swiperPictureService.getByBannerCard("invite_top_banner");
|
| | | if (pictureList != null && pictureList.size() > 0) {
|
| | | SwiperPicture picture = pictureList.get(0);
|
| | | com.alibaba.fastjson.JSONObject pictureJson = new com.alibaba.fastjson.JSONObject();
|
| | | pictureJson.put("src", picture.getSrc());
|
| | | pictureJson.put("jumpDetail", picture.getJumpDetail());
|
| | | pictureJson.put("params", picture.getParams());
|
| | | data.put("topBanner", pictureJson);
|
| | | }
|
| | |
|
| | | } catch (SwiperPictureException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | data.put("desc", configService.get("invite_desc"));
|
| | |
|
| | | com.alibaba.fastjson.JSONObject root = new com.alibaba.fastjson.JSONObject();
|
| | | root.put("code", 0);
|
| | | root.put("data", data);
|
| | | out.print(root.toString());
|
| | | }
|
| | |
|
| | | /**
|