| | |
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.admin.InviteGetMoney;
|
| | | 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.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 net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | |
| | | @Resource
|
| | | private UserRankingsService userRankingsService;
|
| | |
|
| | | @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 = 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<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)); }
|
| | | */
|
| | |
|
| | | 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", new JSONArray());
|
| | | data.put("inviteGetMoneyList",
|
| | | JSONArray.fromObject(JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList)));
|
| | | if (uid.equals("0") || uid == null) {
|
| | | data.put("myTeam", "---");
|
| | | data.put("moneyToday", "---");
|
| | | data.put("moneyMonth", "---");
|
| | | data.put("moneyLastMonth", "---");
|
| | | } else {
|
| | | // 我的队员
|
| | | int myFirstTeamCount = inviteGetMoneyService.myFirstTeamCount(uid);
|
| | | int mySecondTeamCount = inviteGetMoneyService.mySecondTeamCount(uid);
|
| | | int myTeamCount = myFirstTeamCount + mySecondTeamCount;
|
| | | data.put("myTeam", myTeamCount);
|
| | | // 今日 本月预估收益
|
| | | BigDecimal moneyToday = inviteGetMoneyService.getMoneyToday(uid + "");
|
| | | if (moneyToday == null) {
|
| | | moneyToday = new BigDecimal(0);
|
| | | }
|
| | | BigDecimal moneyMonth = inviteGetMoneyService.getMoneyMonth(uid + "");
|
| | | if (moneyMonth == null) {
|
| | | moneyMonth = new BigDecimal(0);
|
| | | }
|
| | |
|
| | | BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid + "");
|
| | |
|
| | | 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());
|
| | | }
|
| | |
|
| | | // 活动规则
|
| | | String key = "activityRules"; // key值
|
| | | com.yeshi.fanli.entity.system.System system = new System();
|
| | | system.setCreatetime(java.lang.System.currentTimeMillis());
|
| | | system.setPlatform(1);
|
| | | system.setId(4L);
|
| | | SystemClientParams values = systemClientParamsService.getSystemClientParamsBySystemAndKey(system, key);
|
| | | // 转换换行符 给前端
|
| | | String valueN = values.getValue();
|
| | | String valueBr = valueN.replace("\n", "<br><br>");
|
| | |
|
| | | data.put("activityRules", valueBr);
|
| | | data.put("inviteList", String.format("http://%s/%s/client/share/friends_new.html",
|
| | | Constant.systemCommonConfig.getProjectHost(), Constant.systemCommonConfig.getProjectName()));
|
| | | 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();
|
| | | }
|
| | |
|
| | | com.alibaba.fastjson.JSONObject root = new com.alibaba.fastjson.JSONObject();
|
| | | root.put("code", 0);
|
| | | root.put("data", data);
|
| | |
|
| | | out.print(JsonUtil.loadTrue(0, root, "成功"));
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | | * 方法说明: 分享好友邀请图片
|