| | |
| | |
|
| | | import java.io.InputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | |
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | |
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.admin.EveryDayTask;
|
| | | import com.yeshi.fanli.entity.admin.InviteGetMoney;
|
| | | import com.yeshi.fanli.entity.bus.invite.SpreadImg;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.service.AdminUserService;
|
| | | import com.yeshi.fanli.service.inter.config.EveryDayTaskService;
|
| | | import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | |
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.annotation.RequestNoLogin;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/inviteGetMoney")
|
| | |
| | | @Resource
|
| | | private InviteGetMoneyService inviteGetMoneyService;
|
| | |
|
| | | @Resource
|
| | | private EveryDayTaskService everyDayTaskService;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
| | | @Resource
|
| | | private AdminUserService adminUserService;
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 每日任务商品库列表查询
|
| | | * @author mawurui
|
| | | */
|
| | | @RequestMapping(value="/everyDayTaskList",method=RequestMethod.POST)
|
| | | public void everyDayTaskList(int pageIndex, String key,PrintWriter out){
|
| | | //查询商品总数
|
| | | Integer totalCount = everyDayTaskService.getCount();
|
| | | 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);
|
| | | Map<String, String> map = new HashMap<String, String>();
|
| | | map.put("key", key);
|
| | | pageEntity.setParams(map);
|
| | | //分页查询所有商品
|
| | | List<EveryDayTask> everyDayTaskList = everyDayTaskService.everyDayTaskList(pageIndex-1, key);
|
| | | for(EveryDayTask everyDayTask: everyDayTaskList) {
|
| | | //计算用户得到的佣金
|
| | | String getMoney = taoBaoGoodsBriefService.getGoodsUserHongBao(everyDayTask.getEtGoods());
|
| | | everyDayTask.setGetMoney(getMoney);
|
| | |
|
| | | //计算券后价
|
| | | BigDecimal quanhoujia = TaoBaoUtil.getAfterUseCouplePrice(everyDayTask.getEtGoods());
|
| | | everyDayTask.setQuanhoujia(quanhoujia);
|
| | | |
| | | }
|
| | | |
| | | JSONObject data=new JSONObject();
|
| | | data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
|
| | | data.put("everyDayTaskList", JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(everyDayTaskList));
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | }
|
| | | |
| | | /**
|
| | | * |
| | | * 方法说明: 删除每日任务商品库(真删除)
|
| | | * @author mawurui
|
| | | * createTime 2018年3月29日 下午6:22:21
|
| | | * @param ids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value="/deleteEveryDayTask", method=RequestMethod.POST)
|
| | | public void deletEeveryDayTask(long[] ids, PrintWriter out){
|
| | | for (long id : ids) {
|
| | | everyDayTaskService.deletEeveryDayTask(id);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult("删除成功"));
|
| | | }
|
| | | |
| | | /***
|
| | | * |
| | | * 方法说明: 修改每日任务商品库排序值
|
| | | * @author mawurui
|
| | | * createTime 2018年3月30日 上午9:29:46
|
| | | * @param id
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value="/updateEveryDayTask", method=RequestMethod.POST)
|
| | | public void updateEveryDayTask(EveryDayTask everyDayTask , PrintWriter out) {
|
| | | everyDayTaskService.updateEveryDayTask(everyDayTask);
|
| | | out.print(JsonUtil.loadTrueResult("修改成功"));
|
| | | }
|
| | | |
| | | /**
|
| | | * |
| | | * 方法说明: 查询每日任务详情(页面反显)
|
| | | * @author mawurui
|
| | | * createTime 2018年3月30日 上午9:32:52
|
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | @RequestMapping(value="/getEveryDayTask", method=RequestMethod.POST)
|
| | | public void getEveryDayTask(long id, PrintWriter out) {
|
| | | EveryDayTask everyDayTask = everyDayTaskService.getEveryDayTask(id);
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("everyDayTask", GsonUtil.toDFJson(everyDayTask));
|
| | | out.print(JsonUtil.loadTrueResult(0, data));
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | 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.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/taobao")
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoClassService taoBaoClassService;
|
| | | |
| | |
|
| | | @RequestMapping(value = "getTBGoodsList", method = RequestMethod.POST)
|
| | | public void getTaoBaoGoodsBriefList(int pageIndex, String key, PrintWriter out) {
|
| | |
| | | out.print(JsonUtil.loadTrueResult(dataAll));
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 添加商品到每日任务
|
| | | * |
| | | * @author mawurui createTime 2018年3月29日 上午11:36:25
|
| | | * @param tbids
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addEveryDayTask", method = RequestMethod.POST)
|
| | | public void addEveryDayTask(String tbids, PrintWriter out) {
|
| | | String[] tbidStrArr = tbids.split(",");
|
| | | long[] tbidArr = StringUtil.parseLong(tbidStrArr);
|
| | | List<JSONObject> list = new ArrayList<JSONObject>();
|
| | | JSONObject data = null;
|
| | | for (long tbid : tbidArr) {
|
| | | data = new JSONObject();
|
| | | try {
|
| | | taoBaoGoodsBriefService.addEveryDayTask(tbid);
|
| | | data.put("id", tbid);
|
| | | data.put("msg", "添加成功");
|
| | | } catch (NotExistObjectException e) {
|
| | | data.put("id", tbid);
|
| | | data.put("msg", e.getMessage());
|
| | | } catch (ExistObjectException e) {
|
| | | data.put("id", tbid);
|
| | | data.put("msg", e.getMessage());
|
| | | }
|
| | | list.add(data);
|
| | | }
|
| | | JSONObject dataAll = new JSONObject();
|
| | | dataAll.put("list", list);
|
| | | out.print(JsonUtil.loadTrueResult(dataAll));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "addClassRecommendGoods", method = RequestMethod.POST)
|
| | | public void addClassRecommendGoods(long gcid, String tbids, PrintWriter out) {
|
| | | String[] tbidStrArr = tbids.split(",");
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryOnSale")
|
| | | public void queryOnSale(String callback, Integer pageIndex, Integer pageSize, String key, Long tbClassId, Integer startPrice,
|
| | | Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall, Integer hasCoupon,
|
| | | Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay, Integer includePayRate30,
|
| | | Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel, PrintWriter out) {
|
| | | public void queryOnSale(String callback, Integer pageIndex, Integer pageSize, String key, Long tbClassId,
|
| | | Integer startPrice, Integer endPrice, String startTkRate, String endTkRate, Integer sort, Integer istmall,
|
| | | Integer hasCoupon, Integer baoYou, Integer startDsr, Integer overseas, Integer needPrepay,
|
| | | Integer includePayRate30, Integer includeGoodRate, Integer includeRfdRate, Integer npxLevel,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | | SearchFilter filter = new SearchFilter();
|
| | | |
| | |
|
| | | // 页大小,默认20,1~100
|
| | | if (pageSize == null || pageSize < 1)
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | map.put("isExistence", existence);
|
| | |
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | *
|
| | | * @param callback
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "searchMaterial")
|
| | | public void searchMaterial(String callback, Integer pageIndex, Integer pageSize, |
| | | String subName, String superName, PrintWriter out) {
|
| | | public void searchMaterial(String callback, Integer pageIndex, Integer pageSize, String subName, String superName,
|
| | | PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 页大小,默认20,1~100
|
| | | if (pageSize == null || pageSize < 1)
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | |
|
| | |
|
| | | // 第几页,默认:1
|
| | | if (pageIndex == null || pageIndex < 1)
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | |
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | |
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | |
|
| | | map.put("pictUrl", taoBaoGoodsBrief.getPictUrl());
|
| | | map.put("title", taoBaoGoodsBrief.getTitle());
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | map.put("isExistence", existence);
|
| | |
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | |
| | | }
|
| | | |
| | | |
| | |
|
| | | @RequestMapping(value = "getQiangGou")
|
| | | public void getQiangGou(String callback, Integer pageIndex, PrintWriter out) {
|
| | |
|
| | | try {
|
| | |
|
| | |
|
| | | int pageSize = 40;
|
| | |
|
| | |
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.taoQiangGou(pageIndex, pageSize,startTime, endTime);
|
| | |
|
| | | |
| | | |
| | | if (result == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂未获取到相关数据"));
|
| | | return;
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | | |
| | | // 插入商品集合
|
| | | List<Long> listAuctionId = new ArrayList<Long>();
|
| | | for (TaoBaoGoodsBrief goodsBrief : taoBaoGoodsBriefs) {
|
| | |
| | | // 验证是否存在数据库
|
| | | List<QualityFactory> listHas = selectionGoodsService.listQueryByAuctionId(listAuctionId);
|
| | |
|
| | | |
| | | List<Map<String, Object>> listmap = new ArrayList<Map<String, Object>>();
|
| | |
|
| | | for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
|
| | | taoBaoGoodsBrief.setId(null);
|
| | |
|
| | | Map<String, Object> map = new HashMap<String, Object>();
|
| | |
|
| | |
|
| | | map.put("pictUrl", taoBaoGoodsBrief.getPictUrl());
|
| | | map.put("title", taoBaoGoodsBrief.getTitle());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | map.put("isExistence", existence);
|
| | |
|
| | | listmap.add(map);
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("查询异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | |
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | 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.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.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.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.JSONObject;
|
| | |
|
| | |
| | | private InviteGetMoneyService inviteGetMoneyService;
|
| | |
|
| | | @Resource
|
| | | private EveryDayTaskService everyDayTaskService;
|
| | |
|
| | | @Resource
|
| | | private SystemClientParamsService systemClientParamsService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private UserRankingsService userRankingsService;
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 返回到前端接口
|
| | | * |
| | | * @author mawurui createTime 2018年3月29日 下午2:37:38
|
| | | * @throws NotExistObjectException
|
| | | */
|
| | | @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
|
| | | public void everyDayTaskList(AcceptData acceptData, int pageIndex, PrintWriter out, String uid)
|
| | | throws NotExistObjectException {
|
| | | // 查询商品总数
|
| | | Integer totalCount = everyDayTaskService.getCount();
|
| | | 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) {
|
| | |
|
| | | 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();
|
| | | data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
|
| | | data.put("everyDayTaskList", JsonUtil.getSimpleGsonWithDateAndSerialization().toJson(everyDayTaskList));
|
| | | data.put("inviteGetMoneyList", 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));
|
| | | data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("moneyLastMonth", moneyLastMonth);
|
| | | }
|
| | |
|
| | | // 活动规则
|
| | | 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()));
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | }
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | package com.yeshi.fanli.controller.xcx;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RequestMethod;
|
| | |
|
| | | import com.yeshi.fanli.entity.admin.EveryDayTask;
|
| | | import com.yeshi.fanli.entity.admin.InviteGetMoney;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.system.SystemClientParams;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.service.inter.config.EveryDayTaskService;
|
| | | 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.user.QrCodeService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.Utils;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | private InviteGetMoneyService inviteGetMoneyService;
|
| | |
|
| | | @Resource
|
| | | private EveryDayTaskService everyDayTaskService;
|
| | |
|
| | | @Resource
|
| | | private SystemClientParamsService systemClientParamsService;
|
| | |
|
| | | @Resource
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | /**
|
| | | * |
| | | * 方法说明: 返回到前端接口
|
| | | * |
| | | * @author mawurui createTime 2018年3月29日 下午2:37:38
|
| | | * @throws NotExistObjectException
|
| | | */
|
| | | @RequestMapping(value = "/inviteGetMoney", method = RequestMethod.POST)
|
| | | public void everyDayTaskList(int pageIndex, PrintWriter out, String uid) throws NotExistObjectException {
|
| | | // 查询商品总数
|
| | | Integer totalCount = everyDayTaskService.getCount();
|
| | | 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.everyDayTaskList(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());
|
| | | everyDayTask.setQuanhoujia(quanhoujia);
|
| | | }
|
| | | // 分页查询邀请提成榜
|
| | | 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);
|
| | | }
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pageEntity", JsonUtil.getSimpleGsonWithDate().toJson(pageEntity));
|
| | | data.put("everyDayTaskList", JsonUtil.getSimpleGsonWithDate().toJson(everyDayTaskList));
|
| | | data.put("inviteGetMoneyList", JsonUtil.getSimpleGsonWithDate().toJson(inviteGetMoneyList));
|
| | | if (uid.equals("0") || uid == null) {
|
| | | data.put("myTeam", "---");
|
| | | data.put("moneyToday", "---");
|
| | | data.put("moneyMonth", "---");
|
| | | } 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);
|
| | | }
|
| | | data.put("moneyToday", moneyToday.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | data.put("moneyMonth", moneyMonth.setScale(2, BigDecimal.ROUND_DOWN));
|
| | | }
|
| | |
|
| | | // 活动规则
|
| | | 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()));
|
| | | out.print(JsonUtil.loadTrue(0, JsonUtil.getSimpleGson().toJson(data), "成功"));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.config.EveryDayTaskService;
|
| | | import com.yeshi.fanli.service.inter.goods.RecommendSectionGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefRecordService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
|
| | |
|
| | | @Resource
|
| | | private EveryDayTaskService everyDayTaskService;
|
| | |
|
| | | @Resource
|
| | | private RecommendSectionGoodsService recommendSectionGoodsService;
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | |
|
| | | import com.yeshi.fanli.dao.config.AddEveryDayTaskDao;
|
| | | import com.yeshi.fanli.dao.goods.RecommendSectionGoodsDao;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoGoodsBriefMapper;
|
| | | import com.yeshi.fanli.dao.taobao.TaoBaoGoodsBriefDao;
|
| | | import com.yeshi.fanli.entity.admin.EveryDayTask;
|
| | | import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSection;
|
| | | import com.yeshi.fanli.entity.bus.recommend.RecommendSectionGoods;
|
| | |
| | | @Resource
|
| | | private GoodsClassService goodsClassService;
|
| | |
|
| | | @Resource
|
| | | private AddEveryDayTaskDao addEveryDayTaskDao;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
| | | recommendSectionGoodsService.addRecommendSectionGoods(recommendSection, taobao);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 添加商品到每日任务
|
| | | */
|
| | | @Override
|
| | | public void addEveryDayTask(long tbid) throws NotExistObjectException, ExistObjectException {
|
| | | TaoBaoGoodsBrief taobao = taoBaoGoodsBriefDao.find(TaoBaoGoodsBrief.class, tbid);
|
| | | if (taobao == null) {
|
| | | throw new NotExistObjectException("不存在该淘宝商品");
|
| | | }
|
| | | EveryDayTask everyDaoTask = new EveryDayTask();
|
| | | everyDaoTask.setEtGoods(taobao);
|
| | | everyDaoTask.setEtCreateTime(new Date());
|
| | | addEveryDayTaskDao.create(everyDaoTask);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | public void addClassRecommendGoods(long gcid, long tbid) throws NotExistObjectException, ExistObjectException {
|
| | |
| | |
|
| | | public List<RecommendSectionGoods> listRecommendSectionGoods();
|
| | |
|
| | | public void addEveryDayTask(long tbid) throws NotExistObjectException, ExistObjectException;
|
| | |
|
| | | /**
|
| | | * 获取单个商品用户能够分得的红包
|